aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-09-24 13:46:15 +0100
committerRalph Amissah <ralph@amissah.com>2007-09-24 13:46:15 +0100
commit341e92ed99e198e009751a0619fda9ce4d16a009 (patch)
treeb0c1de640eae256ebd9ffc3108f7ad4199bbb6f1
parentminor cleaning of documentation source, headers (diff)
manpage, special character fixes
-rw-r--r--lib/sisu/v0/manpage.rb25
1 files changed, 9 insertions, 16 deletions
diff --git a/lib/sisu/v0/manpage.rb b/lib/sisu/v0/manpage.rb
index 05586dec..5b2cef6f 100644
--- a/lib/sisu/v0/manpage.rb
+++ b/lib/sisu/v0/manpage.rb
@@ -187,6 +187,8 @@ module SiSU_manpage
end
wrap=util.line_wrap
if wrap =~ /^\s*[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub!(/(^|&nbsp;|\s|\*)\\\*/,'\1\\\\\*') #man page requires
+ wrap.gsub!(/\s\.(\S+)/,' \\.\1')
wrap.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape
wrap.gsub!(/^\s*([\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
.TP
@@ -277,19 +279,8 @@ WOK
when 2..3; '.SH ' << @br << wrapped.upcase << @br << '.BR'
when 4; '.SH ' << @br << wrapped.upcase << @br << '.BR'
when 5..6; '.SH ' << @br << wrapped.upcase << @br
- #when 1; '.SH ' + wrapped.upcase << @br << '.BR'
- #when 2..3; '.SH ' + wrapped.upcase << @br << '.BR'
- #when 4; '.SH ' + wrapped.upcase << @br << '.BR'
- #when 5..6; '.SH ' + wrapped.upcase << @br
- ##when 1; '.SH ' + wrapped.upcase << @br << '.TP' << @br # << '*'*times << @br
- ##when 2..3; '.SH ' + wrapped.upcase << @br << '.TP' << @br # << '='*times << @br
- ##when 4; '.SH ' + wrapped.upcase << @br << '.TP' << @br # << '-'*times << @br
- ##when 5..6; '.SH ' + wrapped.upcase << @br << '.TP' << @br # << '.'*times << @br
end
else
- ##@manpage[:body] << wrapped << '.TP' # main text, contents, body KEEP
- #@manpage[:body] << '.BR' << wrapped # main text, contents, body KEEP [consider s/.BR/.PP/]
-
@manpage[:body] << if wrapped =~/^\.BI\s/ # main text, contents, body KEEP
'.TP' << @br << wrapped.gsub!(/^\.BI\s/,'.B ') # sleight ... simpler output
else
@@ -339,6 +330,9 @@ WOK
para.gsub!(/&#126;/,'~')
para.gsub!(/&#169;/,'©')
end
+ para.gsub!(/(^|&nbsp;|\s|\*)\\\*/,'\1\\\\\*') #man page requires
+ para.gsub!(/\s\.(\S+)/,' \\.\1')
+ para.gsub!(/(\n\.)(\S\S\S+)/m,'\1\\.\2')
para.gsub!(/-/,'\-') #manpages use this
para.gsub!(/&#126;/,'~') if para #manpages use this
if para =~/<:(?:group|verse|alt|code)(?:-end)?>(?:\s+<~(\d+);(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)?/
@@ -370,10 +364,9 @@ WOK
para.gsub!(/^\s*<~\d+;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>$/,'') # remove empty lines - check
para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1\2\3')
para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- para.gsub!(/<:name#\S+?>/,'') # remove name links
- para.gsub!(/&nbsp;/,' ') # decide on
- para.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape
- #para.gsub!(/(["''])/,"\\\\\\1") # decide on
+ para.gsub!(/<:name#\S+?>/,'') # remove name links
+ para.gsub!(/&nbsp;/,' ') # decide on
+ para.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape
para.gsub!(/\{(\S+?\.(?:png|jpg|gif)) .+?\}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
para.gsub!(/^\{\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
wordlist=para.scan(/\S+/)
@@ -508,7 +501,7 @@ WOK
line.gsub!(/\s+$/m,'')
filename_manpage.puts line #unix manpage
end
- else filename_manpage.puts para #unix manpage # /^([*=-]|\.){5}/
+ else filename_manpage.puts para #unix manpage # /^([*=-]|\.){5}/
end
end
filename_manpage.close