generate doclist automatically based on modelist
This commit is contained in:
parent
4c1497fc29
commit
37fc612756
17 changed files with 117 additions and 93 deletions
|
|
@ -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,
|
||||
|
|
|
|||
5
demo/kitchen-sink/docs/ada.ada
Normal file
5
demo/kitchen-sink/docs/ada.ada
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
procedure Hello is
|
||||
begin
|
||||
Put_Line("Hello, world!");
|
||||
end Hello;
|
||||
44
demo/kitchen-sink/docs/c_cpp.cpp
Normal file
44
demo/kitchen-sink/docs/c_cpp.cpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// compound assignment operators
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include \
|
||||
<iostream>
|
||||
|
||||
#include \
|
||||
\
|
||||
<iostream>
|
||||
|
||||
#include \
|
||||
\
|
||||
"iostream"
|
||||
|
||||
#include <boost/asio/io_service.hpp>
|
||||
#include "boost/asio/io_service.hpp"
|
||||
|
||||
#include \
|
||||
\
|
||||
"iostream" \
|
||||
"string" \
|
||||
<vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main ()
|
||||
{
|
||||
int a, b=3; /* foobar */
|
||||
a = b;
|
||||
a+=2; // equivalent to a=a+2
|
||||
cout << a;
|
||||
#if VERBOSE >= 2
|
||||
prints("trace message");
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Print an error message and get out */
|
||||
#define ABORT \
|
||||
do { \
|
||||
print( "Abort\n" ); \
|
||||
exit(8); \
|
||||
} while (0) /* Note: No semicolon */
|
||||
1
demo/kitchen-sink/docs/cobol.CBL
Normal file
1
demo/kitchen-sink/docs/cobol.CBL
Normal file
|
|
@ -0,0 +1 @@
|
|||
TODO
|
||||
22
demo/kitchen-sink/docs/coffee.coffee
Normal file
22
demo/kitchen-sink/docs/coffee.coffee
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env coffee
|
||||
|
||||
try
|
||||
throw URIError decodeURI(0xC0ffee * 123456.7e-8 / .9)
|
||||
catch e
|
||||
console.log 'qstring' + "qqstring" + '''
|
||||
qdoc
|
||||
''' + """
|
||||
qqdoc
|
||||
"""
|
||||
|
||||
do ->
|
||||
###
|
||||
herecomment
|
||||
###
|
||||
re = /regex/imgy.test ///
|
||||
heregex # comment
|
||||
///imgy
|
||||
this isnt: `just JavaScript`
|
||||
undefined
|
||||
|
||||
sentence = "#{ 22 / 7 } is a decent approximation of π"
|
||||
14
demo/kitchen-sink/docs/d.d
Normal file
14
demo/kitchen-sink/docs/d.d
Normal 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);
|
||||
}
|
||||
1
demo/kitchen-sink/docs/ejs.ejs
Normal file
1
demo/kitchen-sink/docs/ejs.ejs
Normal file
|
|
@ -0,0 +1 @@
|
|||
TODO
|
||||
46
demo/kitchen-sink/docs/ftl.ftl
Normal file
46
demo/kitchen-sink/docs/ftl.ftl
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
<#ftl encoding="utf-8" />
|
||||
<#setting locale="en_US" />
|
||||
<#import "library" as lib />
|
||||
<#--
|
||||
FreeMarker comment
|
||||
${abc} <#assign a=12 />
|
||||
-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
|
||||
<title>${title!"FreeMarker"}<title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<h1>Hello ${name!""}</h1>
|
||||
|
||||
<p>Today is: ${.now?date}</p>
|
||||
|
||||
<#assign x = 13>
|
||||
<#if x > 12 && x lt 14>x equals 13: ${x}</#if>
|
||||
|
||||
<ul>
|
||||
<#list items as item>
|
||||
<li>${item_index}: ${item.name!?split("\n")[0]}</li>
|
||||
</#list>
|
||||
</ul>
|
||||
|
||||
User directive: <@lib.function attr1=true attr2='value' attr3=-42.12>Test</@lib.function>
|
||||
<@anotherOne />
|
||||
|
||||
<#if variable?exists>
|
||||
Deprecated
|
||||
<#elseif variable??>
|
||||
Better
|
||||
<#else>
|
||||
Default
|
||||
</#if>
|
||||
|
||||
<img src="images/${user.id}.png" />
|
||||
|
||||
</body>
|
||||
</html>
|
||||
1
demo/kitchen-sink/docs/html.htm
Normal file
1
demo/kitchen-sink/docs/html.htm
Normal file
|
|
@ -0,0 +1 @@
|
|||
TODO
|
||||
1
demo/kitchen-sink/docs/ini.ini
Normal file
1
demo/kitchen-sink/docs/ini.ini
Normal file
|
|
@ -0,0 +1 @@
|
|||
TODO
|
||||
1
demo/kitchen-sink/docs/jsoniq.jq
Normal file
1
demo/kitchen-sink/docs/jsoniq.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
TODO
|
||||
1
demo/kitchen-sink/docs/matlab.matlab
Normal file
1
demo/kitchen-sink/docs/matlab.matlab
Normal file
|
|
@ -0,0 +1 @@
|
|||
TODO
|
||||
1
demo/kitchen-sink/docs/mysql.mysql
Normal file
1
demo/kitchen-sink/docs/mysql.mysql
Normal file
|
|
@ -0,0 +1 @@
|
|||
TODO
|
||||
21
demo/kitchen-sink/docs/scad.scad
Normal file
21
demo/kitchen-sink/docs/scad.scad
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// ace can highlight scad!
|
||||
module Element(xpos, ypos, zpos){
|
||||
translate([xpos,ypos,zpos]){
|
||||
union(){
|
||||
cube([10,10,4],true);
|
||||
cylinder(10,15,5);
|
||||
translate([0,0,10])sphere(5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
union(){
|
||||
for(i=[0:30]){
|
||||
# Element(0,0,0);
|
||||
Element(15*i,0,0);
|
||||
}
|
||||
}
|
||||
|
||||
for (i = [3, 5, 7, 11]){
|
||||
rotate([i*10,0,0])scale([1,1,i])cube(10);
|
||||
}
|
||||
46
demo/kitchen-sink/docs/soy_template.soy
Normal file
46
demo/kitchen-sink/docs/soy_template.soy
Normal 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}
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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"],
|
||||
|
|
|
|||
Loading…
Reference in a new issue