aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/dal.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/dal.rb')
-rw-r--r--lib/sisu/v0/dal.rb451
1 files changed, 226 insertions, 225 deletions
diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb
index 3e5e11ac..cb6d70f8 100644
--- a/lib/sisu/v0/dal.rb
+++ b/lib/sisu/v0/dal.rb
@@ -70,7 +70,7 @@ module SiSU_DAL
include SiSU_Env
include SiSU_Param
include SiSU_Viz
- include Syntax
+ include SiSU_Syntax
class Instantiate < SiSU_Param::Parameters::Instructions
def initialize
@@flag_vocab=0
@@ -199,6 +199,7 @@ module SiSU_DAL
data=data.join.split("\n\n")
data=expand_insertions?(data)
data=SiSU_document_structure::Code.new(@md,data).code
+ data=substitutions_and_insertions?(data)
data_new=[]
data.each do |x|
data_new << if x =~ /\n\n/m; x.split(/\n\n+/)
@@ -206,8 +207,7 @@ module SiSU_DAL
end
end
data=data_new.flatten
- data=substitutions_and_insertions?(data)
- data=Syntax::Markup.new(@md,data).songsheet
+ data=SiSU_Syntax::Markup.new(@md,data).songsheet
data=character_check(data)
data=images(data)
data=SiSU_document_structure::Tables.new(@md,data).tables
@@ -234,12 +234,12 @@ module SiSU_DAL
para.gsub!(/^([12])~\?\s+/,'\1~ ') #conditional header for incorporated document 2004w12
para.gsub!(/^[{~}]\s*$/,'')
para.gsub!(/^#{@@comment}.*/,'') #remove comment and divider #%
- para.gsub!(/<~#>|~#\s*/,'<~#>')
- para.gsub!(/-#\s*/,'<-#><~#>')
+ para.gsub!(/<~#>|~#\s*/,"#{Mx[:fa_o]}~##{Mx[:fa_c]}")
+ para.gsub!(/-#\s*/,"#{Mx[:fa_o]}-##{Mx[:fa_c]}#{Mx[:fa_o]}~##{Mx[:fa_c]}")
#para.gsub!(/(#\{{3} arch-tag:|0\{{3}~cvs)\s+/, "0{{~rcs ") #KEEP ... ENABLE WIDER USE OF REVISION CONTROL
- para.gsub!(/(~\{ )\s+/,'\1')
- para.gsub!(/ \/\//,'<br />') #added 2004w29
- para.gsub!(/<br>/,'<br />') #needed by xml, xhtml etc.
+ para.gsub!(/(#{Mx[:en_a_o]} )\s+/,'\1'); para.gsub!(/(~\{ )\s+/,'\1')
+ para.gsub!(/ \/\//,"#{Mx[:br_line]}") #added 2004w29
+ para.gsub!(/<br>/,"#{Mx[:br_line]}") #needed by xml, xhtml etc.
#para.gsub!(/<p>/,'<p />') #consider
para.gsub!(/`/,"'")
para.gsub!(/\t/,' ')
@@ -252,12 +252,12 @@ module SiSU_DAL
para.gsub!(/\\trademark\b|\\tm\b/,'&#174;')
#non_utf8(para)
para=para + "\n"
- unless para =~/^<:code>/
+ unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
case para
when /\^~/ # endnotes
#% Note must do this first (earlier loop) and then enter gathered data into ~^\d+
sub_para=para.dup
- @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/, %{~\{#{endnote_no} \\1 \}~}).strip
+ @@endnote_array << sub_para.gsub!(/\n/,'').gsub!(/\^~\s+(.+)\s*/, %{#{Mx[:en_a_o]}#{endnote_no} \\1 #{Mx[:en_a_c]}}).strip
endnote_no+=1
para=nil if para =~/\^~ .+/ #removes 'binary' endnote now in endnote array for later insertion
end
@@ -383,7 +383,7 @@ module SiSU_DAL
manifest="#{pre}{#{txt} }#{@u.remote}/#{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+~\{.+?\}~)?/
+ if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]})?/
txt,cmd,url_dir,note=$1,$2,$3,$4
manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n"
end
@@ -452,7 +452,7 @@ module SiSU_DAL
tuned_file
end
def substitutions_and_insertions?(data)
- tuned_file=[]
+ data_expand=[]
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/,'')
@@ -462,16 +462,6 @@ module SiSU_DAL
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
@@ -501,13 +491,25 @@ module SiSU_DAL
para=[]
ins.insert7.split(/\n\n/).each{|x| para << x << "\n"}
end
- para.each{|x| tuned_file << x }
- else tuned_file << para
+ para.each{|x| data_expand << x }
+ else data_expand << para
+ end
+ data_expand.flatten!
+ data_expand.compact!
+ end
+ data_expand.each do |para|
+ para=if @md.markup_version.to_f >= 0.38
+ SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize
+ else
+ SiSU_document_structure::Structure.new(@md,para).structure_marks
+ 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+/,"#{Mx[:meta_o]}\\1#{Mx[:meta_c]}")
+ para.gsub!(/^@(\S+?):([+-])\s+/,"#{Mx[:meta_o]}\\1\\2#{Mx[:meta_c]}")
end
- tuned_file.flatten!
- tuned_file.compact!
end
- tuned_file
end
def numbering_song(data)
data=number_plaintext_para(data)
@@ -524,8 +526,10 @@ module SiSU_DAL
def number_plaintext_para(data)
@tuned_file=[]
data.each do |para|
- para.gsub!(/(^|[^<][^v][^>])\n/,'\1 ') #messy, but idea is that tables should retain breaks
- para.gsub!(/^/,"\n") unless para =~/¡/u
+ if para !~/#{Mx[:gr_o]}(?:code|group|alt|poem|verse)#{Mx[:gr_c]}|#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/
+ para.gsub!(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks
+ end
+ para.gsub!(/^/,"\n") unless para =~/#{Mx[:tc_p]}/u
para.gsub!(/^\s+|\s$/,"\n")
@tuned_file << para
end
@@ -557,27 +561,27 @@ module SiSU_DAL
# debug 2003w46 adding revision control info
if @md.flag_auto_endnotes \
and @md.flag_separate_endnotes_make
- @tuned_file << "\n4~endnotes Endnotes <-#> <~0;0:0;u0>"
+ @tuned_file << "\n#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}Endnotes #{Mx[:gl_o]}-##{Mx[:gl_c]} #{Mx[:id_o]}~0;0:0;u0#{Mx[:id_c]}"
end
- @tuned_file << "\n<ENDNOTES>"
+ @tuned_file << "\n#{Mx[:br_endnotes]}" #DECIDE ON
@tuned_file=@tuned_file.flatten
end
def owner_details_seg
- data << '4~owner.details Owner Details'
+ data << "#{Mx[:lv_o]}4:owner.details#{Mx[:lv_c]}Owner Details"
end
def number_sub_heading(para,num,title_no)
case para
- when /#{num}~- /; para.gsub!(/#{num}~- /,"#{title_no} ")
- when /^#{num}~#\s*/; para.gsub!(/^#{num}~#\s*/,"#{title_no} ")
- when /^#{num}~[a-z_\.]+ /
- para.gsub!(/^#{num}~([a-z_\.]+)\s+(.+)/i,%{#{num}~\\1 #{title_no} \\2 <:name##{title_no}>})
- when /^#{num}~\s+#{title_no}/
- para.gsub!(/^#{num}~ /,"#{num}~#{title_no} ") #where title contains title number
- else para.gsub!(/^#{num}~ /,"#{num}~#{title_no} #{title_no} ") #main, where title number is to be provided
+ when /#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/; para.gsub!(/#{Mx[:lv_o]}#{num}:-#{Mx[:lv_c]}/,"#{title_no} ")
+ when /^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/; para.gsub!(/^#{Mx[:lv_o]}#{num}:##{Mx[:lv_c]}/,"#{title_no} ")
+ when /^#{Mx[:lv_o]}#{num}:[a-z_\.]+#{Mx[:lv_c]}/
+ para.gsub!(/^#{Mx[:lv_o]}#{num}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i,%{#{Mx[:lv_o]}#{num}:\\1#{Mx[:lv_c]} #{title_no} \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}})
+ when /^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}\s*#{title_no}/
+ para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]}") #where title contains title number
+ else para.gsub!(/^#{Mx[:lv_o]}#{num}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{num}:#{title_no}#{Mx[:lv_c]} #{title_no} ") #main, where title number is to be provided
end
if @md.toc_lev_limit \
and @md.toc_lev_limit < num
- para.gsub!(/^[5-8]~(?:~\S+)?\s*/,'!_ ')
+ para.gsub!(/^#{Mx[:lv_o]}[5-9]:\S*?#{Mx[:lv_c]}/,'!_ ') #bold line, watch
end
para
end
@@ -596,61 +600,61 @@ module SiSU_DAL
if (@md.markup =~/num_top/ \
or (@md.num_top \
and @md.num_top !~/^$/)) \
- and para !~/^0~/
+ and para !~/^#{Rx[:meta]}/
if (para =~/^(?:#{no1}|^#{no2}|^#{no3}#{no4})~#/ \
- and para !~/^4~endnotes?/)
+ and para !~/^#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}/)
t_not+=1 #; t_no2=0; t_no3=0
- para.gsub!(/^(#{no1})~#\s*/,"\\1~ps#{t_not} ")
- para.gsub!(/^(#{no2})~#\s*/,"\\1~ps#{t_not} ")
- para.gsub!(/^(#{no3})~#\s*/,"\\1~ps#{t_not} ")
- para.gsub!(/^(#{no4})~#\s*/,"\\1~ps#{t_not} ")
+ para.gsub!(/^(#{Mx[:lv_o]}#{no1}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2")
+ para.gsub!(/^(#{Mx[:lv_o]}#{no2}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2")
+ para.gsub!(/^(#{Mx[:lv_o]}#{no3}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2")
+ para.gsub!(/^(#{Mx[:lv_o]}#{no4}):#(#{Mx[:lv_c]})/,"\\1:ps#{t_not}\\2")
end
- if para =~/#{no1}~/
+ if para =~/#{Mx[:lv_o]}#{no1}:/
@subnumber=1
- @subnumber=0 if para =~/#{no1}~/
+ @subnumber=0 if para =~/#{Mx[:lv_o]}#{no1}:/
end
- if para =~/^[0-6]~[ \w-]/ \
- and para !~ /(?:[0-6]~[\w-]+-|4~endnotes|^[0-6]~([a-z_\.]+)\s+[\d.]+)\s/ \
- and para !~/<~#>|<-#>/
- if para =~/^#{no1}~/
+ if para =~/^#{Mx[:lv_o]}[1-6]:[\w-]*#{Mx[:lv_c]}/ \
+ and para !~ /(?:#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}|#{Mx[:lv_o]}4:endnotes#{Mx[:lv_c]}|^#{Mx[:lv_o]}[1-6]:[a-z_\.]+#{Mx[:lv_c]}\s+[\d.]+)\s/ \
+ and para !~/#{Mx[:fa_o]}(?:~#|-#)#{Mx[:fa_c]}/
+ if para =~/^#{Mx[:lv_o]}#{no1}:/
t_no1+=1; t_no2=0; t_no3=0
title_no="#{t_no1}"
if not @md.seg_names.nil? \
and not @md.seg_names.include?(title_no)
- para.gsub!(/^#{no1}~\s+(\S+)#/,"#{no1}~#{title_no} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329)
+ para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*(\S+)#/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]} \\1 #{title_no} ") #shift placement of auto-number to after first word, e.g. Article # not # Article, added on occasion of ABF (20040329)
para.gsub!(/^#{no1}\{\s+(Article|Clause|Section)\s+#/i,%{#{no1}~#{title_no} \\1 #{title_no}. })
- unless para =~/^#{no1}~\s+[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review
- para.gsub!(/^#{no1}~\s+/,"#{no1}~#{title_no} #{title_no}. ")
+ unless para =~/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}\s*[\d.]+\s/ #fix -> if the title starts with a numbering scheme, do not auto-number, review
+ para.gsub!(/^#{Mx[:lv_o]}#{no1}:#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:#{title_no}#{Mx[:lv_c]}#{title_no}. ")
end
@md.seg_names << title_no
#else puts "warning segment name #{title_no} already exists"
end
- unless para =~/^#{no1}~([a-z_\.]+)\s+[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required
- para.gsub!(/^#{no1}~([a-z_\.]+)\s+(.+)/i,%{#{no1}~\\1 #{title_no}. \\2 <:name##{title_no}>})
+ unless para =~/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*[A-Z]\.?\s/ #bug -> tmp fix, excludes A. B. C. lettering, but not roman numerals, is arbitrary, review required
+ para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)#{Mx[:lv_c]}\s*(.+)/i,
+ %{#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}#{title_no}. \\2 #{Mx[:fa_o]}:name##{title_no}#{Mx[:fa_c]}})
end
+ para.gsub!(/^#{Mx[:lv_o]}#{no1}:##{Mx[:lv_c]}/,"#{title_no}. ") #watch
para.gsub!(/^#{no1}~#\s*/,"#{title_no}. ")
end
- if para =~/^#{no2}~/
+ if para =~/^#{Mx[:lv_o]}#{no2}:\S*?#{Mx[:lv_c]}/
t_no2+=1; t_no3=0
title_no="#{t_no1}.#{t_no2}"
para=number_sub_heading(para,no2,title_no)
end
- if para =~/^#{no3}~/
+ if para =~/^#{Mx[:lv_o]}#{no3}:\S*?#{Mx[:lv_c]}/
t_no3+=1
title_no="#{t_no1}.#{t_no2}.#{t_no3}"
para=number_sub_heading(para,no3,title_no)
end
- elsif para =~ /^[0-6]~[\w-]+-/ # endnotes, watch2005
- para.gsub!(/^#{no1}~([a-z_\.]+)- /,"#{no1}~\\1 ")
- para.gsub!(/^#{no2}~([a-z_\.]+)- /,"#{no2}~\\1 ")
- para.gsub!(/^#{no3}~([a-z_\.]+)- /,"#{no3}~\\1 ")
+ elsif para =~/^#{Mx[:lv_o]}[1-6]:[\w-]+-#{Mx[:lv_c]}/ # endnotes, watch2005
+ para.gsub!(/^#{Mx[:lv_o]}#{no1}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no1}:\\1#{Mx[:lv_c]}") #"#{no1}~\\1 ")
+ para.gsub!(/^#{Mx[:lv_o]}#{no2}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no2}:\\1#{Mx[:lv_c]}")
+ para.gsub!(/^#{Mx[:lv_o]}#{no3}:([a-z_\.]+)-#{Mx[:lv_c]}/,"#{Mx[:lv_o]}#{no3}:\\1#{Mx[:lv_c]}")
end
elsif @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4
- unless para =~ /^[0-6]~\S+/ #endnotes watch?
- if para =~/^[1-6]~\s+([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d
- name_num=$1
- para.gsub!(/^([1-6]~)\s+/,"\\1#{name_num} ")
- end
+ if para =~/^#{Mx[:lv_o]}[1-9]:#{Mx[:lv_c]}([\d\.]+)/ #risky (must be unique) consider output to 4~~\d instead of 4~\d
+ name_num=$1
+ para.gsub!(/^#{Mx[:lv_o]}([1-9]:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{name_num}#{Mx[:lv_c]}")
end
if @md.toc_lev_limit
end
@@ -663,7 +667,7 @@ module SiSU_DAL
@tuned_file=[]
object_array=SiSU_document_structure::OCN.new(@md,data).ocn
object_array.each do |o|
- @tuned_file <<= if o.ocn; "#{o.txt} <~#{o.ocn};#{o.lv};#{o.type}>" #main ocn descriptor
+ @tuned_file <<= if o.ocn; "#{o.txt} #{Mx[:id_o]}~#{o.ocn};#{o.lv};#{o.type}#{Mx[:id_c]}" #main ocn descriptor
else o.txt
end
end
@@ -675,8 +679,8 @@ module SiSU_DAL
letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z )
data.each do |para|
if para =~/\w|\S|<|\(/
- if para !~/^%% |^0~|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^<:p[bn]>|^<:\#|<:- |<[:!]!4|^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|<ENDNOTES?>/i #ocn here #&nbsp; added with Tune.code #¡
- if para=~/^[1-8]~/; number_small,letter_small=0,0 #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later)
+ if para !~/^%% |#{Rx[:meta]}|^0~|^#{Mx[:lv_o]}endnotes:|^4~endnotes|^<\/center>|<:ee>|<:e[:_]>|^\^~ |<:e[:_]\d+?>|^#{Mx[:fa_o]}:p[bn]#{Mx[:fa_c]}|^<:\#|<:- |<[:!]!4|#{Mx[:gr_o]}(?:alt|code|group|poem|table)#{Mx[:gr_c]}|^(?:alt|code|group|poem|table)\{|^\}(?:alt|code|group|poem|table)|^\}table$|<table|<\/table>|<td|<\/td>|<th|<\/th>|<tr>|<\/tr>|<hr width|<:4-endnotes>|\[endnotes\]|<:zz>|<:isbn-|<:journal-|<:conference-|#{Mx[:br_endnotes]}/i #ocn here #&nbsp; added with Tune.code #¡
+ if para=~/^#{Mx[:lv_o]}[1-9]:\S*?#{Mx[:lv_c]}/; number_small,letter_small=0,0 #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later)
end
if para =~/^#[ 1]/
letter_small=0
@@ -685,7 +689,7 @@ module SiSU_DAL
para.gsub!(/^#[ 1]/,"#{number_small}. ") #change 2004
end
if para =~/^_# /
- para.gsub!(/^_# /,"<:i1> #{letter[letter_small]}. ") #change 2004
+ para.gsub!(/^_# /,"#{Mx[:fa_o]}:i1#{Mx[:fa_c]} #{letter[letter_small]}. ") #change 2004
letter_small+=1
end
end
@@ -717,53 +721,51 @@ module SiSU_DAL
end
data.each do |para|
para=SiSU_document_structure::Structure.new(@md,para).structure_markup
- if para =~/^[456]~ /
- if para=~/^4/ \
+ if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}/
+ if para=~/^#{Mx[:lv_o]}[4]:#{Mx[:lv_c]}/ \
and not @md.set_heading_seg
@md.set_heading_seg=true
end
- if para =~/^[456]~(?:\s\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
+ if para =~/^#{Mx[:lv_o]}[456]:#{Mx[:lv_c]}(?:\s*\S+)?\s+([\d.,:-]+)/m #heading starts with a recognised numeric or word followed by a recognised numerical construct, use that as name
pattern=$1
pattern.gsub!(/(?:[:,-]|\W)/,'.')
pattern.gsub!(/\.$/,'')
if not @md.seg_names.nil? \
and not @md.seg_names.include?(pattern)
- para.gsub!(/^([456])~\s*/,"\\1~#{pattern} ")
+ para.gsub!(/^#{Mx[:lv_o]}([456]):#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1:#{pattern}#{Mx[:lv_c]}")
@md.seg_names << pattern
else puts 'warn, there may be a conflicting numbering scheme' if @md.cmd =~/[VM]/
end
end
- if para =~/^4~\s.+?;4:(\d+);/m #extract segment name from embedded document structure info
+ if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}.+?;4:(\d+);/m #extract segment name from embedded document structure info
pattern=$1
pattern.gsub!(/(?:[:,-]|\W)/,'.')
pattern.gsub!(/\.$/,'')
if not @md.seg_names.nil? \
and not @md.seg_names.include?(pattern)
- para.gsub!(/^(4)~\s*/,"\\1~#{pattern} ")
+ para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1#{pattern}#{Mx[:lv_c]}")
@md.seg_names << pattern
else
- para.gsub!(/^(4)~\s*/,"\\1~~#{pattern} ")
+ para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,"#{Mx[:lv_o]}\\1~#{pattern}#{Mx[:lv_c]}")
@md.seg_names << "~#{pattern}"
end
end
- if para =~/^4~\s+/ #if still not segment name, provide a numerical one
+ if para =~/^#{Mx[:lv_o]}4:#{Mx[:lv_c]}/ #if still not segment name, provide a numerical one
if not @md.seg_names.nil? \
and not @md.seg_names.include?(art_filename_auto)
- para.gsub!(/^4~\s+/,%{4~_#{art_filename_auto} })
+ para.gsub!(/^#{Mx[:lv_o]}(4:)#{Mx[:lv_c]}/,%{#{Mx[:lv_o]}\\1~#{art_filename_auto}#{Mx[:lv_c]}})
@md.seg_names << art_filename_auto
else puts 'segment name (numbering) error'
end
art_filename_auto+=1
end
end
- @tuned_file << if para =~/^([1-6])~/m \
- and (@md.pagenew \
- or @md.pagebreak)
+ @tuned_file << if para =~/^#{Mx[:lv_o]}([1-6]):\S*?#{Mx[:lv_c]}/m \
+ and (@md.pagenew or @md.pagebreak)
m=$1 #watch ref~
para_tmp=[]
- if @md.pagenew.inspect =~/#{m}/; para_tmp << "<:pn>\n" << para
- end
- if @md.pagebreak.inspect =~/#{m}/; para_tmp << "<:pb>\n" << para
+ if @md.pagenew.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page_new]}\n" << para
+ elsif @md.pagebreak.inspect =~/#{m}/; para_tmp << "#{Mx[:br_page]}\n" << para
end
para_result=unless para_tmp.length > 0; para
else para_tmp
@@ -782,11 +784,11 @@ module SiSU_DAL
@tuned_file=[]
data.each do |para|
unless @md.set_heading_top
- if para !~/^(?:@\S+:|0~\S+)\s/m \
+ if para !~/^(?:#{Rx[:meta]}|@\S+:|0~\S+)\s/m \
and para !~/\A\s*\Z/m
@md.set_heading_top=true
- head=if @md.title ; "1~ #{@md.title}"
- else '1~ [no title provided]'
+ head=if @md.title ; "#{Mx[:lv_o]}1:#{Mx[:lv_c]} #{@md.title}"
+ else "#{Mx[:lv_o]}1:#{Mx[:lv_c]} [no title provided]"
end
@tuned_file << head
end
@@ -802,12 +804,12 @@ module SiSU_DAL
@tuned_file=[]
data.each do |para|
unless @md.set_heading_seg
- if para !~/^(?:@\S+:|0~\S+|[123]~)/m \
+ if para !~/^(?:#{Rx[:meta]}|#{Mx[:lv_o]}[123]:\S*?#{Mx[:lv_c]})/m \
and para !~/\A\s*\Z/m \
- and para !~/<:p[bn]>/
+ and para !~/#{Mx[:br_page]}|#{Mx[:br_page_new]}/
@md.set_heading_seg=true
- head=if @md.title ; "4~seg [#{@md.title}]"
- else '4~seg [segment]'
+ head=if @md.title ; "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [#{@md.title}]"
+ else "#{Mx[:lv_o]}4:seg#{Mx[:lv_c]} [segment]"
end
@tuned_file << head
end
@@ -825,7 +827,7 @@ module SiSU_DAL
unless @md.set_header_title
if para !~/^%{1,2}\s/m \
and para !~/\A\s*\Z/m
- @tuned_file << "0~title #{@md.heading_seg_first}"
+ @tuned_file << "#{Mx[:meta_o]}title#{Mx[:meta_c]} #{@md.heading_seg_first}"
@md.title=@md.heading_seg_first
@md.set_header_title=true
end
@@ -842,23 +844,23 @@ module SiSU_DAL
data.each do |para|
# manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->
if @md.mod.inspect =~/--no-asterisk|--no-annotate/
- para.gsub!(/~\[[*]\s.+?\]~/,'')
+ para.gsub!(/#{Mx[:en_b_o]}\s.+?#{Mx[:en_b_c]}/,'')
end
if @md.mod.inspect =~/--no-dagger|--no-annotate/
- para.gsub!(/~\[[+]\s.+?\]~/,'')
+ para.gsub!(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'')
end
- unless para =~/^<:code>/
+ unless para =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
case para
# auto-numbered endnotes <!e!> <!e_!> -->
- when /~\{\s+.+?\}~|~\[[*+]\s+.+?\]~/
- para.gsub!(/\s*(\}~|\]~)/,' \1') # required 2003w31
- word_mode=para.scan(/<:group>\n|\n<:group-end>|\S+/m)
+ when /#{Mx[:en_a_o]}\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/
+ para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31
+ word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\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(/<:group>\n|\n<:group-end>|\S+/m)
+ word_mode=para.scan(/#{Mx[:gr_o]}group#{Mx[:gr_c]}\n|\n#{Mx[:gr_o]}group-end#{Mx[:gr_c]}|\S+/m)
word_mode=endnote_call_number(word_mode)
para=word_mode.join(' ')
endnote_ref+=1
@@ -870,19 +872,19 @@ module SiSU_DAL
end
def endnote_call_number(data)
data.each do |word|
- unless data =~/^<:code>/
+ unless data =~/^#{Mx[:gr_o]}code#{Mx[:gr_c]}/
case word
- when /~\{/
- unless word =~/~\{[*+]+/
- word.gsub!(/~\{/,"~\{#{@@endnote_counter} ")
+ when /#{Mx[:en_a_o]}/
+ unless word =~/#{Mx[:en_a_o]}[*+]+/
+ word.gsub!(/#{Mx[:en_a_o]}/,"#{Mx[:en_a_o]}#{@@endnote_counter} ")
@@endnote_counter+=1
end
- when /~\[/
- if word =~/~\[[+]/
- word.gsub!(/~\[[+]/,"~\[\+#{@@endnote_counter_dag} ")
+ when /#{Mx[:en_b_o]}/
+ if word =~/#{Mx[:en_b_o]}[+]/
+ word.gsub!(/#{Mx[:en_b_o]}[+]/,"#{Mx[:en_b_o]}\+#{@@endnote_counter_dag} ")
@@endnote_counter_dag+=1
else
- word.gsub!(/~\[[*]?/,"~\[\*#{@@endnote_counter_asterisk} ")
+ word.gsub!(/#{Mx[:en_b_o]}[*]?/,"#{Mx[:en_b_o]}\*#{@@endnote_counter_asterisk} ")
@@endnote_counter_asterisk+=1
end
when /~\^|<:e>/
@@ -898,106 +900,105 @@ module SiSU_DAL
base_html="#{dir.url.root}/#{@md.fnb}"
ocnm=ocnd=ocnv=0
ocnm+=1
- header0='<:pn>'
- header1="\n1~meta Document Information (metadata) <~0;0:0;m#{ocnm}>"
+ header1="\n#{Mx[:lv_o_1]}meta#{Mx[:lv_c]}Document Information (metadata) #{Mx[:id_o]}~0;0:0;m#{ocnm}#{Mx[:id_c]}"
ocnm+=1
- header4="\n4~metadata Metadata <~0;m#{ocnm};m#{ocnm}>"
+ header4="\n#{Mx[:lv_o_4]}metadata#{Mx[:lv_c]}Metadata #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}"
ocnm+=1; ocnd+=1
- head_no_dc="<~0;m#{ocnm};d#{ocnd}>"
+ head_no_dc="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
ocnm+=1; ocnd+=1
- head_no_dc_tag="<~0;m#{ocnm};d#{ocnd}>"
+ head_no_dc_tag="#{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
data.each do |para|
case para
- when /^0~(title|creator|author|translator|translated_by|illustrator|illustrated_by|prepared_by|digitized_by|description|publisher|contributor|date\.created|date\.issued|date\.available|date\.valid|date\.modified|date|type|format|rights|identifier|source|language)/i
+ when /^#{Mx[:meta_o]}(title|creator|author|translator|translated_by|illustrator|illustrated_by|prepared_by|digitized_by|description|publisher|contributor|date\.created|date\.issued|date\.available|date\.valid|date\.modified|date|type|format|rights|identifier|source|language)#{Mx[:meta_c]}/i
m=$1
ocnm+=1; ocnd+=1
@dc << case para
- when /^0~title/
- "\n#{@tr.dc_title}: <u>#{@md.dc_title}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~(?:creator|author)/
- "\n#{@tr.creator}: <u>#{@md.dc_creator}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /0~(?:translator|translated_by)/
- "\n#{@tr.translator}: <u>#{@md.translator}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~(?:illustrator|illustrated_by)/
- "\n#{@tr.illustrator}: <u>#{@md.illustrator}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~prepared_by/
- "\n#{@tr.prepared_by}: <u>#{@md.prepared_by}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~digitized_by/
- "\n#{@tr.digitized_by}: <u>#{@md.digitized_by}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~description/
- "\n#{@tr.description}: <u>#{@md.dc_description}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~subject/
- "\n#{@tr.subject}: <u>#{@md.dc_subject}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~abstract/
- "\n#{@tr.abstract}: <u>#{@md.dc_abstract}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~publisher/
- "\n#{@tr.publisher}: <u>#{@md.dc_publisher}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~contributor/
- "\n#{@tr.contributor}: <u>#{@md.dc_contributor}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~date.created/
- "\n#{@tr.date_created}: <u>#{@md.dc_date_created}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~date.issued/
- "\n#{@tr.date_issued}: <u>#{@md.dc_date_issued}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~date.available/
- "\n#{@tr.date_available}: <u>#{@md.dc_date_available}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~date.modified/
- "\n#{@tr.date_modified}: <u>#{@md.dc_date_modified}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~date.valid/
- "\n#{@tr.date_valid}: <u>#{@md.dc_date_valid}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~date/
- "\n#{@tr.date}: <u>#{@md.dc_date}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~type/
- "\n#{@tr.type}: <u>#{@md.dc_type}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~format/
- "\n#{@tr.format}: <u>#{@md.dc_format}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~rights/
- "\n#{@tr.rights}: <u>#{@md.dc_rights}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~identifier/
- "\n#{@tr.identifier}: <u>#{@md.dc_identifier}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~source/
- "\n#{@tr.source}: <u>#{@md.dc_source}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~language/
- "\n#{@tr.language}: <u>#{@md.dc_language}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~language.original/
- "\n#{@tr.language_original}: <u>#{@md.language_original}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~relation/
- "\n#{@tr.relation}: <u>#{@md.dc_relation}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~coverage/
- "\n#{@tr.coverage}: <u>#{@md.dc_coverage}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~keywords/
- "\n#{@tr.keywords}: <u>#{@md.keywords}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~comments/
- "\n#{@tr.comments}: <u>#{@md.comments}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~cls_loc/
- "\n#{@cls_dewey}: <u>#{@md.cls_dewey}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~cls_dewey/
- "\n#{@tr.cls_dewey}: <u>#{@md.cls_dewey}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~cls_gutenberg|0~cls_pg/
- "\n#{@tr.cls_gutenberg}: <u>#{@md.cls_gutenberg}</u> <~0;m#{ocnm};d#{ocnd}>"
- #"\n#{@tr.cls_gutenberg}: <u>#{@md.cls_pg}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~cls_isbn/
- "\n#{@tr.cls_isbn}: <u>#{@md.cls_isbn}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~prefix(?:_a)?/
- "\n#{@tr.prefix_a}: <u>#{@md.prefix_a}</u> <~0;m#{ocnm};d#{ocnd}>"
- when /^0~prefix_b/
- "\n#{@tr.prefix_b}: <u>#{@md.prefix_b}</u> <~0;m#{ocnm};d#{ocnd}>"
- else para.gsub(/^0~(#{m})\s+(.+)/m,"\n#{m.capitalize}: <u>\\2</u> <~0;m#{ocnm};d#{ocnd}>")
+ when /^#{Mx[:meta_o]}title#{Mx[:meta_c]}/
+ "\n#{@tr.dc_title}: #{Mx[:fa_underscore_o]}#{@md.dc_title}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}(?:creator|author)#{Mx[:meta_c]}/
+ "\n#{@tr.creator}: #{Mx[:fa_underscore_o]}#{@md.dc_creator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /#{Mx[:meta_o]}(?:translator|translated_by)#{Mx[:meta_c]}/
+ "\n#{@tr.translator}: #{Mx[:fa_underscore_o]}#{@md.translator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}(?:illustrator|illustrated_by)#{Mx[:meta_c]}/
+ "\n#{@tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.illustrator}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}prepared_by#{Mx[:meta_c]}/
+ "\n#{@tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.prepared_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}digitized_by#{Mx[:meta_c]}/
+ "\n#{@tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.digitized_by}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}description#{Mx[:meta_c]}/
+ "\n#{@tr.description}: #{Mx[:fa_underscore_o]}#{@md.dc_description}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}subject#{Mx[:meta_c]}/
+ "\n#{@tr.subject}: #{Mx[:fa_underscore_o]}#{@md.dc_subject}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}abstract#{Mx[:meta_c]}/
+ "\n#{@tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.dc_abstract}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}publisher#{Mx[:meta_c]}/
+ "\n#{@tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.dc_publisher}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}contributor#{Mx[:meta_c]}/
+ "\n#{@tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.dc_contributor}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}date.created#{Mx[:meta_c]}/
+ "\n#{@tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.dc_date_created}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}date.issued#{Mx[:meta_c]}/
+ "\n#{@tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.dc_date_issued}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}date.available#{Mx[:meta_c]}/
+ "\n#{@tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.dc_date_available}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}date.modified#{Mx[:meta_c]}/
+ "\n#{@tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.dc_date_modified}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}date.valid#{Mx[:meta_c]}/
+ "\n#{@tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.dc_date_valid}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}date#{Mx[:meta_c]}/
+ "\n#{@tr.date}: #{Mx[:fa_underscore_o]}#{@md.dc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}type#{Mx[:meta_c]}/
+ "\n#{@tr.type}: #{Mx[:fa_underscore_o]}#{@md.dc_type}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}format#{Mx[:meta_c]}/
+ "\n#{@tr.format}: #{Mx[:fa_underscore_o]}#{@md.dc_format}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}rights#{Mx[:meta_c]}/
+ "\n#{@tr.rights}: #{Mx[:fa_underscore_o]}#{@md.dc_rights}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}identifier#{Mx[:meta_c]}/
+ "\n#{@tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.dc_identifier}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}source#{Mx[:meta_c]}/
+ "\n#{@tr.source}: #{Mx[:fa_underscore_o]}#{@md.dc_source}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}language#{Mx[:meta_c]}/
+ "\n#{@tr.language}: #{Mx[:fa_underscore_o]}#{@md.dc_language}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}language.original#{Mx[:meta_c]}/
+ "\n#{@tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.language_original}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}relation#{Mx[:meta_c]}/
+ "\n#{@tr.relation}: #{Mx[:fa_underscore_o]}#{@md.dc_relation}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}coverage#{Mx[:meta_c]}/
+ "\n#{@tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.dc_coverage}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}keywords#{Mx[:meta_c]}/
+ "\n#{@tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.keywords}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}comments#{Mx[:meta_c]}/
+ "\n#{@tr.comments}: #{Mx[:fa_underscore_o]}#{@md.comments}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}cls_loc#{Mx[:meta_c]}/
+ "\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}cls_dewey#{Mx[:meta_c]}/
+ "\n#{@tr.cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.cls_dewey}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}(?:cls_gutenberg|cls_pg)#{Mx[:meta_c]}/
+ "\n#{@tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.cls_gutenberg}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ #"\n#{@tr.cls_gutenberg}: <u>#{@md.cls_pg}</u> #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}cls_isbn#{Mx[:meta_c]}/
+ "\n#{@tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.cls_isbn}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}prefix(?:_a)?#{Mx[:meta_c]}/
+ "\n#{@tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.prefix_a}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ when /^#{Mx[:meta_o]}prefix_b#{Mx[:meta_c]}/
+ "\n#{@tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.prefix_b}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}"
+ else para.gsub(/^#{Mx[:meta_o]}(#{m})\s+(.+)/m,"\n#{m.capitalize}: #{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};d#{ocnd}#{Mx[:id_c]}")
end
end
end
ocnm+=1; ocnv+=1
- head_no_rc="<~0;m#{ocnm};v#{ocnv}>"
+ head_no_rc="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
- head_no_rc_tag="<~0;m#{ocnm};v#{ocnv}>"
+ head_no_rc_tag="#{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
data.each do |para|
case para
when /^0~(?:cvs|rcs)\+\s+/ #note the + sign to turn on use of cvs id
ocnm+=1; ocnv+=1
- @cvs << "#{@tr.sc_number}: <u>#{@md.sc_number}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @cvs << "#{@tr.sc_number}: #{Mx[:fa_underscore_o]}#{@md.sc_number}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
- @cvs << "#{@tr.sc_date}: <u>#{@md.sc_date}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @cvs << "#{@tr.sc_date}: #{Mx[:fa_underscore_o]}#{@md.sc_date}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
- @cvs << "CVS/RCS time: <u>#{@md.sc_time}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @cvs << "CVS/RCS time: #{Mx[:fa_underscore_o]}#{@md.sc_time}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
when /^0~cvs[+\s]/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP
when /^0~cvs\s+/ #enable pattern above instead if you wish the default to be to include cvs tags from all documents KEEP
@@ -1007,47 +1008,45 @@ module SiSU_DAL
ocnm+=1; ocnv+=1
if @md.sc_filename \
and @md.sc_filename.length > 3
- @rc << "#{@tr.sourcefile}: <u>#{@md.sc_filename}</u> <~0;m#{ocnm};v#{ocnv}>"
- else @rc << "#{@tr.sourcefile}: <u>#{@md.fns}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.sc_filename}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
+ else @rc << "#{@tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
end
ocnm+=1; ocnv+=1
if @md.file_encoding \
and @md.file_encoding.length > 3 #translate
- @rc << "Filetype: <u>#{@md.file_encoding}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @rc << "Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
end
ocnm+=1; ocnv+=1
if @md.dgst #change. enable by default
- @rc << "#{@tr.sourcefile_digest}, #{@md.dgst[0]} <u>#{@md.dgst[1]}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @rc << "#{@tr.sourcefile_digest}, #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
end
if @md.dgst_skin #change. enable by default
- @rc << "Skin_Digest: #{@md.dgst_skin[0]} <u>#{@md.dgst_skin[1]}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @rc << "Skin_Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
end
- @rc << "<b>Generated</b> #{head_no_rc}" if @rc.length > 0
- @rc << "#{@tr.last_generated}: <u>#{Time.now}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @rc << "#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0
+ @rc << "#{@tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
if @md.sisu_version[:version]
- @rc << "#{@tr.sisu_version}: <u>#{@md.sisu_version[:project]}</u> <u>#{@md.sisu_version[:version]}</u> of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]}) <~0;m#{ocnm};v#{ocnv}>"
+ @rc << "#{@tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]}) #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
ocnm+=1; ocnv+=1
end
- @rc << "#{@tr.ruby_version}: <u> #{@md.ruby_version}</u> <~0;m#{ocnm};v#{ocnv}>"
+ @rc << "#{@tr.ruby_version}: #{Mx[:fa_underscore_o]} #{@md.ruby_version}#{Mx[:fa_underscore_c]} #{Mx[:id_o]}~0;m#{ocnm};v#{ocnv}#{Mx[:id_c]}"
end
- meta << header0
- meta << header1
- meta << header4
- meta << "Document Manifest @\n #{base_html}/#{@md.fn[:manifest]} <~0;m#{ocnm};m#{ocnm}>"
- meta << "<b>Dublin Core</b> (DC) #{head_no_dc}" if @dc.length > 0
- meta << "<i>DC tags included with this document are provided here.</i> #{head_no_dc_tag}" if @dc.length > 0
+ meta << Mx[:br_page_new] << header1 << header4
+ meta << "Document Manifest @\n #{base_html}/#{@md.fn[:manifest]} #{Mx[:id_o]}~0;m#{ocnm};m#{ocnm}#{Mx[:id_c]}"
+ meta << "#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC) #{head_no_dc}" if @dc.length > 0
+ meta << "#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]} #{head_no_dc_tag}" if @dc.length > 0
@dc.each { |x| meta << x }
- meta << "<b>Version Information</b> #{head_no_rc}" if @rc.length > 0
+ meta << "#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]} #{head_no_rc}" if @rc.length > 0
if @cvs.length > 0
- meta << "<i>Note the version information provided here, is specific to the host site.</i> #{head_no_rc_tag}"
+ meta << "#{Mx[:fa_italics_o]}Note the version information provided here, is specific to the host site.#{Mx[:fa_italics_c]} #{head_no_rc_tag}"
@cvs.each { |x| meta << x }
end
@rc.each { |x| meta << x }
## ENDNOTE RELATED endnote related
- meta << "\n<EOF>"
+ meta << "\n#{Mx[:br_eof]}"
meta=object_digest(meta)
end
def stamped(para,hash_class)
@@ -1056,23 +1055,23 @@ module SiSU_DAL
digest_all=hash_class.hexdigest(para) # print "#{hash_class.name}: "; puts digest_all #length==32 or 64
stripped=strip_clean_of_markup(para)
digest_strip=hash_class.hexdigest(stripped)
- unless para =~/<:code>/
+ unless para =~/#{Mx[:fa_o]}code#{Mx[:fa_c]}/
case para
- when /~\{[\d*+]+\s+.+?\}~|~\[[*+]\d+\s+.+?\]~/m
+ when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m
en_and_para,en_and_para_digest=[],[]
- 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]
+ para.gsub!(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,' \1') #watch
+ para_plus_en=para.scan(/.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/m)
+ para_tail=if para =~/(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+([\s\S]+)/m
+ /(?:.*?#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|.*?#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})+(.+?#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]})/m.match(para)[1]
else ''
end
para_plus_en << para_tail
en_and_para_digest << endnote_digest(para_plus_en)
para_new=en_and_para_digest.join(' ')
- @tuned << para_new + '<' + digest_strip + ':' + digest_all + '>' unless para.nil?
- else @tuned << para + '<' + digest_strip + ':' + digest_all + '>' unless para.nil?
+ @tuned << para_new + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil?
+ else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil?
end
- else @tuned << para + '<' + digest_strip + ':' + digest_all + '>' unless para.nil?
+ else @tuned << para + Mx[:id_o] + digest_strip + ':' + digest_all + Mx[:id_c] unless para.nil?
end
@tuned.join
end
@@ -1088,7 +1087,8 @@ module SiSU_DAL
data.compact!
data.each do |para|
para.strip!
- if para=~/<~\d+;(?:\w|[0-6]:)\d+;\w\d+>/
+ if para=~/#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}/ \
+ and para !~/#{Rx[:meta]}/ #test should not be necessary remove
if @env.digest.type =~/sha256/
for hash_class in [ Digest::SHA256 ]
@tuned_file << stamped(para,hash_class)
@@ -1108,16 +1108,16 @@ module SiSU_DAL
para_bit=[]
data.each do |en_plus|
para_bit <<= case en_plus
- when /~\{|~\[/
- if en_plus =~/~\{.+?\}~|~\[.+?\]~/
- para_txt,en_open,en_txt,en_close=/(.*?)(~\{|~\[)(.+?)(\}~|\]~)/m.match(en_plus)[1..4]
+ when /#{Mx[:en_a_o]}|#{Mx[:en_b_o]}/
+ if en_plus =~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/
+ para_txt,en_open,en_txt,en_close=/(.*?)(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m.match(en_plus)[1..4]
stripped_en=strip_clean_of_markup(en_txt)
digest_en_strip=if @env.digest.type =~/sha256/
Digest::SHA256.hexdigest(stripped_en)
else
Digest::MD5.hexdigest(stripped_en)
end
- para_txt + en_open + en_txt + '<' + digest_en_strip + '>' + en_close
+ para_txt + en_open + en_txt + Mx[:id_o] + digest_en_strip + Mx[:id_c] + en_close
else puts "Error Exception - problem encountered with:\n#{en_plus}" #arbitrary exception, tidy up
end
else en_plus
@@ -1131,12 +1131,13 @@ module SiSU_DAL
s=s.gsub(/ [ ]+/,' ')
s=s.gsub(/^ [ ]+/,'')
s=s.gsub(/ [ ]+$/,'')
- s=s.gsub(/(<\/[bi]>')[ ]+(s )/,'\1\2')
+ s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
+ s=s.gsub(/((?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})')[ ]+(s )/,'\1\2')
end
def strip_clean_of_markup(s) # used for digest, define rules, make same as in db clean
#consider: <\/?[ib]>|<(?:\/ )?br>|<del>(.+?)<\/del>
s=s.dup
- s=s.gsub(/(?:<\/?[ib]>|<~\d+;(?:\w|[0-6]:)\d+;\w\d+>|<#@dp:#@dp>|^[1-6]~\S+|~\{\d+\s.+?\}~)/m,'') # markup and endnotes removed
+ s=s.gsub(/(?:<\/?[ib]>|#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}|#{Mx[:id_o]}#@dp:#@dp#{Mx[:id_c]}|^#{Mx[:lv_o]}[1-6]:\S+?#{Mx[:lv_c]}|#{Mx[:en_a_o]}\d+\s.+?#{Mx[:en_a_c]})/m,'') # markup and endnotes removed
#% same as db clean -->
s=s.gsub(/<del>(.+?)<\/del>/,'DELETED(\1)') # deletions
s=s.gsub(/<sup>(\d+)<\/sup>/,'[\1]')