Permalink
Browse files

syntax highlighting

  • Loading branch information...
1 parent 744b64c commit e0106874c765c90240d61ebfdd7386794071651d @astro astro committed Aug 27, 2012
Showing with 780 additions and 2 deletions.
  1. +26 −2 index.html
  2. +125 −0 sh_haskell.js
  3. +25 −0 sh_init.js
  4. +538 −0 sh_main.js
  5. +66 −0 sh_style.css
View
@@ -4,8 +4,18 @@
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head>
<title>Themenabend Haskell &amp; Yesod</title>
+ <!-- Slidy: http://www.w3.org/Talks/Tools/Slidy2/ -->
<link rel="stylesheet" type="text/css" media="screen, projection, print" href="slidy.css" />
- <script src="slidy.js" charset="utf-8" type="text/javascript"></script>
+ <script src="slidy.js" charset="utf-8"
+ type="text/javascript"></script>
+
+ <!-- Highlighting: http://zenzike.com/posts/2010-10-14-highlighting-haskell-with-shjs -->
+ <link rel="stylesheet" type="text/css" href="sh_style.css" />
+ <script type="text/javascript" src="sh_main.js" > </script>
+ <script type="text/javascript" src="sh_haskell.js" > </script>
+ <script type="text/javascript" src="sh_init.js" > </script>
+
+ <!-- Custom style -->
<style type="text/css">
.cover {
text-align: center;
@@ -20,7 +30,7 @@
}
</style>
</head>
-<body>
+<body onload="sh_highlightDocument();">
<div class="slide cover">
<h1>Themenabend Haskell &amp; Yesod</h1>
@@ -37,7 +47,21 @@
  * Bücher/Doku
  * Hackage/Cabal
  * Hayoo/Hoogle
+-->
+<!--
* Syntax, Currying, Typen, Lazyness  (astro)  (min. 30min)
+-->
+<div class="slide">
+ <h2>Syntax</h2>
+ <ul>
+ <li>
+ <p>Rumpf:</p>
+ <pre class="sh_haskell">f = undefined</pre>
+ </li>
+ </ul>
+</div>
+
+<!--
* Monads, Functors, Applicatives (maloi) (30 min)
* Combinatoric Parsing: Attoparsec (astro) (15 min)
* Template Haskell (maloi) (20min)
View
@@ -0,0 +1,125 @@
+if (! this.sh_languages) {
+ this.sh_languages = {};
+}
+sh_languages['haskell'] = [
+ [
+ [
+ /\b[+-]?(?:(?:0x[A-Fa-f0-9]+)|(?:0[oO][0-7]+)|(?:(?:[\d]*\.)?[\d]+(?:[eE][+-]?[\d]+)?))u?(?:(?:int(?:8|16|32|64))|L)?\b/g,
+ 'sh_number',
+ -1
+ ],
+ [
+ /"/g,
+ 'sh_string',
+ 1
+ ],
+ [
+ /'(?:[^\\']{1}|\\[\\'0abfnrtv"&]|\\[\d]+|\\[oO][0-7]+|\\[xX][A-Fa-f0-9]+)'/g,
+ 'sh_string',
+ -1
+ ],
+ [
+ /\b(?:as|case|class|data|deriving|do|else|hiding|if|import|in|infixl|infixr|instance|let|module|newtype|of|primitive|qualified|then|type|where|_)\b/g,
+ 'sh_keyword',
+ -1
+ ],
+ [
+ /\b(?:abs|acos|acosh|all|and|any|appendFile|approxRational|asTypeOf|asin|asinh|atan|atan2|atanh|basicIORun|break|catch|ceiling|chr|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|denominator|digitToInt|div|divMod|drop|dropWhile|either|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromDouble|fromEnum|fromInt|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|group|head|id|inRange|index|init|intToDigit|interact|ioError|isAlpha|isAlphaNum|isAscii|isControl|isDenormalized|isDigit|isHexDigit|isIEEE|isInfinite|isLower|isNaN|isNegativeZero|isOctDigit|isPrint|isSpace|isUpper|iterate|last|lcm|length|lex|lexDigits|lexLitChar|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|numerator|odd|or|ord|otherwise|pack|pi|pred|primExitWith|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|range|rangeSize|read|readDec|readFile|readFloat|readHex|readIO|readInt|readList|readLitChar|readLn|readOct|readParen|readSigned|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showInt|showList|showLitChar|showParen|showSigned|showString|shows|showsPrec|significand|signum|sin|sinh|snd|sort|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|threadToIOResult|toEnum|toInt|toInteger|toLower|toRational|toUpper|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\b/g,
+ 'sh_predef_func',
+ -1
+ ],
+ [
+ /\b(?:False|True|Left|Right|Just|Nothing|EQ|LT|GT)\b/g,
+ 'sh_predef_var',
+ -1
+ ],
+ [
+ /\b(?:Bounded|Enum|Eq|Floating|Fractional|Functor|Integral|Ix|Monad|Num|Ord|Read|Real|RealFloat|RealFrac|Show)\b/g,
+ 'sh_classname',
+ -1
+ ],
+ [
+ /\{-#/g,
+ 'sh_preproc',
+ 2
+ ],
+ [
+ /\{-/g,
+ 'sh_comment',
+ 3
+ ],
+ [
+ /(?:--)(?![!#\$%&\*\+\.\/<=>\?@\\\^\|\-~:])/g,
+ 'sh_comment',
+ 4
+ ],
+ [
+ /^>(?= )/g,
+ 'sh_comment',
+ -1
+ ],
+ [
+ /(?:\.\.|:|::|=|\\|\||<\-|\->|@|~|=>)(?![!#\$%&\*\+\.\/<=>\?@\\\^\|\-~:])||||||/g,
+ 'sh_specialchar',
+ -1
+ ],
+ [
+ /[!#\$%&\*\+\.\/<=>\?@\\\^\|\-~:]+|||||||`\w+`/g,
+ 'sh_symbol',
+ -1
+ ],
+ [
+ /\b(?:Bool|Char|Double|Either|FilePath|Float|Int|Integer|IO|IOError|Maybe|Ordering|Ratio|Rational|ReadS|ShowS|String|ByteString)\b/g,
+ 'sh_type',
+ -1
+ ],
+ [
+ /\b(?:[A-Z][\w']*)\b(?![\.])/g,
+ 'sh_usertype',
+ -1
+ ],
+ [
+ /\{|\}|\[|\]/g,
+ 'sh_cbracket',
+ -1
+ ]
+ ],
+ [
+ [
+ /\\(?:\\|")/g,
+ null,
+ -1
+ ],
+ [
+ /"/g,
+ 'sh_string',
+ -2
+ ]
+ ],
+ [
+ [
+ /#-\}/g,
+ 'sh_preproc',
+ -2
+ ]
+ ],
+ [
+ [
+ /-\}/g,
+ 'sh_comment',
+ -2
+ ],
+ [
+ /\{-/g,
+ 'sh_comment',
+ 3
+ ]
+ ],
+ [
+ [
+ /$/g,
+ null,
+ -2
+ ]
+ ]
+];
View
@@ -0,0 +1,25 @@
+var codes = document.getElementsByTagName("code");
+var title, elTitle, elPre;
+for (var i=0, l=codes.length ; i<l ; i++) {
+ elPre = codes[i].parentNode;
+ if (elPre.tagName != "PRE") continue;
+
+ // Prepare for highlighting
+ // elPre.className = elPre.className.replace("sourceCode ","");
+ if (elPre.className.match("sourceCode"))
+ switch (elPre.className.replace("sourceCode ","")) {
+ case 'css':
+ case 'haskell':
+ case 'html':
+ case 'php':
+ elPre.className = "sourceCode sh_" + elPre.className.replace("sourceCode ", "");
+ break;
+ case 'js':
+ elPre.className += " sh_javascript";
+ case 'literate haskell':
+ elPre.className += " sh_haskell";
+ break;
+ }
+}
+
+sh_highlightDocument();
Oops, something went wrong. Retry.

0 comments on commit e010687

Please sign in to comment.