summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-02-05 06:02:31 +0000
committerRalph Amissah <ralph@amissah.com>2014-02-05 06:02:31 +0000
commit99c5b5d56f8785ee9ec2cc991c55a8a2eb6524bb (patch)
tree709cf7ab40ec7d5ab3e5ee25d1cbd1ac75a1dd57
parentv5 v6: ocn: strict html; turn on/off rules for txt & odf (diff)
downloadsisu-99c5b5d56f8785ee9ec2cc991c55a8a2eb6524bb.zip
sisu-99c5b5d56f8785ee9ec2cc991c55a8a2eb6524bb.tar.xz
v5 v6: html, endnote name and nameref make compliant (epub use same)
-rw-r--r--data/doc/sisu/CHANGELOG_v53
-rw-r--r--data/doc/sisu/CHANGELOG_v63
-rw-r--r--lib/sisu/v5/constants.rb6
-rw-r--r--lib/sisu/v5/html_format.rb2
-rw-r--r--lib/sisu/v5/html_segments.rb6
-rw-r--r--lib/sisu/v5/html_tune.rb12
-rw-r--r--lib/sisu/v5/xhtml_epub2_format.rb6
-rw-r--r--lib/sisu/v5/xhtml_epub2_segments.rb2
-rw-r--r--lib/sisu/v5/xhtml_epub2_tune.rb20
-rw-r--r--lib/sisu/v6/constants.rb6
-rw-r--r--lib/sisu/v6/html_format.rb2
-rw-r--r--lib/sisu/v6/html_segments.rb6
-rw-r--r--lib/sisu/v6/html_tune.rb12
-rw-r--r--lib/sisu/v6/xhtml_epub2_format.rb6
-rw-r--r--lib/sisu/v6/xhtml_epub2_segments.rb2
-rw-r--r--lib/sisu/v6/xhtml_epub2_tune.rb20
16 files changed, 66 insertions, 48 deletions
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index e59d839..a97c8bc 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -48,6 +48,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.3.1.orig.tar.xz
* --strict html option
(various changes, e.g. ocn [url]#37 only available as [url]#o37)
* tags
+ * endnote name and nameref (make compliant)
+
+* epub use same endnote name and nameref as introduced here for html
* ocn turn on/off rules
* txt
diff --git a/data/doc/sisu/CHANGELOG_v6 b/data/doc/sisu/CHANGELOG_v6
index a1183d8..3000f42 100644
--- a/data/doc/sisu/CHANGELOG_v6
+++ b/data/doc/sisu/CHANGELOG_v6
@@ -38,6 +38,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_6.0.1.orig.tar.xz
* --strict html option
(various changes, e.g. ocn [url]#37 only available as [url]#o37)
* tags
+ * endnote name and nameref (make compliant)
+
+* epub use same endnote name and nameref as introduced here for html
* ocn turn on/off rules
* txt
diff --git a/lib/sisu/v5/constants.rb b/lib/sisu/v5/constants.rb
index fea57ce..a9be54f 100644
--- a/lib/sisu/v5/constants.rb
+++ b/lib/sisu/v5/constants.rb
@@ -102,6 +102,12 @@ Xx={
}
Mx={
ocn_id_char: 'o',
+ note: 'note_',
+ note_ref: 'noteref_',
+ note_astx: 'note_astx_',
+ note_ref_astx: 'noteref_astx_',
+ note_plus: 'note_plus_',
+ note_ref_plus: 'noteref_plus_',
meta_o: '〔@', meta_c: '〕',
lv_o_0: 0,
lv_o_1: 1,
diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb
index e0be4f8..a933d09 100644
--- a/lib/sisu/v5/html_format.rb
+++ b/lib/sisu/v5/html_format.rb
@@ -1248,7 +1248,7 @@ WOK
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
note=$1
- note=note.gsub(/[\n\s]+/m,' ')
+ note=note.gsub(/[\s]+/m,' ')
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
gsub(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
end
diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb
index b710db8..7a368b9 100644
--- a/lib/sisu/v5/html_segments.rb
+++ b/lib/sisu/v5/html_segments.rb
@@ -502,7 +502,7 @@ module SiSU_HTML_Seg
'<br /><hr width=90% /><br />'
end
if @md.flag_separate_endnotes
- dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type
+ dob.obj=dob.obj.gsub(/"\s+href="#(#{Mx[:note]}\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#\\1">}) #endnote- twice #removed file type
end
if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/
if (dob.is==:heading \
@@ -600,7 +600,7 @@ module SiSU_HTML_Seg
@@seg_subtoc_array << subtoc
end
if @md.flag_auto_endnotes
- if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/) \
+ if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="#{Mx[:note]}[\d*+]+"/) \
&& dob.is !=:code # endnote-
endnote_array=[]
if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m
@@ -629,7 +629,7 @@ module SiSU_HTML_Seg
end
try.join('<br \/>')
#% creation of separate end segment/page of all endnotes referenced back to reference segment
- m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
+ m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(##{Mx[:note_ref]}[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
endnote_part_a=note_match_seg[m,1]
endnote_part_b=note_match_seg[m,2]
txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b }
diff --git a/lib/sisu/v5/html_tune.rb b/lib/sisu/v5/html_tune.rb
index e9392ca..8433686 100644
--- a/lib/sisu/v5/html_tune.rb
+++ b/lib/sisu/v5/html_tune.rb
@@ -256,14 +256,14 @@ module SiSU_HTML_Tune
def endnotes_html(dob)
unless dob.is ==:code
dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched)
+ %{&nbsp;<a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</a> } +
+ %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2">&nbsp;<sup>\\2.</sup></a> \\3 \\4}).
gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched)
+ %{&nbsp;<a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</a> } +
+ %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2">&nbsp;<sup>\\2.</sup></a> \\3 \\4}).
gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched)
+ %{&nbsp;<a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</a> } +
+ %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2">&nbsp;<sup>\\2</sup></a> \\3 \\4})
end
dob
end
diff --git a/lib/sisu/v5/xhtml_epub2_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb
index 8dd8a88..e3b877a 100644
--- a/lib/sisu/v5/xhtml_epub2_format.rb
+++ b/lib/sisu/v5/xhtml_epub2_format.rb
@@ -2132,10 +2132,10 @@ output_epub_cont_seg.close
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
note=$1
- note=note.gsub(/[\n\s]+/m,' ')
+ note=note.gsub(/[\s]+/m,' ')
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
- gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,'').
- gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') #remove
+ gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'').
+ gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') #remove
end
%{<#{tag} class="#{attrib}">
<a href="#o#{@ocn}"><i>#{txt}</i></a> #{note}
diff --git a/lib/sisu/v5/xhtml_epub2_segments.rb b/lib/sisu/v5/xhtml_epub2_segments.rb
index 764fcc1..8612696 100644
--- a/lib/sisu/v5/xhtml_epub2_segments.rb
+++ b/lib/sisu/v5/xhtml_epub2_segments.rb
@@ -401,7 +401,7 @@ WOK
sto.break
end
if @md.flag_separate_endnotes # may need to revisit, check
- dob.obj=dob.obj.gsub(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type
+ dob.obj=dob.obj.gsub(/"\s+href="##{Mx[:note_ref]}(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}##{Mx[:note_ref]}\\1">}) #endnote- twice #removed file type
end
if (dob.is ==:heading \
|| dob.is==:heading_insert \
diff --git a/lib/sisu/v5/xhtml_epub2_tune.rb b/lib/sisu/v5/xhtml_epub2_tune.rb
index 6ac53c3..82f9036 100644
--- a/lib/sisu/v5/xhtml_epub2_tune.rb
+++ b/lib/sisu/v5/xhtml_epub2_tune.rb
@@ -298,22 +298,22 @@ module SiSU_XHTML_EPUB2_Tune
data.each do |dob|
unless dob.is ==:code
dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref]}\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1\\2 <a href="##{Mx[:note_ref]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note]}\\2">\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
gsub(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_astx\\2">#{Mx[:nbsp]}<sup id="note_ref_astx\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast}\\2 <a href="#note_ref_astx\\2">#{Mx[:nbsp]}<sup id="note_astx\\2">#{ast}\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note_astx]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref_astx]}\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{ast}\\2 <a href="##{Mx[:note_ref_astx]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_astx]}\\2">#{ast}\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
gsub(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_plus\\2">#{Mx[:nbsp]}<sup id="note_ref_plus\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls}\\2 <a href="#note_ref_plus\\2">#{Mx[:nbsp]}<sup id="note_plus\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note_plus]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref_plus]}\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{pls}\\2 <a href="##{Mx[:note_ref_plus]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_plus]}\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug
if dob.obj =~/#{Mx[:en_a_o]}([*+]+)\s+.+?#{Mx[:en_a_c]}/
m=$1.length.to_i
dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/,
- %{#{Mx[:nbsp]}<a href="#note#{a*m}">#{Mx[:nbsp]}<sup id="note_ref#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast*m} <a href="#note_ref#{a*m}">#{Mx[:nbsp]}<sup id="note#{a*m}">#{ast*m}</sup></a> \\2 \\3}). #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note]}#{a*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref]}#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{ast*m} <a href="##{Mx[:note_ref]}#{a*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note]}#{a*m}">#{ast*m}</sup></a> \\2 \\3}). #endnote- note- (careful may have switched)
gsub(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- %{#{Mx[:nbsp]}<a href="#note#{s*m}">#{Mx[:nbsp]}<sup id="note_ref#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls*m} <a href="#note_ref#{s*m}">#{Mx[:nbsp]}<sup id="note#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note]}#{s*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref]}#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{pls*m} <a href="##{Mx[:note_ref]}#{s*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note]}#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
end
end
@tuned_file << dob
diff --git a/lib/sisu/v6/constants.rb b/lib/sisu/v6/constants.rb
index 390df5a..e70a2f9 100644
--- a/lib/sisu/v6/constants.rb
+++ b/lib/sisu/v6/constants.rb
@@ -102,6 +102,12 @@ Xx={
}
Mx={
ocn_id_char: 'o',
+ note: 'note_',
+ note_ref: 'noteref_',
+ note_astx: 'note_astx_',
+ note_ref_astx: 'noteref_astx_',
+ note_plus: 'note_plus_',
+ note_ref_plus: 'noteref_plus_',
meta_o: '〔@', meta_c: '〕',
lv_o_0: 0,
lv_o_1: 1,
diff --git a/lib/sisu/v6/html_format.rb b/lib/sisu/v6/html_format.rb
index ddfaaa7..63271d9 100644
--- a/lib/sisu/v6/html_format.rb
+++ b/lib/sisu/v6/html_format.rb
@@ -1248,7 +1248,7 @@ WOK
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
note=$1
- note=note.gsub(/[\n\s]+/m,' ')
+ note=note.gsub(/[\s]+/m,' ')
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
gsub(/<a[\n\s]+name="-\d+"[\n\s]+href="#_\d+">&nbsp;<sup>\d+<\/sup>&nbsp;/m,'')
end
diff --git a/lib/sisu/v6/html_segments.rb b/lib/sisu/v6/html_segments.rb
index efe3702..0586cdf 100644
--- a/lib/sisu/v6/html_segments.rb
+++ b/lib/sisu/v6/html_segments.rb
@@ -502,7 +502,7 @@ module SiSU_HTML_Seg
'<br /><hr width=90% /><br />'
end
if @md.flag_separate_endnotes
- dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type
+ dob.obj=dob.obj.gsub(/"\s+href="#(#{Mx[:note]}\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#\\1">}) #endnote- twice #removed file type
end
if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/
if (dob.is==:heading \
@@ -600,7 +600,7 @@ module SiSU_HTML_Seg
@@seg_subtoc_array << subtoc
end
if @md.flag_auto_endnotes
- if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/) \
+ if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="#{Mx[:note]}[\d*+]+"/) \
&& dob.is !=:code # endnote-
endnote_array=[]
if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m
@@ -629,7 +629,7 @@ module SiSU_HTML_Seg
end
try.join('<br \/>')
#% creation of separate end segment/page of all endnotes referenced back to reference segment
- m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(#-[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
+ m=/(?:#{Mx[:en_a_o]}[\d*+]+|#{Mx[:en_b_o]}[*+]\d+)\s+(.+?href=")(##{Mx[:note_ref]}[\d*+]+".+)(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/mi
endnote_part_a=note_match_seg[m,1]
endnote_part_b=note_match_seg[m,2]
txt_obj={ endnote_part_a: endnote_part_a, endnote_part_b: endnote_part_b }
diff --git a/lib/sisu/v6/html_tune.rb b/lib/sisu/v6/html_tune.rb
index 384a19b..516deaa 100644
--- a/lib/sisu/v6/html_tune.rb
+++ b/lib/sisu/v6/html_tune.rb
@@ -256,14 +256,14 @@ module SiSU_HTML_Tune
def endnotes_html(dob)
unless dob.is ==:code
dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched)
+ %{&nbsp;<a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</a> } +
+ %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2">&nbsp;<sup>\\2.</sup></a> \\3 \\4}).
gsub(/(#{Mx[:en_b_o]})([*+]\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched)
+ %{&nbsp;<a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</a> } +
+ %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2">&nbsp;<sup>\\2.</sup></a> \\3 \\4}).
gsub(/(#{Mx[:en_a_o]})([*+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- '&nbsp;<a name="-\2" href="#_\2">&nbsp;<sup>\2</sup>&nbsp;</a> ' + #note- endnote-
- '\1\2 <a name="_\2" href="#-\2">&nbsp;<sup>\2</sup></a> \3 \4') #endnote- note- (careful may have switched)
+ %{&nbsp;<a name="#{Mx[:note_ref]}\\2" href="##{Mx[:note]}\\2">&nbsp;<sup>\\2</sup>&nbsp;</a> } +
+ %{\\1\\2 <a name="#{Mx[:note]}\\2" href="##{Mx[:note_ref]}\\2">&nbsp;<sup>\\2</sup></a> \\3 \\4})
end
dob
end
diff --git a/lib/sisu/v6/xhtml_epub2_format.rb b/lib/sisu/v6/xhtml_epub2_format.rb
index d5b7e85..7ae97f9 100644
--- a/lib/sisu/v6/xhtml_epub2_format.rb
+++ b/lib/sisu/v6/xhtml_epub2_format.rb
@@ -2132,10 +2132,10 @@ output_epub_cont_seg.close
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m # had \s* at end
note=$1
- note=note.gsub(/[\n\s]+/m,' ')
+ note=note.gsub(/[\s]+/m,' ')
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
- gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,'').
- gsub(/<a[\n\s]+"[\n\s]+href="#note_ref\d+">#{$ep[:hsp]}<sup id="note\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') #remove
+ gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'').
+ gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') #remove
end
%{<#{tag} class="#{attrib}">
<a href="#o#{@ocn}"><i>#{txt}</i></a> #{note}
diff --git a/lib/sisu/v6/xhtml_epub2_segments.rb b/lib/sisu/v6/xhtml_epub2_segments.rb
index 2be4afd..d249b0f 100644
--- a/lib/sisu/v6/xhtml_epub2_segments.rb
+++ b/lib/sisu/v6/xhtml_epub2_segments.rb
@@ -401,7 +401,7 @@ WOK
sto.break
end
if @md.flag_separate_endnotes # may need to revisit, check
- dob.obj=dob.obj.gsub(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type
+ dob.obj=dob.obj.gsub(/"\s+href="##{Mx[:note_ref]}(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}##{Mx[:note_ref]}\\1">}) #endnote- twice #removed file type
end
if (dob.is ==:heading \
|| dob.is==:heading_insert \
diff --git a/lib/sisu/v6/xhtml_epub2_tune.rb b/lib/sisu/v6/xhtml_epub2_tune.rb
index 12f70fc..fd90ae5 100644
--- a/lib/sisu/v6/xhtml_epub2_tune.rb
+++ b/lib/sisu/v6/xhtml_epub2_tune.rb
@@ -298,22 +298,22 @@ module SiSU_XHTML_EPUB2_Tune
data.each do |dob|
unless dob.is ==:code
dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref]}\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1\\2 <a href="##{Mx[:note_ref]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note]}\\2">\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
gsub(/(#{Mx[:en_b_o]})[*](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_astx\\2">#{Mx[:nbsp]}<sup id="note_ref_astx\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast}\\2 <a href="#note_ref_astx\\2">#{Mx[:nbsp]}<sup id="note_astx\\2">#{ast}\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note_astx]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref_astx]}\\2">#{ast}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{ast}\\2 <a href="##{Mx[:note_ref_astx]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_astx]}\\2">#{ast}\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched)
gsub(/(#{Mx[:en_b_o]})[+](\d+)\s+(.+?)(#{Mx[:en_b_c]})/,
- %{#{Mx[:nbsp]}<a href="#note_plus\\2">#{Mx[:nbsp]}<sup id="note_ref_plus\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls}\\2 <a href="#note_ref_plus\\2">#{Mx[:nbsp]}<sup id="note_plus\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note_plus]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref_plus]}\\2">#{pls}\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{pls}\\2 <a href="##{Mx[:note_ref_plus]}\\2">#{Mx[:nbsp]}<sup id="#{Mx[:note_plus]}\\2">#{pls}\\2.</sup></a> \\3 \\4}) #endnote- note- (careful may have switched) # double-check there may here be a bug
if dob.obj =~/#{Mx[:en_a_o]}([*+]+)\s+.+?#{Mx[:en_a_c]}/
m=$1.length.to_i
dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]})[*]+\s+(.+?)(#{Mx[:en_a_c]})/,
- %{#{Mx[:nbsp]}<a href="#note#{a*m}">#{Mx[:nbsp]}<sup id="note_ref#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{ast*m} <a href="#note_ref#{a*m}">#{Mx[:nbsp]}<sup id="note#{a*m}">#{ast*m}</sup></a> \\2 \\3}). #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note]}#{a*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref]}#{a*m}">#{ast*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{ast*m} <a href="##{Mx[:note_ref]}#{a*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note]}#{a*m}">#{ast*m}</sup></a> \\2 \\3}). #endnote- note- (careful may have switched)
gsub(/(#{Mx[:en_a_o]})([+]+)\s+(.+?)(#{Mx[:en_a_c]})/,
- %{#{Mx[:nbsp]}<a href="#note#{s*m}">#{Mx[:nbsp]}<sup id="note_ref#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
- %{\\1#{pls*m} <a href="#note_ref#{s*m}">#{Mx[:nbsp]}<sup id="note#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
+ %{#{Mx[:nbsp]}<a href="##{Mx[:note]}#{s*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note_ref]}#{s*m}">#{pls*m}</sup>#{Mx[:nbsp]}</a> } + #note- endnote-
+ %{\\1#{pls*m} <a href="##{Mx[:note_ref]}#{s*m}">#{Mx[:nbsp]}<sup id="#{Mx[:note]}#{s*m}">#{pls*m}</sup></a> \\2 \\3}) #endnote- note- (careful may have switched)
end
end
@tuned_file << dob