From ebbee9c0962219a4dfad783d4633cee8947503d9 Mon Sep 17 00:00:00 2001 From: "john.j.camilleri" Date: Wed, 16 May 2012 10:37:29 +0000 Subject: [PATCH] RGL Browser: proper syntax highlighting for GF --- .../browse/google-code-prettify/lang-gf.js | 15 +++++++ .../{prettify-own.css => prettify-gf.css} | 45 +------------------ lib/doc/browse/index.html | 8 ++-- 3 files changed, 20 insertions(+), 48 deletions(-) create mode 100644 lib/doc/browse/google-code-prettify/lang-gf.js rename lib/doc/browse/google-code-prettify/{prettify-own.css => prettify-gf.css} (60%) diff --git a/lib/doc/browse/google-code-prettify/lang-gf.js b/lib/doc/browse/google-code-prettify/lang-gf.js new file mode 100644 index 000000000..2d7d8677f --- /dev/null +++ b/lib/doc/browse/google-code-prettify/lang-gf.js @@ -0,0 +1,15 @@ +/* + GF language + Customised from lang-hs.js (Haskell) +*/ +PR.registerLangHandler(PR.createSimpleLexer([ + ["pln", /^[\t-\r ]+/, null, "\t\n \r "], + ["str", /^"(?:[^\n\f\r"\\]|\\[\S\s])*(?:"|$)/, null, '"'], +// ["str", /^'(?:[^\n\f\r'\\]|\\[^&])'?/, null, "'"], + ["lit", /^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+-]?\d+)?)/i, null, "0123456789"] +], [ + ["com", /^(?:--[^\n\f\r]*|{-(?:[^-]|-+[^}-])*-})/], + ["kwd", /^(?:abstract|case|cat|concrete|data|def|flags|fun|in|incomplete|instance|interface|let|lin|lincat|lindef|of|open|oper|param|pre|printname|resource|strs|table|transfer|variants|where|with)(?=[^\d'A-Za-z_]|$)/, null], + ["pln", /^(?:[A-Z][\w']*\.)*[A-Za-z][\w']*/], + ["pun", /^[^\d\t-\r "'A-Za-z]+/] +]), ["gf"]); diff --git a/lib/doc/browse/google-code-prettify/prettify-own.css b/lib/doc/browse/google-code-prettify/prettify-gf.css similarity index 60% rename from lib/doc/browse/google-code-prettify/prettify-own.css rename to lib/doc/browse/google-code-prettify/prettify-gf.css index 942d5b7a7..7cbf73617 100644 --- a/lib/doc/browse/google-code-prettify/prettify-own.css +++ b/lib/doc/browse/google-code-prettify/prettify-gf.css @@ -10,7 +10,7 @@ } .kwd { - color:#008 + color:#c0f } .com { @@ -49,49 +49,6 @@ color:red } } -@media print,projection -{ - .str - { - color:#060 - } - .kwd - { - color:#006; - font-weight:bold - } - .com - { - color:#600; - font-style:italic - } - .typ - { - color:#404; - font-weight:bold - } - .lit - { - color:#044 - } - .pun,.opn,.clo - { - color:#440 - } - .tag - { - color:#006; - font-weight:bold - } - .atn - { - color:#404 - } - .atv - { - color:#060 - } -} pre.prettyprint { } diff --git a/lib/doc/browse/index.html b/lib/doc/browse/index.html index 7588b7d09..211a48557 100644 --- a/lib/doc/browse/index.html +++ b/lib/doc/browse/index.html @@ -8,7 +8,7 @@ - +
@@ -37,7 +37,7 @@
-

+        

       
@@ -77,7 +77,6 @@
  • Some way of browsing just the API
  • Better visual cues for functions in scope
  • -
  • Customised GF syntax highlighting (currently using a Haskell default)
  • The page sometimes stalls when handling large files (in particular the dictionary modules)
@@ -85,10 +84,11 @@
- John J. Camilleri. Updated 2012-05-15. + John J. Camilleri. Updated 2012-05-16.
+ \ No newline at end of file