aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/po4a.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3/po4a.rb')
-rw-r--r--lib/sisu/v3/po4a.rb246
1 files changed, 124 insertions, 122 deletions
diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb
index 0a5886ff..adb977c2 100644
--- a/lib/sisu/v3/po4a.rb
+++ b/lib/sisu/v3/po4a.rb
@@ -57,7 +57,7 @@
linefeed)
=end
-module SiSU_po4a
+module SiSU_Po4a
require_relative 'dal' # dal.rb
require_relative 'sysenv' # sysenv.rb
include SiSU_Env
@@ -74,7 +74,7 @@ module SiSU_po4a
# puts "#{@opt.fns} not a processed file type"
#end
r=Px[:lng_lst].join('|')
- r.gsub!(/\|en\|/,'|')
+ r=r.gsub(/\|en\|/,'|')
@lang_regx=%r{(?:#{r})}
if opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \
and opt.f_pth[:lng]!=opt.lng_base
@@ -93,14 +93,14 @@ module SiSU_po4a
src[:pth]=@opt.f_pth[:pth]
src[:files]=if @opt.fns =~ /\.(?:(?:-|ssm\.)sst|ssm)$/
@opt.fns=@opt.fns.gsub(/\.ssm\.sst$/,'.ssm')
- SiSU_Assemble::Composite_file_list.new(@opt).read
+ SiSU_Assemble::CompositeFileList.new(@opt).read
else
[@opt.fns]
end
md=SiSU_Param::Parameters.new(@opt).get
src[:files].each do |fn|
SiSU_DAL::Source.new(@opt,fn).read # -m
- env=SiSU_Env::Info_env.new(@opt.fns)
+ env=SiSU_Env::InfoEnv.new(@opt.fns)
m=/((.+?)(?:\~\w\w(?:_\w\w)?)?)\.((?:-|ssm\.)?sst|ssm|ssi)$/ #watch added match for sss
@fnn,@fnb,@fnt=fn[m,1],fn[m,2],fn[m,3]
unless @opt.cmd =~/q/
@@ -149,10 +149,10 @@ module SiSU_po4a
env.plaintext_wrap
else 78
end
- SiSU_po4a::Source::Scroll.new(fn,@dal_array_lang_src,@dal_array_lang_translation,@@md_src,@@md_trn,wrap_width).songsheet
- SiSU_Env::Info_skin.new(md).select #watch
+ SiSU_Po4a::Source::Scroll.new(fn,@dal_array_lang_src,@dal_array_lang_translation,@@md_src,@@md_trn,wrap_width).songsheet
+ SiSU_Env::InfoSkin.new(md).select #watch
end
- rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error
+ rescue; SiSU_Errors::InfoError.new($!,$@,@opt.cmd,@opt.fns).error
ensure
end
end
@@ -160,7 +160,7 @@ module SiSU_po4a
class Scroll <Source
require_relative 'defaults' # defaults.rb
require_relative 'po4a_set' # po4a_set.rb
- include SiSU_po4a_utils
+ include SiSU_Po4aUtils
@@endnotes={ para: [], end: [] }
def initialize(fn,data_src,data_trn,md_src,md_trn,wrap_width)
@fn,@data_src,@data_trn,@md_src,@md_trn,@wrap_width=fn,data_src,data_trn,md_src,md_trn,wrap_width
@@ -168,7 +168,7 @@ module SiSU_po4a
? md_src
: md_trn
@brace_url=SiSU_Viz::Skin.new.url_decoration
- @vz=SiSU_Env::Get_init.instance.skin
+ @vz=SiSU_Env::GetInit.instance.skin
@tab="\t"
@@endnotes_=(@md.opt.mod.inspect =~/--endnote/) ? true : false # --footnote
@br=(@md.opt.mod.inspect =~/--dos/) ? "\r\n" : "\n" # --unix
@@ -187,9 +187,9 @@ module SiSU_po4a
@n=[]
notes_a.flatten.each do |n| #high cost to deal with <br> appropriately within plaintext, consider
n=n.dup.to_s
- n.gsub!(/^([\d]+)\s+/,'^~\1 ')
- #n.gsub!(/^([\d*+]+)\s+/,'^~\1 ')
- n.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>')
+ n=n.gsub(/^([\d]+)\s+/,'^~\1 ').
+ #gsub(/^([\d*+]+)\s+/,'^~\1 ').
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br>')
@n << n
end
notes_a=@n.flatten
@@ -219,13 +219,13 @@ module SiSU_po4a
end
util=pot_structure(desc,orig,trans)
wrap=util.line_wrap
- if wrap =~ /^\s*\^~[\d*+]+\s+.+?\s*\Z/m
- wrap.gsub!(/^\s*(\^~[\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
+ wrap=if wrap =~ /^\s*\^~[\d*+]+\s+.+?\s*\Z/m
+ wrap.gsub(/^\s*(\^~[\d*+]+)\s+(.+?)\s*\Z/m, <<GSUB
\\1 \\2
GSUB
)
else
- wrap.gsub!(/^(.+)\Z/m, <<GSUB
+ wrap.gsub(/^(.+)\Z/m, <<GSUB
\\1
GSUB
)
@@ -239,11 +239,11 @@ GSUB
end
def pot_metadata_src
@po4a_identify_type='type: SiSU doc' #'type: Plain text'
- meta_src=Metadata::Summary.new(@md_src)
+ meta_src=SiSU_Metadata::Summary.new(@md_src)
w=[]
w << [
"#. #{@po4a_identify_type} - metadata: title",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.title.main,
meta_src.metadata_tags.title.sub,
@@ -256,7 +256,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: creator",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.creator.head,
meta_src.metadata_tags.creator.author,
@@ -271,7 +271,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: rights",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.rights.head,
meta_src.metadata_tags.rights.copyright.text,
@@ -285,7 +285,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: classify",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.classify.head,
meta_src.metadata_tags.classify.relation,
@@ -301,7 +301,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: date",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.date.head,
meta_src.metadata_tags.date.added_to_site,
@@ -315,7 +315,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - processing, make instruction",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.processing_tags.make.language,
meta_src.processing_tags.make.headings,
@@ -344,12 +344,12 @@ GSUB
def pot_metadata_src_trn
@po4a_identify_type='type: SiSU doc'
#@po4a_identify_type='type: Plain text'
- meta_src=Metadata::Summary.new(@md_src)
- meta_trn=Metadata::Summary.new(@md_trn)
+ meta_src=SiSU_Metadata::Summary.new(@md_src)
+ meta_trn=SiSU_Metadata::Summary.new(@md_trn)
w=[]
w << [
"#. #{@po4a_identify_type} - metadata: title",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.title.main,
meta_src.metadata_tags.title.sub,
@@ -369,7 +369,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: creator",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.creator.head,
meta_src.metadata_tags.creator.author,
@@ -393,7 +393,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: rights",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.rights.head,
meta_src.metadata_tags.rights.copyright.text,
@@ -415,7 +415,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: classify",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.classify.head,
meta_src.metadata_tags.classify.relation,
@@ -441,7 +441,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - metadata: date",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.metadata_tags.date.head,
meta_src.metadata_tags.date.added_to_site,
@@ -463,7 +463,7 @@ GSUB
]
w << [
"#. #{@po4a_identify_type} - processing, make instruction",
- "#: en/#{@md.fns}:#{SiSU_po4a_utils::Pot_number.new.num}",
+ "#: en/#{@md.fns}:#{SiSU_Po4aUtils::PotNumber.new.num}",
'msgid ""',
meta_src.processing_tags.make.language,
meta_src.processing_tags.make.headings,
@@ -499,7 +499,7 @@ GSUB
end
end
def pot_structure(desc,orig,trans,indent=0,hang=0)
- SiSU_po4a_utils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent,hang)
+ SiSU_Po4aUtils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent,hang)
end
def pot_structure_heading(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
lv=n=n3=nil
@@ -509,7 +509,7 @@ GSUB
util=nil
fn=(dob_src.name=~/[a-z\d]/i) ? dob_src.name : ''
mark="#{dob_src.lv}~#{fn} "
- d="#{dob_src.is} (level #{dob_src.lv})"
+ d="#{dob_src.is.to_s} (level #{dob_src.lv})"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for headings is marker at the start of the line/object, indicating the heading level, and if provided an associated name tag, this heading is "#{mark}"}
@@ -538,7 +538,7 @@ GSUB
s_mark=desc=orig=trans=''
if dob_src.bullet_
mark="_#{dob_src.indent}* "
- d="#{dob_src.is}: indent #{dob_src.indent}, bullet"
+ d="#{dob_src.is.to_s}: indent #{dob_src.indent}, bullet"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented bullet text is at the start of the line/object, an underscore followed by the indent level and an asterisk "#{mark}"}
@@ -547,7 +547,7 @@ GSUB
desc="#{d}#{s_mark}#{instruct}"
else
mark="_#{dob_src.indent} "
- d="#{dob_src.is}: indent #{dob_src.indent}"
+ d="#{dob_src.is.to_s}: indent #{dob_src.indent}"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by the indent level "#{mark}"}
@@ -562,7 +562,7 @@ GSUB
and dob_src.indent != dob_src.hang
s_mark=desc=orig=trans=''
mark="_#{dob_src.hang}_#{dob_src.indent} "
- d="#{dob_src.is}: hang #{dob_src.hang} indent #{dob_src.indent}"
+ d="#{dob_src.is.to_s}: hang #{dob_src.hang} indent #{dob_src.indent}"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented text with a first line indented to a different level from the rest of the paragraph, is at the start of the line/object, an underscore and the first indent level a second underscore and the indent level for the rest of the paragraph, "#{mark1}"}
@@ -576,7 +576,7 @@ GSUB
s_mark=desc=orig=trans=''
if dob_src.bullet_
mark='_* '
- d="#{dob_src.is}: bullet"
+ d="#{dob_src.is.to_s}: bullet"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by an asterisk "#{mark}"}
@@ -587,7 +587,7 @@ GSUB
trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}"
else
mark=''
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=%{\n# regular paragraph, no special markup}
if @md.opt.cmd=~/M/
instruct="\n# "
@@ -613,7 +613,7 @@ GSUB
end
def pot_structure_block(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="block{\\n\\n...\\n\\n}block"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# block text is a text block with an opening and closing marker, the content of which may be wrapped"
@@ -628,7 +628,7 @@ GSUB
end
def pot_structure_group(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="group{\\n\\n...\\n\\n}group"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# group text is a text block with an opening and closing marker, the content of which may be wrapped"
@@ -643,7 +643,7 @@ GSUB
end
def pot_structure_verse(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="poem{\n\nverse\n\nverse\n\n...\n\n}poem"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# verse are part of the text block described as a poem, the first verse is preceeded by an opening marker, and the last verse by a closing marker, the content of which should remain unwrapped"
@@ -658,7 +658,7 @@ GSUB
end
def pot_structure_code(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="code{\\n\\n...\\n\\n}code"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# codeblocks are a text block with an opening and closing marker, the content of which should remain unwrapped"
@@ -673,7 +673,7 @@ GSUB
end
def pot_structure_table(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="table{\\n\\n...\\n\\n}table"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# tables are a text block with an opening and closing marker, the content of which should remain unwrapped"
@@ -681,9 +681,9 @@ GSUB
end
desc="#{d}#{s_mark}#{instruct}"
orig=dob_src.obj
- orig.gsub!(/#{Mx[:tc_c]}/,"\n")
+ orig=orig.gsub(/#{Mx[:tc_c]}/,"\n")
trans=(dob_trn=='') ? '' : dob_trn.obj
- trans.gsub!(/#{Mx[:tc_c]}/,"\n")
+ trans=trans.gsub(/#{Mx[:tc_c]}/,"\n")
util=pot_structure(desc,orig,trans)
unwrapped=util.no_line_wrap_block
@pot[:body] << unwrapped << @br
@@ -729,22 +729,22 @@ GSUB
and data_trn[t]
break
end
- if data_src[s].of == 'comment' \
- and data_trn[t].of == 'comment' \
+ if data_src[s].of == :comment \
+ and data_trn[t].of == :comment \
and (data_src[s].is == data_trn[t].is)
s+=1;t+=1
next
end
- if (data_src[s].is == 'comment' or data_trn[t].is == 'comment') \
+ if (data_src[s].is == :comment or data_trn[t].is == :comment) \
and (data_src[s].is != data_trn[t].is)
- if data_src[s].is == 'comment'
+ if data_src[s].is == :comment
puts "src (comment):\n\t" + data_src[s].obj if @md.opt.cmd =~/M/
s+=1
- #next if data_src[s].is == 'comment'
- elsif data_trn[t].is == 'comment'
+ #next if data_src[s].is == :comment
+ elsif data_trn[t].is == :comment
puts "trans (comment):\n\t" + data_trn[t].obj if @md.opt.cmd =~/M/
t+=1
- #next if data_trn[t].is == 'comment'
+ #next if data_trn[t].is == :comment
end
end
if (defined? data_src[s].ocn and data_src[s].ocn.class == Fixnum) \
@@ -811,16 +811,16 @@ GSUB
if defined? dob_src.ocn \
and dob_src.ocn.to_s =~/\d+/
paranum=dob_src.ocn.to_s
- @p_num=SiSU_po4a_utils::Paragraph_number.new(paranum)
+ @p_num=SiSU_Po4aUtils::ParagraphNumber.new(paranum)
end
case dob_src.is
- when 'heading'; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t)
- when 'para'; pot_structure_para(dob_src,notes_s,dob_trn,notes_t)
- when 'group'; pot_structure_group(dob_src,notes_s,dob_trn,notes_t)
- when 'block'; pot_structure_block(dob_src,notes_s,dob_trn,notes_t)
- when 'verse'; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t)
- when 'code'; pot_structure_code(dob_src,notes_s,dob_trn,notes_t)
- when 'table'; pot_structure_table(dob_src,notes_s,dob_trn,notes_t)
+ when :heading; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t)
+ when :para; pot_structure_para(dob_src,notes_s,dob_trn,notes_t)
+ when :group; pot_structure_group(dob_src,notes_s,dob_trn,notes_t)
+ when :block; pot_structure_block(dob_src,notes_s,dob_trn,notes_t)
+ when :verse; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t)
+ when :code; pot_structure_code(dob_src,notes_s,dob_trn,notes_t)
+ when :table; pot_structure_table(dob_src,notes_s,dob_trn,notes_t)
end
if defined? dob_src.idx \
and not dob_src.idx.nil? \
@@ -829,79 +829,81 @@ GSUB
end
dob_src='' if (dob_src.obj =~/<a name="n\d+">/ \
and dob_src.obj =~/^(-\{{2}~\d+|<!e[:_]\d+!>)/) # -endnote
- dob_src.obj.gsub!(/<!.+!>/,' ') if dob_src ## Clean Prepared Text
- dob_src.obj.gsub!(/<:\S+>/,' ') if dob_src ## Clean Prepared Text
+ if dob_src ## Clean Prepared Text
+ dob_src.obj=dob_src.obj.gsub(/<!.+!>/,' ').
+ gsub(/<:\S+>/,' ') if dob_src ## Clean Prepared Text
+ end
end
#[dob_src,dob_trn]
end
def markup(dob) # Used for major markup instructions
- dir=SiSU_Env::Info_env.new(@md.fns)
+ dir=SiSU_Env::InfoEnv.new(@md.fns)
fix=[]
- dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
- "#{Px[:po_bold_o]}\\1#{Px[:po_bold_c]}")
- dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
- "#{Px[:po_italics_o]}\\1#{Px[:po_italics_c]}")
- dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
- "#{Px[:po_underscore_o]}\\1#{Px[:po_underscore_c]}")
- dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
- "#{Px[:po_subscript_o]}\\1#{Px[:po_subscript_c]}")
- dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
- "#{Px[:po_superscript_o]}\\1#{Px[:po_superscript_c]}")
- dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
- "#{Px[:po_insert_o]}\\1#{Px[:po_insert_c]}")
- dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
- "#{Px[:po_cite_o]}\\1#{Px[:po_cite_c]}")
- dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
- "#{Px[:po_strike_o]}\\1#{Px[:po_strike_c]}")
- dob.obj.gsub!(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
- "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}")
+ dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,
+ "#{Px[:po_bold_o]}\\1#{Px[:po_bold_c]}").
+ gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,
+ "#{Px[:po_italics_o]}\\1#{Px[:po_italics_c]}").
+ gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,
+ "#{Px[:po_underscore_o]}\\1#{Px[:po_underscore_c]}").
+ gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,
+ "#{Px[:po_subscript_o]}\\1#{Px[:po_subscript_c]}").
+ gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,
+ "#{Px[:po_superscript_o]}\\1#{Px[:po_superscript_c]}").
+ gsub(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,
+ "#{Px[:po_insert_o]}\\1#{Px[:po_insert_c]}").
+ gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,
+ "#{Px[:po_cite_o]}\\1#{Px[:po_cite_c]}").
+ gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,
+ "#{Px[:po_strike_o]}\\1#{Px[:po_strike_c]}").
+ gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
+ "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}")
notes=''
- unless dob.is=='code'
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1')
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]')
- dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]')
- dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1')
+ unless dob.is==:code
+ dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
+ gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}image/,'\1 [link: local image]').
+ gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1')
#dob.obj.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,"#{@brace_url.txt_open}\\1#{@brace_url.txt_close}")
notes=extract_endnotes(dob)
#% ### footnotes current state - extracted
- dob.obj.gsub!(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^') # endnote marker marked up
+ dob.obj=dob.obj.gsub(/#{Mx[:en_a_o]}([\d]+)\s+(?:.+?)#{Mx[:en_a_c]}/,'~^'). # endnote marker marked up
#% ### footnotes current state - keep inline
#dob.obj.gsub!(/#{Mx[:en_a_o]}[\d]+\s+(.+?)#{Mx[:en_a_c]}/,'~{ \1 }~') # inline endnote with marker marked up
- dob.obj.gsub!(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,'~[ \1 ]~') # inline endnote with marker marked up
- dob.obj.gsub!(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,'~{\1 \2 }~') # inline endnote with marker marked up
- dob.obj.gsub!(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,'~[\1 \2 ]~') # inline endnote with marker marked up
- dob.obj.gsub!(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<')
- dob.obj.gsub!(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>')
- dob.obj.gsub!(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&')
- dob.obj.gsub!(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!')
- dob.obj.gsub!(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#')
- dob.obj.gsub!(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*')
- dob.obj.gsub!(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-')
- dob.obj.gsub!(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/')
- dob.obj.gsub!(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_')
- dob.obj.gsub!(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{')
- dob.obj.gsub!(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}')
- dob.obj.gsub!(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~')
- dob.obj.gsub!(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
+ gsub(/#{Mx[:en_b_o]}[\d]+\s+(.+?)#{Mx[:en_b_c]}/,'~[ \1 ]~'). # inline endnote with marker marked up
+ gsub(/#{Mx[:en_a_o]}([*+]+)\s+(.+?)#{Mx[:en_a_c]}/,'~{\1 \2 }~'). # inline endnote with marker marked up
+ gsub(/#{Mx[:en_b_o]}([*+]+)\s+(.+?)#{Mx[:en_b_c]}/,'~[\1 \2 ]~'). # inline endnote with marker marked up
+ gsub(/#{Mx[:gl_o]}(?:#lt|#060)#{Mx[:gl_c]}/,'<').
+ gsub(/#{Mx[:gl_o]}(?:#gt|#062)#{Mx[:gl_c]}/,'>').
+ gsub(/#{Mx[:gl_o]}#(?:038|amp)#{Mx[:gl_c]}/,'&').
+ gsub(/#{Mx[:gl_o]}#033#{Mx[:gl_c]}/,'!').
+ gsub(/#{Mx[:gl_o]}#035#{Mx[:gl_c]}/,'#').
+ gsub(/#{Mx[:gl_o]}#042#{Mx[:gl_c]}/,'*').
+ gsub(/#{Mx[:gl_o]}#045#{Mx[:gl_c]}/,'-').
+ gsub(/#{Mx[:gl_o]}#047#{Mx[:gl_c]}/,'/').
+ gsub(/#{Mx[:gl_o]}#095#{Mx[:gl_c]}/,'_').
+ gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
+ gsub(/#{Mx[:gl_o]}#125#{Mx[:gl_c]}/,'}').
+ gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
+ gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
end
- if dob.of=='block' # watch
- dob.obj.gsub!(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ")
- dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
- else dob.obj.gsub!(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
+ dob.obj=if dob.of==:block # watch
+ dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ").
+ gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
+ else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
end
- if dob.is=='code'
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _<
- dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_<
+ if dob.is==:code
+ dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
+ gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
end
- dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks
- dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1')
- dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1')
- dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links
- dob.obj.gsub!(/&nbsp;|#{Mx[:nbsp]}/,' ') # decide on
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]")
- dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
+ dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,''). # remove page breaks
+ gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
+ gsub(/<a href=".+?">(.+?)<\/a>/m,'\1').
+ gsub(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,''). # remove name links
+ gsub(/&nbsp;|#{Mx[:nbsp]}/,' '). # decide on
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]'). #"[ #{dir.url.images_local}\/\\1 ]")
+ gsub(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]')
[dob,notes]
end
def publish(fn,pot)
@@ -921,7 +923,7 @@ GSUB
include SiSU_Env
def initialize(fn,content,md)
@fn,@content,@md=fn,content,md
- @file=SiSU_Env::SiSU_file.new(md,fn)
+ @file=SiSU_Env::FileOp.new(md,fn)
end
def po4a #%pot output
file_pot=(@md.opt.f_pth[:lng] ==opt.lng_base) \
@@ -934,8 +936,8 @@ GSUB
and para.length > 0
para.each do |line|
if line
- line.gsub!(/\s+$/m,'')
- line.gsub!(/^\A[ ]*\Z/m,'')
+ line=line.gsub(/\s+$/m,'').
+ gsub(/^\A[ ]*\Z/m,'')
if line=~/^\A[ ]*\Z/m
emptyline+=1
else emptyline=0
@@ -947,7 +949,7 @@ GSUB
end
end
file_pot.close
- SiSU_po4a_utils::Pot_number.new.reset
+ SiSU_Po4aUtils::PotNumber.new.reset
po4a_git
end
def po4a_git