generate doclist automatically based on modelist

This commit is contained in:
nightwing 2013-09-07 19:13:30 +04:00
commit 37fc612756
17 changed files with 118 additions and 94 deletions

View file

@ -66,95 +66,19 @@ function makeHuge(txt) {
}
var docs = {
"docs/javascript.js": "JavaScript",
"docs/AsciiDoc.asciidoc": "AsciiDoc",
"docs/clojure.clj": "Clojure",
"docs/coffeescript.coffee": "CoffeeScript",
"docs/coldfusion.cfm": "ColdFusion",
"docs/cpp.cpp": "C/C++",
"docs/csharp.cs": "C#",
"docs/css.css": "CSS",
"docs/curly.curly": "Curly",
"docs/dart.dart": "Dart",
"docs/diff.diff": "Diff",
"docs/dot.dot": "Dot",
"docs/freemarker.ftl" : "FreeMarker",
"docs/glsl.glsl": "Glsl",
"docs/golang.go": "Go",
"docs/groovy.groovy": "Groovy",
"docs/haml.haml": "Haml",
"docs/Haxe.hx": "haXe",
"docs/html.html": "HTML",
"docs/html_ruby.erb": "HTML (Ruby)",
"docs/jade.jade": "Jade",
"docs/java.java": "Java",
"docs/jsp.jsp": "JSP",
"docs/json.json": "JSON",
"docs/jsx.jsx": "JSX",
"docs/javascript.js": {order: 1, name: "JavaScript"},
"docs/latex.tex": {name: "LaTeX", wrapped: true},
"docs/less.less": "LESS",
"docs/lisp.lisp": "Lisp",
"docs/lsl.lsl": "LSL",
"docs/scheme.scm": "Scheme",
"docs/livescript.ls": "LiveScript",
"docs/liquid.liquid": "Liquid",
"docs/logiql.logic": "LogiQL",
"docs/lua.lua": "Lua",
"docs/lucene.lucene": "Lucene",
"docs/luapage.lp": "LuaPage",
"docs/Makefile": "Makefile",
"docs/markdown.md": {name: "Markdown", wrapped: true},
"docs/mushcode.mc": {name: "MUSHCode", wrapped: true},
"docs/objectivec.m": {name: "Objective-C"},
"docs/ocaml.ml": "OCaml",
"docs/OpenSCAD.scad": "OpenSCAD",
"docs/pascal.pas": "Pascal",
"docs/perl.pl": "Perl",
"docs/pgsql.pgsql": {name: "pgSQL", wrapped: true},
"docs/php.php": "PHP",
"docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
"docs/powershell.ps1": "Powershell",
"docs/properties.properties": "Properties",
"docs/python.py": "Python",
"docs/r.r": "R",
"docs/rdoc.Rd": "RDoc",
"docs/rhtml.rhtml": "RHTML",
"docs/ruby.rb": "Ruby",
"docs/abap.abap": "SAP - ABAP",
"docs/scala.scala": "Scala",
"docs/scss.scss": "SCSS",
"docs/sass.sass": "SASS",
"docs/sh.sh": "SH",
"docs/space.space": "Space",
"docs/stylus.styl": "Stylus",
"docs/sql.sql": {name: "SQL", wrapped: true},
"docs/svg.svg": "SVG",
"docs/tcl.tcl": "Tcl",
"docs/tex.tex": "Tex",
"docs/textile.textile": {name: "Textile", wrapped: true},
"docs/snippets.snippets": "snippets",
"docs/toml.toml": "TOML",
"docs/typescript.ts": "Typescript",
"docs/vbscript.vbs": "VBScript",
"docs/velocity.vm": "Velocity",
"docs/xml.xml": "XML",
"docs/xquery.xq": "XQuery",
"docs/yaml.yaml": "YAML",
"docs/c9search.c9search_results": "C9 Search Results",
"docs/actionscript.as": "ActionScript",
"docs/assembly_x86.asm": "Assembly_x86",
"docs/autohotkey.ahk": "AutoHotKey",
"docs/batchfile.bat": "BatchFile",
"docs/erlang.erl": "Erlang",
"docs/forth.frt": "Forth",
"docs/haskell.hs": "Haskell",
"docs/julia.js": "Julia",
"docs/prolog.plg": "Prolog",
"docs/rust.rs": "Rust",
"docs/twig.twig": "Twig",
"docs/Nix.nix": "Nix",
"docs/protobuf.proto": "Protobuf"
"docs/textile.textile": {name: "Textile", wrapped: true},
"docs/c9search.c9search_results": "C9 Search Results",
"docs/Nix.nix": "Nix"
};
var ownSource = {
@ -166,6 +90,23 @@ var hugeDocs = {
"build/src-min/ace.js": ""
};
modelist.modes.forEach(function(m) {
var ext = m.extensions.split("|")[0];
if (ext[0] === "^") {
path = ext.substr(1);
} else {
var path = m.name + "." + ext
}
path = "docs/" + path;
if (!docs[path]) {
docs[path] = {name: m.caption};
} else if (typeof docs[path] == "object" && !docs[path].name) {
docs[path].name = m.caption;
}
})
if (window.require && window.require.s) try {
for (var path in window.require.s.contexts._.defined) {
if (path.indexOf("!") != -1)
@ -176,6 +117,13 @@ if (window.require && window.require.s) try {
}
} catch(e) {}
function sort(list) {
return list.sort(function(a, b) {
var cmp = (b.order || 0) - (a.order || 0);
return cmp || a.name && a.name.localeCompare(b.name);
})
}
function prepareDocList(docs) {
var list = [];
for (var path in docs) {
@ -219,7 +167,7 @@ function loadDoc(name, callback) {
module.exports = {
fileCache: fileCache,
docs: prepareDocList(docs),
docs: sort(prepareDocList(docs)),
ownSource: prepareDocList(ownSource),
hugeDocs: prepareDocList(hugeDocs),
initDoc: initDoc,

View file

@ -0,0 +1,5 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
Put_Line("Hello, world!");
end Hello;

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1,14 @@
#!/usr/bin/env rdmd
// Computes average line length for standard input.
import std.stdio;
void main() {
ulong lines = 0;
double sumLength = 0;
foreach (line; stdin.byLine()) {
++lines;
sumLength += line.length;
}
writeln("Average line length: ",
lines ? sumLength / lines : 0);
}

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1 @@
TODO

View file

@ -0,0 +1,46 @@
/**
* Greets a person using "Hello" by default.
* @param name The name of the person.
* @param? greetingWord Optional greeting word to use instead of "Hello".
*/
{template .helloName #eee}
{if not $greetingWord}
Hello {$name}!
{else}
{$greetingWord} {$name}!
{/if}
{/template}
/**
* Greets a person and optionally a list of other people.
* @param name The name of the person.
* @param additionalNames The additional names to greet. May be an empty list.
*/
{template .helloNames}
// Greet the person.
{call .helloName data="all" /}<br>
// Greet the additional people.
{foreach $additionalName in $additionalNames}
{call .helloName}
{param name: $additionalName /}
{/call}
{if not isLast($additionalName)}
<br> // break after every line except the last
{/if}
{ifempty}
No additional people to greet.
{/foreach}
{/template}
{/foreach}
{if length($items) > 5}
{msg desc="Says hello to the user."}
{namespace ns autoescape="contextual"}
/** Example. */
{template .example}
foo is {$ij.foo}
{/template}

View file

@ -963,7 +963,7 @@ if (match) {
<a href="http://www.divshot.com/">Divshot</a>
</li>
<li>
<img src="https://codio.com/s/img/logo-beta-e0ba4559.png"
<img src="https://codio.com/s/img/logo-beta-111c10af.png"
style="left: -4px; width: 110px;top: 16px;">
<a href="https://codio.com/">Codio</a>
</li>
@ -1038,7 +1038,7 @@ if (match) {
<a href="http://iknode.com/">iKnode</a>
</li>
<li title="Online conference and code review tool">
<div style="width: 90px; left: 5px; top: 0px;background:rgb(24,73,92);color: white;
<div style="width: 90px; left: 5px; top: 0px;background:rgb(24,73,92);color: white;position: absolute;
font-size: 68px;text-align: center;font-weight: bold;font-family: inherit;line-height: normal;">sT</div>
<a href="http://sourcetalk.net/">SourceTalk</a>
</li>
@ -1079,6 +1079,10 @@ if (match) {
<div class="text-logo" >allong.es</div>
<a href="http://allong.es/try/">Try allong.es</a>
</li>
<li>
<div class="text-logo" >Codechat</div>
<a href="http://codechat.net/">Codechat</a>
</li>
<li>
<a href="https://github.com/Gozala/sky-edit">Sky Edit</a>
</li>

View file

@ -50,10 +50,10 @@ var supportedModes = {
AutoHotKey: ["ahk"],
BatchFile: ["bat|cmd"],
C9Search: ["c9search_results"],
C_Cpp: ["c|cc|cpp|cxx|h|hh|hpp"],
C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp"],
Clojure: ["clj"],
Cobol: ["^CBL|COB"],
coffee: ["^Cakefile|coffee|cf|cson"],
Cobol: ["CBL|COB"],
coffee: ["coffee|cf|cson|^Cakefile"],
ColdFusion: ["cfm"],
CSharp: ["cs"],
CSS: ["css"],
@ -74,7 +74,7 @@ var supportedModes = {
haXe: ["hx"],
HTML: ["htm|html|xhtml"],
HTML_Ruby: ["erb|rhtml|html.erb"],
Ini: ["Ini|conf"],
Ini: ["ini|conf"],
Jade: ["jade"],
Java: ["java"],
JavaScript: ["js"],
@ -83,7 +83,7 @@ var supportedModes = {
JSP: ["jsp"],
JSX: ["jsx"],
Julia: ["jl"],
LaTeX: ["latex|tex|ltx|bib"],
LaTeX: ["tex|latex|ltx|bib"],
LESS: ["less"],
Liquid: ["liquid"],
Lisp: ["lisp"],
@ -93,7 +93,7 @@ var supportedModes = {
Lua: ["lua"],
LuaPage: ["lp"],
Lucene: ["lucene"],
Makefile: ["^GNUmakefile|^makefile|^Makefile|^OCamlMakefile|make"],
Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"],
MATLAB: ["matlab"],
Markdown: ["md|markdown"],
MySQL: ["mysql"],
@ -113,14 +113,14 @@ var supportedModes = {
R: ["r"],
RDoc: ["Rd"],
RHTML: ["Rhtml"],
Ruby: ["ru|gemspec|rake|rb"],
Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"],
Rust: ["rs"],
SASS: ["sass"],
SCAD: ["scad"],
Scala: ["scala"],
Scheme: ["scm|rkt"],
SCSS: ["scss"],
SH: ["sh|bash"],
SH: ["sh|bash|^.bashrc"],
Space: ["space"],
snippets: ["snippets"],
SQL: ["sql"],
@ -132,7 +132,7 @@ var supportedModes = {
Textile: ["textile"],
Toml: ["toml"],
Twig: ["twig"],
Typescript: ["typescript|ts|str"],
Typescript: ["ts|typescript|str"],
VBScript: ["vbs"],
Velocity: ["vm"],
XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],