fixes #844 duplicate entries in doc (#845)

This commit is contained in:
Morgan 2019-11-19 22:50:40 +01:00 committed by Vincent Prouillet
parent ea5a106d6e
commit e8dc33ad08
3 changed files with 94 additions and 77 deletions

View file

@ -34,4 +34,3 @@
| [peterlyons.com](https://peterlyons.com) | https://github.com/focusaurus/peterlyons.com-zola | | [peterlyons.com](https://peterlyons.com) | https://github.com/focusaurus/peterlyons.com-zola |
| [blog.turbo.fish](https://blog.turbo.fish) | https://git.sr.ht/~jplatte/blog.turbo.fish | | [blog.turbo.fish](https://blog.turbo.fish) | https://git.sr.ht/~jplatte/blog.turbo.fish |
| [guerinpe.com](https://guerinpe.com) | https://github.com/Grelot/blog | | [guerinpe.com](https://guerinpe.com) | https://github.com/Grelot/blog |

View file

@ -3,7 +3,11 @@
//! Although it is a valid example for serializing syntaxes, you probably won't need //! Although it is a valid example for serializing syntaxes, you probably won't need
//! to do this yourself unless you want to cache your own compiled grammars. //! to do this yourself unless you want to cache your own compiled grammars.
extern crate syntect; extern crate syntect;
use std::collections::HashMap;
use std::collections::HashSet;
use std::env; use std::env;
use std::iter::FromIterator;
use syntect::dumps::*; use syntect::dumps::*;
use syntect::highlighting::ThemeSet; use syntect::highlighting::ThemeSet;
use syntect::parsing::SyntaxSetBuilder; use syntect::parsing::SyntaxSetBuilder;
@ -26,10 +30,25 @@ fn main() {
builder.add_from_folder(package_dir, true).unwrap(); builder.add_from_folder(package_dir, true).unwrap();
let ss = builder.build(); let ss = builder.build();
dump_to_file(&ss, packpath_newlines).unwrap(); dump_to_file(&ss, packpath_newlines).unwrap();
let mut syntaxes: HashMap<String, HashSet<String>> = HashMap::new();
for s in ss.syntaxes() { for s in ss.syntaxes().iter() {
if !s.file_extensions.is_empty() { syntaxes
println!("- {} -> {:?}", s.name, s.file_extensions); .entry(s.name.clone())
.and_modify(|e| {
for ext in &s.file_extensions {
e.insert(ext.clone());
}
})
.or_insert_with(|| HashSet::from_iter(s.file_extensions.iter().cloned()));
}
let mut keys = syntaxes.keys().collect::<Vec<_>>();
keys.sort_by(|a, b| a.to_lowercase().cmp(&b.to_lowercase()));
for k in keys {
if !syntaxes[k].is_empty() {
let mut extensions_sorted = syntaxes[k].iter().cloned().collect::<Vec<_>>();
extensions_sorted.sort();
println!("- {} -> {:?}", k, extensions_sorted);
} }
} }
} }

View file

@ -23,105 +23,104 @@ interpreted as plain text.
Here is a full list of the supported languages and the short names you can use: Here is a full list of the supported languages and the short names you can use:
``` ```
- Plain Text -> ["txt"]
- Assembly x86 (NASM) -> ["asm", "inc", "nasm"]
- Crystal -> ["cr"]
- Dart -> ["dart"]
- Elixir -> ["ex", "exs"]
- fsharp -> ["fs"]
- Handlebars -> ["handlebars", "handlebars.html", "hbr", "hbrs", "hbs", "hdbs", "hjs", "mu", "mustache", "rac", "stache", "template", "tmpl"]
- Jinja2 -> ["j2", "jinja2"]
- Julia -> ["jl"]
- Kotlin -> ["kt", "kts"]
- Less -> ["less", "css.less"]
- MiniZinc (MZN) -> ["mzn", "dzn"]
- Nim -> ["nim", "nims"]
- ASP -> ["asa"]
- HTML (ASP) -> ["asp"]
- ActionScript -> ["as"] - ActionScript -> ["as"]
- AppleScript -> ["applescript", "script editor"] - AppleScript -> ["applescript", "script editor"]
- ASP -> ["asa"]
- Assembly x86 (NASM) -> ["asm", "inc", "nasm"]
- Batch File -> ["bat", "cmd"] - Batch File -> ["bat", "cmd"]
- NAnt Build File -> ["build"] - BibTeX -> ["bib"]
- C# -> ["cs", "csx"] - Bourne Again Shell (bash) -> [".bash_aliases", ".bash_completions", ".bash_functions", ".bash_login", ".bash_logout", ".bash_profile", ".bash_variables", ".bashrc", ".profile", ".textmate_init", ".zshrc", "bash", "fish", "sh", "zsh"]
- C++ -> ["cpp", "cc", "cp", "cxx", "c++", "C", "h", "hh", "hpp", "hxx", "h++", "inl", "ipp"]
- C -> ["c", "h"] - C -> ["c", "h"]
- CSS -> ["css", "css.erb", "css.liquid"] - C# -> ["cs", "csx"]
- C++ -> ["C", "c++", "cc", "cp", "cpp", "cxx", "h", "h++", "hh", "hpp", "hxx", "inl", "ipp"]
- Clojure -> ["clj"] - Clojure -> ["clj"]
- CMake -> ["CMakeLists.txt", "cmake"]
- CMake C Header -> ["h.in"]
- CMake C++ Header -> ["h++.in", "hh.in", "hpp.in", "hxx.in"]
- CMakeCache -> ["CMakeCache.txt"]
- Crystal -> ["cr"]
- CSS -> ["css", "css.erb", "css.liquid"]
- D -> ["d", "di"] - D -> ["d", "di"]
- Dart -> ["dart"]
- Diff -> ["diff", "patch"] - Diff -> ["diff", "patch"]
- Erlang -> ["erl", "hrl", "Emakefile", "emakefile"] - Elixir -> ["ex", "exs"]
- HTML (Erlang) -> ["yaws"] - Elm -> ["elm"]
- Git Attributes -> ["attributes", "gitattributes", ".gitattributes"] - Erlang -> ["Emakefile", "emakefile", "erl", "hrl"]
- fsharp -> ["fs"]
- Generic Config -> [".dircolors", ".gitattributes", ".gitignore", ".gitmodules", ".inputrc", "Doxyfile", "cfg", "conf", "config", "dircolors", "gitattributes", "gitignore", "gitmodules", "ini", "inputrc", "mak", "mk", "pro"]
- Git Attributes -> [".gitattributes", "attributes", "gitattributes"]
- Git Commit -> ["COMMIT_EDITMSG", "MERGE_MSG", "TAG_EDITMSG"] - Git Commit -> ["COMMIT_EDITMSG", "MERGE_MSG", "TAG_EDITMSG"]
- Git Config -> ["gitconfig", ".gitconfig", ".gitmodules"] - Git Config -> [".gitconfig", ".gitmodules", "gitconfig"]
- Git Ignore -> ["exclude", "gitignore", ".gitignore"] - Git Ignore -> [".gitignore", "exclude", "gitignore"]
- Git Link -> [".git"] - Git Link -> [".git"]
- Git Log -> ["gitlog"] - Git Log -> ["gitlog"]
- Git Rebase Todo -> ["git-rebase-todo"] - Git Rebase Todo -> ["git-rebase-todo"]
- Go -> ["go"] - Go -> ["go"]
- Graphviz (DOT) -> ["dot", "DOT", "gv"] - Graphviz (DOT) -> ["DOT", "dot", "gv"]
- Groovy -> ["groovy", "gvy", "gradle", "Jenkinsfile"] - Groovy -> ["Jenkinsfile", "gradle", "groovy", "gvy"]
- HTML -> ["html", "htm", "shtml", "xhtml"] - Handlebars -> ["handlebars", "handlebars.html", "hbr", "hbrs", "hbs", "hdbs", "hjs", "mu", "mustache", "rac", "stache", "template", "tmpl"]
- Haskell -> ["hs"] - Haskell -> ["hs"]
- Literate Haskell -> ["lhs"] - HTML -> ["htm", "html", "shtml", "xhtml"]
- Java Server Page (JSP) -> ["jsp"] - HTML (ASP) -> ["asp"]
- Java -> ["java", "bsh"] - HTML (Erlang) -> ["yaws"]
- HTML (Rails) -> ["erb", "html.erb", "rails", "rhtml"]
- HTML (Tcl) -> ["adp"]
- Java -> ["bsh", "java"]
- Java Properties -> ["properties"] - Java Properties -> ["properties"]
- JSON -> ["json", "sublime-settings", "sublime-menu", "sublime-keymap", "sublime-mousemap", "sublime-theme", "sublime-build", "sublime-project", "sublime-completions", "sublime-commands", "sublime-macro", "sublime-color-scheme"] - Java Server Page (JSP) -> ["jsp"]
- JavaScript -> ["js", "htc"] - JavaScript -> ["htc", "js"]
- BibTeX -> ["bib"] - JavaScript (Rails) -> ["js.erb"]
- LaTeX -> ["tex", "ltx"] - Jinja2 -> ["j2", "jinja2"]
- TeX -> ["sty", "cls"] - JSON -> ["json", "sublime-build", "sublime-color-scheme", "sublime-commands", "sublime-completions", "sublime-keymap", "sublime-macro", "sublime-menu", "sublime-mousemap", "sublime-project", "sublime-settings", "sublime-theme"]
- Lisp -> ["lisp", "cl", "clisp", "l", "mud", "el", "scm", "ss", "lsp", "fasl"] - Julia -> ["jl"]
- Kotlin -> ["kt", "kts"]
- LaTeX -> ["ltx", "tex"]
- Less -> ["css.less", "less"]
- Linker Script -> ["ld"]
- Lisp -> ["cl", "clisp", "el", "fasl", "l", "lisp", "lsp", "mud", "scm", "ss"]
- Literate Haskell -> ["lhs"]
- Lua -> ["lua"] - Lua -> ["lua"]
- Makefile -> ["make", "GNUmakefile", "makefile", "Makefile", "makefile.am", "Makefile.am", "makefile.in", "Makefile.in", "OCamlMakefile", "mak", "mk"] - Makefile -> ["GNUmakefile", "Makefile", "Makefile.am", "Makefile.in", "OCamlMakefile", "mak", "make", "makefile", "makefile.am", "makefile.in", "mk"]
- Markdown -> ["md", "mdown", "markdown", "markdn"] - Markdown -> ["markdn", "markdown", "md", "mdown"]
- MATLAB -> ["matlab"] - MATLAB -> ["matlab"]
- MiniZinc (MZN) -> ["dzn", "mzn"]
- NAnt Build File -> ["build"]
- Nim -> ["nim", "nims"]
- Nix -> ["nix"]
- Objective-C -> ["h", "m"]
- Objective-C++ -> ["M", "h", "mm"]
- OCaml -> ["ml", "mli"] - OCaml -> ["ml", "mli"]
- OCamllex -> ["mll"] - OCamllex -> ["mll"]
- OCamlyacc -> ["mly"] - OCamlyacc -> ["mly"]
- Objective-C++ -> ["mm", "M", "h"] - Pascal -> ["dpr", "p", "pas"]
- Objective-C -> ["m", "h"] - Perl -> ["PL", "pl", "pm", "pod", "t"]
- PHP -> ["php", "php3", "php4", "php5", "php7", "phps", "phpt", "phtml"] - PHP -> ["php", "php3", "php4", "php5", "php7", "phps", "phpt", "phtml"]
- Pascal -> ["pas", "p", "dpr"] - Plain Text -> ["txt"]
- Perl -> ["pl", "pm", "pod", "t", "PL"] - PowerShell -> ["ps1", "psd1", "psm1"]
- Python -> ["py", "py3", "pyw", "pyi", "pyx", "pyx.in", "pxd", "pxd.in", "pxi", "pxi.in", "rpy", "cpy", "SConstruct", "Sconstruct", "sconstruct", "SConscript", "gyp", "gypi", "Snakefile", "wscript"] - Python -> ["SConscript", "SConstruct", "Sconstruct", "Snakefile", "cpy", "gyp", "gypi", "pxd", "pxd.in", "pxi", "pxi.in", "py", "py3", "pyi", "pyw", "pyx", "pyx.in", "rpy", "sconstruct", "wscript"]
- R -> ["R", "r", "s", "S", "Rprofile"] - R -> ["R", "Rprofile", "S", "r", "s"]
- Rd (R Documentation) -> ["rd"] - Rd (R Documentation) -> ["rd"]
- HTML (Rails) -> ["rails", "rhtml", "erb", "html.erb"]
- JavaScript (Rails) -> ["js.erb"]
- Ruby Haml -> ["haml", "sass"]
- Ruby on Rails -> ["rxml", "builder"]
- SQL (Rails) -> ["erbsql", "sql.erb"]
- Regular Expression -> ["re"]
- reStructuredText -> ["rst", "rest"]
- Ruby -> ["rb", "Appfile", "Appraisals", "Berksfile", "Brewfile", "capfile", "cgi", "Cheffile", "config.ru", "Deliverfile", "Fastfile", "fcgi", "Gemfile", "gemspec", "Guardfile", "irbrc", "jbuilder", "podspec", "prawn", "rabl", "rake", "Rakefile", "Rantfile", "rbx", "rjs", "ruby.rail", "Scanfile", "simplecov", "Snapfile", "thor", "Thorfile", "Vagrantfile"]
- Rust -> ["rs"]
- SQL -> ["sql", "ddl", "dml"]
- Scala -> ["scala", "sbt"]
- Bourne Again Shell (bash) -> ["sh", "bash", "zsh", "fish", ".bash_aliases", ".bash_completions", ".bash_functions", ".bash_login", ".bash_logout", ".bash_profile", ".bash_variables", ".bashrc", ".profile", ".textmate_init", ".zshrc"]
- HTML (Tcl) -> ["adp"]
- Tcl -> ["tcl"]
- Textile -> ["textile"]
- XML -> ["xml", "xsd", "xslt", "tld", "dtml", "rss", "opml", "svg"]
- YAML -> ["yaml", "yml", "sublime-syntax"]
- PowerShell -> ["ps1", "psm1", "psd1"]
- SWI-Prolog -> ["pro"]
- Reason -> ["re", "rei"] - Reason -> ["re", "rei"]
- CMake C Header -> ["h.in"] - Regular Expression -> ["re"]
- CMake C++ Header -> ["hh.in", "hpp.in", "hxx.in", "h++.in"] - reStructuredText -> ["rest", "rst"]
- CMake -> ["CMakeLists.txt", "cmake"] - Ruby -> ["Appfile", "Appraisals", "Berksfile", "Brewfile", "Cheffile", "Deliverfile", "Fastfile", "Gemfile", "Guardfile", "Rakefile", "Rantfile", "Scanfile", "Snapfile", "Thorfile", "Vagrantfile", "capfile", "cgi", "config.ru", "fcgi", "gemspec", "irbrc", "jbuilder", "podspec", "prawn", "rabl", "rake", "rb", "rbx", "rjs", "ruby.rail", "simplecov", "thor"]
- CMakeCache -> ["CMakeCache.txt"] - Ruby Haml -> ["haml", "sass"]
- Generic Config -> ["cfg", "conf", "config", "ini", "pro", "mak", "mk", "Doxyfile", "inputrc", ".inputrc", "dircolors", ".dircolors", "gitmodules", ".gitmodules", "gitignore", ".gitignore", "gitattributes", ".gitattributes"] - Ruby on Rails -> ["builder", "rxml"]
- Elm -> ["elm"] - Rust -> ["rs"]
- Linker Script -> ["ld"] - Scala -> ["sbt", "scala"]
- SQL -> ["ddl", "dml", "sql"]
- SQL (Rails) -> ["erbsql", "sql.erb"]
- SWI-Prolog -> ["pro"]
- Swift -> ["swift"] - Swift -> ["swift"]
- TOML -> ["toml", "tml"] - Tcl -> ["tcl"]
- TeX -> ["cls", "sty"]
- Textile -> ["textile"]
- TOML -> ["Cargo.lock", "Gopkg.lock", "Pipfile", "tml", "toml"]
- TypeScript -> ["ts"] - TypeScript -> ["ts"]
- TypeScriptReact -> ["tsx"] - TypeScriptReact -> ["tsx"]
- VimL -> ["vim"] - VimL -> ["vim"]
- Nix -> ["nix"] - XML -> ["dtml", "opml", "rss", "svg", "tld", "xml", "xsd", "xslt"]
- TOML -> ["toml", "tml", "Cargo.lock", "Gopkg.lock", "Pipfile"] - YAML -> ["sublime-syntax", "yaml", "yml"]
``` ```
If you want to highlight a language not on that list, please open an issue or a pull request on the [Zola repo](https://github.com/getzola/zola). If you want to highlight a language not on that list, please open an issue or a pull request on the [Zola repo](https://github.com/getzola/zola).