X-Git-Url: http://git.chise.org/gitweb/?p=m17n%2Fm17n-docs.git;a=blobdiff_plain;f=utils%2Fmkman.rb;h=41554618156c2a297e13bf022664aa3db5a80942;hp=43c8fd9f35a4c57cb13f1138191bb2312f9600cc;hb=d93198d780f88fae2c64aa57ad58ff6b7e482dab;hpb=fbf77a9a1df16aabf4496072b1739f9d4cadae99 diff --git a/utils/mkman.rb b/utils/mkman.rb index 43c8fd9..4155461 100644 --- a/utils/mkman.rb +++ b/utils/mkman.rb @@ -13,12 +13,15 @@ $currentdir = Dir.pwd+"/" $doxywork = $currentdir+"doxywork/" $srcman3 = $currentdir+usr_or_ja+"/man/man3/" if usr_or_ja == "usr" - $dstman3m = $currentdir+"/man/man3m/" + $dstman3m = $currentdir+"/usr/man3m/" else - $dstman3m = $currentdir+"/man/ja/man3m/" + $dstman3m = $currentdir+"/ja/man3m/" end $sampledir="sample/man3/" +$headfile = $currentdir+"manhead" +headbuf = open($headfile, "r").readlines + # # Extra information about header strings Doxygen generates in a man file. # @@ -201,13 +204,6 @@ def frewrite(text) title = text[0].split(" ")[1].chop!.reverse.chop!.reverse - if text.index("\\fBReturns: \\fP\n") == nil - print title, ": Returns not described\n" - end - if text.index("\\fBErrors: \\fP\n") == nil - print title, ": Errors not described\n" - end - buf.push(".ad l\n.nh\n.SH NAME\n") # if @brief is given if text[1] =~ /\"\\fI(.+)\\fP\"/ @@ -223,7 +219,8 @@ def frewrite(text) description == [] print title, ": No description found\n" else - buf.push("\n.SH DESCRIPTION\n").push(womanrewrite(desrewrite(description))) + descriptiontext = womanrewrite(desrewrite(description)) + buf.push("\n.SH DESCRIPTION\n").push(descriptiontext) end return buf end @@ -244,6 +241,8 @@ end ####non-synopsys section of a function def desrewrite(text) + returndescribed = false + errordescribed = false #removing identation text.grep(/^\\fB.+\\fP/){|line| @@ -253,17 +252,27 @@ def desrewrite(text) text.each_with_index{|line,i| +### TEST 6/24 + line.gsub!(".RS 4","") + #removing "More..." hyperlink line.gsub!(/More.../,"") # ? ad hoc line.gsub!(/^\.TP/,"") #headers - line.gsub!(/^\\fBReturn value:\\fP/,"\n.SH RETURNS\n.PP") - line.gsub!(/^\\fBSee Also:\\fP/,"\n.SH \"SEE ALSO\"\n.PP") + if line =~ /Return\svalue:/ + returndescribed = true + end + line.gsub!(/^\\fBReturn value:\\fP/,"\n.SH RETURN VALUE\n.PP") + if line =~ /Errors:/ + errordescribed = true + end line.gsub!(/^\\fBErrors:\\fP/,"\n.SH ERRORS\n.PP") + line.gsub!(/^\\fBSee Also:\\fP/,"\n.SH \"SEE ALSO\"\n.PP") - line.gsub!(/^\\fB(.+)\\fP/){"\n.SS " << $1} + line.gsub!(/^\\fB(.+)[^\)]\\fP/){"\n.SS " << $1} + # [^\)] in the pattern is added to avoid the first function in see also section. #removing indentation if text[i - 1] =~ /^.PP/ @@ -291,6 +300,13 @@ def desrewrite(text) } +unless returndescribed == true + print (" return not described \n") +end +unless errordescribed == true + print (" errors not described \n") +end + return text end @@ -383,6 +399,7 @@ Dir.mkdir $doxywork unless FileTest.directory? $doxywork Dir.chdir($srcman3) Dir.open(".").each{|filename| + if FileTest.directory? filename next end @@ -455,6 +472,7 @@ unless FileTest.directory? filename end filetowrite = open($dstman3m+filename,"w") + filetowrite.puts(headbuf) filetowrite.puts(buf) filetowrite.flush end