summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorAndres Mejia <amejia004@gmail.com>2012-02-03 21:13:53 -0500
committerAndres Mejia <amejia004@gmail.com>2012-02-05 14:25:26 -0500
commitca4f08da1afe3dbae32fe342d9cb113171352dfb (patch)
treeab8a08f361eaa364a9341d0a0431cb8aa23d3759 /doc
parentf2de495ab495e45a3316284cb0984c30a2744232 (diff)
downloadlibarchive-ca4f08da1afe3dbae32fe342d9cb113171352dfb.tar.gz
Use states to determine if writing literal text for <pre> tags.
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/mdoc2mediawiki.awk12
1 files changed, 11 insertions, 1 deletions
diff --git a/doc/mdoc2mediawiki.awk b/doc/mdoc2mediawiki.awk
index 9d585299..16649dae 100755
--- a/doc/mdoc2mediawiki.awk
+++ b/doc/mdoc2mediawiki.awk
@@ -26,6 +26,10 @@ BEGIN {
sep = ""
nextsep = " "
spaces = " "
+
+ NORMAL_STATE = 0
+ PRETAG_STATE = 1
+ STATE = NORMAL_STATE
}
# Add a word with appropriate preceding whitespace
@@ -63,7 +67,11 @@ function endline() {
addclose(trailer)
trailer = ""
if(length(out) > 0) {
- print out " "
+ if (STATE == PRETAG_STATE) {
+ print out
+ } else {
+ print out " "
+ }
out=""
}
if(displaylines > 0) {
@@ -159,6 +167,7 @@ function splitwords(l, dest, n, o, w) {
dispstart()
displaylines = 1
} else if(match(words[w],"^Bd$")) { # Begin display
+ STATE = PRETAG_STATE
if(match(words[w+1],"-literal")) {
dispstart()
displaylines=10000
@@ -167,6 +176,7 @@ function splitwords(l, dest, n, o, w) {
} else if(match(words[w],"^Ed$")) { # End display
displaylines = 0
dispend()
+ STATE = NORMAL_STATE
} else if(match(words[w],"^Ns$")) { # Suppress space before next word
sep=""
} else if(match(words[w],"^No$")) { # Normal text