From 98066f7dbc056c75b808b49f8406b7ac21118111 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 5 Sep 2014 23:20:13 -0400 Subject: v5 v6: ao_doc_str, if faulty document structure, stop; if --no-stop option, skip --- data/doc/sisu/CHANGELOG_v5 | 3 +++ data/doc/sisu/CHANGELOG_v6 | 3 +++ lib/sisu/v5/ao_doc_str.rb | 32 +++++++++++++++++++++++++------- lib/sisu/v6/ao_doc_str.rb | 32 +++++++++++++++++++++++++------- 4 files changed, 56 insertions(+), 14 deletions(-) diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5 index 90d95339..1fd44736 100644 --- a/data/doc/sisu/CHANGELOG_v5 +++ b/data/doc/sisu/CHANGELOG_v5 @@ -38,6 +38,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.6.5.orig.tar.xz sisu_5.6.5.orig.tar.xz sisu_5.6.5-1.dsc +* ao_doc_str, if faulty document structure, stop; if --no-stop option, skip + processing document + * ao_numbering, provide more information on duplicate numbering before stop * html navigation, enable turn off (nav buttons on remaining html segments) diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6 index 772c2df9..a6ef4d23 100644 --- a/data/doc/sisu/CHANGELOG_v6 +++ b/data/doc/sisu/CHANGELOG_v6 @@ -28,6 +28,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.2.6.orig.tar.xz sisu_6.2.6.orig.tar.xz sisu_6.2.6-1.dsc +* ao_doc_str, if faulty document structure, stop; if --no-stop option, skip + processing document + * ao_numbering, provide more information on duplicate numbering before stop * html navigation, enable turn off (nav buttons on remaining html segments) diff --git a/lib/sisu/v5/ao_doc_str.rb b/lib/sisu/v5/ao_doc_str.rb index e10cc4ef..49c9bdf1 100644 --- a/lib/sisu/v5/ao_doc_str.rb +++ b/lib/sisu/v5/ao_doc_str.rb @@ -1308,7 +1308,10 @@ module SiSU_AO_DocumentStructureExtract STDERR.puts %{current level: #{structure_info.lv[node_ln]} (possible parent levels: #{structure_info.possible_parents(structure_info.lv[node_ln])}) parent level: #{structure_info.lv[node_parent_ln]} (possible child levels: #{structure_info.possible_children(structure_info.lv[node_parent_ln])}) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end end @@ -1327,7 +1330,10 @@ has incorrect level and/or parent level @title: SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless (defined? @md.creator.author \ and @md.creator.author) @@ -1337,7 +1343,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" :author: anonymous? SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end def ocn #and auto segment numbering increment @@ -1672,8 +1681,11 @@ or this level should be 6~ rather #{dob.lv}" STDERR.puts %{Substantive text objects must follow a level 1~ 2~ or 3~ heading: #{lev}~ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} puts dob.obj.gsub(/^(.{1,80})/,'"\1"') - $process_document = :skip - break + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + break + else exit + end end if not dob.obj =~/~#|-#/ ocn_flag=true @@ -1751,13 +1763,19 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} STDERR.puts %{The number of level A~ in this document: #{@lev_occurences[:a]} There must be one level A~ (no more and no less) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless @lev_occurences[:l1] > 0 STDERR.puts %{The number of level 1~ in this document: #{@lev_occurences[:l1]} There must be at least one level 1~ (and as many as required) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end @o_array end diff --git a/lib/sisu/v6/ao_doc_str.rb b/lib/sisu/v6/ao_doc_str.rb index 6e7a103f..6be0e068 100644 --- a/lib/sisu/v6/ao_doc_str.rb +++ b/lib/sisu/v6/ao_doc_str.rb @@ -1308,7 +1308,10 @@ module SiSU_AO_DocumentStructureExtract STDERR.puts %{current level: #{structure_info.lv[node_ln]} (possible parent levels: #{structure_info.possible_parents(structure_info.lv[node_ln])}) parent level: #{structure_info.lv[node_parent_ln]} (possible child levels: #{structure_info.possible_children(structure_info.lv[node_parent_ln])}) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end end @@ -1327,7 +1330,10 @@ has incorrect level and/or parent level @title: SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless (defined? @md.creator.author \ and @md.creator.author) @@ -1337,7 +1343,10 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" :author: anonymous? SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}" } - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end end def ocn #and auto segment numbering increment @@ -1672,8 +1681,11 @@ or this level should be 6~ rather #{dob.lv}" STDERR.puts %{Substantive text objects must follow a level 1~ 2~ or 3~ heading: #{lev}~ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} puts dob.obj.gsub(/^(.{1,80})/,'"\1"') - $process_document = :skip - break + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + break + else exit + end end if not dob.obj =~/~#|-#/ ocn_flag=true @@ -1751,13 +1763,19 @@ SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} STDERR.puts %{The number of level A~ in this document: #{@lev_occurences[:a]} There must be one level A~ (no more and no less) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end unless @lev_occurences[:l1] > 0 STDERR.puts %{The number of level 1~ in this document: #{@lev_occurences[:l1]} There must be at least one level 1~ (and as many as required) SKIPPED processing file: [#{@md.opt.lng}] "#{@md.fns}"} - $process_document = :skip + if @md.opt.act[:no_stop][:set]==:on + $process_document = :skip + else exit + end end @o_array end -- cgit v1.2.3