aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/po4a.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
committerRalph Amissah <ralph@amissah.com>2013-10-23 23:40:45 -0400
commitedd89902036bde18c91031470e19c871a182cf6d (patch)
tree1269e7b1660aa64896fc21768002e837233c2c24 /lib/sisu/v5/po4a.rb
parentv4 v5: version & changelog (diff)
v5: options & downstream, more use of opt.act instead of opt.cmd
* opt.act.*.set==:on instead of opt.cmd =~/\S/
Diffstat (limited to 'lib/sisu/v5/po4a.rb')
-rw-r--r--lib/sisu/v5/po4a.rb52
1 files changed, 30 insertions, 22 deletions
diff --git a/lib/sisu/v5/po4a.rb b/lib/sisu/v5/po4a.rb
index d1106c7b..64f2c18d 100644
--- a/lib/sisu/v5/po4a.rb
+++ b/lib/sisu/v5/po4a.rb
@@ -105,15 +105,23 @@ module SiSU_Po4a
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/
+ unless @opt.act[:quiet][:set]==:on
path=env.path.output_tell
- tool=(@opt.cmd =~/[MVv]/) \
+ tool=(@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on) \
? "#{env.program.text_editor} #{path}/#{md.fnb}/#{md.fn[:plain]}"
: @opt.fns
- @opt.cmd=~/[MVvz]/ \
- ? SiSU_Screen::Ansi.new(@opt.cmd,'Pot po4a',tool).green_hi_blue
- : SiSU_Screen::Ansi.new(@opt.cmd,'Pot po4a',tool).green_title_hi
- SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow if @opt.cmd =~/[MV]/
+ (@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on) \
+ ? SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Pot po4a',tool).green_hi_blue
+ : SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],'Pot po4a',tool).green_title_hi
+ if (@opt.act[:verbose][:set]==:on \
+ || @opt.act[:verbose_plus][:set]==:on \
+ || @opt.act[:maintenance][:set]==:on)
+ SiSU_Screen::Ansi.new(@opt.act[:color_state][:set],@opt.fns,"#{path}/#{md.fnb}/#{md.fn[:plain]}").flow
+ end
end
if @opt.fns =~/\S+?~#{@lang_regx}\.ss[mti]/ \
or @opt.f_pth[:lng] !=@opt.lng_base
@@ -210,7 +218,7 @@ module SiSU_Po4a
d="#{nt} #{@fn}"
mark="^~ "
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct=%{\n# footnotes, the preferred sisu markup for a footnote is~{this is a footnote}~ however, for translation a footnote reference marker in the text~^ with a set of notes following the paragraph starting on a newline with "^~ this is a footnote", is easier to deal with, if possible these should be converted back to~{inline notes}~}
s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
end
@@ -509,7 +517,7 @@ GSUB
mark="#{dob_src.lv}~#{fn} "
d="#{dob_src.is.to_s} (level #{dob_src.lv})"
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
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}"}
s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
end
@@ -538,7 +546,7 @@ GSUB
mark="_#{dob_src.indent}* "
d="#{dob_src.is.to_s}: indent #{dob_src.indent}, bullet"
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
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}"}
s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
end
@@ -547,7 +555,7 @@ GSUB
mark="_#{dob_src.indent} "
d="#{dob_src.is.to_s}: indent #{dob_src.indent}"
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by the indent level "#{mark}"}
s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
end
@@ -562,7 +570,7 @@ GSUB
mark="_#{dob_src.hang}_#{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/
+ if @md.opt.act[:maintenance][:set]==:on
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}"}
s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
end
@@ -576,7 +584,7 @@ GSUB
mark='_* '
d="#{dob_src.is.to_s}: bullet"
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by an asterisk "#{mark}"}
s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
end
@@ -587,7 +595,7 @@ GSUB
mark=''
d=dob_src.is.to_s
instruct=%{\n# regular paragraph, no special markup}
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct="\n# "
s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"}
end
@@ -613,7 +621,7 @@ GSUB
mark="block{\\n\\n...\\n\\n}block"
d=dob_src.is.to_s
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct="\n# block text is a text block with an opening and closing marker, the content of which may be wrapped"
s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
end
@@ -628,7 +636,7 @@ GSUB
mark="group{\\n\\n...\\n\\n}group"
d=dob_src.is.to_s
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct="\n# group text is a text block with an opening and closing marker, the content of which may be wrapped"
s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
end
@@ -643,7 +651,7 @@ GSUB
mark="poem{\n\nverse\n\nverse\n\n...\n\n}poem"
d=dob_src.is.to_s
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
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"
s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
end
@@ -658,7 +666,7 @@ GSUB
mark="code{\\n\\n...\\n\\n}code"
d=dob_src.is.to_s
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct="\n# codeblocks are a text block with an opening and closing marker, the content of which should remain unwrapped"
s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
end
@@ -673,7 +681,7 @@ GSUB
mark="table{\\n\\n...\\n\\n}table"
d=dob_src.is.to_s
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct="\n# tables are a text block with an opening and closing marker, the content of which should remain unwrapped"
s_mark="\n# " + %{"\\n\\n#{mark}\\n\\n"}
end
@@ -689,7 +697,7 @@ GSUB
def pot_structure_idx(dob_src='',dob_trn='') #% Used to extract the structure of a document
mark="={ ... }"
instruct=s_mark=''
- if @md.opt.cmd=~/M/
+ if @md.opt.act[:maintenance][:set]==:on
instruct="\n# the book index should be attached unwrapped to the preceding text block (there should be a new line, but no empty line)"
s_mark="\n# " + %{"\\n#{mark}\\n\\n"}
end
@@ -736,11 +744,11 @@ GSUB
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
- puts "src (comment):\n\t" + data_src[s].obj if @md.opt.cmd =~/M/
+ puts "src (comment):\n\t" + data_src[s].obj if @md.opt.act[:maintenance][:set]==:on
s+=1
#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/
+ puts "trans (comment):\n\t" + data_trn[t].obj if @md.opt.act[:maintenance][:set]==:on
t+=1
#next if data_trn[t].is == :comment
end
@@ -949,7 +957,7 @@ GSUB
po4a_git
end
def po4a_git
- unless @md.opt.cmd =~/M/
+ unless @md.opt.act[:maintenance][:set]==:on
require_relative 'git' # git.rb
git=SiSU_Git::Source.new(@md.opt)
git.create_file_structure_git unless FileTest.directory?(@file.output_path.pot_git.dir)