diff --git a/_includes/language-alias.html b/_includes/language-alias.html new file mode 100644 index 0000000..26912a3 --- /dev/null +++ b/_includes/language-alias.html @@ -0,0 +1,72 @@ +{% comment %} + + Convert the alias of the syntax language to the official name + + See: + +{% endcomment %} + +{% assign _lang = include.language | default: '' %} + +{% case _lang %} + {% when 'actionscript', 'as', 'as3' %} + {{ 'ActionScript' }} + {% when 'applescript' %} + {{ 'AppleScript' }} + {% when 'brightscript', 'bs', 'brs' %} + {{ 'BrightScript' }} + {% when 'cfscript', 'cfc' %} + {{ 'CFScript' }} + {% when 'coffeescript', 'coffee', 'coffee-script' %} + {{ 'CoffeeScript' }} + {% when 'cs', 'csharp' %} + {{ 'C#' }} + {% when 'erl' %} + {{ 'Erlang' }} + {% when 'graphql' %} + {{ 'GraphQL' }} + {% when 'haskell', 'hs' %} + {{ 'Haskell' }} + {% when 'javascript', 'js' %} + {{ 'JavaScript' }} + {% when 'make', 'mf', 'gnumake', 'bsdmake' %} + {{ 'Makefile' }} + {% when 'md', 'mkd' %} + {{ 'Markdown' }} + {% when 'm' %} + {{ 'Matlab' }} + {% when 'objective_c', 'objc', 'obj-c', 'obj_c', 'objectivec' %} + {{ 'Objective-C' }} + {% when 'perl', 'pl' %} + {{ 'Perl' }} + {% when 'php','php3','php4','php5' %} + {{ 'PHP' }} + {% when 'plaintext', 'text' %} + {{ 'Text' }} + {% when 'py' %} + {{ 'Python' }} + {% when 'rb' %} + {{ 'Ruby' }} + {% when 'rs','no_run','ignore','should_panic' %} + {{ 'Rust' }} + {% when 'bash', 'zsh', 'ksh', 'sh' %} + {{ 'Shell' }} + {% when 'st', 'squeak' %} + {{ 'Smalltalk' }} + {% when 'tex'%} + {{ 'TeX' }} + {% when 'latex' %} + {{ 'LaTex' }} + {% when 'ts', 'typescript' %} + {{ 'TypeScript' }} + {% when 'vb', 'visualbasic' %} + {{ 'Visual Basic' }} + {% when 'vue', 'vuejs' %} + {{ 'Vue.js' }} + {% when 'yml' %} + {{ 'YAML' }} + {% when 'css', 'html', 'scss', 'ssh', 'toml', 'xml', 'yaml' %} + {{ _lang | upcase }} + {% else %} + {{ _lang | capitalize }} +{% endcase %} diff --git a/_includes/refactor-content.html b/_includes/refactor-content.html index e8230c2..c97f746 100644 --- a/_includes/refactor-content.html +++ b/_includes/refactor-content.html @@ -121,7 +121,8 @@ {% assign _text = _left | split: 'file="' | last | split: '"' | first %} {% assign _label_icon = 'far fa-file' %} {% else %} - {% assign _text = _left | split: 'language-' | last | split: ' ' | first %} + {% assign _lang = _left | split: 'language-' | last | split: ' ' | first %} + {% capture _text %}{% include language-alias.html language=_lang %}{% endcapture %} {% assign _label_icon = 'fas fa-code small' %} {% endif %} diff --git a/_sass/addon/syntax.scss b/_sass/addon/syntax.scss index c898c8d..1abcb12 100644 --- a/_sass/addon/syntax.scss +++ b/_sass/addon/syntax.scss @@ -172,7 +172,7 @@ div { align-items: center; line-height: 1.85rem; - // the label + // the label block span { color: var(--lang-badge-color); padding-left: 0.6rem; @@ -183,13 +183,7 @@ div { margin-left: 0.3rem; font-weight: 600; - // language - @at-root .highlighter-rouge:not([file]) #{&} { - font-size: 0.75rem; - text-transform: uppercase; - } - - } // :after + } @at-root [file] #{&} > i { // center the file icon position: relative;