aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2015-05-11 18:56:20 -0400
committerRalph Amissah <ralph@amissah.com>2015-05-15 00:22:18 -0400
commit40b83047b2a77998354188dabca8ad352b17d45f (patch)
treec479418814229b1a0b99f9b3d7fdd5f007e4a245
parentao_references, fix (diff)
appendices: bibliography & glossary, worked on
* bibliography & glossary make activated by markup headers 1~!biblio & 1~!glossary * bibliography tags altered (introduced in 5.8.0 v6 project dir branch) * version bump for change in behavior
-rw-r--r--data/doc/sisu/CHANGELOG_v734
-rw-r--r--lib/sisu/ao.rb20
-rw-r--r--lib/sisu/ao_appendices.rb (renamed from lib/sisu/ao_references.rb)368
-rw-r--r--lib/sisu/ao_doc_str.rb77
-rw-r--r--lib/sisu/dp.rb10
-rw-r--r--lib/sisu/html_format.rb2
6 files changed, 344 insertions, 167 deletions
diff --git a/data/doc/sisu/CHANGELOG_v7 b/data/doc/sisu/CHANGELOG_v7
index 1deba428..b9541814 100644
--- a/data/doc/sisu/CHANGELOG_v7
+++ b/data/doc/sisu/CHANGELOG_v7
@@ -20,10 +20,38 @@ Reverse Chronological:
--- HEAD ---
-* sisu_7.0.1.orig.tar.xz (Open commit window: 2015-05-05; Pre-Release))
- http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_7.0.1
+* sisu_7.1.0.orig.tar.xz (2015-05-15:19/5)
+ http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=log;h=refs/tags/sisu_7.1.0
- * ao_references (bibliography), a fix
+ * bibliography 1~!bibliography
+
+ 1~!bibliography
+
+ au: author Surname, FirstNames (if multiple semi-colon separator)
+ (required unless editor to be used instead)
+ ti: title (required)
+ st: subtitle
+ jo: journal
+ vo: volume
+ ed: editor (required if author not provided)
+ tr: translator
+ src: source (generic field where others are not appropriate)
+ in: in (like src)
+ pl: place/location (state, country)
+ pb: publisher
+ edn: edition
+ yr: year (yyyy or yyyy-mm or yyyy-mm-dd) (required)
+ pg: pages
+ url: http://url
+ note: note
+ id: create_short_identifier e.g. authorSurnameYear
+ (used in substitutions: when found within text will be
+ replaced by the short name provided)
+ sn: short name e.g. Author, /{short title}/, Year
+ (used in substitutions: when an id is found within text
+ the short name will be used to replace it)
+
+ * glossary 1~!glossary
* qi (quick installer) cleaning
diff --git a/lib/sisu/ao.rb b/lib/sisu/ao.rb
index 3e5f506e..c4266b06 100644
--- a/lib/sisu/ao.rb
+++ b/lib/sisu/ao.rb
@@ -64,7 +64,7 @@ module SiSU_AO
require_relative 'ao_syntax' # ao_syntax.rb
include SiSU_AO_Syntax
require_relative 'ao_doc_str' # ao_doc_str.rb
- require_relative 'ao_references' # ao_references.rb
+ require_relative 'ao_appendices' # ao_appendices.rb
require_relative 'ao_idx' # ao_idx.rb
require_relative 'ao_numbering' # ao_numbering.rb
require_relative 'ao_hash_digest' # ao_hash_digest.rb
@@ -534,38 +534,38 @@ module SiSU_AO
reset
data_txt=@data
data_txt=
- SiSU_AO_Insertions::Insertions.new(@md,data_txt). # ao_expand_insertions.rb
+ SiSU_AO_Insertions::Insertions.new(@md,data_txt). # ao_expand_insertions.rb
expand_insertions?
data_txt=
- SiSU_AO_MiscArrangeText::SI.new(@md,data_txt). # ao_misc_arrange.rb
+ SiSU_AO_MiscArrangeText::SI.new(@md,data_txt). # ao_misc_arrange.rb
prepare_text
data_obj,
metadata,
bibliography=
- SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt). # ao_doc_str.rb
+ SiSU_AO_DocumentStructureExtract::Build.new(@md,data_txt). # ao_doc_str.rb
identify_parts
data_obj=
- SiSU_AO_Syntax::Markup.new(@md,data_obj,bibliography).songsheet # ao_syntax.rb
+ SiSU_AO_Syntax::Markup.new(@md,data_obj,bibliography).songsheet # ao_syntax.rb
data_obj,
endnote_array=
- SiSU_AO_CharacterCheck::Check.new(data_obj). # ao_character_check.rb
+ SiSU_AO_CharacterCheck::Check.new(data_obj). # ao_character_check.rb
character_check_and_oldstyle_endnote_array
data_obj=
- SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb
+ SiSU_AO_Images::Images.new(@md,data_obj).images # ao_images.rb
data_obj,
tags_map,
ocn_html_seg_map=
- SiSU_AO_Numbering::Numbering.new(@md,data_obj,@fnx,@process). # ao_numbering.rb
+ SiSU_AO_Numbering::Numbering.new(@md,data_obj,@fnx,@process). # ao_numbering.rb
numbering_song
data_obj,
book_index_rel,
book_index_rel_html_seg,
html_idx,
xhtml_idx=
- SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env). # ao_idx.rb
+ SiSU_AO_BookIndex::BookIndex.new(@md,data_obj,@env). # ao_idx.rb
indexing_song if @md.book_idx
data_obj=
- SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array). # ao_endnotes.rb
+ SiSU_AO_Endnotes::Endnotes.new(@md,data_obj,endnote_array). # ao_endnotes.rb
endnotes
outputdata=data_obj
if (@md.opt.act[:ao][:set]==:on \
diff --git a/lib/sisu/ao_references.rb b/lib/sisu/ao_appendices.rb
index 18b726f8..809f53f8 100644
--- a/lib/sisu/ao_references.rb
+++ b/lib/sisu/ao_appendices.rb
@@ -51,154 +51,284 @@
** Git
<http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=summary>
- <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_references.rb;hb=HEAD>
+ <http://git.sisudoc.org/gitweb/?p=code/sisu.git;a=blob;f=lib/sisu/ao_appendices.rb;hb=HEAD>
=end
-module SiSU_AO_References
+module SiSU_AO_Appendices
+ class Glossary
+ def initialize(md,data)
+ @md,@data=md,data
+ end
+ def glossary_extraction
+ glossary=[]
+ glossaryflag=false
+ code_flag=false
+ flag_code_curly=:not_code_curly
+ flag_code_tics=:not_code_tics
+ @data=@data.select do |t_o|
+ if t_o =~/^code\{/
+ flag_code_curly=:code_curly
+ elsif t_o =~/^\}code/
+ flag_code_curly=:not_code_curly
+ elsif t_o =~/^``` code/
+ flag_code_tics=:code_tics
+ elsif flag_code_tics ==:code_tics \
+ and t_o =~/^```/
+ flag_code_tics=:not_code_tics
+ end
+ code_flag=if flag_code_curly==:code_curly \
+ or flag_code_tics==:code_tics
+ true
+ else false
+ end
+ unless code_flag
+ if @md.flag_glossary
+ if t_o =~/^1~!glossary/
+ glossaryflag = true
+ next
+ elsif t_o =~/^:?[B-D]~/
+ next
+ elsif t_o =~/^:?[B-D1]~/
+ glossaryflag = false
+ t_o
+ elsif glossaryflag
+ if t_o !~/\A%+ /
+ glossary << t_o
+ next
+ else
+ t_o
+ end
+ else t_o
+ end
+ else t_o
+ end
+ else t_o
+ end
+ end.compact
+ [@data,glossary]
+ end
+ end
class Bibliography
def initialize(md,data)
@md,@data=md,data
end
- def sort_bibliography_array_by_author_year_title(bib)
+ def sort_bibliography_array_by_deemed_author_year_title(bib)
if bib
bib.compact.sort_by do |c|
- [c[:author_arr][0],c[:year],c[:title]]
+ [c[:deemed_author],c[:ymd],c[:title]]
end
end
end
def citation_in_prepared_bibliography(cite)
@cite=cite
- def article
+ def generic
{
- is: :article,
+ is: nil, # :book, :article, :magazine, :newspaper, :blog, :other
author_raw: nil,
author: nil,
author_arr: nil,
- title: nil,
- language: nil,
- journal: nil,
- volume: nil,
+ editor_raw: nil,
editor: nil,
- year: nil,
- where: nil,
- url: nil,
- note: nil,
- short_name: nil,
- id: nil,
- }
- end
- def book
- {
- is: :book,
- author_raw: nil,
- author: nil,
- author_arr: nil,
- #editor: nil,
+ editor_arr: nil,
title: nil,
subtitle: nil,
fulltitle: nil,
language: nil,
- publisher: nil,
+ trans: nil,
+ src: nil,
+ journal: nil,
+ in: nil,
+ volume: nil,
edition: nil,
year: nil,
- where: nil,
+ place: nil,
+ publisher: nil,
url: nil,
+ pages: nil,
note: nil,
+ #format: nil, #consider list of fields arranged with markup
short_name: nil,
id: nil,
}
end
def citation_metadata
- type=if @cite =~/^jo: \S+/m
- :article
- elsif @cite =~/^au: \S+/m
- :book
- end
+ type=:generic
if type
+ citation=generic
citeblock=@cite.split("\n")
- if type == :article
- citation=article
- citeblock.select do |meta|
- case meta
- when /^((?:au|author):\s+)\S+/ #req
- citation[:author_raw]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:ti|title):\s+)\S+/ #req
- citation[:title]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:lng|language):\s+)\S+/
- citation[:language]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:jo|journal):\s+)\S+/ #req?
- citation[:journal]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:vo|volume):\s+)\S+/
- citation[:volume]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:edr|editor):\s+)\S+/
- citation[:editor]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:yr|year):\s+)\S+/ #req?
- citation[:year]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:pst|publisher_state):\s+)\S+/
- citation[:where]=/^#{$1}(.+)/.match(meta)[1]
- when /^(url:\s+)\S+/
- citation[:url]=/^#{$1}(.+)/.match(meta)[1]
- when /^(note:\s+)\S+/
- citation[:note]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:sn|shortname):\s+)\S+/
- citation[:short_name]=/^#{$1}(.+)/.match(meta)[1]
- when /^(id:\s+)\S+/
- citation[:id]=/^#{$1}(.+)/.match(meta)[1]
- end
+ citeblock.select do |meta|
+ case meta
+ when /^((?:au|author):\s+)\S+/ #req
+ citation[:author_raw]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:ti|title):\s+)\S+/ #req
+ citation[:title]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:st|subtitle):\s+)\S+/
+ citation[:subtitle]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:lng|language):\s+)\S+/
+ citation[:language]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:edr?|editor):\s+)\S+/
+ citation[:editor_raw]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:tr|trans(:?lator)?):\s+)\S+/
+ citation[:editor_raw]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:pb|publisher):\s+)\S+/
+ citation[:publisher]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:edn|edition):\s+)\S+/
+ citation[:edition]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:yr|year):\s+)\S+/ #req?
+ citation[:year]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:pl|publisher_state):\s+)\S+/
+ citation[:place]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:jo|journal):\s+)\S+/ #req?
+ citation[:journal]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:vol?|volume):\s+)\S+/
+ citation[:volume]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:in):\s+)\S+/
+ citation[:in]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:src):\s+)\S+/
+ citation[:src]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:pg|pages?):\s+)\S+/
+ citation[:pages]=/^#{$1}(.+)/.match(meta)[1]
+ when /^(url:\s+)\S+/
+ citation[:url]=/^#{$1}(.+)/.match(meta)[1]
+ when /^(note:\s+)\S+/
+ citation[:note]=/^#{$1}(.+)/.match(meta)[1]
+ when /^((?:sn|shortname):\s+)\S+/ # substitution: (/#{id}/,"#{sn}")
+ citation[:short_name]=/^#{$1}(.+)/.match(meta)[1]
+ when /^(id:\s+)\S+/ # substitution: (/#{id}/,"#{sn}")
+ citation[:id]=/^#{$1}(.+)/.match(meta)[1]
end
end
- if type == :book
- citation=book
- citeblock.select do |meta|
- case meta
- when /^((?:au|author):\s+)\S+/ #req
- citation[:author_raw]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:ti|title):\s+)\S+/ #req
- citation[:title]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:st|subtitle):\s+)\S+/
- citation[:subtitle]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:lng|language):\s+)\S+/
- citation[:language]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:pb|publisher):\s+)\S+/
- citation[:publisher]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:edn|edition):\s+)\S+/
- citation[:edition]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:yr|year):\s+)\S+/ #req?
- citation[:year]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:pst|publisher_state):\s+)\S+/
- citation[:where]=/^#{$1}(.+)/.match(meta)[1]
- when /^(url:\s+)\S+/
- citation[:url]=/^#{$1}(.+)/.match(meta)[1]
- when /^(note:\s+)\S+/
- citation[:note]=/^#{$1}(.+)/.match(meta)[1]
- when /^((?:sn|shortname):\s+)\S+/
- citation[:short_name]=/^#{$1}(.+)/.match(meta)[1]
- when /^(id:\s+)\S+/
- citation[:id]=/^#{$1}(.+)/.match(meta)[1]
- end
- end
+ if citation[:subtitle]
+ citation[:fulltitle] = citation[:title] \
+ + ' - ' \
+ + citation[:subtitle]
+ else
+ citation[:fulltitle] = citation[:title]
end
- if citation[:is]==:book
- if citation[:subtitle]
- citation[:fulltitle] = citation[:title] \
- + ' - ' \
- + citation[:subtitle]
- else
- citation[:fulltitle] = citation[:title]
- end
+ if citation[:author_raw]
+ citation[:author_arr]=citation[:author_raw].split(/;\s*/)
+ citation[:author]=citation[:author_arr].map do |author|
+ author.gsub(/(.+?),\s+(.+)/,'\2 \1').strip
+ end.join(', ').strip
+ end
+ if citation[:editor_raw]
+ citation[:editor_arr]=citation[:editor_raw].split(/;\s*/)
+ citation[:editor]=citation[:editor_arr].map do |editor|
+ editor.gsub(/(.+?),\s+(.+)/,'\2 \1').strip
+ end.join(', ').strip
+ end
+ citation[:ymd]=if not citation[:year] =~/^[0-9]{4}/
+ '9999'
+ else citation[:year]
+ end
+ citation[:deemed_author]=if not citation[:author_raw] \
+ and citation[:editor_raw]
+ citation[:editor_arr][0]
+ elsif citation[:author_raw]
+ citation[:author_arr][0]
+ else
+ SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
+ warn('Citation needs an author or editor, title: "' \
+ + citation[:title] + '"')
+ '000'
end
- citation[:author_arr]=citation[:author_raw].split(/;\s*/)
- citation[:author]=citation[:author_arr].map do |author|
- author.gsub(/(.+?),\s+(.+)/,'\2 \1').strip
- end.join(', ').strip
unless citation[:short_name]
- citation[:short_name]=%{#{citation[:author]}, "#{citation[:short_name]}" (#{citation[:date]})}
+ citation[:short_name]=%{#{citation[:author]}, "#{citation[:title]}" (#{citation[:date]})}
end
end
citation
end
self
end
+ def biblio_format
+ def generic(c)
+ cite=%{#{c[:author]}. /{"#{c[:fulltitle]}".}/}
+ cite=(c[:journal]) \
+ ? cite + %{ #{c[:journal]},}
+ : cite
+ cite=(c[:source]) \
+ ? cite + %{ #{c[:source]},}
+ : cite
+ cite=(c[:in]) \
+ ? cite + %{ in #{c[:in]},}
+ : cite
+ cite=(c[:volume]) \
+ ? cite + %{ #{c[:volume]},}
+ : cite
+ cite=(c[:trans]) \
+ ? cite + %{ trans. #{c[:trans]},}
+ : cite
+ cite=(c[:editor]) \
+ ? cite + %{ ed. #{c[:editor]},}
+ : cite
+ cite=(c[:place]) \
+ ? cite + %{ #{c[:place]},}
+ : cite
+ cite=(c[:publisher]) \
+ ? cite + %{ #{c[:publisher]},}
+ : cite
+ cite=(c[:year]) \
+ ? cite + %{ (#{c[:year]})}
+ : cite
+ cite=(c[:pages]) \
+ ? cite + %{ #{c[:pages]}}
+ : cite
+ cite=(c[:url]) \
+ ? cite + %{ #{c[:url]}}
+ : cite
+ cite=(c[:note]) \
+ ? cite + %{ #{c[:note]}}
+ : cite
+ cite
+ end
+ def generic_editor(c)
+ cite=%{#{c[:editor]} ed. /{"#{c[:fulltitle]}".}/}
+ cite=(c[:journal]) \
+ ? cite + %{ #{c[:journal]}, }
+ : cite
+ cite=(c[:source]) \
+ ? cite + %{ #{c[:source]}, }
+ : cite
+ cite=(c[:in]) \
+ ? cite + %{ in #{c[:in]},}
+ : cite
+ cite=(c[:volume]) \
+ ? cite + %{ #{c[:volume]},}
+ : cite
+ cite=(c[:trans]) \
+ ? cite + %{ trans. #{c[:trans]},}
+ : cite
+ cite=(c[:place]) \
+ ? cite + %{ #{c[:place]},}
+ : cite
+ cite=(c[:publisher]) \
+ ? cite + %{ #{c[:publisher]}}
+ : cite
+ cite=(c[:year]) \
+ ? cite + %{ (#{c[:year]})}
+ : cite
+ cite=(c[:pages]) \
+ ? cite + %{ #{c[:pages]}}
+ : cite
+ cite=(c[:url]) \
+ ? cite + %{ #{c[:url]}}
+ : cite
+ cite=(c[:note]) \
+ ? cite + %{ #{c[:note]}}
+ : cite
+ cite
+ end
+ self
+ end
+ def biblio_make(cite)
+ if cite[:author]
+ biblio_format.generic(cite)
+ elsif cite[:editor]
+ biblio_format.generic_editor(cite)
+ else
+ biblio_format.generic(cite)
+ end
+ end
def biblio_extraction
bibliography=[]
biblioflag=false
@@ -223,7 +353,7 @@ module SiSU_AO_References
end
unless code_flag
if @md.flag_auto_biblio
- if t_o =~/^1~biblio(?:graphy)?/
+ if t_o =~/^1~!biblio(?:graphy)?/
biblioflag = true
t_o
elsif t_o =~/^:?[B-D1]~/
@@ -239,7 +369,7 @@ module SiSU_AO_References
else t_o
end
elsif @md.flag_biblio
- if t_o =~/^1~biblio(?:graphy)?/
+ if t_o =~/^1~!biblio(?:graphy)?/
biblioflag = true
next
elsif t_o =~/^:?[B-D]~/
@@ -264,30 +394,22 @@ module SiSU_AO_References
if @md.flag_auto_biblio \
and bibliography.length > 0
data_new=[]
- bibliography=sort_bibliography_array_by_author_year_title(bibliography)
+ bib=sort_bibliography_array_by_deemed_author_year_title(bibliography)
+ biblio_done=[]
@data.select do |t_o|
- if t_o =~/^1~biblio(?:graphy)?/
- bibliography.each do |c|
- if c[:is]==:book
- <<-WOK
-
-!_ #{c[:author]}
-/{"#{c[:fulltitle]}"}/ #{c[:publisher]} (#{c[:year]})
- WOK
- elsif c[:is]==:article
- <<-WOK
-
-!_ #{c[:author]}
-/{"#{c[:title]}"}/ #{c[:journal]} (#{c[:year]})
- WOK
- end
+ if t_o =~/^1~!biblio(?:graphy)?/
+ bib.each do |c|
+ d=c
+ d.store(:obj, biblio_make(c))
+ biblio_done << d
+ #biblio_done << { obj: biblio_make(c), id: c[:id] }
end
else data_new << t_o
end
end
@data=data_new
end
- [@data,bibliography]
+ [@data,biblio_done]
end
end
class Citations
diff --git a/lib/sisu/ao_doc_str.rb b/lib/sisu/ao_doc_str.rb
index 9da488b6..e0034ed5 100644
--- a/lib/sisu/ao_doc_str.rb
+++ b/lib/sisu/ao_doc_str.rb
@@ -1072,7 +1072,13 @@ module SiSU_AO_DocumentStructureExtract
table: 0,
}
@metadata={}
- @data,bibliography=SiSU_AO_References::Bibliography.new(@md,@data).biblio_extraction
+ if @md.flag_auto_biblio \
+ or @md.flag_biblio
+ @data,bibliography=SiSU_AO_Appendices::Bibliography.new(@md,@data).biblio_extraction
+ end
+ if @md.flag_glossary
+ @data,glossary=SiSU_AO_Appendices::Glossary.new(@md,@data).glossary_extraction
+ end
tuned_file=extract_structure_loop(@data,tuned_file)
if @md.flag_endnotes
tuned_file << @pb
@@ -1095,6 +1101,30 @@ module SiSU_AO_DocumentStructureExtract
obj: 'Endnotes'
}
end
+ if @md.flag_glossary
+ tuned_file << @pb
+ h={
+ ln: 1,
+ lc: 1,
+ obj: 'Glossary',
+ autonum_: false,
+ }
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ h={
+ ln: 4,
+ lc: 2,
+ obj: 'Glossary',
+ name: 'glossary',
+ autonum_: false,
+ }
+ tuned_file << SiSU_AO_DocumentStructure::ObjectHeading.new.heading_insert(h)
+ h={
+ obj: 'Glossary'
+ }
+ if glossary.length > 0
+ tuned_file=extract_structure_loop(glossary,tuned_file)
+ end
+ end
if @md.flag_auto_biblio
tuned_file << @pb
h={
@@ -1116,27 +1146,17 @@ module SiSU_AO_DocumentStructureExtract
obj: 'Bibliography'
}
citenumber=0
- bibliography.each do |c|
- citenumber +=1 if c.is_a?(Hash)
- if c[:is]==:book
- h={
- obj: %{[#{citenumber}] *{#{c[:author]}}* /{"#{c[:fulltitle]}"}/ #{c[:publisher]} (#{c[:year]}) #{c[:url]}},
- tags: [c[:id]],
- hang: 0,
- indent: 2,
- ocn_: false,
- }
- tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
- elsif c[:is]==:article
- h={
- obj: %{[#{citenumber}] *{#{c[:author]}}* /{"#{c[:title]}"}/ #{c[:journal]} #{c[:volume]} (#{c[:year]}) #{c[:url]}},
- tags: [c[:id]],
- hang: 0,
- indent: 2,
- ocn_: false,
- }
- tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
- end
+ bibliography.each do |cite|
+ citenumber +=1 if cite.is_a?(Hash)
+ h={
+ obj: cite[:obj],
+ #obj: %{[#{citenumber}] } + cite[:obj],
+ tags: [cite[:id]],
+ hang: 0,
+ indent: 2,
+ ocn_: false,
+ }
+ tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
end
elsif @md.flag_biblio
tuned_file << @pb
@@ -1158,17 +1178,19 @@ module SiSU_AO_DocumentStructureExtract
h={
obj: 'Bibliography'
}
- if bibliography.length > 0
+ if not bibliography.nil? \
+ and bibliography.length > 0
tuned_file=extract_structure_loop(bibliography,tuned_file)
else
tuned_file, citations =
- SiSU_AO_References::Citations.new(@md,tuned_file).songsheet # ao_references.rb
+ SiSU_AO_Appendices::Citations.new(@md,tuned_file).songsheet # ao_appendices.rb
citenumber=0
citations.compact.each do |c|
citenumber +=1 if c.is_a?(Hash)
if c[:is]==:book
h={
- obj: %{[#{citenumber}] *{#{c[:author]}}* /{#{c[:publication]}}/ (#{c[:year]})},
+ obj: %{#{c[:author]}. /{#{c[:publication]}}/ (#{c[:year]})},
+ #obj: %{[#{citenumber}] *{#{c[:author]}}* /{#{c[:publication]}}/ (#{c[:year]})},
hang: 0,
indent: 2,
ocn_: false,
@@ -1176,7 +1198,8 @@ module SiSU_AO_DocumentStructureExtract
tuned_file << SiSU_AO_DocumentStructure::ObjectPara.new.paragraph(h)
elsif c[:is]==:article
h={
- obj: %{[#{citenumber}] *{#{c[:author]}}* /{"#{c[:title]}"}/ #{c[:publication]} editor #{c[:editor]} (#{c[:year]})},
+ obj: %{#{c[:author]}. /{"#{c[:title]}"}/ #{c[:publication]} editor #{c[:editor]} (#{c[:year]})},
+ #obj: %{[#{citenumber}] *{#{c[:author]}}* /{"#{c[:title]}"}/ #{c[:publication]} editor #{c[:editor]} (#{c[:year]})},
hang: 0,
indent: 2,
ocn_: false,
@@ -1229,7 +1252,7 @@ module SiSU_AO_DocumentStructureExtract
obj: 'eof',
}
meta=SiSU_AO_DocumentStructure::ObjectMetadata.new.metadata(@metadata)
- [tuned_file,meta,bibliography]
+ [tuned_file,meta,bibliography,glossary]
end
def table_rows_and_columns_array(table_str)
table=[]
diff --git a/lib/sisu/dp.rb b/lib/sisu/dp.rb
index f3b15e9e..300edc8d 100644
--- a/lib/sisu/dp.rb
+++ b/lib/sisu/dp.rb
@@ -897,9 +897,9 @@ module SiSU_Param
@doc={ lv: [] }
@doc[:fns],@doc[:fnb],@doc[:scr_suffix]='','',''
@@publisher='SiSU scribe'
- attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:project_details,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv0,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_biblio,:flag_auto_biblio,:flag_endnotes,:flag_auto_endnotes,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section
+ attr_accessor :make,:env,:path,:file,:fn,:fns,:fno,:fnb,:fnn,:fnt,:fnl,:flv,:fnz,:fnstex,:ocn,:sfx_src,:pdf,:file_type,:dir_out,:dir_tex,:dir_lout,:txt_path,:sisu,:project_details,:ruby_version,:title,:subtitle,:full_title,:html_title,:subtitle_tex,:creator,:classify,:author_home,:author,:author_title,:author_nationality,:authors,:authorship,:translator,:illustrator,:prepared_by,:digitized_by,:subject,:description,:publisher,:current_publisher,:contributor,:date,:date_created,:date_issued,:date_available,:date_valid,:date_modified,:date_translated,:date_added_to_site,:date_scheme,:date_created_scheme,:date_issued_scheme,:date_available_scheme,:date_valid_scheme,:date_modified_scheme,:type,:format,:identifier,:source,:language,:language_original,:relation,:coverage,:rights,:keywords,:comments,:abstract,:cls_loc,:cls_dewey,:cls_pg,:cls_isbn,:papersize,:papersize_array,:toc,:lv0,:lv1,:lv2,:lv3,:lv4,:lv5,:lv6,:lvs,:pagenew,:pagebreak,:pageline,:num_top,:bold_match_list,:italics_match_list,:substitution_match_list,:emphasis_set_to,:toc_lev_limit,:flag_biblio,:flag_auto_biblio,:flag_endnotes,:flag_auto_endnotes,:flag_glossary,:flag_separate_endnotes,:flag_separate_endnotes_make,:markup,:markup_instruction,:flag_tables,:vocabulary,:doc_css,:yaml,:lnk,:links,:prefix_a,:prefix_b,:suffix,:information,:contact,:icon,:image,:ad_url,:ad_png,:ad_alt,:ad_began,:flag_promo,:promo,:ad_home,:stmp,:stmpd,:sc_filename,:sc_number,:sc_date,:sc_time,:sc_info,:yamladdr,:locale,:wc_lines,:wc_words,:wc_bytes,:file_encoding,:filesize,:user,:home,:hostname,:pwd,:firstseg,:programs,:author_copymark,:i18n,:lang,:lang_code_insert,:en,:notes,:dgst,:generated,:tags,:tag_array,:concord_make,:seg_names,:seg_autoname_safe,:set_header_title,:set_heading_top,:set_heading_seg,:heading_seg_first,:heading_seg_first_flag,:base_program,:ec,:opt,:sem_tag,:book_idx,:topic_register,:topic_register_array,:original,:writing_focus,:audio,:daisy,:home_button_image,:home_button_links,:footer_links,:cover_image,:man_section
def initialize(fns_array,opt)
- @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_biblio=@flag_auto_biblio=@flag_endnotes=@flag_auto_endnotes=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@project_details=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv0=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil
+ @env=@path,@file=@fn=@fns=@fno=@fnb=@fnn=@fnt=@fnl=@flv=@fnz=@fnstex=@ocn=@sfx_src=@pdf=@file_type=@dir_out=@dir_tex=@dir_lout=@txt_path=@make=@flag_biblio=@flag_auto_biblio=@flag_endnotes=@flag_auto_endnotes=@flag_glossary=@flag_separate_endnotes=@flag_separate_endnotes_make=@sisu=@project_details=@ruby_version=@title=@subtitle=@full_title=@html_title=@subtitle_tex=@creator=@classify=@author_home=@author=@author_title=@author_nationality=@translator=@illustrator=@prepared_by=@digitized_by=@subject=@description=@publisher=@current_publisher=@contributor=@date=@date_created=@date_issued=@date_available=@date_valid=@date_modified=@date_translated=@date_added_to_site=@date_scheme=@date_created_scheme=@date_issued_scheme=@date_available_scheme=@date_valid_scheme=@date_modified_scheme=@type=@format=@identifier=@source=@language=@language_original=@relation=@coverage=@rights=@keywords=@comments=@abstract=@cls_loc=@cls_dewey=@cls_pg=@cls_isbn=@papersize=@toc=@lv0=@lv1=@lv2=@lv3=@lv4=@lv5=@lv6=@pagenew=@pagebreak=@pageline=@num_top=@bold_match_list=@italics_match_list=@substitution_match_list=@emphasis_set_to=@toc_lev_limit=@flag_tables=@vocabulary=@doc_css=@yaml=@lnk=@links=@prefix_a=@prefix_b=@suffix=@information=@contact=@icon=@ad_url=@ad_png=@ad_alt=@ad_began=@promo=@ad_home=@stmp=@stmpd=@sc_filename=@sc_number=@sc_date=@sc_time=@sc_info=@yamladdr=@locale=@wc_lines=@wc_words=@wc_bytes=@file_encoding=@filesize=@firstseg=@programs=@author_copymark=@i18n=@lang=@lang_code_insert=@en=@notes=@dgst=@generated=@heading_seg_first=@base_program=@topic_register=@original=@writing_focus=@audio=@home_button_image=@home_button_links=@cover_image=@man_section=nil
@data, @path, @fns, @fno, @opt=
fns_array,opt.pth,opt.fns,opt.fno,opt #@data used as data
@flag_tables,@set_header_title,@set_heading_top,@set_heading_seg,@heading_seg_first_flag,@flag_promo,@book_idx=
@@ -1014,6 +1014,7 @@ module SiSU_Param
@fnstex=@fns.gsub(/_/,'\_\-').gsub(/\./,'.\-')
@flag_endnotes,@flag_auto_endnotes,@flag_separate_endnotes=false,false,false
@flag_separate_endnotes_make=true
+ @flag_glossary=false
@flag_biblio,@flag_auto_biblio=false,false
ver=SiSU_Env::InfoVersion.instance
@project_details=ver.get_version
@@ -1216,7 +1217,7 @@ module SiSU_Param
).txt_grey if @opt.act[:verbose][:set]==:on
end
unless @code_flag
- if para =~/^1~biblio(?:graphy)?/
+ if para =~/^1~!biblio(?:graphy)?/
@flag_auto_biblio,@flag_biblio=false,true
#@flag_biblio=true
elsif @flag_biblio ==true \
@@ -1224,6 +1225,9 @@ module SiSU_Param
and para =~/^(?:au|author):/m
@flag_auto_biblio =true
end
+ if para =~/^1~!glossary/
+ @flag_glossary=true
+ end
end
if not @book_idx \
and para =~/^=\{(.+?)\}[\s`]*\Z/m
diff --git a/lib/sisu/html_format.rb b/lib/sisu/html_format.rb
index b5726626..54edac82 100644
--- a/lib/sisu/html_format.rb
+++ b/lib/sisu/html_format.rb
@@ -883,7 +883,7 @@ WOK
tags=''
if defined? dob.tags \
and dob.tags.length > 0 # insert tags "hypertargets"
- dob.tags.each do |t|
+ dob.tags.compact.each do |t| # .compact hides a problem, nil should not occur fix (upstream)
t=t.gsub(/[^a-z0-9._-]/,'') #use for all html tags? consider limiting to strict? or implementing earlier
tags=(t =~/^[0-9.]+$/) \
? tags #check what can be sorted in ao