aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v4
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-08-28 18:22:27 -0400
committerRalph Amissah <ralph@amissah.com>2013-08-28 18:22:27 -0400
commitdbddd3289c1a7bad5b549698af0a58aa568fcc43 (patch)
treece801cb01286a340ae0220ab74dcaae986e800d7 /lib/sisu/v4
parentdebian/changelog (4.2.0-1) (diff)
parentv5: dal, grouped text with fontface spanning newlines, partial solution, test (diff)
Merge tag 'sisu_4.2.1' into debian/sid
SiSU 4.2.1
Diffstat (limited to 'lib/sisu/v4')
-rw-r--r--lib/sisu/v4/dal_doc_str.rb35
-rw-r--r--lib/sisu/v4/dal_misc_arrange.rb6
-rw-r--r--lib/sisu/v4/manifest.rb5
-rw-r--r--lib/sisu/v4/odf.rb8
-rw-r--r--lib/sisu/v4/texpdf_format.rb3
5 files changed, 42 insertions, 15 deletions
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
index 6c588a8a..e7d9917b 100644
--- a/lib/sisu/v4/dal_doc_str.rb
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -194,7 +194,7 @@ module SiSU_DAL_DocumentStructureExtract
end
t_o=t_o.gsub(/(?:\n\s*\n)+/m,"\n") if @@flag[:code]==:off
if t_o !~/^(?:code|poem|alt|group|block)\{|^\}(?:code|poem|alt|group|block)|^(?:table\{|\{table)[ ~]/ \
- and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
+ and t_o !~/^[`]{3}\s+(?:code|poem|alt|group|block|table)|^[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*$/ \
and @@flag[:code]==:off \
and @@flag[:poem]==:off \
and @@flag[:group]==:off \
@@ -391,7 +391,7 @@ module SiSU_DAL_DocumentStructureExtract
h={ obj: 'alt text start' } #introduce a counter
t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << t_o
- elsif t_o =~/^(?:table\{|\{table)[ ~]/
+ elsif t_o =~/^(?:table\{|[`]{3}\s+table|\{table)[ ~]/
h={ obj: 'table start' } #introduce a counter
ins=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
tuned_file << ins
@@ -409,15 +409,15 @@ module SiSU_DAL_DocumentStructureExtract
heading=false
end
@h={ head_: heading, cols: cols, widths: col, idx: idx }
- elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+/
+ elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+c\d+/
@@flag[:table]=:tics
@rows=''
case t_o
- when /table\{~h\s+c(\d+);\s+(.+)/
+ when /^[`]{3}\s+table~h\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=true
- when /table\{\s+c(\d+);\s+(.+)/
+ when /^[`]{3}\s+table\s+c(\d+);\s+(.+)/
cols=$1
col=$2.scan(/\d+/)
heading=false
@@ -425,7 +425,7 @@ module SiSU_DAL_DocumentStructureExtract
@h={ head_: heading, cols: cols, widths: col, idx: idx }
elsif t_o=~/^\{table(?:~h)?(?:\s+\d+;?)?\}\n.+\Z/m
m1,m2,hd=nil,nil,nil
- tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1] #two table representations should be consolidated as one
+ tbl=/^\{table(?:~h)?(?:\s+\d+;?)?\}\n(.+)\Z/m.match(t_o)[1]
hd=((t_o =~/^\{table~h/) ? true : false)
tbl,tags=extract_tags(tbl)
rws=tbl.split(/\n/)
@@ -452,6 +452,29 @@ module SiSU_DAL_DocumentStructureExtract
h={ obj: 'table end' } #introduce a counter
t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
t_o
+ elsif t_o=~/^[`]{3}\s+table(?:~h)?\s+/
+ m1,m2,hd=nil,nil,nil
+ h=case t_o
+ when /^[`]{3}\s+table~h\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ m1,tbl,hd=$1,$2,true
+ when /^[`]{3}\s+table\s+(.+?)\n(.+)\Z/m #two table representations should be consolidated as one
+ m1,tbl,hd=$1,$2,false
+ else nil
+ end
+ tbl,tags=extract_tags(tbl)
+ col=m1.scan(/\d+/)
+ rws=tbl.split(/\n/)
+ rows=''
+ rws.each do |r|
+ r=r.gsub(/\s*\|\s*/m,"#{Mx[:tc_p]}") #r.gsub!(/\|/m,"#{Mx[:tc_p]}")
+ rows += r + Mx[:tc_c]
+ end
+ h={ head_: hd, cols: col.length, widths: col, obj: rows, idx: idx, tags: tags }
+ t_o=SiSU_DAL_DocumentStructure::ObjectTable.new.table(h) unless h.nil?
+ tuned_file << t_o
+ h={ obj: 'table end' } #introduce a counter
+ t_o=SiSU_DAL_DocumentStructure::ObjectComment.new.comment(h)
+ t_o
elsif t_o=~/^\{table(?:~h)?\s+/
m1,m2,hd=nil,nil,nil
h=case t_o
diff --git a/lib/sisu/v4/dal_misc_arrange.rb b/lib/sisu/v4/dal_misc_arrange.rb
index ab4f3ea4..e6cc72db 100644
--- a/lib/sisu/v4/dal_misc_arrange.rb
+++ b/lib/sisu/v4/dal_misc_arrange.rb
@@ -78,8 +78,10 @@ module SiSU_DAL_MiscArrangeText
block_open,block_close,text=nil,nil,nil
if para =~/\A[`]{3}\s+.+?\n.+?\n[`]{3}(?:\s+[~-][#]|\s+\~\{.+?\}\~)?\s*\Z/m
block_open,text,block_close=/\A([`]{3}\s+.+?)\n(.+?)\n([`]{3}(\s+[~-][#]|\s+\~\{.+?\}\~)?)\s*\Z/m.match(para)[1..3]
- para=[]
- para << block_open << text << block_close
+ ((para=~/^[`]{3}\s+table(?:~h)?\s+/) \
+ and (para !~/^[`]{3}\s+table(?:~h)?\s+c\d+/)) \
+ ? para
+ : (para=[]; para << block_open << text << block_close)
elsif para =~/\A[`]{3}\s+.+?\n.*?\Z/m #look at, study
block_open,text=/\A([`]{3}(?:\s+.+?))\n(.*?)\Z/m.match(para)[1,2]
para=[]
diff --git a/lib/sisu/v4/manifest.rb b/lib/sisu/v4/manifest.rb
index eb888387..d86830e4 100644
--- a/lib/sisu/v4/manifest.rb
+++ b/lib/sisu/v4/manifest.rb
@@ -841,10 +841,11 @@ WOK
'..'
else '..'
end
+ output_organised_by="(output organised by #{@env.output_dir_structure.by?})"
harvest=(FileTest.file?("#{pth_local}/authors#{@fn_lng}.html") \
&& FileTest.file?("#{pth_local}/topics#{@fn_lng}.html")) \
- ? %{<p class="small"><a href="#{pth_rel_home}/index.html">.:</a> other document manifests: [<a href="#{pth_rel}/authors#{@fn_lng}.html">authors</a>] [<a href="#{pth_rel}/topics#{@fn_lng}.html">topics</a>]</p>}
- : ''
+ ? %{<p class="small"><a href="#{pth_rel_home}/index.html">.:</a> other document manifests: [<a href="#{pth_rel}/authors#{@fn_lng}.html">authors</a>] [<a href="#{pth_rel}/topics#{@fn_lng}.html">topics</a>] #{output_organised_by}</p>}
+ : %{<p class="small"><a href="#{pth_rel_home}/index.html">#{output_organised_by}</p>}
manifest_title=%{<p class="bold">#{@translate.manifest_description}</p>#{harvest}}
@manifest[:html] <<<<WOK
<div id="horizontal_links">
diff --git a/lib/sisu/v4/odf.rb b/lib/sisu/v4/odf.rb
index acc44ab3..adaaea87 100644
--- a/lib/sisu/v4/odf.rb
+++ b/lib/sisu/v4/odf.rb
@@ -119,7 +119,6 @@ module SiSU_ODF
begin
pre
@data=markup(@dal_array)
- post
publish
ensure
unless @md.opt.cmd =~/[MV]/ #check maintenance flag
@@ -173,6 +172,7 @@ module SiSU_ODF
SiSU_ODF_Format::Tags.new.set_bookmark_tag(dob)
end
def heading(dob,p_num)
+ dob=footnote(dob)
m=/#{$1}/
breakpage=''
if @md.fns \
@@ -351,6 +351,7 @@ module SiSU_ODF
dob
end
def normal(dob,p_num) #P1 - P3
+ dob=footnote(dob)
dob.obj=dob.obj.gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
'<text:a xlink:type="simple" xlink:href="\1">\1</text:a>'). #http ftp matches escaped, no decoration
gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
@@ -431,6 +432,7 @@ module SiSU_ODF
dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each_with_index do |parablock,i|
set_ref=(i==0) ? "#{p_num[:set_ref]}#{set_bookmark_tag(dob)}" : ''
parablock=group_clean(parablock)
+ parablock=footnote(parablock)
parray << %{<text:p text:style-name="P_group">#{set_ref}#{parablock}</text:p>} if parablock =~/\S+/
end
dob.obj=parray.join \
@@ -506,6 +508,7 @@ module SiSU_ODF
end
def table(dob,p_num) #
if dob.is ==:table
+ dob=footnote(dob) #check
table=SiSU_ODF_Format::Table.new(@md,dob,p_num)
dob=table.table
end
@@ -542,7 +545,6 @@ module SiSU_ODF
#p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn).set_ref_and_display
end
end
- dob=footnote(dob)
if dob.is==:heading
@@odf[:body] << heading(dob,p_num).obj << @br*2
if SiSU_Env::ProcessingSettings.new(md).build.toc?
@@ -731,8 +733,6 @@ WOK
x=x.gsub(/\n+/m,'') unless @md.opt.cmd=~/M/
@@odf[:head] << x
end
- def post
- end
def publish
content=[]
br_pg='<text:p text:style-name="P_normal_page_new"> </text:p>'
diff --git a/lib/sisu/v4/texpdf_format.rb b/lib/sisu/v4/texpdf_format.rb
index c154fc2b..b010bb08 100644
--- a/lib/sisu/v4/texpdf_format.rb
+++ b/lib/sisu/v4/texpdf_format.rb
@@ -116,7 +116,8 @@ module SiSU_TeX_Pdf
"\\begin{tiny}\\hspace{0mm}\\end{tiny}{\\marginpar{\\begin{tiny}\\hspace{0mm}\\hypertarget{#{dob.ocn}}{#{show_ocn}}\\end{tiny}}}" #ocn object citation numbering
end
def table_special_characters(r)
- r=r.gsub(/#{Mx[:tc_p]}|$/u,'&').
+ r=r.gsub(/#{Mx[:tc_p]}/mu,'&').
+ gsub(/#{Mx[:tc_c]}/m,'\\\\\\').
gsub(/%/,'\%').
gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'\begin{bfseries}\1 \end{bfseries}').
gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'\emph{\1}').