From 804d1054c375bb6e6887c8d61ac5135a3449b552 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 22 Mar 2010 20:08:09 -0400 Subject: odf, shared_xml, texpdf: grouped bulleted text --- lib/sisu/v2/odf.rb | 5 ++++- lib/sisu/v2/shared_xml.rb | 3 +++ lib/sisu/v2/texpdf.rb | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb index c51eab90..d4aeb616 100644 --- a/lib/sisu/v2/odf.rb +++ b/lib/sisu/v2/odf.rb @@ -418,10 +418,13 @@ module SiSU_ODF dob.obj=para_array.join(' ') dob.obj=dob.obj.strip end - if dob.obj =~/#{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix + if dob.is=='code' #{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix dob.obj.gsub!(/(^|[^}])_/m,'\1>') dob.obj.gsub!(/(^|[^}])_/m,'\1>') end + if dob.of=='group' + dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ') + end dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'\1') dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'\1') dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'\1') diff --git a/lib/sisu/v2/shared_xml.rb b/lib/sisu/v2/shared_xml.rb index d70e0808..8a58909b 100644 --- a/lib/sisu/v2/shared_xml.rb +++ b/lib/sisu/v2/shared_xml.rb @@ -392,6 +392,9 @@ module SiSU_XML_munge dob.obj.gsub!(/(^|[^}])_/m,'\1>') #code-block: angle brackets special characters dob.obj.gsub!(/(^|[^}])_/m,'\1>') end + if dob.of=='group' + dob.obj.gsub!(/#{Mx[:gl_bullet]}/,'● ') + end dob.obj.gsub!(/#{Dx[:url_o]}/,"#{Dx[:url_o_xml]}") dob.obj.gsub!(/#{Dx[:url_c]}/,"#{Dx[:url_c_xml]}") dob.obj.gsub!(/ |#{Mx[:nbsp]}/m,' ') diff --git a/lib/sisu/v2/texpdf.rb b/lib/sisu/v2/texpdf.rb index 00a4d16d..f0e04b33 100644 --- a/lib/sisu/v2/texpdf.rb +++ b/lib/sisu/v2/texpdf.rb @@ -413,6 +413,7 @@ module SiSU_TeX @lineone=case dob.is when /alt|group|verse/ dob.tmp.gsub!(/#{Mx[:nbsp]}/m,'{~}') + dob.tmp.gsub!(/#{Mx[:gl_bullet]}/m,'$\txtbullet$~~') dob.tmp.gsub!(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway ocn=SiSU_TeX_Pdf::Format_text_object.new(@md).ocn_display(dob) dob.tmp=if dob.is=='group' \ -- cgit v1.2.3 From f2e312f596b0a8d4383dd97e458adf9b3d6c1a52 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 22 Mar 2010 20:08:45 -0400 Subject: shared_matadata, odf metadata use
[prevent
breakage] --- lib/sisu/v2/shared_metadata.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb index 7c8cc971..f39b2f79 100644 --- a/lib/sisu/v2/shared_metadata.rb +++ b/lib/sisu/v2/shared_metadata.rb @@ -474,6 +474,7 @@ WOK def meta_para url_brace=SiSU_Viz::Skin.new.url_decoration if @inf.class==String + @inf.gsub!(/
/,'
') @inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\1') #http ftp matches escaped, no decoration @inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, @@ -484,7 +485,7 @@ WOK %{#{url_brace.xml_open}\\1#{url_brace.xml_close}}) if @inf !~/http:\/\// # improve upon, document crash where url contains '@' symbol end <#{@tag.capitalize}: #{@inf}} +#{@tag.capitalize}: #{@inf} WOK end def metadata -- cgit v1.2.3 From fc14d48727e251c0da232ddc966e4078b0bb6d9e Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 22 Mar 2010 20:09:22 -0400 Subject: xml_dom, behavior fixes --- lib/sisu/v2/xml_dom.rb | 95 ++++++++++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 46 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v2/xml_dom.rb b/lib/sisu/v2/xml_dom.rb index 8a4589ba..ff38ff86 100644 --- a/lib/sisu/v2/xml_dom.rb +++ b/lib/sisu/v2/xml_dom.rb @@ -158,7 +158,7 @@ WOK end @@xml[:sc]=sc end - def xml_element(dob,xml_el='',xml_content='') + def xml_element(dob,xml_el='',xml_content='',type='norm') n=n1=n2=n3=0 if dob.is=='heading' lv=dob.ln @@ -179,7 +179,7 @@ WOK #{Ax[:tab]*n1} #{Ax[:tab]*n2} #{Ax[:tab]*n3}#{dob.ocn}#{tag} -#{Ax[:tab]*n3}#{dob.obj} +#{Ax[:tab]*n3}#{dob.obj} #{Ax[:tab]*n2} #{Ax[:tab]*n1}#{xml_content} WOK @@ -281,53 +281,47 @@ WOK end end xml_el ||='' - xml_element(dob,xml_el,xml_content) + xml_element(dob,xml_el,xml_content,type) if lv @level[lv]=true ((lv+1)..6).each { |x| @level[x]=false } end end + def add_to_body(dob,type='norm') + if defined? dob.obj # main text, contents, body KEEP + if defined? dob.ocn \ + and dob.ocn + @@xml[:body] << %{#{Ax[:tab]*6}} + @@xml[:body] << %{#{Ax[:tab]*7}#{dob.ocn}} if defined? dob.ocn + end + #@@xml[:body] << %{#{Ax[:tab]*7}#{dob.obj}} + #@@xml[:body] << %{#{Ax[:tab]*7}#{Ax[:tab]*1}} + @@xml[:body] << %{#{Ax[:tab]*7}#{Ax[:tab]*1}} + @@xml[:body] << %{#{Ax[:tab]*8}#{dob.obj}#{Ax[:tab]*1}} + @@xml[:body] << %{#{Ax[:tab]*7}} + @@xml[:body] << %{#{Ax[:tab]*6}} + end + end def group_structure(dob) dob=@trans.markup_group(dob) #decide check & FIX dob.obj.gsub!(/#{Mx[:en_a_o]}(\d+)\s+(.+?)#{Mx[:en_a_c]}/m, '\1\2 ') dob.obj.strip! - @@xml[:body] << %{#{Ax[:tab]*6}} - @@xml[:body] << %{#{Ax[:tab]*7}#{dob.ocn}} - @@xml[:body] << %{#{Ax[:tab]*7}#{Ax[:tab]*1}} - @@xml[:body] << %{#{Ax[:tab]*8}#{dob.obj}#{Ax[:tab]*1}} - @@xml[:body] << %{#{Ax[:tab]*7}} - @@xml[:body] << "#{Ax[:tab]*6}" + dob end def poem_structure(dob) dob=@trans.markup_group(dob) #decide check & FIX dob.obj.strip! - @@xml[:body] << %{#{Ax[:tab]*6}} - @@xml[:body] << %{#{Ax[:tab]*7}#{dob.ocn}} - @@xml[:body] << %{#{Ax[:tab]*7}#{Ax[:tab]*1}} - @@xml[:body] << %{#{Ax[:tab]*8}#{dob.obj}#{Ax[:tab]*1}} - @@xml[:body] << %{#{Ax[:tab]*7}} - @@xml[:body] << "#{Ax[:tab]*6}" + dob end def code_structure(dob) dob=@trans.markup_group(dob) #decide check & FIX dob.obj.gsub!(/\s\s/,'  ') dob.obj.strip! - @@xml[:body] << %{#{Ax[:tab]*6}} - @@xml[:body] << %{#{Ax[:tab]*7}#{dob.ocn}} - @@xml[:body] << %{#{Ax[:tab]*7}#{Ax[:tab]*1}} - @@xml[:body] << %{#{Ax[:tab]*8}#{dob.obj}#{Ax[:tab]*1}} - @@xml[:body] << %{#{Ax[:tab]*7}} - @@xml[:body] << "#{Ax[:tab]*6}" + dob end def table_structure(dob) #tables table=SiSU_XHTML_shared::Table_xhtml.new(dob) - @@xml[:body] << %{#{Ax[:tab]*0}} - @@xml[:body] << %{#{Ax[:tab]*1}#{dob.ocn}} - @@xml[:body] << %{#{Ax[:tab]*1}#{Ax[:tab]*1}} - @@xml[:body] << %{#{Ax[:tab]*2}#{table.table.obj}} - @@xml[:body] << %{#{Ax[:tab]*1}} - @@xml[:body] << "#{Ax[:tab]*0}" end def markup(data) xml_sc(@md) @@ -348,60 +342,69 @@ WOK if dob !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ @p_num=SiSU_XML_format::Paragraph_number.new(@md,dob.ocn) if defined? dob.ocn if not @rcdc - if defined? dob.ocn and dob.ocn.to_s =~/\d+/ + if defined? dob.ocn \ + and dob.ocn.to_s =~/\d+/ format_scroll=SiSU_XML_format::Format_scroll.new(@md,dob) if dob.is=='para' and dob.indent ##FIX x=SiSU_XML_format::Format_seg.new(@md,dob) if dob.is=='heading' if dob.ln==1 + type="heading_section_#{dob.ln.to_s}" xml_markup(dob) - xml_structure(dob) + xml_structure(dob,type) dob.obj=x.heading_body1 elsif dob.ln==2 + type="heading_section_#{dob.ln.to_s}" xml_markup(dob) - xml_structure(dob) + xml_structure(dob,type) dob.obj=x.heading_body2 elsif dob.ln==3 + type="heading_section_#{dob.ln.to_s}" xml_markup(dob) - xml_structure(dob) + xml_structure(dob,type) dob.obj=x.heading_body3 elsif dob.ln==4 + type="heading_content_#{dob.lv}" xml_markup(dob) - xml_structure(dob) + xml_structure(dob,type) dob.obj=x.heading_body4 elsif dob.ln==5 + type="heading_content_#{dob.lv}" xml_markup(dob) - xml_structure(dob) + xml_structure(dob,type) dob.obj=x.heading_body5 elsif dob.ln==6 - xml_markup(dob) - xml_structure(dob) + type="heading_content_#{dob.lv}" + xml_structure(dob,type) dob.obj=x.heading_body6 end else ocn=dob.ocn if dob.is=='verse' + type='verse' poem_structure(dob) #redo elsif dob.is=='group' + type='group' group_structure(dob) #redo elsif dob.is=='code' + type='code' code_structure(dob) #redo elsif dob.is=='table' # tables come as single block #work area 2005w13 + type='table' table_structure(dob) elsif dob.is=='para' \ - and dob.indent.to_s =~/[0-9]/ \ + and dob.indent.to_s =~/[1-9]/ \ and dob.bullet_ + type="indent_bullet#{dob.indent.to_s}" + xml_markup(dob) elsif dob.is=='para' \ - and dob.indent.to_s =~/[0-9]/ - else xml_structure(dob) - end - xml_markup(dob) - if defined? dob.ocn \ - and dob.ocn - @@xml[:body] << %{#{Ax[:tab]*6}} + and dob.indent.to_s =~/[1-9]/ + type="indent#{dob.indent.to_s}" + xml_markup(dob) + else + type='norm' + xml_markup(dob) end - @@xml[:body] << "#{Ax[:tab]*7}#{dob.ocn}" if defined? dob.ocn - @@xml[:body] << %{#{Ax[:tab]*7}#{dob.obj}} if defined? dob.obj # main text, contents, body KEEP - @@xml[:body] << "#{Ax[:tab]*6}" + add_to_body(dob,type) end elsif dob.obj =~/(#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ elsif dob.obj =~/(MetaData)/ -- cgit v1.2.3