Added LuaPage mode/highlighter to Ace.
Added LuaPage mode and example doc to kitchen sink demo.
This commit is contained in:
parent
5f6cbc8bd7
commit
561a426516
4 changed files with 132 additions and 0 deletions
|
|
@ -109,6 +109,8 @@ var modesByName = {
|
|||
less: ["LESS" , "less"],
|
||||
liquid: ["Liquid" , "liquid"],
|
||||
lua: ["Lua" , "lua"],
|
||||
luapage: ["LuaPage" , "lp"],
|
||||
// LuaPage implements the LuaPage markup as described by the Kepler Project's CGILua documentation: http://keplerproject.github.com/cgilua/manual.html#templates
|
||||
markdown: ["Markdown" , "md|markdown"],
|
||||
ocaml: ["OCaml" , "ml|mli"],
|
||||
perl: ["Perl" , "pl|pm"],
|
||||
|
|
@ -186,6 +188,7 @@ var docs = {
|
|||
"docs/ocaml.ml": "OCaml",
|
||||
"docs/OpenSCAD.scad": "OpenSCAD",
|
||||
"docs/lua.lua": "Lua",
|
||||
"docs/luapage.lp": "LuaPage", // index.lp from the Kepler Project's LuaDoc HTML doclet. http://keplerproject.github.com/luadoc/
|
||||
"docs/liquid.liquid": "Liquid",
|
||||
"docs/java.java": "Java",
|
||||
"docs/clojure.clj": "Clojure",
|
||||
|
|
|
|||
67
demo/kitchen-sink/docs/luapage.lp
Normal file
67
demo/kitchen-sink/docs/luapage.lp
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<title>Reference</title>
|
||||
<link rel="stylesheet" href="<%=luadoc.doclet.html.link("luadoc.css")%>" type="text/css" />
|
||||
<!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="container">
|
||||
|
||||
<div id="product">
|
||||
<div id="product_logo"></div>
|
||||
<div id="product_name"><big><b></b></big></div>
|
||||
<div id="product_description"></div>
|
||||
</div> <!-- id="product" -->
|
||||
|
||||
<div id="main">
|
||||
|
||||
<div id="navigation">
|
||||
<%=luadoc.doclet.html.include("menu.lp", { doc=doc })%>
|
||||
|
||||
</div> <!-- id="navigation" -->
|
||||
|
||||
<div id="content">
|
||||
|
||||
|
||||
<%if not options.nomodules and #doc.modules > 0 then%>
|
||||
<h2>Modules</h2>
|
||||
<table class="module_list">
|
||||
<!--<tr><td colspan="2">Modules</td></tr>-->
|
||||
<%for _, modulename in ipairs(doc.modules) do%>
|
||||
<tr>
|
||||
<td class="name"><a href="<%=luadoc.doclet.html.module_link(modulename, doc)%>"><%=modulename%></a></td>
|
||||
<td class="summary"><%=doc.modules[modulename].summary%></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</table>
|
||||
<%end%>
|
||||
|
||||
|
||||
|
||||
<%if not options.nofiles and #doc.files > 0 then%>
|
||||
<h2>Files</h2>
|
||||
<table class="file_list">
|
||||
<!--<tr><td colspan="2">Files</td></tr>-->
|
||||
<%for _, filepath in ipairs(doc.files) do%>
|
||||
<tr>
|
||||
<td class="name"><a href="<%=luadoc.doclet.html.file_link(filepath)%>"><%=filepath%></a></td>
|
||||
<td class="summary"></td>
|
||||
</tr>
|
||||
<%end%>
|
||||
</table>
|
||||
<%end%>
|
||||
|
||||
</div> <!-- id="content" -->
|
||||
|
||||
</div> <!-- id="main" -->
|
||||
|
||||
<div id="about">
|
||||
<p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
|
||||
</div> <!-- id="about" -->
|
||||
|
||||
</div> <!-- id="container" -->
|
||||
</body>
|
||||
</html>
|
||||
22
lib/ace/mode/luapage.js
Normal file
22
lib/ace/mode/luapage.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var HtmlMode = require("./html").Mode;
|
||||
var LuaMode = require("./lua").Mode;
|
||||
var Tokenizer = require("../tokenizer").Tokenizer;
|
||||
var LuaPageHighlightRules = require("./luapage_highlight_rules").LuaPageHighlightRules;
|
||||
|
||||
var Mode = function() {
|
||||
var highlighter = new LuaPageHighlightRules();
|
||||
|
||||
this.$tokenizer = new Tokenizer(new LuaPageHighlightRules().getRules());
|
||||
this.$embeds = highlighter.getEmbeds();
|
||||
this.createModeDelegates({
|
||||
"lua-": LuaMode
|
||||
});
|
||||
};
|
||||
oop.inherits(Mode, HtmlMode);
|
||||
|
||||
exports.Mode = Mode;
|
||||
});
|
||||
40
lib/ace/mode/luapage_highlight_rules.js
Normal file
40
lib/ace/mode/luapage_highlight_rules.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
define(function(require, exports, module) {
|
||||
"use strict";
|
||||
|
||||
var oop = require("../lib/oop");
|
||||
var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
|
||||
var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
|
||||
|
||||
var LuaPageHighlightRules = function() {
|
||||
this.$rules = new HtmlHighlightRules().getRules();
|
||||
|
||||
for (var i in this.$rules){ // Thanks to Harutyun Amirjanyan for this fix.
|
||||
this.$rules[i].unshift({
|
||||
token: "keyword",
|
||||
regex: "<\\%\\=?",
|
||||
next: "lua-start"
|
||||
}, {
|
||||
token: "keyword",
|
||||
regex: "<\\?lua\\=?",
|
||||
next: "lua-start"
|
||||
});
|
||||
}
|
||||
this.embedRules(LuaHighlightRules, "lua-", [
|
||||
{
|
||||
token: "keyword",
|
||||
regex: "\\%>",
|
||||
next: "start"
|
||||
},
|
||||
{
|
||||
token: "keyword",
|
||||
regex: "\\?>",
|
||||
next: "start"
|
||||
}
|
||||
]);
|
||||
};
|
||||
|
||||
oop.inherits(LuaPageHighlightRules, HtmlHighlightRules);
|
||||
|
||||
exports.LuaPageHighlightRules = LuaPageHighlightRules;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue