Skip to content

Instantly share code, notes, and snippets.

@IngoHohmann
Created June 4, 2013 14:55
Show Gist options
  • Save IngoHohmann/5706552 to your computer and use it in GitHub Desktop.
Save IngoHohmann/5706552 to your computer and use it in GitHub Desktop.
fast test for fixing up html in the old rebol.net wiki
REBOL [
author: "Ingo Hohmann"
date: 2013-06-04
purpose: "Fix html in asciidoc pages"
]
name: %R3_Commands_vs._R2_Commands.txt
newname: head insert find/last copy name #"." ".ascii"
file: read name
output: copy ""
emit: func[text /local nl][
append probe form text
]
remit: func[text [block!]][
emit reform text
]
text-rule: [
copy text to "<" (emit text)
]
tag-rule: [
"<" [
; opening tags
[ "table"
here:
thru "</table>"
there:
(change/part here trim/lines copy/part here there there)
:here
; TODO: Add table setup
(
emit {[format="csv"]^/|=======^/}
)
thru ">"
] |
[ "tr"
;(emit newline)
thru ">"
] |
[ "td"
thru ">"
] |
[ "th"
thru ">"
] |
[ "tt"
thru ">"
] |
; closing tags
[ "/table"
(emit "|=======^/")
thru ">"
] |
[ "/td"
thru ">"
here:
[
["</" :here]
|
[(emit ",")]
]
] |
[ "/th"
thru ">"
here:
[
["</" :here]
|
[(emit ",")]
]
] |
[ "/tr"
(emit newline)
thru ">"
] |
; catch all
[ "/"
thru ">"
] |
[ thru ">"]
]
]
parse file [
some [
tag-rule | text-rule
]
]
write newname output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment