aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/ao_doc_str.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-01-06 22:42:31 -0500
committerRalph Amissah <ralph@amissah.com>2014-01-06 22:42:31 -0500
commit0e42ce6f34c3cfdf370f439f58c4e3de8b05ea92 (patch)
tree6fc9ffb3f627a91138a1479d6fa144687b7b45e3 /lib/sisu/v5/ao_doc_str.rb
parentv5: docbook, fictionbook, some tidying (diff)
v5: cosmetic code, case statement
Diffstat (limited to 'lib/sisu/v5/ao_doc_str.rb')
-rw-r--r--lib/sisu/v5/ao_doc_str.rb110
1 files changed, 49 insertions, 61 deletions
diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb
index 40be4e30..f1e73362 100644
--- a/lib/sisu/v5/ao_doc_str.rb
+++ b/lib/sisu/v5/ao_doc_str.rb
@@ -97,15 +97,15 @@ module SiSU_AO_DocumentStructureExtract
end
def ln_get(lv)
case lv
- when /A/; 1
- when /B/; 2
- when /C/; 3
- when /1/; 4
- when /2/; 5
- when /3/; 6
- when /4/; 7
- when /5/; 8
- when /6/; 9
+ when /A/ then 1
+ when /B/ then 2
+ when /C/ then 3
+ when /1/ then 4
+ when /2/ then 5
+ when /3/ then 6
+ when /4/ then 7
+ when /5/ then 8
+ when /6/ then 9
end
end
def image_test(str)
@@ -401,8 +401,8 @@ module SiSU_AO_DocumentStructureExtract
elsif @@flag[:code]==:off
if t_o =~/^(?:code\{|[`]{3}\s+code)/
@@flag[:code]=case t_o
- when /^code\{/; :curls
- when /^[`]{3}\s+code/; :tics
+ when /^code\{/ then :curls
+ when /^[`]{3}\s+code/ then :tics
else @@flag[:code] #error
end
@@counter=1
@@ -411,8 +411,8 @@ module SiSU_AO_DocumentStructureExtract
t_o=SiSU_AO_DocumentStructure::ObjectComment.new.comment(h)
elsif t_o =~/^(?:poem\{|[`]{3}\s+poem)/
@@flag[:poem]=case t_o
- when /^poem\{/; :curls
- when /^[`]{3}\s+poem/; :tics
+ when /^poem\{/ then :curls
+ when /^[`]{3}\s+poem/ then :tics
else @@flag[:poem] #error
end
h={ obj: 'poem start' } #introduce a counter
@@ -420,8 +420,8 @@ module SiSU_AO_DocumentStructureExtract
tuned_file << t_o
elsif t_o =~/^(?:group\{|[`]{3}\s+group)/
@@flag[:group]=case t_o
- when /^group\{/; :curls
- when /^[`]{3}\s+group/; :tics
+ when /^group\{/ then :curls
+ when /^[`]{3}\s+group/ then :tics
else @@flag[:group] #error
end
h={ obj: 'group text start' } #introduce a counter
@@ -429,8 +429,8 @@ module SiSU_AO_DocumentStructureExtract
tuned_file << t_o
elsif t_o =~/^(?:block\{|[`]{3}\s+block)/
@@flag[:block]=case t_o
- when /^block\{/; :curls
- when /^[`]{3}\s+block/; :tics
+ when /^block\{/ then :curls
+ when /^[`]{3}\s+block/ then :tics
else @@flag[:block] #error
end
h={ obj: 'block text start' } #introduce a counter
@@ -438,8 +438,8 @@ module SiSU_AO_DocumentStructureExtract
tuned_file << t_o
elsif t_o =~/^(?:alt\{|[`]{3}\s+alt)/
@@flag[:alt]=case t_o
- when /^alt\{/; :curls
- when /^[`]{3}\s+alt/; :tics
+ when /^alt\{/ then :curls
+ when /^[`]{3}\s+alt/ then :tics
else @@flag[:alt] #error
end
h={ obj: 'alt text start' } #introduce a counter
@@ -803,34 +803,22 @@ module SiSU_AO_DocumentStructureExtract
end
def possible_parents(child)
case child
- when /A~/
- 'none'
- when /B~/
- 'A~'
- when /C~/
- 'B~'
- when /1/
- 'A~, B~, C~'
- when /2/
- '1'
- when /3/
- '2'
+ when /A~/ then 'none'
+ when /B~/ then 'A~'
+ when /C~/ then 'B~'
+ when /1/ then 'A~, B~, C~'
+ when /2/ then '1'
+ when /3/ then '2'
end
end
def possible_children(parent)
case parent
- when /A~/
- 'B~, 1'
- when /B~/
- 'C~, 1'
- when /C~/
- '1'
- when /1/
- '2'
- when /2/
- '3'
- when /3/
- 'none'
+ when /A~/ then 'B~, 1'
+ when /B~/ then 'C~, 1'
+ when /C~/ then '1'
+ when /1/ then '2'
+ when /2/ then '3'
+ when /3/ then 'none'
end
end
self
@@ -873,15 +861,15 @@ has incorrect level and/or parent level}
#dob.ln now is determined, and set earlier, check how best to remove this -->
if dob.is==:heading
ln=case dob.lv
- when 'A'; 1
- when 'B'; 2
- when 'C'; 3
- when '1'; 4
- when '2'; 5
- when '3'; 6
- when '4'; 7
- when '5'; 8
- when '6'; 9
+ when 'A' then 1
+ when 'B' then 2
+ when 'C' then 3
+ when '1' then 4
+ when '2' then 5
+ when '3' then 6
+ when '4' then 7
+ when '5' then 8
+ when '6' then 9
end
end
if not dob.obj =~/~#|-#/
@@ -1245,15 +1233,15 @@ or this level should be 5~ rather #{dob.lv}" #level 6
? %{<#{o[:lv]} id="#{o[:node]}">}
: "</#{o[:lv]}>"
ln=case o[:lv]
- when 'A'; 1
- when 'B'; 2
- when 'C'; 3
- when '1'; 4
- when '2'; 5
- when '3'; 6
- when '4'; 7
- when '5'; 8
- when '6'; 9
+ when 'A' then 1
+ when 'B' then 2
+ when 'C' then 3
+ when '1' then 4
+ when '2' then 5
+ when '3' then 6
+ when '4' then 7
+ when '5' then 8
+ when '6' then 9
end
h={ tag: tag, node: o[:node], lv: o[:lv], ln: ln, status: o[:status] }
SiSU_AO_DocumentStructure::ObjectStructure.new.xml_dom(h) #downstream code utilise else ignore like comments