Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[cow] use span instead of div in pretty-printed code (to make it read…

…able in the RSS feed as well)
  • Loading branch information...
commit c1ac82ed8deac654f3d703dfd2795dd8f8ffdeb2 1 parent d2813b2
Thomas Gazagnaire samoht authored
Showing with 14 additions and 17 deletions.
  1. +14 −17 lib/cow/lib/code.ml
31 lib/cow/lib/code.ml
View
@@ -130,15 +130,12 @@ let regexp keywords8 =
['0' - '9']+
| '-' ['0' - '9']+
-type keyword1 = string with html
-type keyword2 = string with html
-type keyword3 = string with html
-type keyword4 = string with html
-type keyword5 = string with html
-type keyword6 = string with html
-type keyword7 = string with html
-type keyword8 = string with html
-type comments = string with html
+let html_of_keyword i str =
+ let k = "keyword" ^ string_of_int i in
+ <:xml<<span class=$str:k$>$str:str$</span>&>>
+
+let html_of_comments str =
+ <:xml<<span class="comments">$str:str$</span>&>>
let ocaml str : Html.t =
@@ -148,35 +145,35 @@ let ocaml str : Html.t =
| keywords8 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword8 str @ accu) lexbuf
+ main (html_of_keyword 8 str @ accu) lexbuf
| keywords7 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword7 str @ accu) lexbuf
+ main (html_of_keyword 7 str @ accu) lexbuf
| keywords6 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword6 str @ accu) lexbuf
+ main (html_of_keyword 6 str @ accu) lexbuf
| keywords5 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword5 str @ accu) lexbuf
+ main (html_of_keyword 5 str @ accu) lexbuf
| keywords4 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword4 str @ accu) lexbuf
+ main (html_of_keyword 4 str @ accu) lexbuf
| keywords3 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword3 str @ accu) lexbuf
+ main (html_of_keyword 3 str @ accu) lexbuf
| keywords2 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword2 str @ accu) lexbuf
+ main (html_of_keyword 2 str @ accu) lexbuf
| keywords1 ->
let str = Ulexing.utf8_lexeme lexbuf in
- main (html_of_keyword1 str @ accu) lexbuf
+ main (html_of_keyword 1 str @ accu) lexbuf
| ident | blank+ | _ ->
let str = Ulexing.utf8_lexeme lexbuf in
Please sign in to comment.
Something went wrong with that request. Please try again.