From: nisikimi Date: Wed, 27 Sep 2006 02:13:25 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: XML-base~31 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a03edd9bf22cfcd8058c185b1a8140aaea36a5f9;p=m17n%2Fm17n-docs.git *** empty log message *** --- diff --git a/utils/mkman.rb b/utils/mkman.rb index b136889..cf91ded 100644 --- a/utils/mkman.rb +++ b/utils/mkman.rb @@ -154,21 +154,41 @@ end def documentfunc(title, func_text, short_text) func_text.grep(/^\.SS/){|i| - #¼«Ê¬¤è¤ê¸å¤í¤À¤± - func_rest = func_text[func_text.index(i)..func_text.size] - documentfunc2(i, title, func_rest, short_text)} -end + #¼«Ê¬¤È¤½¤Î¸å¤í + func_rest = func_text[func_text.index(i) ..func_text.size] + if funclast = func_rest.index(func_rest[1 .. func_rest.size].find{|m| m =~ /^\.SS/}) + func_desc = func_rest[0 .. funclast - 1] + else + func_desc = func_rest + end + + print "\n" + print"----\n" + print i + print "\n" + print func_desc -def documentfunc2 (dstart, title, func_text, short_text) - #func_text¤ÎºÇ½é¤Î¹ÔÃæ¤Î´Ø¿ô̾ - dstart =~ /\s([a-z0-9_]+)\s\(/ - return if $1 == nil - fname = $1 + #fname: func_text¤ÎºÇ½é¤Î¹ÔÃæ¤Î´Ø¿ô̾ + i =~ /\s([a-z0-9_]+)\s\(/ + if $1 == nil + else + fname = $1 + ffname = "\\fB".concat($1.concat("\\fP")) + #short_text¤Î´Ø¿ô̾¤Î£²¹Ô¸å¤¬brief¡£ + if short_text.find{|i| i.index(ffname)} + brief = short_text[short_text.index(short_text.find{|i| i.index(ffname)}) + 2] + documentfunc2(fname, title, func_desc, brief) +# else +# print " Cannot find short desc for " +# print ffname + end + end + } +end + +def documentfunc2 (fname, title, func_desc, brief) - ffname = "\\fB".concat($1.concat("\\fP")) - #short_text¤Î´Ø¿ô̾¤Î£²¹Ô¸å¤¬brief¡£ - brief = short_text[short_text.index(short_text.find{|i| i.index(ffname)}) + 2] #´Ø¿ô¤´¤È¤Î¥Õ¥¡¥¤¥ë¤òºî¤ë¡£ file = open($doxywork+fname+$manext, "w") file.puts("@function") @@ -185,18 +205,20 @@ def documentfunc2 (dstart, title, func_text, short_text) else file.print("\n") end #¥í¥ó¥° - file.puts(func_text[0]) - for line in func_text[1 .. func_text.size] - break if /.SS/ =~ line - file.puts(line) - end + file.puts(func_desc) +# for line in func_desc[1 .. func_desc.size] +# break if /.SS/ =~ line +# file.puts(line) +# end file.flush + end ####rewriting each man file ### rewriting a man file for a function def frewrite(text) + # let the library name appear in the header buf = [text[0].gsub!(/\" \"/, "\" \"\" \"")] @@ -210,16 +232,16 @@ def frewrite(text) end synopsys = text.find{|line| line =~ /\.SS/} - buf.push("\n\n.SH SYNOPSIS").push(formatsynopsys(synopsys)).push("\n") - - description = text[text.index(synopsys)+2..text.size] - if - description == [] - print title, ": No description found\n" - else - descriptiontext = womanrewrite(desrewrite(description)) - buf.push("\n.SH DESCRIPTION\n").push(descriptiontext) - end + buf.push("\n\n.SH SYNOPSIS").push(formatsynopsys(synopsys)).push("\n") + + description = text[text.index(synopsys)+2..text.size] + if + description == [] + print title, ": No description found\n" + else + descriptiontext = womanrewrite(desrewrite(description)) + buf.push("\n.SH DESCRIPTION\n").push(descriptiontext) + end return buf end @@ -439,6 +461,8 @@ Dir.open(".").each{|filename| next end + print "RUBY DIVIDING: ", filename, "\n" + file = open(filename,"r") text = file.readlines title = text[0] @@ -464,8 +488,7 @@ Dir.open(".").each{|filename| group_text = text end - documentfunc(title, func_text, short_text) - + documentfunc(title, func_text, short_text) else group_text = text @@ -495,7 +518,7 @@ unless FileTest.directory? filename next end - print "PROCESSING: ", filename, "\n" + print "RUBY REWRINTING: ", filename, "\n" if /@function/ =~ text[0] buf = frewrite(text[1..text.size])