summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@acm.org>2014-06-21 13:42:09 -0700
committerTim Kientzle <kientzle@acm.org>2014-06-21 13:42:09 -0700
commitf4839ee8d23a1a8b434fb42389ef45e52c7584bb (patch)
treef43baa446c5567074cbec14090d4ef0cb8e9b111 /doc
parent5c80ecf39bf7ac8997fb798b272516ee814822c7 (diff)
downloadlibarchive-f4839ee8d23a1a8b434fb42389ef45e52c7584bb.tar.gz
Don't put '' around options within literals
Diffstat (limited to 'doc')
-rwxr-xr-xdoc/mdoc2wiki.awk155
1 files changed, 79 insertions, 76 deletions
diff --git a/doc/mdoc2wiki.awk b/doc/mdoc2wiki.awk
index cf63b848..3a336028 100755
--- a/doc/mdoc2wiki.awk
+++ b/doc/mdoc2wiki.awk
@@ -153,22 +153,22 @@ function splitwords(l, dest, n, o, w) {
l = substr(l, 2)
o = index(l, "\"")
if (o > 0) {
- w = substr(l, 1, o-1)
- l = substr(l, o+1)
- dest[n++] = w
+ w = substr(l, 1, o-1)
+ l = substr(l, o+1)
+ dest[n++] = w
} else {
- dest[n++] = l
- l = ""
+ dest[n++] = l
+ l = ""
}
} else {
o = match(l, "[ \t]")
if (o > 0) {
- w = substr(l, 1, o-1)
- l = substr(l, o+1)
- dest[n++] = w
+ w = substr(l, 1, o-1)
+ l = substr(l, o+1)
+ dest[n++] = w
} else {
- dest[n++] = l
- l = ""
+ dest[n++] = l
+ l = ""
}
}
}
@@ -200,8 +200,8 @@ function splitwords(l, dest, n, o, w) {
STATE = PRETAG_STATE
if(match(words[w+1],"-literal")) {
dispstart()
- displaylines=10000
- w=nwords
+ displaylines=10000
+ w=nwords
}
} else if(match(words[w],"^Ed$")) { # End display
displaylines = 0
@@ -215,7 +215,7 @@ function splitwords(l, dest, n, o, w) {
addopen("\"")
add(words[++w])
while(w<nwords&&!match(words[w+1],"^[\\.,]"))
- add(words[++w])
+ add(words[++w])
addclose("\"")
} else if(match(words[w],"^Do$")) {
addopen("\"")
@@ -277,11 +277,11 @@ function splitwords(l, dest, n, o, w) {
if(match(section,"SYNOPSIS"))
breakline()
if(w >= nwords)
- n=name
+ n=name
else if (match(words[w+1], "^[A-Z][a-z]$"))
- n=name
+ n=name
else if (match(words[w+1], "^[.,;:]$"))
- n=name
+ n=name
else {
n=words[++w]
if(!length(name))
@@ -290,27 +290,30 @@ function splitwords(l, dest, n, o, w) {
if(!length(n))
n=name
if (displaylines == 0)
- add("'''" n "'''")
+ add("'''" n "'''")
else
- add(n)
+ add(n)
} else if(match(words[w],"^Nd$")) {
add("- " wtail())
} else if(match(words[w],"^Fl$")) {
addopen("-")
} else if(match(words[w],"^Ar$")) {
if(w==nwords)
- add("''file ...''")
+ add("''file ...''")
else {
- ++w
- gsub("<", "\\&lt;", words[w])
- add("''" words[w] "''")
+ ++w
+ gsub("<", "\\&lt;", words[w])
+ if (displaylines > 0)
+ add(words[w])
+ else
+ add("''" words[w] "''")
}
} else if(match(words[w],"^Cm$")) {
++w
if (displaylines == 0) {
- add("'''" words[w] "'''")
+ add("'''" words[w] "'''")
} else
- add(words[w])
+ add(words[w])
} else if(match(words[w],"^Op$")) {
addopen("<nowiki>[</nowiki>")
option=1
@@ -321,36 +324,36 @@ function splitwords(l, dest, n, o, w) {
print ""
} else if(match(words[w],"^An$")) {
if (match(words[w+1],"-nosplit"))
- ++w
+ ++w
endline()
} else if(match(words[w],"^Ss$")) {
add("===")
trailer="==="
} else if(match(words[w],"^Ft$")) {
if (match(section, "SYNOPSIS")) {
- breakline()
+ breakline()
}
l = wtail()
add("''" l "''")
if (match(section, "SYNOPSIS")) {
- breakline()
+ breakline()
}
} else if(match(words[w],"^Fn$")) {
++w
F = "'''" words[w] "'''("
Fsep = ""
while(w<nwords) {
- ++w
- if (match(words[w], "^[.,:]$")) {
- --w
- break
- }
- F = F Fsep "''" words[w] "''"
- Fsep = ", "
+ ++w
+ if (match(words[w], "^[.,:]$")) {
+ --w
+ break
+ }
+ F = F Fsep "''" words[w] "''"
+ Fsep = ", "
}
add(F ")")
if (match(section, "SYNOPSIS")) {
- addclose(";")
+ addclose(";")
}
} else if(match(words[w],"^Fo$")) {
w++
@@ -363,7 +366,7 @@ function splitwords(l, dest, n, o, w) {
} else if(match(words[w],"^Fc$")) {
add(F ")")
if (match(section, "SYNOPSIS")) {
- addclose(";")
+ addclose(";")
}
} else if(match(words[w],"^Va$")) {
w++
@@ -374,11 +377,11 @@ function splitwords(l, dest, n, o, w) {
} else if(match(words[w],"^Pa$")) {
w++
# if(match(words[w],"^\\."))
-# add("\\&")
+# add("\\&")
if (displaylines == 0)
- add("''" words[w] "''")
+ add("''" words[w] "''")
else
- add(words[w])
+ add(words[w])
} else if(match(words[w],"^Dv$")) {
linecmd()
} else if(match(words[w],"^Em|Ev$")) {
@@ -404,22 +407,22 @@ function splitwords(l, dest, n, o, w) {
++listdepth
listnext[listdepth]=""
if(match(words[w+1],"-bullet")) {
- optlist[listdepth]=1
- addopen("<ul>")
- listclose[listdepth]="</ul>"
+ optlist[listdepth]=1
+ addopen("<ul>")
+ listclose[listdepth]="</ul>"
} else if(match(words[w+1],"-enum")) {
- optlist[listdepth]=2
- enum=0
- addopen("<ol>")
- listclose[listdepth]="</ol>"
+ optlist[listdepth]=2
+ enum=0
+ addopen("<ol>")
+ listclose[listdepth]="</ol>"
} else if(match(words[w+1],"-tag")) {
- optlist[listdepth]=3
- addopen("<dl>")
- listclose[listdepth]="</dl>"
+ optlist[listdepth]=3
+ addopen("<dl>")
+ listclose[listdepth]="</dl>"
} else if(match(words[w+1],"-item")) {
- optlist[listdepth]=4
- addopen("<ul>")
- listclose[listdepth]="</ul>"
+ optlist[listdepth]=4
+ addopen("<ul>")
+ listclose[listdepth]="</ul>"
}
w=nwords
} else if(match(words[w],"^El$")) {
@@ -430,30 +433,30 @@ function splitwords(l, dest, n, o, w) {
} else if(match(words[w],"^It$")) {
addclose(listnext[listdepth])
if(optlist[listdepth]==1) {
- addpunct("<li>")
- listnext[listdepth] = "</li>"
+ addpunct("<li>")
+ listnext[listdepth] = "</li>"
} else if(optlist[listdepth]==2) {
- addpunct("<li>")
- listnext[listdepth] = "</li>"
+ addpunct("<li>")
+ listnext[listdepth] = "</li>"
} else if(optlist[listdepth]==3) {
- addpunct("<dt>")
- listnext[listdepth] = "</dt>"
- if(match(words[w+1],"^Xo$")) {
- # Suppress trailer
- w++
- } else if(match(words[w+1],"^Pa$|^Ev$")) {
- addopen("'''")
- w++
- add(words[++w] "'''")
- trailer = listnext[listdepth] "<dd>" trailer
- listnext[listdepth] = "</dd>"
- } else {
- trailer = listnext[listdepth] "<dd>" trailer
- listnext[listdepth] = "</dd>"
- }
+ addpunct("<dt>")
+ listnext[listdepth] = "</dt>"
+ if(match(words[w+1],"^Xo$")) {
+ # Suppress trailer
+ w++
+ } else if(match(words[w+1],"^Pa$|^Ev$")) {
+ addopen("'''")
+ w++
+ add(words[++w] "'''")
+ trailer = listnext[listdepth] "<dd>" trailer
+ listnext[listdepth] = "</dd>"
+ } else {
+ trailer = listnext[listdepth] "<dd>" trailer
+ listnext[listdepth] = "</dd>"
+ }
} else if(optlist[listdepth]==4) {
- addpunct("<li>")
- listnext[listdepth] = "</li>"
+ addpunct("<li>")
+ listnext[listdepth] = "</li>"
}
} else if(match(words[w], "^Vt$")) {
w++
@@ -463,9 +466,9 @@ function splitwords(l, dest, n, o, w) {
} else if(match(words[w],"^Xc$")) {
# TODO: Figure out how to handle this
if (optlist[listdepth] == 3) {
- addclose(listnext[listdepth])
- addopen("<dd>")
- listnext[listdepth] = "</dd>"
+ addclose(listnext[listdepth])
+ addopen("<dd>")
+ listnext[listdepth] = "</dd>"
}
} else if(match(words[w],"^[=]$")) {
addpunct(words[w])