2 # Converts variant of MediaWiki to DocBook
5 func open_section
(tag
) {
11 func close_section
() {
14 print "</"stack
[stack_i
]">"
25 if (block_state
!= "") {
26 print "</"block_state
">"
32 if (block_state
!= s
) {
45 print "<itemizedlist>"
54 print "</itemizedlist>"
64 # empty lines = close block
70 # lists/stuff that goes in <screen> tags
71 # if matches a previous indentation level it's a list
72 # otherwise it should have higher indentation level
73 # and belongs in <screen> tag
77 # must use gensub because length() doesn't seem to change after sub()
78 tmp = gensub
("^ *", "", 1)
81 if (list_indent == n
) {
83 } else if (list_indent
< n
) {
88 print "funny indent level"
97 # must use gensub because length() doesn't seem to change after sub()
98 tmp = gensub
("^- *", "", 1)
105 # replace " with prettier Unicode open/close double quotes
107 while (match($0, "\"")) {
108 sub("\"", "\\“")
109 sub("\"", "\\”")
114 while (match($
0, "''")) {
115 sub("''", "<emphasis>")
116 sub("''", "</emphasis>")
125 open_section
("section")
126 print "<title>"$
0"</title>"
133 open_section
("section")
134 print "<title>"$
0"</title>"
141 open_section
("chapter")
142 print "<title>"$
0"</title>"
148 gsub("\\[\\[", "<ulink url=\"")
150 gsub("]]", "</ulink>")
153 # default = paragraph
155 if (!was_list_item
) {