@@ -153,22 +153,22 @@ function splitwords(l, dest, n, o, w) {
153153 l = substr (l, 2 )
154154 o = index (l, " \" " )
155155 if (o > 0 ) {
156- w = substr (l, 1 , o- 1 )
157- l = substr (l, o+ 1 )
158- dest[ n++ ] = w
156+ w = substr (l, 1 , o- 1 )
157+ l = substr (l, o+ 1 )
158+ dest[ n++ ] = w
159159 } else {
160- dest[ n++ ] = l
161- l = " "
160+ dest[ n++ ] = l
161+ l = " "
162162 }
163163 } else {
164164 o = match (l, " [ \t ]" )
165165 if (o > 0 ) {
166- w = substr (l, 1 , o- 1 )
167- l = substr (l, o+ 1 )
168- dest[ n++ ] = w
166+ w = substr (l, 1 , o- 1 )
167+ l = substr (l, o+ 1 )
168+ dest[ n++ ] = w
169169 } else {
170- dest[ n++ ] = l
171- l = " "
170+ dest[ n++ ] = l
171+ l = " "
172172 }
173173 }
174174 }
@@ -200,8 +200,8 @@ function splitwords(l, dest, n, o, w) {
200200 STATE = PRETAG_STATE
201201 if (match (words[ w+ 1 ] ," -literal" )) {
202202 dispstart()
203- displaylines= 10000
204- w= nwords
203+ displaylines= 10000
204+ w= nwords
205205 }
206206 } else if (match (words[ w] ," ^Ed$" )) { # End display
207207 displaylines = 0
@@ -215,7 +215,7 @@ function splitwords(l, dest, n, o, w) {
215215 addopen(" \" " )
216216 add(words[ ++ w] )
217217 while (w< nwords&&! match (words[ w+ 1 ] ," ^[\\ .,]" ))
218- add(words[ ++ w] )
218+ add(words[ ++ w] )
219219 addclose(" \" " )
220220 } else if (match (words[ w] ," ^Do$" )) {
221221 addopen(" \" " )
@@ -277,11 +277,11 @@ function splitwords(l, dest, n, o, w) {
277277 if (match (section," SYNOPSIS" ))
278278 breakline()
279279 if (w >= nwords)
280- n= name
280+ n= name
281281 else if (match (words[ w+ 1 ] , " ^[A-Z][a-z]$" ))
282- n= name
282+ n= name
283283 else if (match (words[ w+ 1 ] , " ^[.,;:]$" ))
284- n= name
284+ n= name
285285 else {
286286 n= words[ ++ w]
287287 if (! length (name))
@@ -290,27 +290,30 @@ function splitwords(l, dest, n, o, w) {
290290 if (! length (n))
291291 n= name
292292 if (displaylines == 0 )
293- add(" '''" n " '''" )
293+ add(" '''" n " '''" )
294294 else
295- add(n)
295+ add(n)
296296 } else if (match (words[ w] ," ^Nd$" )) {
297297 add(" - " wtail())
298298 } else if (match (words[ w] ," ^Fl$" )) {
299299 addopen(" -" )
300300 } else if (match (words[ w] ," ^Ar$" )) {
301301 if (w== nwords)
302- add(" ''file ...''" )
302+ add(" ''file ...''" )
303303 else {
304- ++ w
305- gsub (" <" , " \\ <" , words[ w] )
306- add(" ''" words[ w] " ''" )
304+ ++ w
305+ gsub (" <" , " \\ <" , words[ w] )
306+ if (displaylines > 0 )
307+ add(words[ w] )
308+ else
309+ add(" ''" words[ w] " ''" )
307310 }
308311 } else if (match (words[ w] ," ^Cm$" )) {
309312 ++ w
310313 if (displaylines == 0 ) {
311- add(" '''" words[ w] " '''" )
314+ add(" '''" words[ w] " '''" )
312315 } else
313- add(words[ w] )
316+ add(words[ w] )
314317 } else if (match (words[ w] ," ^Op$" )) {
315318 addopen(" <nowiki>[</nowiki>" )
316319 option= 1
@@ -321,36 +324,36 @@ function splitwords(l, dest, n, o, w) {
321324 print " "
322325 } else if (match (words[ w] ," ^An$" )) {
323326 if (match (words[ w+ 1 ] ," -nosplit" ))
324- ++ w
327+ ++ w
325328 endline()
326329 } else if (match (words[ w] ," ^Ss$" )) {
327330 add(" ===" )
328331 trailer= " ==="
329332 } else if (match (words[ w] ," ^Ft$" )) {
330333 if (match (section, " SYNOPSIS" )) {
331- breakline()
334+ breakline()
332335 }
333336 l = wtail()
334337 add(" ''" l " ''" )
335338 if (match (section, " SYNOPSIS" )) {
336- breakline()
339+ breakline()
337340 }
338341 } else if (match (words[ w] ," ^Fn$" )) {
339342 ++ w
340343 F = " '''" words[ w] " '''("
341344 Fsep = " "
342345 while (w< nwords) {
343- ++ w
344- if (match (words[ w] , " ^[.,:]$" )) {
345- -- w
346- break
347- }
348- F = F Fsep " ''" words[ w] " ''"
349- Fsep = " , "
346+ ++ w
347+ if (match (words[ w] , " ^[.,:]$" )) {
348+ -- w
349+ break
350+ }
351+ F = F Fsep " ''" words[ w] " ''"
352+ Fsep = " , "
350353 }
351354 add(F " )" )
352355 if (match (section, " SYNOPSIS" )) {
353- addclose(" ;" )
356+ addclose(" ;" )
354357 }
355358 } else if (match (words[ w] ," ^Fo$" )) {
356359 w++
@@ -363,7 +366,7 @@ function splitwords(l, dest, n, o, w) {
363366 } else if (match (words[ w] ," ^Fc$" )) {
364367 add(F " )" )
365368 if (match (section, " SYNOPSIS" )) {
366- addclose(" ;" )
369+ addclose(" ;" )
367370 }
368371 } else if (match (words[ w] ," ^Va$" )) {
369372 w++
@@ -374,11 +377,11 @@ function splitwords(l, dest, n, o, w) {
374377 } else if (match (words[ w] ," ^Pa$" )) {
375378 w++
376379# if(match(words[w],"^\\."))
377- # add("\\&")
380+ # add("\\&")
378381 if (displaylines == 0 )
379- add(" ''" words[ w] " ''" )
382+ add(" ''" words[ w] " ''" )
380383 else
381- add(words[ w] )
384+ add(words[ w] )
382385 } else if (match (words[ w] ," ^Dv$" )) {
383386 linecmd()
384387 } else if (match (words[ w] ," ^Em|Ev$" )) {
@@ -404,22 +407,22 @@ function splitwords(l, dest, n, o, w) {
404407 ++ listdepth
405408 listnext[ listdepth] = " "
406409 if (match (words[ w+ 1 ] ," -bullet" )) {
407- optlist[ listdepth] = 1
408- addopen(" <ul>" )
409- listclose[ listdepth] = " </ul>"
410+ optlist[ listdepth] = 1
411+ addopen(" <ul>" )
412+ listclose[ listdepth] = " </ul>"
410413 } else if (match (words[ w+ 1 ] ," -enum" )) {
411- optlist[ listdepth] = 2
412- enum= 0
413- addopen(" <ol>" )
414- listclose[ listdepth] = " </ol>"
414+ optlist[ listdepth] = 2
415+ enum= 0
416+ addopen(" <ol>" )
417+ listclose[ listdepth] = " </ol>"
415418 } else if (match (words[ w+ 1 ] ," -tag" )) {
416- optlist[ listdepth] = 3
417- addopen(" <dl>" )
418- listclose[ listdepth] = " </dl>"
419+ optlist[ listdepth] = 3
420+ addopen(" <dl>" )
421+ listclose[ listdepth] = " </dl>"
419422 } else if (match (words[ w+ 1 ] ," -item" )) {
420- optlist[ listdepth] = 4
421- addopen(" <ul>" )
422- listclose[ listdepth] = " </ul>"
423+ optlist[ listdepth] = 4
424+ addopen(" <ul>" )
425+ listclose[ listdepth] = " </ul>"
423426 }
424427 w= nwords
425428 } else if (match (words[ w] ," ^El$" )) {
@@ -430,30 +433,30 @@ function splitwords(l, dest, n, o, w) {
430433 } else if (match (words[ w] ," ^It$" )) {
431434 addclose(listnext[ listdepth] )
432435 if (optlist[ listdepth] == 1 ) {
433- addpunct(" <li>" )
434- listnext[ listdepth] = " </li>"
436+ addpunct(" <li>" )
437+ listnext[ listdepth] = " </li>"
435438 } else if (optlist[ listdepth] == 2 ) {
436- addpunct(" <li>" )
437- listnext[ listdepth] = " </li>"
439+ addpunct(" <li>" )
440+ listnext[ listdepth] = " </li>"
438441 } else if (optlist[ listdepth] == 3 ) {
439- addpunct(" <dt>" )
440- listnext[ listdepth] = " </dt>"
441- if (match (words[ w+ 1 ] ," ^Xo$" )) {
442- # Suppress trailer
443- w++
444- } else if (match (words[ w+ 1 ] ," ^Pa$|^Ev$" )) {
445- addopen(" '''" )
446- w++
447- add(words[ ++ w] " '''" )
448- trailer = listnext[ listdepth] " <dd>" trailer
449- listnext[ listdepth] = " </dd>"
450- } else {
451- trailer = listnext[ listdepth] " <dd>" trailer
452- listnext[ listdepth] = " </dd>"
453- }
442+ addpunct(" <dt>" )
443+ listnext[ listdepth] = " </dt>"
444+ if (match (words[ w+ 1 ] ," ^Xo$" )) {
445+ # Suppress trailer
446+ w++
447+ } else if (match (words[ w+ 1 ] ," ^Pa$|^Ev$" )) {
448+ addopen(" '''" )
449+ w++
450+ add(words[ ++ w] " '''" )
451+ trailer = listnext[ listdepth] " <dd>" trailer
452+ listnext[ listdepth] = " </dd>"
453+ } else {
454+ trailer = listnext[ listdepth] " <dd>" trailer
455+ listnext[ listdepth] = " </dd>"
456+ }
454457 } else if (optlist[ listdepth] == 4 ) {
455- addpunct(" <li>" )
456- listnext[ listdepth] = " </li>"
458+ addpunct(" <li>" )
459+ listnext[ listdepth] = " </li>"
457460 }
458461 } else if (match (words[ w] , " ^Vt$" )) {
459462 w++
@@ -463,9 +466,9 @@ function splitwords(l, dest, n, o, w) {
463466 } else if (match (words[ w] ," ^Xc$" )) {
464467 # TODO: Figure out how to handle this
465468 if (optlist[ listdepth] == 3 ) {
466- addclose(listnext[ listdepth] )
467- addopen(" <dd>" )
468- listnext[ listdepth] = " </dd>"
469+ addclose(listnext[ listdepth] )
470+ addopen(" <dd>" )
471+ listnext[ listdepth] = " </dd>"
469472 }
470473 } else if (match (words[ w] ," ^[=]$" )) {
471474 addpunct(words[ w] )
0 commit comments