From 04c7fafa159760ff5ae999eb97047f271a0a549b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 28 Mar 2017 20:39:35 -0400 Subject: 0.13.8 endnotes for various types of block --- org/ao_doc_abstraction.org | 59 ++++++++++++++++++++++++++++++++++++---------- org/defaults.org | 3 +++ org/sdp.org | 2 +- 3 files changed, 51 insertions(+), 13 deletions(-) (limited to 'org') diff --git a/org/ao_doc_abstraction.org b/org/ao_doc_abstraction.org index 2f7672b..355c126 100644 --- a/org/ao_doc_abstraction.org +++ b/org/ao_doc_abstraction.org @@ -864,6 +864,8 @@ if there is a blurb section you need to: /+ within block object: group +/ } else if (type["group"] == TriState.on) { /+ within block object: group +/ + line = (line) + .replaceAll(rgx.para_delimiter, mkup.br_paragraph ~ "$1"); _group_block_(line, an_object, type); continue; #+END_SRC @@ -874,6 +876,14 @@ if there is a blurb section you need to: #+BEGIN_SRC d } else if (type["block"] == TriState.on) { /+ within block object: block +/ + if (auto m = line.match(rgx.spaces_line_start)) { + line = (line) + .replaceAll(rgx.spaces_line_start, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); + } + if (auto m = line.match(rgx.spaces_multiple)) { + line = (line) + .replaceAll(rgx.spaces_multiple, (m.captures[1]).translate([ ' ' : mkup.nbsp ])); + } _block_block_(line, an_object, type); continue; #+END_SRC @@ -1241,7 +1251,10 @@ if ((type["heading"] == State.on) if (the_document_body_section.length > 0) { if (((the_document_body_section[$-1].is_a == "para") || (the_document_body_section[$-1].is_a == "heading") - || (the_document_body_section[$-1].is_a == "group")) + || (the_document_body_section[$-1].is_a == "quote") + || (the_document_body_section[$-1].is_a == "group") + || (the_document_body_section[$-1].is_a == "block") + || (the_document_body_section[$-1].is_a == "verse")) && (the_document_body_section.length > previous_length)) { if ((the_document_body_section[$-1].is_a == "heading") && (the_document_body_section[$-1].heading_lev_markup < 5)) { @@ -1249,17 +1262,36 @@ if (the_document_body_section.length > 0) { type["glossary_section"] = State.off; type["blurb_section"] = State.off; } - previous_length = the_document_body_section.length.to!int; - if ((the_document_body_section[$-1].text).match( - rgx.inline_notes_delimiter_al_regular_number_note - )) { - previous_count=(the_document_body_section.length -1).to!int; - note_section.gather_notes_for_endnote_section( - the_document_body_section, - segment_anchor_tag_that_object_belongs_to, - to!int(the_document_body_section.length-1), - ); + if (the_document_body_section[$-1].is_a == "verse") { + /+ scan for endnotes for whole poem (each verse in poem) +/ + foreach (i; previous_length .. the_document_body_section.length) { + if (the_document_body_section[i].is_a == "verse") { + if ((the_document_body_section[i].text).match( + rgx.inline_notes_delimiter_al_regular_number_note + )) { + note_section.gather_notes_for_endnote_section( + the_document_body_section, + segment_anchor_tag_that_object_belongs_to, + to!int(i), + ); + } + } + } + } else { + /+ scan object for endnotes +/ + previous_length = the_document_body_section.length.to!int; + if ((the_document_body_section[$-1].text).match( + rgx.inline_notes_delimiter_al_regular_number_note + )) { + previous_count=(the_document_body_section.length -1).to!int; + note_section.gather_notes_for_endnote_section( + the_document_body_section, + segment_anchor_tag_that_object_belongs_to, + to!int(the_document_body_section.length-1), + ); + } } + previous_length = the_document_body_section.length.to!int; } } #+END_SRC @@ -5914,7 +5946,10 @@ struct NotesSection { in { assert((contents_am[cntr].is_a == "para") || (contents_am[cntr].is_a == "heading") - || (contents_am[cntr].is_a == "group")); + || (contents_am[cntr].is_a == "quote") + || (contents_am[cntr].is_a == "group") + || (contents_am[cntr].is_a == "block") + || (contents_am[cntr].is_a == "verse")); assert(cntr >= previous_count); previous_count=cntr; assert( diff --git a/org/defaults.org b/org/defaults.org index 25b1a4b..b666c30 100644 --- a/org/defaults.org +++ b/org/defaults.org @@ -1185,8 +1185,11 @@ template SiSUlanguageCodes() { #+BEGIN_SRC d static newline = ctRegex!("\n", "mg"); static space = ctRegex!(`[ ]`, "mg"); +static spaces_line_start = ctRegex!(`^(?P[ ]+)`, "mg"); +static spaces_multiple = ctRegex!(`(?P[ ]{2,})`, "mg"); // could be issues for endnotes static two_spaces = ctRegex!(`[ ]{2}`, "mg"); static nbsp_char = ctRegex!(`░`, "mg"); +static nbsp_chars_line_start = ctRegex!(`^░+`, "mg"); static nbsp_and_space = ctRegex!(` [ ]`, "mg"); static nbsp_char_and_space = ctRegex!(`░[ ]`, "mg"); #+END_SRC diff --git a/org/sdp.org b/org/sdp.org index b1ed6ba..ff989c9 100644 --- a/org/sdp.org +++ b/org/sdp.org @@ -23,7 +23,7 @@ struct Version { int minor; int patch; } -enum ver = Version(0, 13, 7); +enum ver = Version(0, 13, 8); #+END_SRC * 1. sdp (sisu document parser) :sdp: -- cgit v1.2.3