aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/doc_reform
diff options
context:
space:
mode:
Diffstat (limited to 'src/doc_reform')
-rw-r--r--src/doc_reform/output/epub3.d20
-rw-r--r--src/doc_reform/output/html.d12
-rw-r--r--src/doc_reform/output/xmls.d152
3 files changed, 83 insertions, 101 deletions
diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d
index 4d86036..026a2b5 100644
--- a/src/doc_reform/output/epub3.d
+++ b/src/doc_reform/output/epub3.d
@@ -32,7 +32,7 @@ template outputEPub3() {
string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) {
auto xhtml_format = outputXHTMLs();
auto pth_epub3 = DocReformPathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
- string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters!
+ string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters!
string content = format(q"¶ <?xml version='1.0' encoding='utf-8'?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID">
<metadata
@@ -61,7 +61,7 @@ template outputEPub3() {
<!-- nav epub3 navigation -->
<item id="nav" href="toc_nav.xhtml" media-type="application/xhtml+xml" properties="nav" />
¶",
- uuid,
+ _uuid,
xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_full),
xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_main),
(doc_matters.conf_make_meta.meta.title_sub.empty)
@@ -75,9 +75,9 @@ template outputEPub3() {
? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.date_published),
(doc_matters.conf_make_meta.meta.rights_copyright.empty)
? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.rights_copyright),
- uuid,
- uuid,
- uuid,
+ _uuid,
+ _uuid,
+ _uuid,
(pth_epub3.fn_oebps_css(doc_matters.src.filename)).chompPrefix("OEBPS/"),
);
content ~= " " ~ "<!-- Content Documents -->" ~ "\n ";
@@ -208,7 +208,7 @@ template outputEPub3() {
}
string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) {
int counter = 0;
- string uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
+ string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
auto markup = InlineMarkup();
auto rgx = Rgx();
enum DomTags { none, open, close, close_and_open, open_still, }
@@ -235,7 +235,7 @@ template outputEPub3() {
doc_matters.conf_make_meta.meta.title_full, // title
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
: " by " ~ doc_matters.conf_make_meta.meta.creator_author, // author
- uuid, // uuid
+ _uuid, // uuid
"3", // content depth
doc_matters.conf_make_meta.meta.title_full, // title
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
@@ -309,7 +309,7 @@ template outputEPub3() {
string[] doc_parts_;
foreach (part; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
- string _txt = xhtml_format.special_characters(obj, obj.text);
+ string _txt = xhtml_format.special_characters(obj);
if (obj.metainfo.is_a == "heading") {
assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.heading_lev_markup) {
@@ -449,10 +449,10 @@ template outputEPub3() {
doc_epub3_endnotes[segment_filename] ~= t[1];
break;
case "code":
- doc_epub3[segment_filename] ~= xhtml_format.code(doc_matters, obj, _txt);
+ doc_epub3[segment_filename] ~= xhtml_format.code(obj, _txt);
break;
case "table":
- doc_epub3[segment_filename] ~= xhtml_format.table(doc_matters, obj, _txt);
+ doc_epub3[segment_filename] ~= xhtml_format.table(obj, _txt);
doc_epub3_endnotes[segment_filename] ~= "";
break;
default:
diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d
index 63a5dc2..97ba0ce 100644
--- a/src/doc_reform/output/html.d
+++ b/src/doc_reform/output/html.d
@@ -27,7 +27,7 @@ template outputHTML() {
foreach (part; doc_matters.xml.keys_seq.scroll) {
foreach (obj; doc_abstraction[part]) {
delimit = xhtml_format.div_delimit(part, previous_part);
- string _txt = xhtml_format.special_characters(obj, obj.text);
+ string _txt = xhtml_format.special_characters(obj);
switch (obj.metainfo.is_of_part) {
case "frontmatter": assert(part == "head" || "toc");
switch (obj.metainfo.is_of_type) {
@@ -96,10 +96,10 @@ template outputHTML() {
doc_html ~= xhtml_format.verse_scroll(doc_matters, obj, _txt, suffix);
break;
case "code":
- doc_html ~= xhtml_format.code(doc_matters, obj, _txt);
+ doc_html ~= xhtml_format.code(obj, _txt);
break;
case "table":
- doc_html ~= xhtml_format.table(doc_matters, obj, _txt);
+ doc_html ~= xhtml_format.table(obj, _txt);
break;
default:
{ /+ debug +/
@@ -224,7 +224,7 @@ template outputHTML() {
foreach (part; doc_matters.xml.keys_seq.seg) {
foreach (obj; doc_abstraction[part]) {
delimit = xhtml_format.div_delimit(part, previous_part);
- string _txt = xhtml_format.special_characters(obj, obj.text);
+ string _txt = xhtml_format.special_characters(obj);
if (obj.metainfo.is_a == "heading") {
assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
switch (obj.metainfo.heading_lev_markup) {
@@ -367,10 +367,10 @@ template outputHTML() {
doc_html_endnotes[segment_filename] ~= t[1];
break;
case "code":
- doc_html[segment_filename] ~= xhtml_format.code(doc_matters, obj, _txt);
+ doc_html[segment_filename] ~= xhtml_format.code(obj, _txt);
break;
case "table":
- doc_html[segment_filename] ~= xhtml_format.table(doc_matters, obj, _txt);
+ doc_html[segment_filename] ~= xhtml_format.table(obj, _txt);
doc_html_endnotes[segment_filename] ~= "";
break;
default:
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d
index ef35e10..58cfb4e 100644
--- a/src/doc_reform/output/xmls.d
+++ b/src/doc_reform/output/xmls.d
@@ -44,31 +44,25 @@ template outputXHTMLs() {
// you also need to close the last div, introduce a footer?
return delimit;
}
- string special_characters(O)(
- const O obj,
- string _txt
- ){
+ string special_characters_text(string _txt){
_txt = _txt
.replaceAll(rgx.xhtml_ampersand, "&#38;")
.replaceAll(rgx.xhtml_quotation, "&#34;")
.replaceAll(rgx.xhtml_less_than, "&#60;")
.replaceAll(rgx.xhtml_greater_than, "&#62;")
.replaceAll(rgx.nbsp_char, " ");
+ return _txt;
+ }
+ string special_characters(O)(
+ const O obj,
+ ){
+ string _txt = special_characters_text(obj.text);
if (!(obj.metainfo.is_a == "code")) {
_txt = (_txt)
.replaceAll(rgx.xhtml_line_break, "<br />");
}
return _txt;
}
- string special_characters_text(string _txt){
- _txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&#38;")
- .replaceAll(rgx.xhtml_quotation, "&#34;")
- .replaceAll(rgx.xhtml_less_than, "&#60;")
- .replaceAll(rgx.xhtml_greater_than, "&#62;")
- .replaceAll(rgx.nbsp_char, " ");
- return _txt;
- }
string font_face(string _txt){
_txt = _txt
.replaceAll(rgx.inline_emphasis, ("<em>$1</em>"))
@@ -98,19 +92,7 @@ template outputXHTMLs() {
auto header_metadata(M)(
M doc_matters,
) {
- string _title="Title";
- string _author="Author";
- string _publisher="Publisher";
- string _date="Date";
- string _date_created="Date";
- string _date_issued="Date";
- string _date_available="Date";
- string _date_valid="Date";
- string _date_modified="Date";
- string _language="en";
- string _rights="Copyright: Copyright (C) year holder";
- string _generator="doc_reform [DocReform 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)";
- string _generator_home="http://www.sisudoc.org";
+ string _publisher="Publisher"; // TODO
string o;
o = format(q"¶<!-- DocReform header metadata -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
@@ -128,19 +110,19 @@ template outputXHTMLs() {
<meta name="generator" content="%s" />
<link rel="generator" href="%s" />
<!-- DocReform header metadata -->¶",
- _title,
- _author,
- _publisher,
- _date,
- _date_created,
- _date_issued,
- _date_available,
- _date_valid,
- _date_modified,
- _language,
- _rights,
- _generator,
- _generator_home,
+ doc_matters.conf_make_meta.meta.title_full,
+ doc_matters.conf_make_meta.meta.creator_author,
+ _publisher,
+ doc_matters.conf_make_meta.meta.date_published,
+ doc_matters.conf_make_meta.meta.date_created,
+ doc_matters.conf_make_meta.meta.date_issued,
+ doc_matters.conf_make_meta.meta.date_available,
+ doc_matters.conf_make_meta.meta.date_valid,
+ doc_matters.conf_make_meta.meta.date_modified,
+ doc_matters.src.language,
+ doc_matters.conf_make_meta.meta.rights_copyright,
+ doc_matters.generator_program.name_and_version,
+ doc_matters.generator_program.url_home,
);
return o;
}
@@ -164,7 +146,7 @@ template outputXHTMLs() {
o = format(q"¶<div class="flex-menu-option">
%s
</div>¶",
- _locations,
+ _locations,
);
return o;
}
@@ -289,18 +271,18 @@ template outputXHTMLs() {
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="dc.title" content="%s" />
<meta name="dc.author" content="%s" />
- <meta name="dc.publisher" content="DocReform http://www.jus.uio.no/sisu (this copy)" />
- <meta name="dc.date" content="year" />
- <meta name="dc.date.created" content="year" />
- <meta name="dc.date.issued" content="year" />
- <meta name="dc.date.available" content="year" />
- <meta name="dc.date.valid" content="year" />
- <meta name="dc.date.modified" content="year" />
- <meta name="dc.language" content="US" />
- <meta name="dc.rights" content="Copyright: Copyright (C) year holder" />
- <meta name="generator" content="doc_reform [DocReform 7.1.8 of 2016w08/5 (2016-02-26)] (n*x and D)" />
- <link rel="generator" href="http://www.sisudoc.org/" />
- <link rel="shortcut icon" href="../_sisu/image/rb7.ico" />
+ <meta name="dc.publisher" content="FIX" />
+ <meta name="dc.date" content="%s" />
+ <meta name="dc.date.created" content="%s" />
+ <meta name="dc.date.issued" content="%s" />
+ <meta name="dc.date.available" content="%s" />
+ <meta name="dc.date.valid" content="%s" />
+ <meta name="dc.date.modified" content="%s" />
+ <meta name="dc.language" content="%s" />
+ <meta name="dc.rights" content="%s" />
+ <meta name="generator" content="%s" />
+ <link rel="generator" href="%s" />
+ <link rel="shortcut icon" href="../_sisu/image/d.ico" />
<link rel="stylesheet" href="css/epub.css" type="text/css" id="main-css" />
</head>
<body lang="%s">
@@ -312,6 +294,16 @@ template outputXHTMLs() {
doc_matters.conf_make_meta.meta.title_full,
(doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
: ", " ~ doc_matters.conf_make_meta.meta.creator_author,
+ doc_matters.conf_make_meta.meta.date_published,
+ doc_matters.conf_make_meta.meta.date_created,
+ doc_matters.conf_make_meta.meta.date_issued,
+ doc_matters.conf_make_meta.meta.date_available,
+ doc_matters.conf_make_meta.meta.date_valid,
+ doc_matters.conf_make_meta.meta.date_modified,
+ doc_matters.src.language,
+ doc_matters.conf_make_meta.meta.rights_copyright,
+ doc_matters.generator_program.name_and_version,
+ doc_matters.generator_program.url_home,
doc_matters.src.language,
);
return o;
@@ -624,8 +616,7 @@ template outputXHTMLs() {
}
return bar();
}
- auto heading(M,O)(
- M doc_matters,
+ auto heading(O)(
const O obj,
string _txt,
string _xml_type = "html",
@@ -688,7 +679,7 @@ template outputXHTMLs() {
) {
auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
- string o = heading(doc_matters, obj, _txt);
+ string o = heading(obj, _txt);
return o;
}
auto heading_seg(M,O)(
@@ -701,15 +692,14 @@ template outputXHTMLs() {
auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type);
_txt = t[0];
string[] _endnotes = t[1];
- string o = heading(doc_matters, obj, _txt, _xml_type);
+ string o = heading(obj, _txt, _xml_type);
auto u = tuple(
o,
_endnotes,
);
return u;
}
- auto para(M,O)(
- M doc_matters,
+ auto para(O)(
const O obj,
string _txt,
) {
@@ -758,7 +748,7 @@ template outputXHTMLs() {
) {
auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
- string o = para(doc_matters, obj, _txt);
+ string o = para(obj, _txt);
return o;
}
auto para_seg(M,O)(
@@ -771,15 +761,14 @@ template outputXHTMLs() {
auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type);
_txt = t[0].to!string;
string[] _endnotes = t[1];
- string o = para(doc_matters, obj, _txt);
+ string o = para(obj, _txt);
auto u = tuple(
o,
_endnotes,
);
return u;
}
- auto quote(M,O)(
- M doc_matters,
+ auto quote(O)(
const O obj,
string _txt,
) {
@@ -818,7 +807,7 @@ template outputXHTMLs() {
) {
auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
- string o = quote(doc_matters, obj, _txt);
+ string o = quote(obj, _txt);
return o;
}
auto quote_seg(M,O)(
@@ -831,15 +820,14 @@ template outputXHTMLs() {
auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type);
_txt = t[0].to!string;
string[] _endnotes = t[1];
- string o = quote(doc_matters, obj, _txt);
+ string o = quote(obj, _txt);
auto u = tuple(
o,
_endnotes,
);
return u;
}
- auto group(M,O)(
- M doc_matters,
+ auto group(O)(
const O obj,
string _txt,
) {
@@ -879,7 +867,7 @@ template outputXHTMLs() {
) {
auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
- string o = group(doc_matters, obj, _txt);
+ string o = group(obj, _txt);
return o;
}
auto group_seg(M,O)(
@@ -892,15 +880,14 @@ template outputXHTMLs() {
auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type);
_txt = t[0].to!string;
string[] _endnotes = t[1];
- string o = group(doc_matters, obj, _txt);
+ string o = group(obj, _txt);
auto u = tuple(
o,
_endnotes,
);
return u;
}
- auto block(M,O)(
- M doc_matters,
+ auto block(O)(
const O obj,
string _txt,
) {
@@ -936,7 +923,7 @@ template outputXHTMLs() {
) {
auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
- string o = block(doc_matters, obj, _txt);
+ string o = block(obj, _txt);
return o;
}
auto block_seg(M,O)(
@@ -949,15 +936,14 @@ template outputXHTMLs() {
auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type);
_txt = t[0].to!string;
string[] _endnotes = t[1];
- string o = block(doc_matters, obj, _txt);
+ string o = block(obj, _txt);
auto u = tuple(
o,
_endnotes,
);
return u;
}
- auto verse(M,O)(
- M doc_matters,
+ auto verse(O)(
const O obj,
string _txt,
) {
@@ -993,7 +979,7 @@ template outputXHTMLs() {
) {
auto tags = _xhtml_anchor_tags(obj);
_txt = inline_markup_scroll(doc_matters, obj, _txt, _suffix);
- string o = verse(doc_matters, obj, _txt);
+ string o = verse(obj, _txt);
return o;
}
auto verse_seg(M,O)(
@@ -1006,15 +992,14 @@ template outputXHTMLs() {
auto t = inline_markup_seg(doc_matters, obj, _txt, _suffix, _xml_type);
_txt = t[0].to!string;
string[] _endnotes = t[1];
- string o = verse(doc_matters, obj, _txt);
+ string o = verse(obj, _txt);
auto u = tuple(
o,
_endnotes,
);
return u;
}
- auto tablarize(M,O)(
- M doc_matters,
+ auto tablarize(O)(
const O obj,
string _txt,
) {
@@ -1047,14 +1032,13 @@ template outputXHTMLs() {
);
return t;
}
- auto table(M,O)(
- M doc_matters,
+ auto table(O)(
const O obj,
string _txt,
) {
auto tags = _xhtml_anchor_tags(obj);
_txt = font_face(_txt);
- auto t = tablarize(doc_matters, obj, _txt);
+ auto t = tablarize(obj, _txt);
_txt = t[0];
string _note = t[1];
string o;
@@ -1077,8 +1061,7 @@ template outputXHTMLs() {
);
return o;
}
- auto endnote(M,O)(
- M doc_matters,
+ auto endnote(O)(
const O obj,
string _txt,
) {
@@ -1093,8 +1076,7 @@ template outputXHTMLs() {
);
return o;
}
- auto code(M,O)(
- M doc_matters,
+ auto code(O)(
const O obj,
string _txt,
) {