aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/develop/ao_endnotes.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2015-03-19 18:38:21 -0400
committerRalph Amissah <ralph@amissah.com>2015-03-23 21:46:12 -0400
commit64dfdccbc0a136aab15c53ef0375244a28895429 (patch)
treed1cca15d22480dfb9e31765bd6160e72aab0c102 /lib/sisu/develop/ao_endnotes.rb
parentd: manifest add html ids to label/identify content (diff)
d: ao & elsewhere, use of map & select
Diffstat (limited to 'lib/sisu/develop/ao_endnotes.rb')
-rw-r--r--lib/sisu/develop/ao_endnotes.rb15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/sisu/develop/ao_endnotes.rb b/lib/sisu/develop/ao_endnotes.rb
index c6dafd4c..c5233452 100644
--- a/lib/sisu/develop/ao_endnotes.rb
+++ b/lib/sisu/develop/ao_endnotes.rb
@@ -66,9 +66,8 @@ module SiSU_AO_Endnotes
end
def endnotes
data=@data
- @tuned_file=[]
endnote_ref=1
- data.each do |dob|
+ @tuned_file=data.each.map do |dob|
# manually numbered endnotes <!e(\d)!> <!e_(\d)!> -->
if @md.opt.selections.str =~/--no-asterisk|--no-annotate/
dob.obj=dob.obj.
@@ -89,20 +88,20 @@ module SiSU_AO_Endnotes
word_mode=endnote_call_number(word_mode)
dob.obj=word_mode.join(' ')
endnote_ref+=1
- when /~\^(?:\s|$)|<:e>/ #%note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
+ when /~\^(?:\s|$)/ #%note inserts endnotes previously gathered from /^(<!e[:_]!>|[-~]\{{3})/ (in earlier loop)
word_mode=dob.obj.scan(/\S+/m)
word_mode=endnote_call_number(word_mode)
dob.obj=word_mode.join(' ')
endnote_ref+=1
end
end
- @tuned_file << dob
- end
+ dob
+ end.flatten
@endnote_counter,
@endnote_counter_asterisk,
@endnote_counter_dag=
1,1,1
- @tuned_file=@tuned_file.flatten
+ @tuned_file
end
def endnote_call_number(words)
words.each do |word|
@@ -123,9 +122,9 @@ module SiSU_AO_Endnotes
"#{Mx[:en_b_o]}\*#{@endnote_counter_asterisk} ")
@endnote_counter_asterisk+=1
end
- when /~\^|<:e>/
+ when /~\^/
if @endnote_array
- word.gsub!(/~\^|<:e>/,
+ word.gsub!(/~\^/,
"#{@endnote_array[@endnote_counter-1]}")
@endnote_counter+=1
end