aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-03-12 18:42:33 -0400
committerRalph Amissah <ralph@amissah.com>2012-03-12 18:42:35 -0400
commit231c64ecdf11280c8c7c2342462b7682ce8214fc (patch)
tree350cbb88a8bc7d1330a73a096185081fb9f7ec11 /lib
parentv3dv: lib, clean trailing whitespace (diff)
v3dv: texinfo, fix (break holding back 3.2 merge)
* proposed next version starts 3.2, (merge dev branch after 3.1.15)
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v3dv/texinfo.rb28
-rw-r--r--lib/sisu/v3dv/texinfo_format.rb69
2 files changed, 43 insertions, 54 deletions
diff --git a/lib/sisu/v3dv/texinfo.rb b/lib/sisu/v3dv/texinfo.rb
index 145712e1..2496ce7a 100644
--- a/lib/sisu/v3dv/texinfo.rb
+++ b/lib/sisu/v3dv/texinfo.rb
@@ -140,11 +140,10 @@ module SiSU_TexInfo
data=@data
data=pre(data)
data=endnote(data)
- data=markup(data)
- objects=tail(data)
- #output(objects)
- output(@tex_file)
- #output(data.compact)
+ data,head=markup(data)
+ objs_txt=tail(data)
+ doc_txt=[head,objs_txt]
+ output(doc_txt)
makeinfo #KEEP reinstate when fixed #%
place_info
rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue
@@ -340,14 +339,9 @@ module SiSU_TexInfo
end
#%case with endnotes
dob.obj=dob.obj.gsub(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj
- if dob.obj \
- && (dob.is !=:structure \
- && dob.is !=:comment)
- @tex_file << dob.obj
- end
data_new << dob
end
- data_new
+ [data_new, @tex_file]
end
def number_titles
data,data_new=@data,[]
@@ -376,12 +370,16 @@ module SiSU_TexInfo
end
def tail(data)
tex=SiSU_TexInfoFormat::Texinfo.new(@md)
- objects=[]
+ objs_txt=[]
data.each do |dob|
- objects << dob.obj if dob.obj
+ if dob.obj \
+ && (dob.is !=:structure \
+ && dob.is !=:comment)
+ objs_txt << dob.obj if dob.obj
+ end
end
- objects << tex.dublincore << tex.tail
- objects
+ objs_txt << tex.dublincore << tex.tail
+ objs_txt
end
def output(data)
filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo}
diff --git a/lib/sisu/v3dv/texinfo_format.rb b/lib/sisu/v3dv/texinfo_format.rb
index 0555809d..fa5390b6 100644
--- a/lib/sisu/v3dv/texinfo_format.rb
+++ b/lib/sisu/v3dv/texinfo_format.rb
@@ -261,43 +261,34 @@ WOK
relation="Relation: #{relation}\n\n" if relation #dc
coverage="Coverage: #{coverage}\n\n" if coverage #dc
rights="Rights: #{rights}\n\n" if rights #dc
- "@node Dublin Core\n" +
- "@unnumbered Dublin Core\n" +
- "@cindex chapter, Dublin Core\n\n" +
- "#{full_title}" +
- "#{author}" +
- "#{subject}" +
- "#{description}" +
- "#{publisher}" +
- "#{contributor}" +
- "#{date}" +
- "#{date_created}" +
- "#{date_issued}" +
- "#{date_available}" +
- "#{date_valid}" +
- "#{date_modified}" +
- "#{format}" +
- "#{identifier}" +
- "#{source}" +
- "#{language}" +
- "#{relation}" +
- "#{coverage}" +
- "#{rights}" +
- "\n\n"
+ <<WOK
+@node Dublin Core
+@unnumbered Dublin Core
+@cindex chapter, Dublin Core
+
+#{full_title}#{author}#{subject}#{description}#{publisher}#{contributor}#{date}#{date_created}#{date_issued}#{date_available}#{date_valid}#{date_modified}#{format}#{identifier}#{source}#{language}#{relation}#{coverage}#{rights}
+
+WOK
end
def tail
- "@c %% 6\n" +
- "@node Index\n" +
- "@unnumbered Index\n" +
- "@printindex cp\n\n" +
- "@bye"
+ <<WOK
+@c %% 6
+@node Index
+@unnumbered Index
+@printindex cp
+
+@bye
+WOK
end
def clean(dob)
if dob.is==:heading \
and dob.obj !~/##{dob.ocn}/
dob.obj="#{dob.obj} ##{dob.ocn}"
end
- dob.obj=dob.obj.gsub(/<:#>/,'').strip
+ dob.obj=dob.obj.gsub(/\n/m,' ').
+ gsub(/<:#>/,'').
+ gsub(/,\s+/,' - ').
+ strip
dob
end
def menu
@@ -310,52 +301,52 @@ WOK
def level1
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level2
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level3
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level4
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level5
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def level6
dob=clean(@dob)
nd=dob.obj.gsub(/@footnote\{.+?\}\s+/,'')
- dob.obj="@node #{nd}\n@unnumbered #{dob.obj}\n@cindex chapter, #{nd}\n"
+ dob.obj="@node #{nd}\n@unnumbered #{nd}\n@cindex chapter, #{nd}\n"
dob
end
def submenu
@dob.obj=@dob.obj.join("\n")
@dob.obj=@dob.obj.gsub(/[5]\\+~\S+/,'')
dob=clean(@dob)
- dob.obj="@menu\n#{dob.obj}\n@end menu\n\n"
- dob.obj=dob.obj.gsub(/.+/m,"#{dob.obj}")
+ dob.obj="@menu\n#{dob.obj}\n@end menu\n\n".
+ gsub(/.+/m,"#{dob.obj}")
end
def subsubmenu
@dob.obj=@dob.obj.join("\n")
@dob.obj=@dob.obj.gsub(/[6]\\+~\S+/,'')
dob=clean(@dob)
- dob.obj="@menu\n#{dob.obj}\n@end menu\n\n"
- dob.obj=dob.obj.gsub(/.+/m,"#{dob.obj}")
+ dob.obj="@menu\n#{dob.obj}\n@end menu\n\n".
+ gsub(/.+/m,"#{dob.obj}")
end
def indent1
@dob.obj=@dob.obj.gsub(/<:i1>(.*)/,'\1')