aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-10-09 12:28:18 +0100
committerRalph Amissah <ralph@amissah.com>2007-10-09 12:28:18 +0100
commita6a8bb8f2960aeb218a0687d456d662a21ea6616 (patch)
tree8d465223114bda9233cc1938d37b87ecb6bca731 /lib
parentUpdated sisu-0.60.1 (diff)
parentchangelog update (diff)
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
-rw-r--r--lib/sisu/v0/dal.rb91
-rw-r--r--lib/sisu/v0/dal_syntax.rb3
-rw-r--r--lib/sisu/v0/html.rb24
-rw-r--r--lib/sisu/v0/html_segments.rb31
-rw-r--r--lib/sisu/v0/odf.rb8
-rw-r--r--lib/sisu/v0/param.rb14
-rw-r--r--lib/sisu/v0/shared_xml.rb3
-rw-r--r--lib/sisu/v0/sysenv.rb12
-rw-r--r--lib/sisu/v0/texinfo.rb28
-rw-r--r--lib/sisu/v0/texpdf.rb76
-rw-r--r--lib/sisu/v0/texpdf_format.rb2
-rw-r--r--lib/sisu/v0/xml.rb6
12 files changed, 150 insertions, 148 deletions
diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb
index 15d1c55c..8e514725 100644
--- a/lib/sisu/v0/dal.rb
+++ b/lib/sisu/v0/dal.rb
@@ -188,6 +188,7 @@ module SiSU_DAL
@metafile="#{@env.path.dal}/#{@md.fns}.meta"
my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
data=data.join.split("\n\n")
+ data=expand_insertions?(data)
data=SiSU_document_structure::Code.new(@md,data).code
data_new=[]
data.each do |x|
@@ -354,41 +355,21 @@ module SiSU_DAL
end
file_type_names=file_type_names.flatten
end
- def substitutions_and_insertions?(data)
- tuned_file=[]
- if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content preceeds it)
- data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'')
- data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'')
- end
- if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
- data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1')
- data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1')
- end
+ def expand_insertions?(data)
+ tuned_file,tuned_file_tmp=[],[]
data.each do |para|
- para=if @md.markup_version.to_f >= 0.38
- SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize
- else para
- end
- #para.gsub!(/<url:(\S+?)>/,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate?
- para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12
- if para =~/^@\S+?:/
- para.gsub!(/^@(\S+?):\s+/,'0~\1 ')
- para.gsub!(/^@(\S+?):([+-])\s+/,'0~\1\2 ')
- end
if para !~/^%+\s/ and
- para =~/^(?:_\*\s+)?\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.(?:sst|ssm)\b)(?:\s+~\{.+?\}~)?(?:\s+\*~\S+)*\s*$/
+ para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.ss[tm]\b)/
txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil
url_and_stub=SiSU_Env::Info_env.new.url
if defined? url_and_stub.remote
@output_url="#{url_and_stub.remote}"
- if para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm])(\s+~\{.+?\}~)?/
- #syntax e.g.: { "Sphinx or Robot", Leena Krohn [3sS]}sphinx_or_robot.leena_krohn.1996.sst
- txt,cmd,source,url_dir,note=$1,$2,$3,$4,$5
- elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+~\{.+?\}~)?/
- #syntax e.g.: { "Sphinx or Robot", Leena Krohn [3sS]}../sphinx_or_robot.leena_krohn.1996/
- txt,cmd,url_dir,note=$1,$2,$3,$4
+ if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/m
+ pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6
+ elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm]\b)(.*)/
+ pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5
end
- manifest="{#{txt} }#@output_url/#{url_dir}/toc.html#{note}\n\n"
+ manifest="#{pre}{#{txt} }#@output_url/#{url_dir}/toc.html#{note}\n\n"
else
puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}"
if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+~\{.+?\}~)?/
@@ -396,7 +377,7 @@ module SiSU_DAL
manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n"
end
end
- tuned_file << manifest
+ tuned_file_tmp << manifest
output_filetypes_in_cmd(cmd,source).each do |o_f|
describe = case o_f
when /sisu_manifest.html/; '~^ document manifest'
@@ -419,13 +400,41 @@ module SiSU_DAL
end
if describe
if @output_url
- tuned_file << "_1 {#{describe} }#@output_url/#{url_dir}/#{o_f}\n\n" if describe
+ tuned_file_tmp << "&nbsp;&nbsp;&nbsp;&nbsp; {#{describe} }#@output_url/#{url_dir}/#{o_f}" if describe #to double space <:br> at beginning of entry
else
- tuned_file << "_1 { #{describe} }../#{url_dir}/#{o_f}\n\n"
+ tuned_file_tmp << "&nbsp;&nbsp;&nbsp;&nbsp; { #{describe} }../#{url_dir}/#{o_f}" #to double space <:br> at beginning of entry
end
end
end
- elsif para =~/<:insert\d+!?>/ and para !~/^%\s+/
+ tuned_file << 'group{' << tuned_file_tmp.join("\n").strip << '}group'
+ tuned_file_tmp=[]
+ else tuned_file << para
+ end
+ end
+ tuned_file
+ end
+ def substitutions_and_insertions?(data)
+ tuned_file=[]
+ if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content preceeds it)
+ data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'')
+ data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'')
+ end
+ if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier
+ data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1')
+ data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1')
+ end
+ data.each do |para|
+ para=if @md.markup_version.to_f >= 0.38
+ SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize
+ else para
+ end
+ #para.gsub!(/<url:(\S+?)>/,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate?
+ para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12
+ if para =~/^@\S+?:/
+ para.gsub!(/^@(\S+?):\s+/,'0~\1 ')
+ para.gsub!(/^@(\S+?):([+-])\s+/,'0~\1\2 ')
+ end
+ if para =~/<:insert\d+!?>/ and para !~/^%\s+/
@skin.select
ins=SiSU_Viz::Inserts.new
case para
@@ -465,8 +474,8 @@ module SiSU_DAL
data=number_plaintext_para(data)
data=name_endnote_seg(data) #tr issue
data=auto_number_heading_ie_title(data) #tr issue
- data=ocn(data) unless @md.markup =~/not_to/
- data=minor_numbering(data) #unless @md.markup =~/not_to/
+ data=ocn(data) #watch
+ data=minor_numbering(data)
data=name_para_seg_filename(data)
data=set_heading_seg(data) unless @md.set_heading_seg
data=set_heading_top(data) unless @md.set_heading_top
@@ -781,13 +790,13 @@ module SiSU_DAL
# auto-numbered endnotes <!e!> <!e_!> -->
when /~\{\s+.+?\}~|~\[[*+]\s+.+?\]~/
para.gsub!(/\s*(\}~|\]~)/,' \1') # required 2003w31
- word_mode=para.scan(/\S+/)
+ word_mode=para.scan(/<:group>\n|\n<:group-end>|\S+/m)
word_mode=endnote_call_number(word_mode)
para=word_mode.join(' ')
endnote_ref+=1
when /~\^(?:\s|$)|<:e>/
#%Note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
- word_mode=para.scan(/\S+/)
+ word_mode=para.scan(/<:group>\n|\n<:group-end>|\S+/m)
word_mode=endnote_call_number(word_mode)
para=word_mode.join(' ')
endnote_ref+=1
@@ -985,12 +994,12 @@ module SiSU_DAL
digest_strip=hash_class.hexdigest(stripped)
unless para =~/<:code>/
case para
- when /~\{[\d*+]+\s+.+?\}~|~\[[*+]\d+\s+.+?\]~/
+ when /~\{[\d*+]+\s+.+?\}~|~\[[*+]\d+\s+.+?\]~/m
en_and_para,en_and_para_digest=[],[]
- para.gsub!(/\s*(\}~|\]~)/,' \1') #watch
- para_plus_en=para.scan(/.*?~\{.+?\}~|.*?~\[.+?\]~/)
- para_tail=if para =~/(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+([\s\S]+)/
- /(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+(.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+>)/.match(para)[1]
+ para.gsub!(/\s*(\}~|\]~)/m,' \1') #watch
+ para_plus_en=para.scan(/.*?~\{.+?\}~|.*?~\[.+?\]~/m)
+ para_tail=if para =~/(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+([\s\S]+)/m
+ /(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+(.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+>)/m.match(para)[1]
else ''
end
para_plus_en << para_tail
diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb
index bf83c8ef..a0dfc405 100644
--- a/lib/sisu/v0/dal_syntax.rb
+++ b/lib/sisu/v0/dal_syntax.rb
@@ -65,6 +65,8 @@ module Syntax
@data,@md=data,md
@vz=SiSU_Env::Get_init.instance.skin
@data_new=[]
+ url_and_stub=SiSU_Env::Info_env.new.url
+ @output_url="#{url_and_stub.remote}"
@http_m='\{.+?\}(?:https?|file)://\S+|(?:https?|file):\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^0~.+|<:(?:code|group|alt|verse)(?:-end)?>|<:br>'
@manmkp_ital='[i/]\\{.+?\\}[i/]'
tail_m_ital=%q{(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$)}
@@ -213,6 +215,7 @@ module Syntax
line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") #
line.gsub!(/^([23]~\??) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.dc_creator}") #
line.gsub!(/<((?:https?|file):\/\/\S+?)>/,'< \1 >') #catch problem markup
+ line.gsub!(/\}\.\.\/(\S+)/,"\}#@output_url/\\1") #means you are not supporting relative links (only relevant in html), converted to static here
line.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30
line.gsub!(/<!(\S+)!>/,'<:\1>') #escaped special character
line.gsub!(/\\~/,'&#126;') #escaped special character
diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb
index d0f0e210..c875614d 100644
--- a/lib/sisu/v0/html.rb
+++ b/lib/sisu/v0/html.rb
@@ -93,17 +93,11 @@ module SiSU_HTML
SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#@fnb/#{@md.fn[:index]}").flow if @opt.cmd =~/[MV]/
SiSU_Env::Info_skin.new(@md).select
data=nil
- unless @md.markup =~/url_png/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary
- SiSU_Env::SiSU_file.new(@md).mkdir
- @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@md).tuned_file_instructions
- data=@tuned_file_array
- else
- data=@env.read_source_file(@opt.fns)
- SiSU_HTML_nav_tune::Tune.new(data,@md).songsheet
- @tuned_file_array=data #watch may not be what you want
- end
- scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll unless @md.markup =~/url_png/
+ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary
+ SiSU_Env::SiSU_file.new(@md).mkdir
+ @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@md).tuned_file_instructions
+ data=@tuned_file_array
+ scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll
toc=SiSU_HTML::Source::Toc.new(data,@md).songsheet
links_guide=SiSU_HTML::Source::Links_guide.new(data,@md).toc
data=@tuned_file_array
@@ -175,12 +169,8 @@ module SiSU_HTML
my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns)
@fnm=my_make_source_file.marshal_meta
@tune_verse_marshal=my_make_source_file.marshal_tune
- if @md.markup !~/url_png/ and @md.cmd =~/[hozn]/
- dal_array=SiSU_DAL::Source.new(@md).get # dal file drawn here
- @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet
- else
- SiSU_HTML_nav_tune::Tune.new(@file_array,@md).songsheet #no doc passed originally... 2004w35, revist changes in conditional 2006
- end
+ dal_array=SiSU_DAL::Source.new(@md).get # dal file drawn here
+ @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet
require "#{SiSU_lib}/param"
@tuned_file_array
end
diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb
index 18ed11ec..de96dd7d 100644
--- a/lib/sisu/v0/html_segments.rb
+++ b/lib/sisu/v0/html_segments.rb
@@ -68,7 +68,7 @@ module SiSU_HTML_seg
@@seg[:tocband],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(9){[]}
@@seg[:header_endnotes]=''
@@tablehead,@@number_of_cols=0,0
- @@flag_group=false
+ @@flag_alt=false
@@dp,@@segtocband=nil,nil
@@fns_previous=''
attr_reader :seg_name_html,:seg_name_html_tracker
@@ -168,7 +168,7 @@ module SiSU_HTML_seg
end
m=para[/.+?<a name="(\d+)">.*/]; @@get_hash_to=$1 if m # changed 2002w42, again w44 ! & again 2003w16
m=para[/^4~(\S+)/]; @@get_hash_fn=$1 if m
- para=if para =~/<!Th?¡\s+c|<:(?:code|alt|verse|group)>/; para.split(/\n/)
+ para=if para =~/<!Th?¡\s+c|<:(?:code|alt|verse|group)>/m; para.split(/\n/)
else para
end
if para.class == String
@@ -178,10 +178,8 @@ module SiSU_HTML_seg
markup(pg)
end
end
- #Seg.new(para,@md).txt
if testforartnum[tracking-1] =~/endnote/
if printed_endnote_seg == 'n'
- #Seg.new(para,@md).endnote
printed_endnote_seg='y'
end
end
@@ -262,20 +260,21 @@ module SiSU_HTML_seg
paranum=m[1].to_s
@p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum)
end
- if para =~/<:(?:code|alt|verse|group)>/ or @@flag_group==true
- if para =~/<:(?:code|alt|verse|group)>/
+ if para =~/<:(?:code|alt|verse|group)>/m or @@flag_alt==true
+ if para =~/<:(?:code|alt|verse|group)>/m
@group_collect=[] #unless @group_collect.class == Array
- @group_collect << @vz.margin_txt_0 + para
- @@flag_group=true
- elsif @@flag_group==true
- unless para =~/<:(?:code|alt|verse|group)-end>/ # neither ideal nor necessary sort later
- @group_collect << para
- else @group_collect << para.gsub(/<:(?:code|alt|verse|group)-end>/,'')
+ @group_collect << @vz.margin_txt_0 + para.gsub(/<:(?:code|alt|verse|group)-end>/m,'') #watch !
+ @@flag_alt=true
+ elsif @@flag_alt==true
+ @group_collect << if para !~/<:(?:code|alt|verse|group)-end>/m # neither ideal nor necessary sort later
+ para
+ else
+ para.gsub(/<:(?:code|alt|verse|group)-end>/m,'')
end
end
- if para =~/<:(?:code|alt|verse|group)-end>/
+ if para =~/<:(?:code|alt|verse|group)-end>/m
para=@group_collect.flatten.join
- @@flag_group=false
+ @@flag_alt=false
@group_collect=[]
end
end
@@ -300,7 +299,7 @@ module SiSU_HTML_seg
when /^i([1-9])$/ #indent levels 1-9
format_txt_obj.gsub_body
para=@sto.seg_lev_para_ocn.format('p',"i#{$1}")
- when /^(?:verse|group|alt)$/
+ when /^(?:verse|group|alt)$/m
@sto.seg_lev_para_ocn.para
when /^code$/
@sto.seg_lev_para_ocn.code
@@ -340,7 +339,7 @@ module SiSU_HTML_seg
@@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
else
para.gsub!(/<:[-_\w\d]?(-.+?-)?>|4~!.+/,'')
- @@seg[:main] << para unless @@flag_group==true
+ @@seg[:main] << para unless @@flag_alt==true
end
end
end
diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb
index 981bedeb..610a51aa 100644
--- a/lib/sisu/v0/odf.rb
+++ b/lib/sisu/v0/odf.rb
@@ -367,6 +367,12 @@ module SiSU_ODF
parray=[]
para.split(/<:?br(?: \/)?>/).each do |parablock|
parablock=group_clean(parablock)
+ parablock.gsub!(/&lt;text:a xlink:type="simple" xlink:href="(.+?)"&gt;/m,'<text:a xlink:type="simple" xlink:href="\1">')
+ parablock.gsub!(/&lt;(\/text:a)&gt;/,'<\1>')
+ parablock.gsub!(/&lt;(text:note text:id=.+?)&gt;/,'<\1>')
+ parablock.gsub!(/&lt;(text:p text:style-name="Footnote")&gt;/,'<\1>')
+ parablock.gsub!(/&lt;(\/?text:(?:note-citation|note-body|note|p))&gt;/,'<\1>')
+ parablock=footnote(parablock)
parray << %{<text:p text:style-name="P4">#{parablock}</text:p>} if parablock =~/\S+/
end
para=parray.join + '<text:p text:style-name="Standard"/>'
@@ -397,8 +403,6 @@ module SiSU_ODF
n=lv - 1
n3=lv + 2
lv=nil if lv == 0
- #extract_endnotes(para)
- #para=fontface(para)
para=unless para=~/^<:code>/
para=if para =~/\{\s*\S+?\.(?:png|jpg|gif)\s.+?\}(?:(?:https?|file|ftp):\S+|image)/; image(para)
elsif para =~/\{.+?\}(?:(?:https?|file|ftp):\S+|image)/; text_link(para)
diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb
index 8a652fa0..90aad6aa 100644
--- a/lib/sisu/v0/param.rb
+++ b/lib/sisu/v0/param.rb
@@ -115,9 +115,9 @@ module SiSU_Param
@doc={ :lv=>[] }
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
@@publisher='SiSU scribe'
- attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_pdf,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis
+ attr_accessor :cmd,:mod,:env,:fn,:fns,:fnb,:fnn,:fnt,:fnl,:flv,:fnstex,:ocn,:sfx_src,:sfx,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:site_skin,:sisu,:sisu_version,:ruby_version,:title,:dc_title,:html_title,:subtitle,:subtitle_tex,:creator_home,:dc_creator,:translator,:illustrator,:prepared_by,:digitized_by,:dc_subject,:dc_description,:dc_publisher,:dc_contributor,:dc_date,:dc_date_created,:dc_date_issued,:dc_date_available,:dc_date_valid,:dc_date_modified,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:dc_type,:dc_format,:dc_identifier,:dc_source,:dc_language,:language_original,:dc_relation,:dc_coverage,:dc_rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:toc,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:pagenew,:pagebreak,:num_top,:toc_lev_limit,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:flag_auto_heading_num,:markup,:markup_instruction,:markup_version,:markup_declared,:make_bold,:make_italic,:flag_tables,:vocabulary,:doc_skin,:doc_css,:yaml,:lnk,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:file_size,:user,:home,:hostname,:pwd,:firstseg,:programs,:creator_copymark,:lang,:en,:dgst,:dgst_skin,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:man_section,:man_name,:man_synopsis
def initialize(fns_array,opt)
- @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_pdf=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil
+ @env=@fn=@fns=@fnb=@fnn=@fnt=@fnl=@flv=@fnstex=@ocn=@sfx_src=@sfx=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@site_skin=@sisu=@sisu_version=@ruby_version=@title=@dc_title=@html_title=@subtitle=@subtitle_tex=@creator_home=@dc_creator=@translator=@illustrator=@prepared_by=@digitized_by=@dc_subject=@dc_description=@dc_publisher=@dc_contributor=@dc_date=@dc_date_created=@dc_date_issued=@dc_date_available=@dc_date_valid=@dc_date_modified=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@dc_type=@dc_format=@dc_identifier=@dc_source=@dc_language=@language_original=@dc_relation=@dc_coverage=@dc_rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@num_top=@toc_lev_limit=@flag_auto_heading_num=@make_bold=@make_italic=@flag_tables=@vocabulary=@doc_skin=@doc_css=@yaml=@lnk=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@file_size=@firstseg=@programs=@creator_copymark=@lang=@en=@dgst=@dgst_skin=@generated=@heading_seg_first=@base_program=@man_synopsis=nil
@man_section=1
@man_name='man page "name/whatis" information not provided, set in header @man: name=[whatis information]'
@data,@fns,@cmd,@mod,@opt=fns_array,opt.fns,opt.cmd,opt.mod,opt #@data used as data
@@ -180,7 +180,6 @@ module SiSU_Param
@papersize=@env.papersize #'A4' #default size #get first from SiSU_Env:: # @env is probably no longer most appropriate name! as default info is more general
@sfx_src=@fns[m,2]
@sfx=nil
- @flag_pdf=true #watch
@flag_auto_heading_num=false
if @fns =~ /[_-]?sst$/ #watch
@env_out_root=@env.path.output
@@ -425,7 +424,6 @@ module SiSU_Param
if para =~/^(?:0~markup|@markup:)\s+(.+?)$/m #%use of markup depreciated for num_top
@markup=$1
@flag_auto_heading_num=true if para =~/num_top/
- @flag_pdf=false if para =~/pdf_no/ or para =~/url_png/
end
when /^(?:0~bold|@bold:)\s+(.+?)$/m #% processing
m=$1.strip
@@ -549,16 +547,16 @@ module SiSU_Param
end
unless @code_flag
case para
- when /~\{\s+.+?\}~/ #% processing
- en=para.scan(/~\{.+?\}~/)
+ when /~\{\s+.+?\}~/m #% processing
+ en=para.scan(/~\{.+?\}~/m)
en.each { |e| @en[:sum] +=1 }
- when /~\^(?:\s|$)/ #% processing
+ when /~\^(?:\s|$)/m #% processing
mk=para.scan(/~\^(?:\s|$)/)
mk.each { |e| @en[:mark] +=1 }
when /^\^~\s+\S/; @en[:note] +=1 #% processing
end
end
- if para =~/~\{|\^~ |~\^|<:ee>/; @flag_auto_endnotes,@flag_endnotes=true,true
+ if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true
end
unless @flag_auto_endnotes
if para =~/^(4~endnotes\b|<:ee>)/
diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb
index 4b9ccb12..da1891e5 100644
--- a/lib/sisu/v0/shared_xml.rb
+++ b/lib/sisu/v0/shared_xml.rb
@@ -391,6 +391,9 @@ module SiSU_XML_munge
def markup_group(para='')
para.gsub!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
para.gsub!(/&lt;:?br(?:\s+\/)?&gt;/,'<br />')
+ para.gsub!(/&lt;(link xmlns:xlink=".+?)"&gt;/,'<"\1">')
+ para.gsub!(/&lt;(\/link)&gt;/,'<\1>')
+ para.gsub!(/&lt;(\/?en)&gt;/,'<\1>')
para
end
end
diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb
index fd3f5be2..48161592 100644
--- a/lib/sisu/v0/sysenv.rb
+++ b/lib/sisu/v0/sysenv.rb
@@ -1797,42 +1797,42 @@ WOK
if defined? @rc['flag']['default'] and
not (@rc['flag']['default'].nil? or @rc['flag']['default'].empty?)
@rc['flag']['default']
- else '-NhwpAobxXyYv'
+ else '-NhwpaobxXyYv'
end
end
def cf_1 #processing flag shortcuts
if defined? @rc['flag']['i'] and
not (@rc['flag']['i'].nil? or @rc['flag']['i'].empty?)
@rc['flag']['i']
- else '-NhwpAoy' #'-Nhwpy'
+ else '-hwpoy'
end
end
def cf_2 #processing flag shortcuts
if defined? @rc['flag']['ii'] and
not (@rc['flag']['ii'].nil? or @rc['flag']['ii'].empty?)
@rc['flag']['ii']
- else '-NhwpAobxXy' # '-NhwpAoy'
+ else '-NhwpaobxXy'
end
end
def cf_3 #processing flag shortcuts
if defined? @rc['flag']['iii'] and
not (@rc['flag']['iii'].nil? or @rc['flag']['iii'].empty?)
@rc['flag']['iii']
- else '-NhwpAobxXyY'
+ else '-NhwpaobxXyY'
end
end
def cf_4 #processing flag shortcuts
if defined? @rc['flag']['iv'] and
not (@rc['flag']['iv'].nil? or @rc['flag']['iv'].empty?)
@rc['flag']['iv']
- else '-NhwpAobxXDyY --import'
+ else '-NhwpaobxXDyY --import'
end
end
def cf_5 #processing flag shortcuts
if defined? @rc['flag']['v'] and
not (@rc['flag']['v'].nil? or @rc['flag']['v'].empty?)
@rc['flag']['v']
- else '-NhwpAobxXDyY --update'
+ else '-NhwpaobxXDyY --update'
end
end
end
diff --git a/lib/sisu/v0/texinfo.rb b/lib/sisu/v0/texinfo.rb
index 18415c47..3c7a35c2 100644
--- a/lib/sisu/v0/texinfo.rb
+++ b/lib/sisu/v0/texinfo.rb
@@ -103,23 +103,19 @@ module SiSU_TexInfo
data=IO.readlines(@opt.fns,'')
@md=SiSU_Param::Parameters.new(@opt).get
puts "\t#{@@cX.grey}TexInfo#{@@cX.off}"
- #@@copyright="\n #{@@tex_backslash*2}[3]\\ \\linebreak \\copyright \\ #{@md.copyright_tex}" if @md.copyright_tex #appears to be redundant ! remove 2004w19
- if @md.markup.to_s !~ /url_png/
- my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- directories
- @marshalfile=my_make.marshal_meta
- if FileTest.file?(@marshalfile)==true
- File.open(@marshalfile) { |f| @@tuned_file=Marshal.load(f)}
- tell.meta_verse_skipped unless @opt.cmd =~/q/
- else
- tex_array=IO.readlines(@opt.fns,'')
- SiSU_Metaverse.songsheet(tex_array)
- end
- tex_array=@@tuned_file
- Texinfo_make.new(tex_array,@md).songsheet
- tex_array=''
+ my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
+ directories
+ @marshalfile=my_make.marshal_meta
+ if FileTest.file?(@marshalfile)==true
+ File.open(@marshalfile) { |f| @@tuned_file=Marshal.load(f)}
+ tell.meta_verse_skipped unless @opt.cmd =~/q/
+ else
+ tex_array=IO.readlines(@opt.fns,'')
+ SiSU_Metaverse.songsheet(tex_array)
end
- #@@filename_texinfo.close if @@filename_texinfo
+ tex_array=@@tuned_file
+ Texinfo_make.new(tex_array,@md).songsheet
+ tex_array=''
@@filename_texinfo=nil
rescue; STDERR.puts SiSU_Screen::Ansi.new(@opt.cmd,$!,$@).rescue
ensure
diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb
index c2a6b14f..be8c973e 100644
--- a/lib/sisu/v0/texpdf.rb
+++ b/lib/sisu/v0/texpdf.rb
@@ -114,25 +114,20 @@ module SiSU_TeX
tell.flow if @opt.cmd =~/[MVv]/
@md=SiSU_Param::Parameters.new(@opt).get
my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns)
- if @md.flag_pdf
- $flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
- @dir_o="#{@env.path.output}/#{@opt.fnb}"
- directories
- filename_index="#{@md.txt_path}/pdf"
- newfilename=filename_index
- #% needed needs to be reprogrammed !!!
- SiSU_Env::Info_skin.new(@md).select
- dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
- SiSU_TeX::Source::LaTeX_create.new(dal_array,@md,'landscape').songsheet
- SiSU_TeX::Source::LaTeX_create.new(dal_array,@md,'portrait').songsheet
- dal_array=''
- pwd=Dir.pwd
- SiSU_TeX::Source::LaTeX_to_pdf.new(@md).latexrun_selective
- Dir.chdir(pwd)
- else
- tell=SiSU_Screen::Ansi.new(@opt.cmd,'instructed NOT to produce LaTeX/PDF')
- tell.warn unless @opt.cmd =~/q/
- end
+ $flag=@md.cmd #introduced to pass 0 for no object citation numbers... to texpdf_format
+ @dir_o="#{@env.path.output}/#{@opt.fnb}"
+ directories
+ filename_index="#{@md.txt_path}/pdf"
+ newfilename=filename_index
+ #% needed needs to be reprogrammed !!!
+ SiSU_Env::Info_skin.new(@md).select
+ dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
+ SiSU_TeX::Source::LaTeX_create.new(dal_array,@md,'landscape').songsheet
+ SiSU_TeX::Source::LaTeX_create.new(dal_array,@md,'portrait').songsheet
+ dal_array=''
+ pwd=Dir.pwd
+ SiSU_TeX::Source::LaTeX_to_pdf.new(@md).latexrun_selective
+ Dir.chdir(pwd)
rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
ensure
unless @opt.cmd =~/[MV]/ #check maintenance flag
@@ -236,7 +231,7 @@ module SiSU_TeX
@@tex_backslash ||="\\\\"
@@tilde='\\\\\\~' #?? debug crazy
@@tex_head_portrait,@@tex_head_landscape=nil,nil
- @@flag_group,@@flag_code=false,false
+ @@flag_alt,@@flag_group,@@flag_code=false,false,false
@@dp,@@prefix_b=nil,nil
def initialize(data,md,orientation)
@data,@md,@orientation=data,md,orientation
@@ -268,16 +263,14 @@ module SiSU_TeX
prefix_b=do_mono.special_characters_safe
@@prefix_b="\n #{@@tex_backslash*2}[3]\\ \\linebreak \\ #{prefix_b}\n" unless @@prefix_b
end
- if @md.markup.to_s !~/url_png/
- data=pre(data)
- data=footnote(data)
- if @md.flag_tables
- data=tables(data)
- end
- data=number_paras(data) if @md.markup !~/not_to/ #check
- data=markup(data)
- output(data)
+ data=pre(data)
+ data=footnote(data)
+ if @md.flag_tables
+ data=tables(data)
end
+ data=number_paras(data) if @md.markup.inspect !~/no_ocn/ and @md.mod.inspect !~/--no-ocn/ #check
+ data=markup(data)
+ output(data)
rescue; SiSU_Errors::Info_error.new($!,$@,@md.fns,@md.cmd).error
ensure
end
@@ -428,7 +421,7 @@ WOK
@group_collect=[]
data.each do |para| #% case follows with levels 1-6 indents & graphics
mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para)
- if para =~/<:(code|alt|verse|group)>/ or @@flag_group==true
+ if para =~/<:(code|alt|verse|group)>/ or @@flag_alt
if para =~/<:(code|alt|verse|group)>/
@lineone=case para
when /<:(alt|verse|group)>/; para
@@ -440,16 +433,22 @@ WOK
do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para)
para=do_mono.special_characters_curly(para)
end
- regx=/<:((?:code|alt|verse|group)(?:-end)?)>/
+ regx=/<:((?:code|alt|verse|group)(?:-end)?)>/m
x=regx.match(para)[1] if para =~regx
x=$1
para.gsub!(/\n<:(?:code|alt|verse|group)>\n/m,'')
para=enclose(para,'code') unless para =~/^$/
- if x =~/(?:alt|verse|group)/; @@flag_group=true
- elsif x =~/code/; @@flag_group,@@flag_code=true,true
- elsif @@flag_group==true; @group_collect << para #<< "\n\n"
+ if x =~/(?:alt|verse|group)/; @@flag_alt=true
+ if x =~/group/; @@flag_group=true
+ end
+ elsif x =~/code/; @@flag_alt,@@flag_code=true,true
+ elsif @@flag_alt;
+ if para =~ /\}(?:https?|file|ftp)/m
+ para=mono.http(@orientation)
+ end
+ @group_collect << para #<< "\n\n"
end
- if x =~/(?:code|alt|verse|group)-end/
+ if x =~/(?:code|alt|verse|group)-end/m
regx=/(\\+marginpar\{\\+begin\{tiny\}\d+\\+end\{tiny\}\})/
y=if para =~regx
regx.match(para)[1]
@@ -470,14 +469,11 @@ WOK
#@group_collect.each{ |x| x.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ') }
#@lineone.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ')
insert=[]
- if para =~/<:code-end>/
+ if para =~/<:code-end>/m
insert << y + @lineone << @group_collect << ' \end{scriptsize}' << " #{@tex.paraskip_normal}"
- #insert << y + @lineone << @group_collect << ' \end{footnotesize}' << " #{@tex.paraskip_normal}"
- #insert << y + @lineone << @group_collect << ' \end{texttt}' << " #{@tex.paraskip_normal}"
- #insert << y + @lineone << @group_collect << ' \end{ttfamily} \end{small}' << " #{@tex.paraskip_normal}"
else insert << y + @lineone << @group_collect
end
- @@flag_group,@@flag_code=false,false
+ @@flag_alt,@@flag_group,@@flag_code=false,false,false
@group_collect=[]
para.gsub!(/(<:\S+>|<!.*?!>|<!>)/,' ')
#para.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>|<!.*?!>|<!>)/,' ')
diff --git a/lib/sisu/v0/texpdf_format.rb b/lib/sisu/v0/texpdf_format.rb
index 51681ce7..bf93ce9c 100644
--- a/lib/sisu/v0/texpdf_format.rb
+++ b/lib/sisu/v0/texpdf_format.rb
@@ -1196,7 +1196,7 @@ WOK
def a4generic
end
def para_num
- paranumber_display=if @md.mod.inspect =~/--no-ocn/; '' #!ocn no object citation numbering
+ paranumber_display=if @md.markup.inspect =~/no_ocn/ or @md.mod.inspect =~/--no-ocn/; ''
else "\\begin{tiny}~\\end{tiny}{\\marginpar{\\begin{tiny}#@string1\\end{tiny}}}" #ocn object citation numbering
end
if @string !~/^([1-6a-z-]#{@@tilde}\S*|<:.+?>|#{@md.lv1}|#{@md.lv2}|#{@md.lv3}|#{@md.lv4}|#{@md.lv5}|#{@md.lv6})/
diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb
index b230ec9f..d6db3ca7 100644
--- a/lib/sisu/v0/xml.rb
+++ b/lib/sisu/v0/xml.rb
@@ -233,13 +233,15 @@ WOK
@@xml[:body] << if lv; %{#{@tab*1}<text class="h#{lv}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} << "\n"
else %{#{@tab*1}<text class="#{type}">\n#{@tab*2}#{wrapped}\n#{@tab*1}</text>\n} # main text, contents, body KEEP
end
- @@xml[:body] << @endnotes if @endnotes # main text, endnotes KEEP
+ @@xml[:body] << @endnotes if @endnotes
##@@xml[:body] << "#{@tab*1}<text>#{para[@regx,2]}</text>\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP
@@xml[:body] << "#{@tab*0}</object>" << "\n" if para[@regx]
@endnotes=[]
end
def group_structure(para='',ocn='')
para.gsub!(/<:group(?:-end)?>/,'')
+ extract_endnotes(para)
+ para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)\s*<#@dp>[}\]]~/,'<en>\1</en>') #footnote/endnote clean
para=@trans.markup_group(para)
para.strip!
@@xml[:body] << %{#{@tab*0}<object id="#{ocn}">} << "\n"
@@ -248,6 +250,8 @@ WOK
@@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n}
@@xml[:body] << %{#{@tab*1}</text>\n}
@@xml[:body] << "#{@tab*0}</object>" << "\n"
+ @@xml[:body] << @endnotes if @endnotes
+ @endnotes=[]
end
def poem_structure(para='',ocn='')
para.gsub!(/<:verse(?:-end)?>/,'')