From 40b83047b2a77998354188dabca8ad352b17d45f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 11 May 2015 18:56:20 -0400 Subject: 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 --- lib/sisu/ao_doc_str.rb | 77 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 50 insertions(+), 27 deletions(-) (limited to 'lib/sisu/ao_doc_str.rb') 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=[] -- cgit v1.2.3