aboutsummaryrefslogtreecommitdiffhomepage
path: root/org/output_xmls.org
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2017-05-06 11:33:10 -0400
committerRalph Amissah <ralph@amissah.com>2019-04-10 15:14:14 -0400
commit7a73aa10276b0c1151500d26b194336b56af7aba (patch)
treee267901f73375393cc429c5c17ce661216de111a /org/output_xmls.org
parentxmls work particularly with epub output (diff)
Diffstat (limited to 'org/output_xmls.org')
-rw-r--r--org/output_xmls.org95
1 files changed, 34 insertions, 61 deletions
diff --git a/org/output_xmls.org b/org/output_xmls.org
index 1757ffa..4c6013c 100644
--- a/org/output_xmls.org
+++ b/org/output_xmls.org
@@ -268,9 +268,11 @@ auto epub3_seg_head(Dm)(
<a name="top" id="top"></a>ΒΆ",
html_simple,
doc_matters.dochead_meta["title"]["full"],
- (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : ", " ~ doc_matters.dochead_meta["creator"]["author"],
+ (doc_matters.dochead_meta["creator"]["author"].empty) ? ""
+ : ", " ~ doc_matters.dochead_meta["creator"]["author"],
doc_matters.dochead_meta["title"]["full"],
- (doc_matters.dochead_meta["creator"]["author"].empty) ? "" : ", " ~ doc_matters.dochead_meta["creator"]["author"],
+ (doc_matters.dochead_meta["creator"]["author"].empty) ? ""
+ : ", " ~ doc_matters.dochead_meta["creator"]["author"],
doc_matters.language,
);
return o;
@@ -368,13 +370,6 @@ auto inline_notes_scroll(O)(
writeln(__LINE__, " (missed) markup endnote: ", obj.is_a, ": ", obj.text);
}
}
- // if (obj.inline_notes_star) {
- // _txt = replaceAll(
- // _txt,
- // rgx.inline_notes_delimiter_al_regular_number_note,
- // ("<a href=\"#note_$1\"><note id=\"noteref_$1\">&nbsp;<sup>$1</sup>&nbsp;</note></a>")
- // );
- // }
return _txt;
}
#+END_SRC
@@ -541,7 +536,7 @@ auto heading_scroll(O)(
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix);
string o = heading(obj, _txt);
return o;
}
@@ -625,7 +620,7 @@ auto para_scroll(O)(
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix);
string o = para(obj, _txt);
return o;
}
@@ -700,7 +695,7 @@ auto quote_scroll(O)(
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix);
string o = quote(obj, _txt);
return o;
}
@@ -775,7 +770,7 @@ auto group_scroll(O)(
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix);
string o = group(obj, _txt);
return o;
}
@@ -846,7 +841,7 @@ auto block_scroll(O)(
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix);
string o = block(obj, _txt);
return o;
}
@@ -878,7 +873,7 @@ auto block_seg(O)(
#+name: xhtml_format_objects
#+BEGIN_SRC d
-auto verse(O)( // using code from code block, review
+auto verse(O)(
auto return ref const O obj,
string _txt,
) {
@@ -917,7 +912,7 @@ auto verse_scroll(O)(
string _suffix = ".html",
) {
auto tags = _xhtml_anchor_tags(obj.anchor_tags);
- _txt = inline_markup_scroll(obj, _txt, _suffix); // issue
+ _txt = inline_markup_scroll(obj, _txt, _suffix);
string o = verse(obj, _txt);
return o;
}
@@ -1002,7 +997,7 @@ auto tablarize(O)(
_table ~= "<tr>";
foreach(col_idx, cell; _table_cols) {
if ((_table_cols.length == 1)
- && (_table_rows.length <= row_idx+2)) { // check row_idx+2 (rather than == ++row_idx)
+ && (_table_rows.length <= row_idx+2)) {
_tablenote ~= cell;
} else {
string _col_is = (row_idx == 0 && obj.table_heading) ? "th" : "td";
@@ -1274,7 +1269,7 @@ void scroll_write_output(M,C)(
}
#+END_SRC
-*** seg :seg:
+*** seg :seg:
**** switch (sections & objects) format html output
#+name: output_html_seg
@@ -1295,7 +1290,7 @@ void seg(D,I)(
foreach (part; doc_matters.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
string _txt = xhtml_format.special_characters(obj, obj.text);
- if (obj.is_a == "heading") { // all headings: frontmatter, body & backmatter
+ if (obj.is_a == "heading") {
switch (obj.heading_lev_markup) {
case 0: .. case 3:
/+ fill buffer, and replace with new levels from 1 to 3 +/
@@ -1320,7 +1315,7 @@ void seg(D,I)(
goto default;
default:
auto t = xhtml_format.heading_seg(obj, _txt, suffix);
- top_level_headings[obj.heading_lev_markup] = t[0]; // should probably have different css tagging (fontsize etc)
+ top_level_headings[obj.heading_lev_markup] = t[0];
break;
}
break;
@@ -1340,10 +1335,10 @@ void seg(D,I)(
doc_html[segment_filename] ~= to!string(t[0]);
doc_html_endnotes[segment_filename] ~= t[1];
break;
- case 8: .. case 9: // unused numbers, if remain check
+ case 8: .. case 9:
if ((doc_matters.opt_action_bool["debug"])) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
}
break;
default:
@@ -1414,7 +1409,7 @@ void seg(D,I)(
case "verse":
auto t = xhtml_format.verse_seg(obj, _txt, suffix);
doc_html[segment_filename] ~= to!string(t[0]);
- doc_html_endnotes[segment_filename] ~= t[1]; // work on
+ doc_html_endnotes[segment_filename] ~= t[1];
break;
case "code":
doc_html[segment_filename] ~= xhtml_format.code(obj, _txt);
@@ -1526,7 +1521,7 @@ void seg_write_output(M,D,E)(
foreach (docseg; doc_html_endnotes[seg_filename]) {
f.writeln(docseg);
}
- f.writeln(xhtml_format.tail); // needed for each lev4
+ f.writeln(xhtml_format.tail);
}
}
catch (ErrnoException ex) {
@@ -1535,7 +1530,7 @@ void seg_write_output(M,D,E)(
}
#+END_SRC
-*** css :css:
+*** css :css:
#+name: output_html_css
#+BEGIN_SRC d
@@ -1956,10 +1951,10 @@ void outputEPub3(D,I)(
doc_epub3[segment_filename] ~= t[0];
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case 8: .. case 9: // unused numbers, if remain check
+ case 8: .. case 9:
if ((doc_matters.opt_action_bool["debug"])) {
writeln(__FILE__, ":", __LINE__, ": ", obj.is_a, ": ", obj.heading_lev_markup);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
}
break;
default:
@@ -2026,7 +2021,7 @@ void outputEPub3(D,I)(
doc_epub3[segment_filename] ~= to!string(t[0]);
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
- case "poem": // double check why both poem & verse
+ case "poem":
break;
case "verse":
auto t = xhtml_format.verse_seg(obj, _txt, suffix);
@@ -2222,26 +2217,23 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
{ /+ OEBPS/[segments].xhtml (the document contents) +/
foreach (seg_filename; doc_matters.segnames_lv_0_to_4) {
string fn = pth_epub3.fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename);
- /+ add zip archive file members (with their content) +/
auto zip_arc_member_file = new ArchiveMember();
- // add seg fn to zip archive
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
debug(epub_output) {
string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.source_filename, seg_filename);
auto f = File(fn_dbg, "w");
}
- /+ // f.writeln(seg_head); // not needed built and inserted earlier +/
foreach (docseg; doc_epub3[seg_filename]) {
debug(epub_output) { f.writeln(docseg); }
- zip_data.write(docseg.dup); // cast as: char[]
+ zip_data.write(docseg.dup);
}
foreach (docseg; doc_epub3_endnotes[seg_filename]) {
debug(epub_output) { f.writeln(docseg); }
- zip_data.write(docseg.dup); // cast as: char[]
+ zip_data.write(docseg.dup);
}
- debug(epub_output) { f.writeln(xhtml_format.tail); } // needed for each lev4
- zip_data.write(xhtml_format.tail.dup); // cast as: char[]
+ debug(epub_output) { f.writeln(xhtml_format.tail); }
+ zip_data.write(xhtml_format.tail.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
/+ create the zip file +/
@@ -2257,15 +2249,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
File(fn_dbg, "w").writeln(mimetypes);
}
fn = pth_epub3.fn_mimetypes(doc_matters.source_filename);
- /+ add zip archive file members (with their content) +/
auto zip_arc_member_file = new ArchiveMember();
- // add mimetypes to zip archive
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
- zip_data.write(mimetypes.dup); // cast as: char[]
+ zip_data.write(mimetypes.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
- /+ create the zip file +/
createZipFile!()(fn_epub, zip.build());
}
{ /+ META-INF/container.xml (identify doc root) +/
@@ -2274,15 +2263,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
File(fn_dbg, "w").writeln(meta_inf_container_xml);
}
fn = pth_epub3.fn_dmi_container_xml(doc_matters.source_filename);
- /+ add zip archive file members (with their content) +/
auto zip_arc_member_file = new ArchiveMember();
- // add META-INF/container.xml to zip archive
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
- zip_data.write(meta_inf_container_xml.dup); // cast as: char[]
+ zip_data.write(meta_inf_container_xml.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
- /+ create the zip file +/
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/
@@ -2291,15 +2277,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
File(fn_dbg, "w").writeln(oebps_toc_nav_xhtml);
}
fn = pth_epub3.fn_oebps_toc_nav_xhtml(doc_matters.source_filename);
- /+ add zip archive file members (with their content) +/
auto zip_arc_member_file = new ArchiveMember();
- // add OEBPS/toc_nav.xhtml to zip archive
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
- zip_data.write(oebps_toc_nav_xhtml.dup); // cast as: char[]
+ zip_data.write(oebps_toc_nav_xhtml.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
- /+ create the zip file +/
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/toc.ncx (navigation toc epub2) +/
@@ -2308,15 +2291,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
File(fn_dbg, "w").writeln(oebps_toc_ncx);
}
fn = pth_epub3.fn_oebps_toc_ncx(doc_matters.source_filename);
- /+ add zip archive file members (with their content) +/
auto zip_arc_member_file = new ArchiveMember();
- // add OEBPS/toc.ncx to zip archive
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
- zip_data.write(oebps_toc_ncx.dup); // cast as: char[]
+ zip_data.write(oebps_toc_ncx.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
- /+ create the zip file +/
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/content.opf (doc manifest) +/
@@ -2325,15 +2305,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
File(fn_dbg, "w").writeln(oebps_content_opf);
}
fn = pth_epub3.fn_oebps_content_opf(doc_matters.source_filename);
- /+ add zip archive file members (with their content) +/
auto zip_arc_member_file = new ArchiveMember();
- // add OEBPS/content.opf to zip archive
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
- zip_data.write(oebps_content_opf.dup); // cast as: char[]
+ zip_data.write(oebps_content_opf.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
- /+ create the zip file +/
createZipFile!()(fn_epub, zip.build());
}
{ /+ OEBPS/_sisu/image (images) +/
@@ -2376,15 +2353,12 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
File(fn_dbg, "w").writeln(css.epub_css);
}
fn = pth_epub3.fn_oebps_css(doc_matters.source_filename);
- /+ add zip archive file members (with their content) +/
auto zip_arc_member_file = new ArchiveMember();
- // add OEBPS/content.opf to zip archive
zip_arc_member_file.name = fn;
auto zip_data = new OutBuffer();
- zip_data.write(css.epub_css.dup); // cast as: char[]
+ zip_data.write(css.epub_css.dup);
zip_arc_member_file.expandedData = zip_data.toBytes();
zip.addMember(zip_arc_member_file);
- /+ create the zip file +/
createZipFile!()(fn_epub, zip.build());
}
}
@@ -2403,8 +2377,7 @@ void epub3_write_output_files(M,D,E,Mt,Mic,Otnx,Otn,Oc)(
auto zipped = new ZipArchive((fn_epub).read);
foreach (filename, member; zipped.directory) {
auto data = zipped.expand(member);
- writeln(filename, " length ", data.length); // member.name
- // Use data
+ writeln(filename, " length ", data.length);
}
}
catch (ZipException ex) {