aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-02-05 00:48:39 -0500
committerRalph Amissah <ralph@amissah.com>2014-02-05 00:48:39 -0500
commit728ed46232abea87eb1f0d5fabd52dc710b1e922 (patch)
tree45fa0eea784f6c28b70f697eb6878ca4f6f7fc7a
parentv5 v6: options, html --strict instruction (diff)
v5 v6: options, ocn switch on/off instructions (& defaults for plaintext & odt)
-rw-r--r--data/doc/sisu/CHANGELOG_v51
-rw-r--r--data/doc/sisu/CHANGELOG_v61
-rw-r--r--lib/sisu/v5/options.rb40
-rw-r--r--lib/sisu/v5/sysenv.rb39
-rw-r--r--lib/sisu/v6/options.rb40
-rw-r--r--lib/sisu/v6/sysenv.rb39
6 files changed, 140 insertions, 20 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index fd184ca7..a5e9059a 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -42,6 +42,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.3.1.orig.tar.xz
* options
* --strict html option
+ * ocn switch on/off instructions (& defaults for plaintext & odt)
* html cleaning
* --strict html option
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index 8433dc63..27269b3f 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -32,6 +32,7 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.1.orig.tar.xz
* options
* --strict html option
+ * ocn switch on/off instructions (& defaults for plaintext & odt)
* html cleaning
* --strict html option
diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb
index d3a40407..bce0a8a4 100644
--- a/lib/sisu/v5/options.rb
+++ b/lib/sisu/v5/options.rb
@@ -666,9 +666,9 @@ module SiSU_Commandline
{ set: :filetype }
else { set: :na }
end
- act[:ocn]=if mod.inspect =~/"--inc-ocn"/
+ act[:ocn]=if mod.inspect =~/"--ocn"|"--inc-ocn"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \
+ elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"/ \
|| act[:switch][:off].inspect =~/"ocn"/
{ bool: false, set: :off }
else { bool: true, set: :na }
@@ -865,10 +865,20 @@ module SiSU_Commandline
|| mod.inspect =~/"--epub"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:odt]=(cmd =~/o/ \
- || mod.inspect =~/"--odt"|"--odf"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
+ act[:odt]=if cmd =~/o/ \
+ or mod.inspect =~/"--odt"|"--odf"|"--odt-ocn"|"--odf-ocn"/
+ act[:odt_ocn]=if (mod.inspect =~/"--odt-ocn"|"--odf-ocn"/ \
+ or mod.inspect =~/"--ocn"|"--inc-ocn"/)
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"/
+ { bool: false, set: :off }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
act[:xml_sax]=(cmd =~/x/ \
|| mod.inspect =~/"--xml-sax"/) \
? { bool: true, set: :on }
@@ -894,10 +904,20 @@ module SiSU_Commandline
|| mod.inspect =~/"--xhtml"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:txt]=(cmd =~/[at]/ \
- || mod.inspect =~/"--txt"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
+ act[:txt]=if cmd =~/[at]/ \
+ or mod.inspect =~/"--txt"|"--text"|"--plaintext"|"--txt-ocn"|"--text-ocn"|"--plaintext-ocn"/
+ act[:txt_ocn]=if (mod.inspect =~/"--txt-ocn"|"--text-ocn"|"--plaintext-ocn"/ \
+ or mod.inspect =~/"--ocn"|"--inc-ocn"/)
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"/
+ { bool: false, set: :off }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
act[:txt_textile]=(mod.inspect =~/"--textile"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
diff --git a/lib/sisu/v5/sysenv.rb b/lib/sisu/v5/sysenv.rb
index 3779ff51..f2b5bd27 100644
--- a/lib/sisu/v5/sysenv.rb
+++ b/lib/sisu/v5/sysenv.rb
@@ -3905,6 +3905,40 @@ WOK
true
end
end
+ def plaintext_ocn?
+ if cmd_rc_act[:txt_ocn][:set]==:on \
+ or cmd_rc_act[:ocn][:set]==:on
+ true
+ elsif cmd_rc_act[:txt_ocn][:set]==:off \
+ or cmd_rc_act[:ocn][:set]==:off
+ false
+ elsif doc_rc.is_a?(Method) \
+ and defined? doc_rc.ocn? \
+ and doc_rc.toc? ==:off
+ false
+ elsif env_rc.build.ocn? ==:off
+ false
+ else
+ false
+ end
+ end
+ def odt_ocn?
+ if cmd_rc_act[:odt_ocn][:set]==:on \
+ or cmd_rc_act[:ocn][:set]==:on
+ true
+ elsif cmd_rc_act[:odt_ocn][:set]==:off \
+ or cmd_rc_act[:ocn][:set]==:off
+ false
+ elsif doc_rc.is_a?(Method) \
+ and defined? doc_rc.ocn? \
+ and doc_rc.toc? ==:off
+ false
+ elsif env_rc.build.ocn? ==:off
+ false
+ else
+ false
+ end
+ end
def html_strict?
if cmd_rc_act[:html_strict][:set]==:on
true
@@ -4154,6 +4188,11 @@ WOK
end
self
end
+ def ocn_html_identifier
+ (build.html_strict?) \
+ ? Mx[:ocn_id_char]
+ : ''
+ end
def output_dir_structure
def by_language_code?
if cmd_rc_act[:output_by][:set] == :language
diff --git a/lib/sisu/v6/options.rb b/lib/sisu/v6/options.rb
index 30d3a257..6f4cce37 100644
--- a/lib/sisu/v6/options.rb
+++ b/lib/sisu/v6/options.rb
@@ -666,9 +666,9 @@ module SiSU_Commandline
{ set: :filetype }
else { set: :na }
end
- act[:ocn]=if mod.inspect =~/"--inc-ocn"/
+ act[:ocn]=if mod.inspect =~/"--ocn"|"--inc-ocn"/
{ bool: true, set: :on }
- elsif mod.inspect =~/"--(?:exc|no)-ocn"/ \
+ elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"/ \
|| act[:switch][:off].inspect =~/"ocn"/
{ bool: false, set: :off }
else { bool: true, set: :na }
@@ -865,10 +865,20 @@ module SiSU_Commandline
|| mod.inspect =~/"--epub"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:odt]=(cmd =~/o/ \
- || mod.inspect =~/"--odt"|"--odf"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
+ act[:odt]=if cmd =~/o/ \
+ or mod.inspect =~/"--odt"|"--odf"|"--odt-ocn"|"--odf-ocn"/
+ act[:odt_ocn]=if (mod.inspect =~/"--odt-ocn"|"--odf-ocn"/ \
+ or mod.inspect =~/"--ocn"|"--inc-ocn"/)
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"/
+ { bool: false, set: :off }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
act[:xml_sax]=(cmd =~/x/ \
|| mod.inspect =~/"--xml-sax"/) \
? { bool: true, set: :on }
@@ -894,10 +904,20 @@ module SiSU_Commandline
|| mod.inspect =~/"--xhtml"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:txt]=(cmd =~/[at]/ \
- || mod.inspect =~/"--txt"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
+ act[:txt]=if cmd =~/[at]/ \
+ or mod.inspect =~/"--txt"|"--text"|"--plaintext"|"--txt-ocn"|"--text-ocn"|"--plaintext-ocn"/
+ act[:txt_ocn]=if (mod.inspect =~/"--txt-ocn"|"--text-ocn"|"--plaintext-ocn"/ \
+ or mod.inspect =~/"--ocn"|"--inc-ocn"/)
+ { bool: true, set: :on }
+ elsif mod.inspect =~/"--no-ocn"|"--exc-ocn"/
+ { bool: false, set: :off }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ { bool: false, set: :na }
+ end
act[:txt_textile]=(mod.inspect =~/"--textile"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
diff --git a/lib/sisu/v6/sysenv.rb b/lib/sisu/v6/sysenv.rb
index 10de1fdd..db1bdc91 100644
--- a/lib/sisu/v6/sysenv.rb
+++ b/lib/sisu/v6/sysenv.rb
@@ -3905,6 +3905,40 @@ WOK
true
end
end
+ def plaintext_ocn?
+ if cmd_rc_act[:txt_ocn][:set]==:on \
+ or cmd_rc_act[:ocn][:set]==:on
+ true
+ elsif cmd_rc_act[:txt_ocn][:set]==:off \
+ or cmd_rc_act[:ocn][:set]==:off
+ false
+ elsif doc_rc.is_a?(Method) \
+ and defined? doc_rc.ocn? \
+ and doc_rc.toc? ==:off
+ false
+ elsif env_rc.build.ocn? ==:off
+ false
+ else
+ false
+ end
+ end
+ def odt_ocn?
+ if cmd_rc_act[:odt_ocn][:set]==:on \
+ or cmd_rc_act[:ocn][:set]==:on
+ true
+ elsif cmd_rc_act[:odt_ocn][:set]==:off \
+ or cmd_rc_act[:ocn][:set]==:off
+ false
+ elsif doc_rc.is_a?(Method) \
+ and defined? doc_rc.ocn? \
+ and doc_rc.toc? ==:off
+ false
+ elsif env_rc.build.ocn? ==:off
+ false
+ else
+ false
+ end
+ end
def html_strict?
if cmd_rc_act[:html_strict][:set]==:on
true
@@ -4154,6 +4188,11 @@ WOK
end
self
end
+ def ocn_html_identifier
+ (build.html_strict?) \
+ ? Mx[:ocn_id_char]
+ : ''
+ end
def output_dir_structure
def by_language_code?
if cmd_rc_act[:output_by][:set] == :language