diff options
Diffstat (limited to 'src/doc_reform/output')
-rw-r--r-- | src/doc_reform/output/defaults.d | 1 | ||||
-rw-r--r-- | src/doc_reform/output/epub3.d | 8 | ||||
-rw-r--r-- | src/doc_reform/output/paths_output.d | 8 | ||||
-rw-r--r-- | src/doc_reform/output/rgx.d | 17 | ||||
-rw-r--r-- | src/doc_reform/output/sqlite.d | 12 | ||||
-rw-r--r-- | src/doc_reform/output/xmls.d | 18 |
6 files changed, 38 insertions, 26 deletions
diff --git a/src/doc_reform/output/defaults.d b/src/doc_reform/output/defaults.d index a038802..b8ff322 100644 --- a/src/doc_reform/output/defaults.d +++ b/src/doc_reform/output/defaults.d @@ -8,6 +8,7 @@ template InternalMarkup() { static struct InlineMarkup { auto en_a_o = "【"; auto en_a_c = "】"; auto en_b_o = "〖"; auto en_b_c = "〗"; + auto quote_o = "“"; auto quote_c = "”"; auto ff_o = "┨"; auto ff_c = "┣"; // fontface auto lnk_o = "┥"; auto lnk_c = "┝"; auto url_o = "┤"; auto url_c = "├"; diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d index 97d8427..e02637c 100644 --- a/src/doc_reform/output/epub3.d +++ b/src/doc_reform/output/epub3.d @@ -288,7 +288,11 @@ template outputEPub3() { } } } - toc ~= format(q"┋ </navMap> + toc ~= format(q"┋ + </navPoint> + </navPoint> + </navPoint> + </navMap> </ncx>┋"); return toc; } @@ -630,7 +634,7 @@ template outputEPub3() { ? zip_data.write(contents.dup) : zip_data.write(contents.dup .replaceAll(rgx.spaces_line_start, "") - .replaceAll(rgx.newline, "") + .replaceAll(rgx.newline, " ") .strip ); zip_arc_member_file.expandedData = zip_data.toBytes(); diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d index c35fa55..7980594 100644 --- a/src/doc_reform/output/paths_output.d +++ b/src/doc_reform/output/paths_output.d @@ -46,7 +46,7 @@ template DocReformOutPathsFnPd() { /+ TODO stuff to work out here +/ auto DocReformOutPathsFnPd(Fn,Pn)( Fn fn_src_pth, - Pn pod_name + Pn pod_name_with_path ) { struct _PathsStruct { string base_filename() { @@ -64,11 +64,11 @@ template DocReformOutPathsFnPd() { +/ string _fn_src = fn_src_pth.baseName.stripExtension; string _output_base_name; - if (!(pod_name.empty)) { - if (pod_name == _fn_src) { + if (!(pod_name_with_path.empty)) { + if (pod_name_with_path == _fn_src) { _output_base_name = _fn_src; } else { - _output_base_name = pod_name ~ "." ~ _fn_src; + _output_base_name = pod_name_with_path ~ "." ~ _fn_src; } } else { _output_base_name = _fn_src; diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d index bf1d766..8cb4581 100644 --- a/src/doc_reform/output/rgx.d +++ b/src/doc_reform/output/rgx.d @@ -38,6 +38,11 @@ static template DocReformOutputRgxInit() { static src_base_parent_path = ctRegex!(`(?P<dir>(?:[/a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure static src_formalised_file_path_parts = ctRegex!(`(?P<pth>(?:[/a-zA-Z0-9._-]+?)(?P<dir>[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure /+ line breaks +/ + static empty_line = ctRegex!(`^\s*$`); + static empty_block = ctRegex!(`^\s*$`, "mg"); + static br_line_natural = ctRegex!(`\n`, "mg"); + static br_empty_line = ctRegex!(`\n[ ]*\n`, "mg"); + static br_newlines_linebreaks = ctRegex!(`[\n┘┙]`, "mg"); static br_line = ctRegex!(`┘`, "mg"); static br_nl = ctRegex!(`┙`, "mg"); static br_paragraph = ctRegex!(`┚`, "mg"); @@ -48,22 +53,23 @@ static template DocReformOutputRgxInit() { static inline_notes_al = ctRegex!(`【(?:[*+]\s+|\s*)(.+?)】`, "mg"); static inline_notes_al_special = ctRegex!(`【(?:[*+]\s+)(.+?)】`, "mg"); // TODO remove match when special footnotes are implemented 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_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)\s*】`, "mg"); static inline_al_delimiter_open_regular = ctRegex!(`【\s`, "m"); static inline_al_delimiter_open_symbol_star = ctRegex!(`【[*]\s`, "m"); static inline_al_delimiter_open_symbol_plus = ctRegex!(`【[+]\s`, "m"); static inline_al_delimiter_close_regular = ctRegex!(`】`, "m"); static inline_al_delimiter_open_and_close_regular = ctRegex!(`【|】`, "m"); - static inline_notes_delimiter_al_regular = ctRegex!(`【(.+?)】`, "mg"); - static inline_notes_delimiter_al_regular_number_note = ctRegex!(`【(?P<num>\d+)\s+(?P<note>.+?)】`, "mg"); static inline_al_delimiter_open_asterisk = ctRegex!(`【\*`, "m"); static inline_al_delimiter_open_plus = ctRegex!(`【\+`, "m"); static inline_text_and_note_al = ctRegex!(`(?P<text>.+?)【(?:[*+ ]*)(?P<note>.+?)】`, "mg"); static inline_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg"); - /+ inline markup footnotes endnotes +/ - static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); - static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>\S+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); + /+ inline markup links +/ + static inline_image = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+))\s*(?P<post>.*?┝┤.*?├)`, "mg"); + static inline_image_without_dimensions = ctRegex!(`(?P<pre>┥)☼(?P<imginf>(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>0)h(?P<height>0))\s*(?P<post>.*?┝┤.*?├)`, "mg"); + static inline_image_info = ctRegex!(`☼?(?P<img>[a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P<width>\d+)h(?P<height>\d+)`, "mg"); static inline_link_anchor = ctRegex!(`┋(?P<anchor>\S+?)┋`, "mg"); // TODO *~text_link_anchor static inline_link_ = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); static inline_link = ctRegex!(`┥(?P<text>.+?)┝┤(?P<link>\S+?)├`, "mg"); @@ -75,6 +81,7 @@ static template DocReformOutputRgxInit() { static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg"); static inline_a_url = ctRegex!(`(┤)([^\s┥┝┤├]+)(├)`, "mg"); static url = ctRegex!(`https?://`, "mg"); + static uri = ctRegex!(`(?:https?|git)://`, "mg"); static inline_link_subtoc = ctRegex!(`^(?P<level>[5-7])~ ┥(?P<text>.+?)┝┤(?P<link>.+?)├`, "mg"); static fn_suffix = ctRegex!(`\.fnSuffix`, "mg"); static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg"); diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d index c57dde9..113af10 100644 --- a/src/doc_reform/output/sqlite.d +++ b/src/doc_reform/output/sqlite.d @@ -387,17 +387,17 @@ template SQLiteFormatAndLoadObject() { if (obj.has.inline_notes_reg) { // _txt = font_face(_txt); _txt = _txt.replaceAll( - rgx.inline_notes_delimiter_al_regular_number_note, + rgx.inline_notes_al_regular_number_note, ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") ); } debug(markup_endnotes) { - if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + if (_txt.match(rgx.inline_notes_al_regular_number_note)) { writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); } } debug(markup) { - if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + if (_txt.match(rgx.inline_notes_al_regular_number_note)) { writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); } } @@ -411,7 +411,7 @@ template SQLiteFormatAndLoadObject() { string[] _endnotes; if (obj.has.inline_notes_reg) { /+ need markup for text, and separated footnote +/ - foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) { + foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) { _endnotes ~= format( "%s%s%s%s\n %s%s%s%s%s\n %s\n%s", "<p class=\"endnote\">", @@ -428,10 +428,10 @@ template SQLiteFormatAndLoadObject() { ); } _txt = _txt.replaceAll( - rgx.inline_notes_delimiter_al_regular_number_note, + rgx.inline_notes_al_regular_number_note, ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") ); - } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) { debug(markup) { writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text); } diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d index 244a618..eb8debd 100644 --- a/src/doc_reform/output/xmls.d +++ b/src/doc_reform/output/xmls.d @@ -311,7 +311,7 @@ template outputXHTMLs() { } auto tail() { string o; - o = format(q"┋ </div> + o = format(q"┋ <a name="bottom" id="bottom"></a> <a name="end" id="end"></a> </body> @@ -334,8 +334,8 @@ template outputXHTMLs() { _img_pth = "../../../image/"; } if (_txt.match(rgx.inline_image)) { - _txt = _txt.replaceAll( - rgx.inline_image, + _txt = _txt + .replaceAll(rgx.inline_image, ("$1<img src=\"" ~ _img_pth ~ "$3\" width=\"$4\" height=\"$5\" naturalsizeflag=\"0\" align=\"bottom\" border=\"0\" /> $6")) @@ -440,17 +440,17 @@ template outputXHTMLs() { if (obj.has.inline_notes_reg) { _txt = font_face(_txt); _txt = _txt.replaceAll( - rgx.inline_notes_delimiter_al_regular_number_note, + rgx.inline_notes_al_regular_number_note, ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") ); } debug(markup_endnotes) { - if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + if (_txt.match(rgx.inline_notes_al_regular_number_note)) { writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); } } debug(markup) { - if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + if (_txt.match(rgx.inline_notes_al_regular_number_note)) { writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text); } } @@ -465,7 +465,7 @@ template outputXHTMLs() { if (obj.has.inline_notes_reg) { _txt = font_face(_txt); /+ need markup for text, and separated footnote +/ - foreach(m; _txt.matchAll(rgx.inline_notes_delimiter_al_regular_number_note)) { + foreach(m; _txt.matchAll(rgx.inline_notes_al_regular_number_note)) { _endnotes ~= format( "%s%s%s%s\n %s%s%s%s%s\n %s\n%s", "<p class=\"endnote\">", @@ -482,10 +482,10 @@ template outputXHTMLs() { ); } _txt = _txt.replaceAll( - rgx.inline_notes_delimiter_al_regular_number_note, + rgx.inline_notes_al_regular_number_note, ("<a href=\"#note_$1\"><note id=\"noteref_$1\"> <sup>$1</sup> </note></a>") ); - } else if (_txt.match(rgx.inline_notes_delimiter_al_regular_number_note)) { + } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) { debug(markup) { writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text); } |