Created
June 4, 2013 14:55
-
-
Save IngoHohmann/5706552 to your computer and use it in GitHub Desktop.
fast test for fixing up html in the old rebol.net wiki
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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