diff options
-rw-r--r-- | org/default_regex.org | 1 | ||||
-rw-r--r-- | org/meta_abstraction.org | 35 | ||||
-rw-r--r-- | src/doc_reform/meta/metadoc_from_src.d | 35 | ||||
-rw-r--r-- | src/doc_reform/meta/rgx.d | 1 | ||||
-rw-r--r-- | src/doc_reform/output/rgx.d | 1 |
5 files changed, 67 insertions, 6 deletions
diff --git a/org/default_regex.org b/org/default_regex.org index 08fa141..4a87e37 100644 --- a/org/default_regex.org +++ b/org/default_regex.org @@ -520,6 +520,7 @@ static inline_notes_al_gen = ctRegex!(`【.+?】`, "m static inline_notes_al_regular = ctRegex!(`【(.+?)】`, "mg"); static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m"); static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg"); +static inline_notes_al_all_note = ctRegex!(`【(?P<num>\d+|(?:[*]|[+])+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_notes_al_special_char_note = ctRegex!(`【(?P<char>(?:[*]|[+])+)\s+(?P<note>.+?)】`, "mg"); static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); diff --git a/org/meta_abstraction.org b/org/meta_abstraction.org index a1b12d6..6ac33b3 100644 --- a/org/meta_abstraction.org +++ b/org/meta_abstraction.org @@ -1501,7 +1501,7 @@ if (the_document_body_section.length > 0) { foreach (i; previous_length .. the_document_body_section.length) { if (the_document_body_section[i].metainfo.is_a == "verse") { if ((the_document_body_section[i].text).match( - rgx.inline_notes_al_regular_number_note + rgx.inline_notes_al_all_note )) { note_section.gather_notes_for_endnote_section( the_document_body_section, @@ -1514,7 +1514,7 @@ if (the_document_body_section.length > 0) { } 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_al_regular_number_note + rgx.inline_notes_al_all_note )) { previous_count=(the_document_body_section.length -1).to!int; note_section.gather_notes_for_endnote_section( @@ -6746,7 +6746,7 @@ struct NotesSection { assert(cntr >= previous_count); assert( (contents_am[cntr].text).match( - rgx.inline_notes_al_regular_number_note) + rgx.inline_notes_al_all_note) ); mixin InternalMarkup; previous_count=cntr; @@ -6754,6 +6754,35 @@ struct NotesSection { static auto munge = ObjInlineMarkupMunge(); foreach(m; (contents_am[cntr].text).matchAll( + rgx.inline_notes_al_special_char_note) + ) { + debug(endnotes_build) { + writeln( + "{^", mkup.ff_o, m["char"], ".", mkup.ff_c, "^}" + ~ mkup.mark_internal_site_lnk, + tag_in_seg["seg_lv4"], + ".fnSuffix#noteref_\n ", m["char"], " ", + m["note"]); // sometimes need segment name (segmented html & epub) + } + // you need anchor for segments at this point -> + object_notes["anchor"] ~= "note_" ~ m["char"] ~ "』"; + object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) + ? (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" + ~ m["char"]) ~ " " + ~ m["note"] ~ "』" + ) + : (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" + ~ mkup.mark_internal_site_lnk + ~ tag_in_seg["seg_lv4"] + ~ ".fnSuffix#noteref_" + ~ m["char"]) ~ " " + ~ m["note"] ~ "』" + ); + } + foreach(m; + (contents_am[cntr].text).matchAll( rgx.inline_notes_al_regular_number_note) ) { debug(endnotes_build) { diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d index 7775f4c..1bfd183 100644 --- a/src/doc_reform/meta/metadoc_from_src.d +++ b/src/doc_reform/meta/metadoc_from_src.d @@ -1154,7 +1154,7 @@ template DocReformDocAbstraction() { foreach (i; previous_length .. the_document_body_section.length) { if (the_document_body_section[i].metainfo.is_a == "verse") { if ((the_document_body_section[i].text).match( - rgx.inline_notes_al_regular_number_note + rgx.inline_notes_al_all_note )) { note_section.gather_notes_for_endnote_section( the_document_body_section, @@ -1167,7 +1167,7 @@ template DocReformDocAbstraction() { } 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_al_regular_number_note + rgx.inline_notes_al_all_note )) { previous_count=(the_document_body_section.length -1).to!int; note_section.gather_notes_for_endnote_section( @@ -5387,7 +5387,7 @@ template DocReformDocAbstraction() { assert(cntr >= previous_count); assert( (contents_am[cntr].text).match( - rgx.inline_notes_al_regular_number_note) + rgx.inline_notes_al_all_note) ); mixin InternalMarkup; previous_count=cntr; @@ -5395,6 +5395,35 @@ template DocReformDocAbstraction() { static auto munge = ObjInlineMarkupMunge(); foreach(m; (contents_am[cntr].text).matchAll( + rgx.inline_notes_al_special_char_note) + ) { + debug(endnotes_build) { + writeln( + "{^", mkup.ff_o, m["char"], ".", mkup.ff_c, "^}" + ~ mkup.mark_internal_site_lnk, + tag_in_seg["seg_lv4"], + ".fnSuffix#noteref_\n ", m["char"], " ", + m["note"]); // sometimes need segment name (segmented html & epub) + } + // you need anchor for segments at this point -> + object_notes["anchor"] ~= "note_" ~ m["char"] ~ "』"; + object_notes["notes"] ~= (tag_in_seg["seg_lv4"].empty) + ? (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}#noteref_" + ~ m["char"]) ~ " " + ~ m["note"] ~ "』" + ) + : (links_and_images( + "{" ~ mkup.superscript ~ mkup.ff_o ~ m["char"] ~ "." ~ mkup.ff_c ~ mkup.superscript ~ "}" + ~ mkup.mark_internal_site_lnk + ~ tag_in_seg["seg_lv4"] + ~ ".fnSuffix#noteref_" + ~ m["char"]) ~ " " + ~ m["note"] ~ "』" + ); + } + foreach(m; + (contents_am[cntr].text).matchAll( rgx.inline_notes_al_regular_number_note) ) { debug(endnotes_build) { diff --git a/src/doc_reform/meta/rgx.d b/src/doc_reform/meta/rgx.d index 4f93c06..ddaf3f9 100644 --- a/src/doc_reform/meta/rgx.d +++ b/src/doc_reform/meta/rgx.d @@ -251,6 +251,7 @@ static template DocReformRgxInit() { static inline_notes_al_regular = ctRegex!(`【(.+?)】`, "mg"); static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m"); static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg"); + static inline_notes_al_all_note = ctRegex!(`【(?P<num>\d+|(?:[*]|[+])+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_notes_al_special_char_note = ctRegex!(`【(?P<char>(?:[*]|[+])+)\s+(?P<note>.+?)】`, "mg"); static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index c0d8bf0..86cd48b 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -55,6 +55,7 @@ static template DocReformOutputRgxInit() { static inline_notes_al_regular = ctRegex!(`【(.+?)】`, "mg"); static inline_notes_al_gen_text = ctRegex!(`【(?P<text>.+?)】`, "m"); static inline_notes_al_gen_ref = ctRegex!(`【(?P<ref>[*+]\s+)\s*(?P<text>.+?)】`, "mg"); + static inline_notes_al_all_note = ctRegex!(`【(?P<num>\d+|(?:[*]|[+])+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_notes_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_notes_al_special_char_note = ctRegex!(`【(?P<char>(?:[*]|[+])+)\s+(?P<note>.+?)】`, "mg"); static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); |