From 2731b33fe2d05fe3ebc3e2f98d39eacf7295d1e4 Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Sat, 16 Nov 2019 12:16:08 -0500
Subject: module & src renaming
---
src/doc_reform/io_in/paths_source.d | 842 +++++
src/doc_reform/io_in/read_config_files.d | 155 +
src/doc_reform/io_in/read_source_files.d | 348 ++
src/doc_reform/io_out/create_zip_file.d | 17 +
src/doc_reform/io_out/defaults.d | 135 +
src/doc_reform/io_out/epub3.d | 814 +++++
src/doc_reform/io_out/html.d | 536 +++
src/doc_reform/io_out/hub.d | 135 +
src/doc_reform/io_out/latex.d | 1204 +++++++
src/doc_reform/io_out/odt.d | 2076 ++++++++++++
src/doc_reform/io_out/package.d | 22 +
src/doc_reform/io_out/paths_output.d | 531 +++
src/doc_reform/io_out/rgx.d | 114 +
src/doc_reform/io_out/source_pod.d | 374 +++
src/doc_reform/io_out/sqlite.d | 1561 +++++++++
src/doc_reform/io_out/xmls.d | 1215 +++++++
src/doc_reform/io_out/xmls_css.d | 4185 ++++++++++++++++++++++++
src/doc_reform/meta/metadoc.d | 8 +-
src/doc_reform/meta/metadoc_from_src.d | 2 +-
src/doc_reform/meta/metadoc_harvest.d | 2 +-
src/doc_reform/meta/metadoc_harvests_authors.d | 2 +-
src/doc_reform/meta/metadoc_harvests_topics.d | 2 +-
src/doc_reform/meta/metadoc_object_setter.d | 141 +
src/doc_reform/meta/object_setter.d | 141 -
src/doc_reform/output/create_zip_file.d | 17 -
src/doc_reform/output/defaults.d | 135 -
src/doc_reform/output/epub3.d | 814 -----
src/doc_reform/output/html.d | 536 ---
src/doc_reform/output/hub.d | 135 -
src/doc_reform/output/latex.d | 1204 -------
src/doc_reform/output/odt.d | 2076 ------------
src/doc_reform/output/package.d | 22 -
src/doc_reform/output/paths_output.d | 531 ---
src/doc_reform/output/rgx.d | 114 -
src/doc_reform/output/source_pod.d | 374 ---
src/doc_reform/output/sqlite.d | 1561 ---------
src/doc_reform/output/xmls.d | 1215 -------
src/doc_reform/output/xmls_css.d | 4185 ------------------------
src/doc_reform/source/paths_source.d | 842 -----
src/doc_reform/source/read_config_files.d | 155 -
src/doc_reform/source/read_source_files.d | 348 --
src/doc_reform/spine.d | 10 +-
42 files changed, 14418 insertions(+), 14418 deletions(-)
create mode 100644 src/doc_reform/io_in/paths_source.d
create mode 100644 src/doc_reform/io_in/read_config_files.d
create mode 100644 src/doc_reform/io_in/read_source_files.d
create mode 100644 src/doc_reform/io_out/create_zip_file.d
create mode 100644 src/doc_reform/io_out/defaults.d
create mode 100644 src/doc_reform/io_out/epub3.d
create mode 100644 src/doc_reform/io_out/html.d
create mode 100644 src/doc_reform/io_out/hub.d
create mode 100644 src/doc_reform/io_out/latex.d
create mode 100644 src/doc_reform/io_out/odt.d
create mode 100644 src/doc_reform/io_out/package.d
create mode 100644 src/doc_reform/io_out/paths_output.d
create mode 100644 src/doc_reform/io_out/rgx.d
create mode 100644 src/doc_reform/io_out/source_pod.d
create mode 100644 src/doc_reform/io_out/sqlite.d
create mode 100644 src/doc_reform/io_out/xmls.d
create mode 100644 src/doc_reform/io_out/xmls_css.d
create mode 100644 src/doc_reform/meta/metadoc_object_setter.d
delete mode 100644 src/doc_reform/meta/object_setter.d
delete mode 100644 src/doc_reform/output/create_zip_file.d
delete mode 100644 src/doc_reform/output/defaults.d
delete mode 100644 src/doc_reform/output/epub3.d
delete mode 100644 src/doc_reform/output/html.d
delete mode 100644 src/doc_reform/output/hub.d
delete mode 100644 src/doc_reform/output/latex.d
delete mode 100644 src/doc_reform/output/odt.d
delete mode 100644 src/doc_reform/output/package.d
delete mode 100644 src/doc_reform/output/paths_output.d
delete mode 100644 src/doc_reform/output/rgx.d
delete mode 100644 src/doc_reform/output/source_pod.d
delete mode 100644 src/doc_reform/output/sqlite.d
delete mode 100644 src/doc_reform/output/xmls.d
delete mode 100644 src/doc_reform/output/xmls_css.d
delete mode 100644 src/doc_reform/source/paths_source.d
delete mode 100644 src/doc_reform/source/read_config_files.d
delete mode 100644 src/doc_reform/source/read_source_files.d
(limited to 'src/doc_reform')
diff --git a/src/doc_reform/io_in/paths_source.d b/src/doc_reform/io_in/paths_source.d
new file mode 100644
index 0000000..fbb6d76
--- /dev/null
+++ b/src/doc_reform/io_in/paths_source.d
@@ -0,0 +1,842 @@
+/++
+ read configuration files
+ - read config files
+ meta_config_files.d
++/
+module doc_reform.io_in.paths_source;
+import std.array,
+ std.file,
+ std.path,
+ std.regex,
+ std.stdio,
+ std.conv : to;
+import
+ doc_reform.meta.defaults,
+ doc_reform.meta.rgx;
+template PodManifest() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto PodManifest(P)(
+ P _pth=""
+ ) {
+ struct ManifestFile_ {
+ string pod_manifest_filename() {
+ return "pod.manifest";
+ }
+ string pod_manifest_path() {
+ string _manifest_path;
+ if ((isValidPath(_pth) && exists(_pth)!=0 && _pth.isDir)
+ && (exists(_pth.chainPath(pod_manifest_filename).array)!=0
+ && (_pth.chainPath(pod_manifest_filename).array).isFile)) {
+ _manifest_path = _pth;
+ } else if (_pth.match(rgx.src_pth_contents)
+ && exists(_pth)!=0 && _pth.isFile) {
+ _manifest_path = _pth.dirName;
+ } else if (_pth.match(rgx.src_pth_pod_sst_or_ssm)
+ && exists(_pth)!=0 && (_pth.isFile)) {
+ if (auto m = _pth.match(rgx.src_pth_pod_sst_or_ssm)) {
+ _manifest_path = m.captures["podpath"];
+ }
+ } else {
+ writeln("WARNING, issue with manifest_path: ", _pth);
+ _manifest_path = null; // _manifest_path = "";
+ }
+ return _manifest_path;
+ }
+ string pods_collection_root_path() {
+ return (pod_manifest_path.length > 0) ? ((chainPath(pod_manifest_path, "..")).asNormalizedPath).array.to!string : "";
+ }
+ string pod_manifest_file_with_path() {
+ string _k;
+ if (exists(pod_manifest_path.chainPath(pod_manifest_filename).array)!=0) {
+ _k = pod_manifest_path.chainPath(pod_manifest_filename).array;
+ } else if (exists(pod_manifest_path)!=0) {
+ _k = pod_manifest_path;
+ }
+ if (exists(_k)==0) {
+ writeln("ERROR >> Processing Skipped! Manifest not found: ", _k);
+ _k = null;
+ }
+ return _k;
+ }
+ }
+ return ManifestFile_();
+ }
+}
+template PathMatters() {
+ mixin spineRgxInit;
+ mixin InternalMarkup;
+ static auto rgx = Rgx();
+ static auto mkup = InlineMarkup();
+ auto PathMatters(O,E)(
+ O _opt_actions,
+ E _env,
+ string _pth,
+ string _fns = "",
+ char[][] _manifest_fn_list = [[]],
+ ) {
+ auto _manifested = PodManifest!()(_pth);
+ struct ManifestMatters_ {
+ auto env() {
+ auto _env = _env;
+ struct Env_ {
+ auto pwd() {
+ return _env["pwd"];
+ }
+ auto home() {
+ return _env["home"];
+ }
+ }
+ return Env_();
+ }
+ auto opt() {
+ struct Opt_ {
+ auto action() {
+ return _opt_actions;
+ }
+ }
+ return Opt_();
+ }
+ bool src_is_pod() {
+ return (_manifested.pod_manifest_path.length > 0) ? true : false;
+ }
+ auto pod() {
+ struct Pod_ {
+ bool src_is_pod() {
+ return (_manifested.pod_manifest_path.length > 0) ? true : false;
+ }
+ string collection_root() {
+ return _manifested.pods_collection_root_path;
+ }
+ string manifest_filename() {
+ return _manifested.pod_manifest_filename;
+ }
+ string manifest_path() {
+ return _manifested.pod_manifest_path;
+ }
+ string pod_name_with_path() {
+ return _manifested.pod_manifest_path.baseName;
+ }
+ string manifest_file_with_path() {
+ return _manifested.pod_manifest_file_with_path;
+ }
+ string[] config_dr_document_make_dirs() {
+ string[] _config_dirs;
+ return _config_dirs;
+ }
+ string[] config_local_site_dirs() {
+ string[] _config_dirs;
+ return _config_dirs;
+ }
+ string[] image_dirs() {
+ string[] _image_dirs;
+ return _image_dirs;
+ }
+ auto manifest_list_of_filenames() {
+ return _manifest_fn_list;
+ }
+ string[] manifest_list_of_languages() {
+ string[] _lngs;
+ foreach (filename_; manifest_list_of_filenames) {
+ string _k = "en";
+ if (auto m = (filename_).match(rgx.language_code_and_filename)) {
+ _k = m.captures[1].to!string;
+ }
+ _lngs ~= _k; // all the languages from the manifest list of filenames with paths
+ }
+ return _lngs;
+ }
+ }
+ return Pod_();
+ }
+ auto src() {
+ string _fns = _fns; // required here by dmd & not by ldc (for D:2078)
+ auto _opt_actions = _opt_actions;
+ auto _env = _env;
+ struct SRC_ {
+ bool is_pod() {
+ return (_manifested.pod_manifest_path.length > 0) ? true : false;
+ }
+ string path_and_fn() {
+ return _fns;
+ }
+ string pod_name_with_path() {
+ return (is_pod) ? _manifested.pod_manifest_path : "";
+ }
+ string pods_collection_root_path() {
+ return (is_pod) ? _manifested.pods_collection_root_path : "";
+ }
+ string pod_name() {
+ return pod_name_with_path.baseName;
+ }
+ string filename() {
+ return path_and_fn.baseName;
+ }
+ string filename_base() {
+ return filename.stripExtension;
+ }
+ string filename_extension() {
+ return filename.match(rgx.src_pth_sst_or_ssm).captures["extension"];
+ }
+ string lng() {
+ string _k;
+ if (auto m = path_and_fn.match(rgx.language_code_and_filename)) {
+ _k = m.captures[1];
+ } else {_k = "en"; }
+ return _k;
+ }
+ string doc_uid() {
+ string _uid;
+ if (is_pod && !(pod_name_with_path.empty)) {
+ if (pod_name_with_path.baseName == filename_base) {
+ _uid = filename_base ~ "." ~ filename_extension ~ mkup.sep ~ lng;
+ } else {
+ _uid = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ "." ~ filename_extension ~ mkup.sep ~ lng;
+ }
+ } else {
+ _uid = mkup.sep ~ filename_base ~ "." ~ filename_extension ~ mkup.sep ~ lng;
+ }
+ return _uid;
+ }
+ string doc_uid_out() {
+ string _uid;
+ if (is_pod && !(pod_name_with_path.empty)) {
+ if (pod_name_with_path.baseName == filename_base) {
+ _uid = filename_base ~ "." ~ lng;
+ } else {
+ _uid = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ "." ~ lng;
+ }
+ } else {
+ _uid = "_" ~ filename_base ~ "." ~ lng;
+ }
+ return _uid;
+ }
+ string docname_composite_unique_per_src_doc() {
+ string _fn;
+ if (pod_name_with_path.baseName == filename_base) {
+ _fn = filename_base ~ mkup.sep ~ filename_extension ~ mkup.sep ~ lng;
+ } else if (!(pod_name_with_path.empty)) {
+ _fn = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension ~ mkup.sep ~ lng;
+ } else {
+ _fn = "_" ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension ~ mkup.sep ~ lng;
+ }
+ return _fn;
+ }
+ string docname_composite_unique_per_src_pod() {
+ /+
+ z pod name if any + src filename (without lng code)
+ filename ~ mkup.sep ~ lng
+ * unique per src pod
+ used by
+ - pod (multilingual collection)
+ - sqlite discrete index (multilingual collection)
+ +/
+ string _fn;
+ if (pod_name_with_path.baseName == filename_base) {
+ _fn = filename_base ~ mkup.sep ~ filename_extension;
+ } else if (!(pod_name_with_path.empty)) {
+ _fn = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension;
+ } else {
+ _fn = "_" ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension;
+ }
+ return _fn;
+ }
+ string language() {
+ return lng();
+ }
+ string file_with_absolute_path() {
+ return _env["pwd"].chainPath(path_and_fn).array;
+ }
+ string absolute_path_to_src() {
+ return (_env["pwd"].chainPath(path_and_fn)).dirName.array;
+ }
+ string path_to_doc_root_path_to_lang_and_filename() {
+ return _env["pwd"].chainPath(path_and_fn).array;
+ }
+ string base_dir() {
+ string _dir;
+ if (
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
+ ) {
+ _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array;
+ assert(_dir == m.captures["dir"]);
+ } else {
+ _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array;
+ assert(_dir == absolute_path_to_src
+ .match(rgx.src_base_parent_dir_name).captures["dir"]);
+ }
+ if (_opt_actions.debug_do) {
+ writeln("--> (base_dir) ", _dir);
+ }
+ return _dir;
+ }
+ string base_parent_dir_path() {
+ string _dir;
+ if (
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
+ ) {
+ _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array;
+ } else {
+ _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array;
+ }
+ return _dir;
+ }
+ string base_dir_path() {
+ string _dir;
+ if (
+ auto m = (absolute_path_to_src)
+ .match(rgx.src_formalised_file_path_parts)
+ ) {
+ _dir = ((m.captures["pth"]).asNormalizedPath).array;
+ } else if (
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
+ ) {
+ _dir = ((path_and_fn.chainPath("../")).asNormalizedPath).array;
+ } else {
+ _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array;
+ }
+ if (_opt_actions.debug_do) {
+ writeln("--> (base_dir_path) ", _dir);
+ }
+ return _dir;
+ }
+ string media_dir_path() {
+ string _dir = ((base_dir_path.chainPath("media")).asNormalizedPath).array;
+ return _dir;
+ }
+ string image_dir_path() {
+ string _paths;
+ string[] _possible_img_pths = [ "./image", "../image", "../../image" ];
+ string _img_pth_found = "";
+ if (is_pod) {
+ _img_pth_found = ((file_with_absolute_path.dirName ~ "/../../image").asNormalizedPath).array;
+ } else {
+ string _img_pth(string _possible_img_pth) {
+ return ((file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).asNormalizedPath).array;
+ }
+ foreach(_possible_img_pth; _possible_img_pths) {
+ if (exists(_img_pth(_possible_img_pth))) {
+ _img_pth_found = _img_pth(_possible_img_pth);
+ break;
+ } else {
+ _paths ~= " " ~ _img_pth(_possible_img_pth);
+ }
+ }
+ }
+ if (_img_pth_found.empty) {
+ writeln("WARNING not image path found, searched: ", _paths);
+ }
+ return _img_pth_found;
+ }
+ auto conf_dir_path() {
+ return ((base_dir_path.chainPath("conf")).asNormalizedPath).array;
+ }
+ auto base_parent_dir() {
+ string _dir;
+ if (
+ auto m = (absolute_path_to_src)
+ .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
+ ) {
+ _dir = m.captures["dir"];
+ } else {
+ _dir = (absolute_path_to_src).match(rgx.src_base_parent_dir_name).captures["dir"];
+ }
+ if (_opt_actions.debug_do) {
+ writeln("--> (base_parent_dir) ", _dir);
+ }
+ return _dir;
+ }
+ string[] config_dirs() {
+ string[] _config_dirs;
+ if (is_pod) {
+ } else {}
+ return _config_dirs;
+ }
+ string[] image_dirs() {
+ string[] _image_dirs;
+ if (is_pod) {
+ } else {}
+ return _image_dirs;
+ }
+ }
+ return SRC_();
+ }
+ auto output() {
+ /+
+ - command line if output path set
+ - config file if found and set set
+ - search for and if exists read config
+ - default paths to config related to:
+ - source markup path;
+ - current dir;
+ - home dir
+ - get output path if set
+ - (program) default within current directory?
+ +/
+ auto _env = _env;
+ struct Out_ {
+ auto path() {
+ auto _output_path = _env["pwd"];
+ if ((_opt_actions.output_dir_set.length > 0)
+ && isValidPath(_opt_actions.output_dir_set)
+ ) {
+ _output_path = ((_opt_actions.output_dir_set).asNormalizedPath).array;
+ if (!exists(_output_path)) {
+ try {
+ _output_path.mkdirRecurse;
+ // } catch (ErrnoException ex) {
+ } catch (Exception ex) {
+ // Handle error
+ }
+ }
+ assert(_output_path.isDir,
+ "not a directory: " ~ _output_path);
+ // TODO always test that is a directory and it is writable
+ }
+ return _output_path;
+ }
+ }
+ return Out_();
+ }
+ }
+ return ManifestMatters_();
+ }
+}
+template ConfigFilePaths() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto ConfigFilePaths(M,E)(
+ M _manifested,
+ E _env,
+ string _cli_config_path_set = ""
+ ) {
+ struct ConfFilePaths {
+ string config_filename_document() {
+ return "dr_document_make";
+ }
+ string config_filename_site() {
+ return "config_local_site";
+ }
+ auto possible_config_path_locations() {
+ struct _ConfFilePaths {
+ string[] dr_document_make() {
+ /+ FIX clean up conf paths ↓ +/
+ /+ config local site (file system only, not in pod) +/
+ /+ return paths +/
+ string[] _possible_config_path_locations;
+ if (_cli_config_path_set.empty) {
+ if (_manifested.src.is_pod) {
+ /+ config document in pod +/
+ string _dr_doc_conf_pod;
+ string _dr_doc_conf_pod_text;
+ _dr_doc_conf_pod = asNormalizedPath(chainPath(
+ to!string(_env["pwd"]),
+ _manifested.pod.manifest_path ~ "/conf"
+ )).array;
+ _dr_doc_conf_pod_text = asNormalizedPath(chainPath(
+ to!string(_env["pwd"]),
+ _manifested.pod.manifest_path ~ "/media/text/" ~ _manifested.src.lng ~ "/conf"
+ )).array;
+ /+ return paths +/
+ _possible_config_path_locations = [
+ _dr_doc_conf_pod_text,
+ _dr_doc_conf_pod,
+ ];
+ } else {
+ /+ config document (& or local site) on filesystem +/
+ string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array; // think about
+ string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
+ /+ return paths +/
+ _possible_config_path_locations = [
+ _dr_doc_conf_pwd,
+ _dr_doc_conf_pwd_a,
+ _dr_doc_conf_pwd_b,
+ _dr_doc_conf_pwd_c,
+ _dr_doc_conf_pwd_d,
+ ];
+ }
+ } else {
+ _possible_config_path_locations = [
+ _cli_config_path_set
+ ];
+ }
+ /+ FIX clean up conf paths ↑
+ (compare pwd to doc path location, and build config path)
+ +/
+ return _possible_config_path_locations;
+ }
+ string[] config_local_site() {
+ /+ FIX clean up conf paths ↓ +/
+ /+ config local site (file system only, not in pod) +/
+ string[] _possible_config_path_locations;
+ if (_cli_config_path_set.empty) {
+ string _dot_pwd = ((chainPath(to!string(_env["pwd"]), ".dr")).asNormalizedPath).array;
+ string _underscore_pwd = ((chainPath(to!string(_env["pwd"]), "_dr")).asNormalizedPath).array;
+ string _dot_home = ((chainPath(to!string(_env["home"]), ".dr")).asNormalizedPath).array;
+ /+ return paths +/
+ if (_manifested.src.is_pod) {
+ string _collection_root_a = ((chainPath(to!string(_manifested.pod.collection_root.to!string), ".dr")).asNormalizedPath).array;
+ string _collection_root_b = ((chainPath(to!string(_manifested.pod.collection_root.to!string), "_dr")).asNormalizedPath).array;
+ _possible_config_path_locations = [
+ _dot_pwd,
+ _underscore_pwd,
+ _dot_home,
+ "/etc/dr",
+ _collection_root_a, // set priority higher?
+ _collection_root_b // set priority higher?
+ ];
+ } else {
+ /+ config document (& or local site) on filesystem +/
+ string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
+ string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
+ _possible_config_path_locations = [
+ _dr_doc_conf_pwd,
+ _dr_doc_conf_pwd_a,
+ _dr_doc_conf_pwd_b,
+ _dr_doc_conf_pwd_c,
+ _dr_doc_conf_pwd_d,
+ _dot_pwd,
+ _underscore_pwd,
+ _dot_home,
+ "/etc/dr"
+ ];
+ }
+ } else {
+ _possible_config_path_locations = [
+ _cli_config_path_set
+ ];
+ }
+ /+ FIX clean up conf paths ↑
+ (compare pwd to doc path location, and build config path)
+ +/
+ return _possible_config_path_locations;
+ }
+ }
+ return _ConfFilePaths();
+ }
+ }
+ return ConfFilePaths();
+ }
+}
+template spinePathsSRC() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spinePathsSRC(D,Fn)(
+ D _pwd,
+ Fn _fn_src_and_path,
+ ) {
+ struct drSrcPaths {
+ auto pwd() {
+ return _pwd;
+ }
+ string language() {
+ // use command line info as well?
+ string _k;
+ if (auto m = _fn_src_and_path.match(rgx.language_code_and_filename)) {
+ _k = m.captures[1];
+ } else { /+ unknown until doc_meta read, (could provide & use command line info?) +/
+ _k = "xx"; // original default was "en" but is not known
+ }
+ return _k;
+ }
+ string doc_root() {
+ return "dr_doc";
+ }
+ auto media_root() {
+ return ((doc_root.chainPath("media")).asNormalizedPath).array;
+ }
+ auto conf_root() {
+ return ((doc_root.chainPath("conf")).asNormalizedPath).array;
+ }
+ auto text_root() {
+ return ((media_root.chainPath("text")).asNormalizedPath).array;
+ }
+ auto image_root() {
+ return ((media_root.chainPath("image")).asNormalizedPath).array;
+ }
+ auto doc_src_fn_with_path_for_text_root_and_lng() {
+ return ((text_root.chainPath(language)).asNormalizedPath).array;
+ }
+ auto doc_src_fn() {
+ return ((_fn_src_and_path.baseName).asNormalizedPath).array;
+ }
+ auto doc_src_with_path() {
+ return ((pwd.chainPath(_fn_src_and_path)).asNormalizedPath).array;
+ }
+ }
+ return drSrcPaths();
+ }
+}
+
+
+template spinePathsPods() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ string _suffix = ".zip";
+ auto spinePathsPods(M)(M doc_matters) {
+ string _base_dir_pod = (doc_matters.output_path.length > 0)
+ ? doc_matters.output_path ~ "/pod"
+ : "/pod";
+ string _base_dir_doc = "dr_doc";
+ struct _PodPaths {
+ string base_filename_(string fn_src) {
+ auto pth = fn_src.baseName.stripExtension;
+ return pth;
+ }
+ string pod_dir_() {
+ auto pth = _base_dir_pod;
+ return pth;
+ }
+ string dr_doc_dir_() {
+ auto pth = _base_dir_doc;
+ return pth;
+ }
+ string pod_filename_(string fn_src) {
+ string pth = _base_dir_pod.chainPath(base_filename_(fn_src) ~ _suffix).array;
+ return pth;
+ }
+ string base_filesystem_(string fn_src) {
+ string pth = _base_dir_pod.chainPath(base_filename_(fn_src)).array;
+ assert(pth == _base_dir_pod ~ "/" ~ base_filename_(fn_src),
+ pth ~ " == " ~ _base_dir_pod ~ "/" ~ base_filename_(fn_src) ~ "?");
+ return pth;
+ }
+ string output_pod_manifest_file(string fn_src) {
+ string pth = base_filesystem_(fn_src).chainPath("pod.manifest").array;
+ return pth;
+ }
+ string base_pod_(string fn_src) {
+ string pth = _base_dir_pod.chainPath(base_filename_(fn_src)).array; // change this
+ return pth;
+ }
+ auto base_filename(string fn_src) {
+ auto pth_1_ = base_filename_(fn_src);
+ auto pth_2_ = base_filename_(fn_src);
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto pod_filename(string fn_src) {
+ auto pth_1_ = pod_filename_(fn_src);
+ auto pth_2_ = pod_filename_(fn_src);
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto base(string fn_src) {
+ auto pth_1_ = "";
+ auto pth_2_ = base_filesystem_(fn_src);
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto pod_root(string fn_src) {
+ auto pth_1_ = "pod";
+ auto pth_2_ = ((base(fn_src).filesystem_open_zpod.chainPath("")).asNormalizedPath).array; // "dr_doc"
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto conf_root(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = "conf";
+ auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("conf")).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto css(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((conf_root(fn_src).zpod.chainPath("css")).asNormalizedPath).array;
+ auto pth_2_ = ((conf_root(fn_src).filesystem_open_zpod.chainPath("css")).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto pod_manifest(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((pod_root(fn_src).zpod.chainPath("pod.manifest")).asNormalizedPath).array;
+ auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("pod.manifest")).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto media_root(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((pod_root(fn_src).zpod.chainPath("media")).asNormalizedPath).array;
+ auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("media")).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto text_root(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((media_root(fn_src).zpod.chainPath("text")).asNormalizedPath).array;
+ auto pth_2_ = ((media_root(fn_src).filesystem_open_zpod.chainPath("text")).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto doc(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = text_root(fn_src).zpod;
+ auto pth_2_ = text_root(fn_src).filesystem_open_zpod;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto doc_lng(string fn_src, string lng) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((text_root(fn_src).zpod.chainPath(lng)).asNormalizedPath).array;
+ auto pth_2_ = ((text_root(fn_src).filesystem_open_zpod.chainPath(lng)).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto image_root(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((media_root(fn_src).zpod.chainPath("image")).asNormalizedPath).array;
+ auto pth_2_ = ((media_root(fn_src).filesystem_open_zpod.chainPath("image")).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto fn_pod_filelist(string fn_src) {
+ auto pod_root_ = pod_root(fn_src);
+ auto _manifested = PodManifest!()(fn_src).pod_manifest_filename;
+ auto pth_1_ = _manifested;
+ auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath(_manifested)).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto fn_doc(string fn_src, string lng) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((doc_lng(fn_src, lng).zpod.chainPath(fn_src.baseName)).asNormalizedPath).array;
+ auto pth_2_ = ((doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_src.baseName)).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ auto fn_doc_insert(string fn_src, string fn_insert, string lng) {
+ auto pod_root_ = pod_root(fn_src);
+ auto pth_1_ = ((doc_lng(fn_src, lng).zpod.chainPath(fn_insert.baseName)).asNormalizedPath).array;
+ auto pth_2_ = ((doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_insert.baseName)).asNormalizedPath).array;
+ struct _pods {
+ auto zpod() {
+ return pth_1_;
+ }
+ auto filesystem_open_zpod() {
+ assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
+ return pth_2_;
+ }
+ }
+ return _pods();
+ }
+ }
+ return _PodPaths();
+ }
+}
diff --git a/src/doc_reform/io_in/read_config_files.d b/src/doc_reform/io_in/read_config_files.d
new file mode 100644
index 0000000..c0893de
--- /dev/null
+++ b/src/doc_reform/io_in/read_config_files.d
@@ -0,0 +1,155 @@
+/++
+ read configuration files
+ - read config files
+ meta_config_files.d
++/
+module doc_reform.io_in.read_config_files;
+
+static template readConfigSite() {
+ import
+ doc_reform.meta.rgx;
+ import
+ doc_reform.meta,
+ doc_reform.io_in.paths_source,
+ std.file,
+ std.path;
+ mixin spineRgxInit;
+ final auto readConfigSite(M,E)(
+ M _manifested,
+ E _env,
+ string _cli_config_path_set = ""
+ ) {
+ static auto rgx = Rgx();
+ string config_file_str;
+ string conf_filename = "NONE";
+ auto _conf_file_details = ConfigFilePaths!()(_manifested, _env, _cli_config_path_set);
+ string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site;
+ foreach(conf_fn; [_conf_file_details.config_filename_site]) {
+ foreach(pth; possible_config_path_locations) {
+ char[] conf_file;
+ conf_filename = conf_fn;
+ if (exists(pth)) {
+ auto f_attrib = pth.getLinkAttributes;
+ if (
+ possible_config_path_locations.length == 1
+ && f_attrib.attrIsFile
+ ) {
+ conf_file = pth.to!(char[]);
+ conf_filename = pth.baseName;
+ } else if (f_attrib.attrIsDir) {
+ conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array;
+ conf_filename = conf_fn;
+ }
+ try {
+ if (exists(conf_file)) {
+ if (conf_file.getLinkAttributes.attrIsFile) {
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ } catch (ErrnoException ex) {
+ } catch (FileException ex) {
+ }
+ }
+ }
+ if (config_file_str.length > 0) { break; }
+ }
+ struct _ConfContent {
+ string filename() {
+ return conf_filename;
+ }
+ string filetype() {
+ string _ft = "";
+ if (content.match(rgx.yaml_config)) {
+ _ft = "yaml";
+ }
+ return _ft;
+ }
+ string content() {
+ return config_file_str;
+ }
+ }
+ return _ConfContent();
+ }
+}
+static template readConfigDoc() {
+ import
+ doc_reform.meta.rgx;
+ import
+ doc_reform.meta,
+ doc_reform.io_in.paths_source,
+ std.file,
+ std.path;
+ mixin spineRgxInit;
+ final auto readConfigDoc(M,E)(M _manifested, E _env) {
+ static auto rgx = Rgx();
+ string config_file_str;
+ string conf_filename = "NONE";
+ auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
+ string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.dr_document_make;
+ foreach(conf_fn; [_conf_file_details.config_filename_document]) {
+ foreach(pth; possible_config_path_locations) {
+ auto conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array;
+ conf_filename = conf_fn;
+ if (config_file_str.length > 0) {
+ break;
+ }
+ try {
+ if (exists(conf_file)) {
+ if (conf_file.getLinkAttributes.attrIsFile) {
+ config_file_str = conf_file.readText;
+ break;
+ }
+ }
+ } catch (ErrnoException ex) {
+ } catch (FileException ex) {
+ }
+ }
+ if (config_file_str.length > 0) { break; }
+ }
+ struct _ConfContent {
+ string filename() {
+ return conf_filename;
+ }
+ string content() {
+ return config_file_str;
+ }
+ string filetype() {
+ string _ft = "";
+ if (content.match(rgx.yaml_config)) {
+ _ft = "yaml";
+ }
+ return _ft;
+ }
+ }
+ return _ConfContent();
+ }
+}
+static template configReadSiteYAML() {
+ import
+ doc_reform.meta,
+ doc_reform.io_in.paths_source,
+ std.file,
+ std.path;
+ final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) {
+ string _configuration = configReadInSiteYAML!()(_manifested, _env);
+ auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
+ string _conf_yaml_fn = _conf_file_details.config_filename_site;
+ YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml_fn);
+ return _yaml_conf;
+ }
+}
+static template configReadDocYAML() {
+ import
+ doc_reform.meta,
+ doc_reform.io_in.paths_source,
+ std.file,
+ std.path;
+ final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) {
+ string _configuration = configReadInDocYAML!()(_manifested, _env);
+ auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
+ string _conf_yaml_fn = _conf_file_details.config_filename_document;
+ YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml_fn);
+ return _yaml_conf;
+ }
+}
diff --git a/src/doc_reform/io_in/read_source_files.d b/src/doc_reform/io_in/read_source_files.d
new file mode 100644
index 0000000..e443b01
--- /dev/null
+++ b/src/doc_reform/io_in/read_source_files.d
@@ -0,0 +1,348 @@
+/++
+ module source_read_source_files;
+ - open markup files
+ - if master file scan for addional files to import/insert
++/
+module doc_reform.io_in.read_source_files;
+static template spineRawMarkupContent() {
+ import
+ doc_reform.meta.rgx;
+ import
+ doc_reform.meta,
+ doc_reform.io_in.paths_source,
+ std.file,
+ std.path;
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ string[] _images=[];
+ auto _extract_images(S)(S content_block) {
+ string[] images_;
+ string _content_block = content_block.to!string;
+ if (auto m = _content_block.matchAll(rgx.image)) {
+ images_ ~= m.captures[1].to!string;
+ }
+ return images_;
+ }
+ auto rawsrc = RawMarkupContent();
+ auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) {
+ auto _0_header_1_body_content_2_insert_filelist_tuple
+ = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src);
+ return _0_header_1_body_content_2_insert_filelist_tuple;
+ }
+ struct RawMarkupContent {
+ final sourceContent(in string fn_src) {
+ auto raw = MarkupRawUnit();
+ auto source_txt_str
+ = raw.markupSourceReadIn(fn_src);
+ return source_txt_str;
+ }
+ final auto sourceContentSplitIntoHeaderAndBody(O)(O _opt_action, in string source_txt_str, in string fn_src="") {
+ auto raw = MarkupRawUnit();
+ string[] insert_file_list;
+ string[] images_list;
+ auto t
+ = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str);
+ auto header_raw = t[0];
+ auto sourcefile_body_content = t[1];
+ if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise
+ auto ins = Inserts();
+ auto tu
+ = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src);
+ static assert(!isTypeTuple!(tu));
+ sourcefile_body_content = tu[0];
+ insert_file_list = tu[1].dup;
+ images_list = tu[2].dup;
+ } else if (_opt_action.source || _opt_action.pod) {
+ auto ins = Inserts();
+ auto tu
+ = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src);
+ static assert(!isTypeTuple!(tu));
+ images_list = tu[2].dup;
+ }
+ string header_type = "";
+ if (header_raw.match(rgx.yaml_config)) {
+ header_type = "yaml";
+ }
+ t = tuple(
+ header_raw,
+ sourcefile_body_content,
+ header_type,
+ insert_file_list,
+ images_list
+ );
+ static assert(t.length==5);
+ return t;
+ }
+ }
+ struct MarkupRawUnit {
+ import std.file;
+ final private string readInMarkupSource(in char[] fn_src) {
+ enforce(
+ exists(fn_src)!=0,
+ "file not found: «" ~
+ fn_src ~ "»"
+ );
+ string source_txt_str;
+ try {
+ if (exists(fn_src)) {
+ if (fn_src.getLinkAttributes.attrIsFile) {
+ source_txt_str = fn_src.readText;
+ } else {
+ }
+ }
+ } catch (ErrnoException ex) {
+ } catch (UTFException ex) {
+ // Handle validation errors
+ } catch (FileException ex) {
+ // Handle errors
+ }
+ std.utf.validate(source_txt_str);
+ return source_txt_str;
+ }
+ final private char[][] header0Content1(in string src_text) {
+ /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/
+ char[][] header_and_content;
+ auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a);
+ header_and_content ~= m.pre;
+ header_and_content ~= m.hit ~ m.post;
+ assert(header_and_content.length == 2,
+ "document markup is broken, header body split == "
+ ~ header_and_content.length.to!string
+ ~ "; (header / body array split should == 2 (split is on level A~))"
+ );
+ return header_and_content;
+ }
+ final private char[][] markupSourceLineArray(in char[] src_text) {
+ char[][] source_line_arr
+ = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding);
+ return source_line_arr;
+ }
+ auto markupSourceReadIn(in string fn_src) {
+ static auto rgx = Rgx();
+ enforce(
+ fn_src.match(rgx.src_pth_sst_or_ssm),
+ "not a dr markup filename: «" ~
+ fn_src ~ "»"
+ );
+ auto source_txt_str = readInMarkupSource(fn_src);
+ return source_txt_str;
+ }
+ auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {
+ string[] file_insert_list = [];
+ string[] images_list = [];
+ char[][] hc = header0Content1(source_txt_str);
+ char[] header = hc[0];
+ char[] source_txt = hc[1];
+ auto source_line_arr = markupSourceLineArray(source_txt);
+ string header_type = "";
+ if (header.match(rgx.yaml_config)) {
+ header_type = "yaml";
+ }
+ auto t = tuple(
+ header,
+ source_line_arr,
+ header_type,
+ file_insert_list,
+ images_list
+ );
+ return t;
+ }
+ final char[][] getInsertMarkupSourceContentRawLineArray(
+ in char[] fn_src_insert,
+ Regex!(char) rgx_file
+ ) {
+ enforce(
+ fn_src_insert.match(rgx_file),
+ "not a dr markup filename: «" ~
+ fn_src_insert ~ "»"
+ );
+ auto source_txt_str = readInMarkupSource(fn_src_insert);
+ auto source_line_arr = markupSourceLineArray(source_txt_str);
+ return source_line_arr;
+ }
+ }
+ struct Inserts {
+ auto scan_subdoc_source(O)(
+ O _opt_action,
+ char[][] markup_sourcefile_insert_content,
+ string fn_src
+ ) {
+ mixin spineRgxInitFlags;
+ char[][] contents_insert;
+ int[string] type1 = flags_type_init;
+ auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm);
+ auto markup_src_file_path = fn_pth_full.captures[1];
+ foreach (line; markup_sourcefile_insert_content) {
+ if (type1["curly_code"] == 1) {
+ type1["header_make"] = 0;
+ type1["header_meta"] = 0;
+ if (line.matchFirst(rgx.block_curly_code_close)) {
+ type1["curly_code"] = 0;
+ }
+ contents_insert ~= line;
+ } else if (line.matchFirst(rgx.block_curly_code_open)) {
+ type1["curly_code"] = 1;
+ type1["header_make"] = 0;
+ type1["header_meta"] = 0;
+ contents_insert ~= line;
+ } else if (type1["tic_code"] == 1) {
+ type1["header_make"] = 0;
+ type1["header_meta"] = 0;
+ if (line.matchFirst(rgx.block_tic_close)) {
+ type1["tic_code"] = 0;
+ }
+ contents_insert ~= line;
+ } else if (line.matchFirst(rgx.block_tic_code_open)) {
+ type1["tic_code"] = 1;
+ type1["header_make"] = 0;
+ type1["header_meta"] = 0;
+ contents_insert ~= line;
+ } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) {
+ type1["header_make"] = 0;
+ type1["header_meta"] = 0;
+ auto insert_fn = m.captures[2];
+ auto insert_sub_pth = m.captures[1];
+ auto fn_src_insert
+ = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array;
+ auto raw = MarkupRawUnit();
+ auto markup_sourcesubfile_insert_content
+ = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts);
+ debug(insert_file) {
+ writeln(line);
+ writeln(fn_src_insert);
+ writeln(
+ " length contents insert array: ",
+ markup_sourcesubfile_insert_content.length
+ );
+ }
+ if (_opt_action.source || _opt_action.pod) {
+ _images ~= _extract_images(markup_sourcesubfile_insert_content);
+ }
+ auto ins = Inserts();
+ /+
+ - 1. load file
+ - 2. read lines
+ - 3. scan lines
+ - a. if filename insert, and insert filename
+ - repeat 1
+ - b. else
+ - add line to new array;
+ - build image list, search for any image files to add to image list
+ +/
+ } else {
+ type1["header_make"] = 0;
+ type1["header_meta"] = 0;
+ contents_insert ~= line; // images to extract for image list?
+ if (_opt_action.source || _opt_action.pod) {
+ auto _image_linelist = _extract_images(line);
+ if (_image_linelist.length > 0) {
+ _images ~= _image_linelist;
+ }
+ }
+ }
+ } // end src subdoc (inserts) loop
+ auto t = tuple(
+ contents_insert,
+ _images
+ );
+ return t;
+ }
+ auto scan_master_src_for_insert_files_and_import_content(O)(
+ O _opt_action,
+ char[][] sourcefile_body_content,
+ string fn_src
+ ) {
+ import std.algorithm;
+ mixin spineRgxInitFlags;
+ char[][] contents;
+ int[string] type = flags_type_init;
+ auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm);
+ auto markup_src_file_path = fn_pth_full.captures[1];
+ char[][] contents_insert;
+ string[] _images =[];
+ string[] insert_file_list =[];
+ foreach (line; sourcefile_body_content) {
+ if (type["curly_code"] == 1) {
+ if (line.matchFirst(rgx.block_curly_code_close)) {
+ type["curly_code"] = 0;
+ }
+ contents ~= line;
+ } else if (line.matchFirst(rgx.block_curly_code_open)) {
+ type["curly_code"] = 1;
+ contents ~= line;
+ } else if (type["tic_code"] == 1) {
+ if (line.matchFirst(rgx.block_tic_close)) {
+ type["tic_code"] = 0;
+ }
+ contents ~= line;
+ } else if (line.matchFirst(rgx.block_tic_code_open)) {
+ type["tic_code"] = 1;
+ contents ~= line;
+ } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) {
+ auto insert_fn = m.captures[2];
+ auto insert_sub_pth = m.captures[1];
+ auto fn_src_insert
+ = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array;
+ insert_file_list ~= fn_src_insert.to!string;
+ auto raw = MarkupRawUnit();
+ /+ TODO +/
+ auto markup_sourcefile_insert_content
+ = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts);
+ debug(insert_file) {
+ writeln(line);
+ writeln(fn_src_insert);
+ writeln(
+ " length contents insert array: ",
+ markup_sourcefile_insert_content.length
+ );
+ }
+ auto ins = Inserts();
+ auto contents_insert_tu = ins.scan_subdoc_source(
+ _opt_action,
+ markup_sourcefile_insert_content,
+ fn_src_insert.to!string
+ );
+ contents ~= contents_insert_tu[0]; // images to extract for image list?
+ if (_opt_action.source || _opt_action.pod) {
+ auto _image_linelist = _extract_images(contents_insert_tu[0]);
+ if (_image_linelist.length > 0) {
+ _images ~= _image_linelist;
+ }
+ }
+ /+
+ - 1. load file
+ - 2. read lines
+ - 3. scan lines
+ - a. if filename insert, and insert filename
+ - repeat 1
+ - b. else
+ - add line to new array;
+ - build image list, search for any image files to add to image list
+ +/
+ } else {
+ contents ~= line;
+ if (_opt_action.source || _opt_action.pod) {
+ auto _image_linelist = _extract_images(line);
+ if (_image_linelist.length > 0) {
+ _images ~= _image_linelist;
+ }
+ }
+ }
+ } // end src doc loop
+ string[] images = [];
+ foreach(i; uniq(_images.sort())) {
+ images ~= i;
+ }
+ debug(insert_file) {
+ writeln(__LINE__);
+ writeln(contents.length);
+ }
+ auto t = tuple(
+ contents,
+ insert_file_list,
+ images
+ );
+ return t;
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/create_zip_file.d b/src/doc_reform/io_out/create_zip_file.d
new file mode 100644
index 0000000..09b481a
--- /dev/null
+++ b/src/doc_reform/io_out/create_zip_file.d
@@ -0,0 +1,17 @@
+module doc_reform.io_out.create_zip_file;
+template createZipFile() {
+ import std.file;
+ import std.outbuffer;
+ import std.string;
+ import std.zip;
+ void createZipFile(
+ string zip_file_name,
+ void[] compressed_zip_data,
+ ) {
+ try {
+ write(zip_file_name, compressed_zip_data);
+ } catch (ZipException ex) {
+ // Handle Errors
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/defaults.d b/src/doc_reform/io_out/defaults.d
new file mode 100644
index 0000000..887c1be
--- /dev/null
+++ b/src/doc_reform/io_out/defaults.d
@@ -0,0 +1,135 @@
+/++
+ default settings
++/
+module doc_reform.io_out.defaults;
+
+template InternalMarkup() {
+ import std.array;
+ static struct InlineMarkup {
+ string en_a_o = "【"; string en_a_c = "】";
+ string en_b_o = "〖"; string en_b_c = "〗";
+ string quote_o = "“"; string quote_c = "”";
+ string ff_o = "┨"; string ff_c = "┣"; // fontface
+ string lnk_o = "┥"; string lnk_c = "┝";
+ string url_o = "┤"; string url_c = "├";
+ string emph = "*";
+ string bold = "!";
+ string italic = "/";
+ string underscore = "_";
+ string superscript = "^";
+ string subscript = ",";
+ string mono = "■";
+ string cite = "‖";
+ string mark_internal_site_lnk = "¤";
+ string nbsp = "░";
+ string br_line = "┘";
+ string br_nl = "┙";
+ string br_paragraph = "┚";
+ string br_obj = "break_obj";
+ string br_page_line = "┼";
+ string br_page = "┿";
+ string br_page_new = "╂";
+ string tc_s = "┊";
+ string tc_o = "┏";
+ string tc_c = "┚";
+ string tc_p = "┆";
+ string img = "☼";
+ string sep = "␣";
+ string on_o = "「"; auto on_c = "」";
+ string mk_bullet = "● ";
+ static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") {
+ _indent_spaces = replicate(_indent_spaces, indent);
+ return _indent_spaces;
+ }
+ static string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) {
+ _character = replicate(_character, number);
+ return _character;
+ }
+ }
+}
+template spineLanguageCodes() {
+ /+ language codes +/
+ struct Lang {
+ static string[string][string] codes() {
+ auto _lang_codes = [
+ "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ],
+ "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ],
+ "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ],
+ "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ],
+ "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ],
+ "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ],
+ "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ],
+ "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ],
+ "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ],
+ "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ],
+ "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
+ "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ],
+ "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ],
+ "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ],
+ "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ],
+ "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ],
+ "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ],
+ "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ],
+ "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ],
+ "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ],
+ "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ],
+ "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ],
+ "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ],
+ "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ],
+ "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ],
+ "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ],
+ "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ],
+ "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ],
+ "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ],
+ "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ],
+ "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ],
+ "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ],
+ "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ],
+ "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ],
+ "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ],
+ "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ],
+ "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ],
+ "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ],
+ "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ],
+ "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ],
+ "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ],
+ "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ],
+ "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ],
+ "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ],
+ "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ],
+ "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ],
+ "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ],
+ "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ],
+ "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ],
+ "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ],
+ "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ],
+ "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ],
+ "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ],
+ "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ],
+ "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ],
+ "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ],
+ "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ],
+ "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ],
+ "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ],
+ "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ],
+ "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
+ "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ],
+ ];
+ return _lang_codes;
+ }
+ static string[] code_arr_ptr() {
+ string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",];
+ return _lang_codes;
+ }
+ static string[] code_arr() {
+ string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"];
+ return _lang_codes;
+ }
+ static auto codes_() {
+ return "(" ~ join(code_arr,"|") ~ ")";
+ }
+ static auto codes_regex() {
+ return regex(codes_);
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/epub3.d b/src/doc_reform/io_out/epub3.d
new file mode 100644
index 0000000..14038a8
--- /dev/null
+++ b/src/doc_reform/io_out/epub3.d
@@ -0,0 +1,814 @@
+module doc_reform.io_out.epub3;
+template outputEPub3() {
+ import doc_reform.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.xmls,
+ doc_reform.io_out.xmls_css;
+ mixin InternalMarkup;
+ mixin outputXHTMLs;
+ string epub3_mimetypes() {
+ string o;
+ o = format(q"┃application/epub+zip┃") ~ "\n";
+ return o;
+ }
+ string epub3_container_xml() {
+ string o;
+ o = format(q"┃┃") ~ "\n";
+ o ~= format(q"┃
+
+
+ ┃") ~ "\n \n";
+ return o;
+ }
+ string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) {
+ auto xhtml_format = outputXHTMLs();
+ auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
+ string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters!
+ string content = format(q"┃
+
+
+
+ %s
+ main
+ %s
+ subtitle
+ %s
+ %s
+ %s
+ Copyright: %s
+ %s
+ urn:uuid:%s
+
+
+
+
+
+
+
+
+
+ ┃",
+ _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)
+ ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_sub),
+ (doc_matters.conf_make_meta.meta.creator_author.empty)
+ ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
+ (doc_matters.conf_make_meta.meta.creator_author.empty)
+ ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
+ doc_matters.src.language, // language, fix (needed in dochead metadata)
+ (doc_matters.conf_make_meta.meta.date_published.empty)
+ ? "" : 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,
+ (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"),
+ );
+ content ~= " " ~ "" ~ "\n ";
+ content ~= parts["manifest_documents"];
+ // TODO sort jpg & png
+ content ~= " " ~ "" ~ "\n ";
+ foreach (image; doc_matters.srcs.image_list) {
+ content ~= format(q"┃
+ ┃",
+ image.baseName.stripExtension,
+ (pth_epub3.doc_oebps_image).chompPrefix("OEBPS/"),
+ image,
+ image.extension.chompPrefix("."),
+ );
+ }
+ content ~= " " ~ " " ~ "\n ";
+ content ~= " " ~ "" ~ "\n ";
+ content ~= parts["spine"];
+ content ~= " " ~ " " ~ "\n ";
+ content ~= " " ~ "" ~ "\n ";
+ content ~= parts["guide"];
+ content ~= " " ~ " " ~ "\n ";
+ content ~= "" ~ " ";
+ debug(epubmanifest) {
+ foreach (part; doc_matters.has.keys_seq.seg) { // TODO
+ foreach (obj; doc_abstraction[part]) {
+ if (obj.metainfo.is_a == "heading") {
+ if (obj.metainfo.heading_lev_markup == 4) {
+ writefln(
+ "%s~ [%s.xhtml] %s",
+ obj.marked_up_level,
+ obj.tags.segment_anchor_tag_epub,
+ obj.text
+ );
+ } else if (obj.metainfo.heading_lev_markup > 4) {
+ writefln(
+ "%s~ [%s.xhtml#%s] %s",
+ obj.marked_up_level,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.text
+ );
+ }
+ }
+ }
+ }
+ }
+ return content;
+ }
+ string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) {
+ enum DomTags { none, open, close, close_and_open, open_still, }
+ auto markup = InlineMarkup();
+ auto rgx = Rgx();
+ string toc =format("
+
+ %s
+
+
+
+
+ \n",
+ doc_matters.conf_make_meta.meta.title_full,
+ );
+ foreach (sect; doc_matters.has.keys_seq.seg) {
+ foreach (obj; doc_abstraction[sect]) {
+ if (obj.metainfo.is_a == "heading") {
+ string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
+ foreach_reverse (n; 0 .. 7) {
+ string k = n.to!string;
+ switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) {
+ case DomTags.close :
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n";
+ toc ~= markup.indent_by_spaces_provided(n, " ") ~ "" ~ "\n";
+ break;
+ case DomTags.close_and_open :
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n";
+ if (obj.metainfo.heading_lev_markup < 4) {
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n"
+ ~ markup.indent_by_spaces_provided((n + 2), " ")
+ ~ ""
+ ~ _txt
+ ~ " " ~ "\n";
+ } else {
+ string hashtag =(obj.metainfo.heading_lev_markup == 4)
+ ? ""
+ : ("#" ~ obj.metainfo.ocn.to!string);
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ " " ~ "\n"
+ ~ markup.indent_by_spaces_provided((n + 2), " ")
+ ~ ""
+ ~ _txt
+ ~ " " ~ "\n";
+ }
+ break;
+ case DomTags.open :
+ toc ~= markup.indent_by_spaces_provided(n, " ") ~ "" ~ "\n";
+ if (obj.metainfo.heading_lev_markup < 4) {
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n"
+ ~ markup.indent_by_spaces_provided((n + 2), " ")
+ ~ ""
+ ~ _txt
+ ~ " " ~ "\n";
+ } else {
+ string hashtag =(obj.metainfo.heading_lev_markup == 4)
+ ? ""
+ : ("#" ~ obj.metainfo.ocn.to!string);
+ toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ " " ~ "\n"
+ ~ markup.indent_by_spaces_provided((n + 2), " ")
+ ~ ""
+ ~ _txt
+ ~ " " ~ "\n";
+ }
+ break;
+ default :
+ break;
+ }
+ }
+ }
+ }
+ }
+ toc ~="
+
+
+ \n";
+ return toc;
+ }
+ string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) {
+ int counter = 0;
+ string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
+ auto markup = InlineMarkup();
+ auto rgx = Rgx();
+ enum DomTags { none, open, close, close_and_open, open_still, }
+ string toc = format(q"┃
+
+
+
+ %s%s
+
+
+
+
+
+
+
+
+ %s
+
+
+ %s
+
+ ┃",
+ 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
+ "3", // content depth
+ doc_matters.conf_make_meta.meta.title_full, // title
+ (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
+ : doc_matters.conf_make_meta.meta.creator_author, // author
+ );
+ foreach (sect; doc_matters.has.keys_seq.seg) {
+ foreach (obj; doc_abstraction[sect]) {
+ if (obj.metainfo.is_a == "heading") {
+ string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
+ string hashtag =(obj.metainfo.heading_lev_markup <= 4) ? "" : ("#" ~ obj.metainfo.ocn.to!string);
+ foreach_reverse (k; 0 .. 7) {
+ switch (obj.metainfo.dom_structure_markedup_tags_status[k]) {
+ case DomTags.close :
+ toc ~= "\n ";
+ break;
+ case DomTags.close_and_open :
+ ++counter;
+ toc ~= "\n ";
+ toc ~= format(q"┃
+
+
+ %s
+
+ ┃",
+ counter,
+ _txt,
+ obj.tags.segment_anchor_tag_epub,
+ hashtag,
+ );
+ break;
+ case DomTags.open :
+ ++counter;
+ toc ~= format(q"┃
+
+
+ %s
+
+ ┃",
+ counter,
+ _txt,
+ obj.tags.segment_anchor_tag_epub,
+ hashtag,
+ );
+ break;
+ default :
+ break;
+ }
+ }
+ }
+ }
+ }
+ toc ~= format(q"┃
+
+
+
+
+ ┃");
+ return toc;
+ }
+
+ void outputEPub3(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ mixin spineOutputRgxInit;
+ auto xhtml_format = outputXHTMLs();
+ auto rgx = Rgx();
+ string[] doc;
+ string segment_filename;
+ string[] top_level_headings = ["","","",""];
+ string[string] oepbs_content_parts;
+ string suffix = ".xhtml";
+ struct writeOut { /+ epub specific documents +/
+ /+ fixed output +/
+ string mimetypes;
+ string meta_inf_container_xml;
+ string oebps_toc_ncx;
+ string oebps_toc_nav_xhtml;
+ /+ variable output +/
+ string oebps_content_opf;
+ string[][string] doc_epub3;
+ string[][string] doc_epub3_endnotes;
+ string[] doc_parts;
+ }
+ auto epubWrite = writeOut();
+ foreach (part; doc_matters.has.keys_seq.seg) {
+ foreach (obj; doc_abstraction[part]) {
+ 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) {
+ case 0: .. case 3:
+ /+ fill buffer, and replace with new levels from 1 to 3 +/
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0:
+ top_level_headings[0] = "";
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 1:
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 2:
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 3:
+ top_level_headings[3] = "";
+ goto default;
+ default:
+ epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub;
+ epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters);
+ auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0];
+ epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1];
+ break;
+ }
+ break;
+ case 4:
+ segment_filename = obj.tags.segment_anchor_tag_epub;
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters);
+ auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case 5: .. case 7:
+ auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case 8: .. case 9:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ }
+ }
+ break;
+ }
+ } else {
+ assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head" || "toc");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "toc":
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": assert(part == "body");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "para":
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "group":
+ auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "block":
+ auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "poem":
+ break;
+ case "verse":
+ auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "code":
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
+ break;
+ case "table":
+ epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= "";
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "endnote": assert(part == "endnotes");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ break;
+ case "glossary": assert(part == "glossary");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bibliography": assert(part == "bibliography");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bookindex": assert(part == "bookindex");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ case "blurb": assert(part == "blurb");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
+ epubWrite.doc_epub3[segment_filename] ~= t[0];
+ epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ }
+ }
+ break;
+ }
+ }
+ if (obj.metainfo.is_a == "heading") {
+ assert(obj.text.length > 0);
+ if (obj.metainfo.heading_lev_markup <= 4) {
+ oepbs_content_parts["manifest_documents"] ~=
+ format(q"┃
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.tags.segment_anchor_tag_epub,
+ );
+ oepbs_content_parts["spine"] ~=
+ format(q"┃
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ );
+ oepbs_content_parts["guide"] ~=
+ format(q"┃
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.tags.segment_anchor_tag_epub,
+ );
+ } else if (obj.metainfo.heading_lev_markup > 4) {
+ oepbs_content_parts["manifest_documents"] ~=
+ format(q"┃
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ oepbs_content_parts["spine"] ~=
+ format(q"┃
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ oepbs_content_parts["guide"] ~=
+ format(q"┃
+ ┃",
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ obj.tags.segment_anchor_tag_epub,
+ obj.metainfo.object_number,
+ );
+ }
+ }
+ }
+ }
+ /+ epub specific documents +/
+ epubWrite.mimetypes = epub3_mimetypes;
+ epubWrite.meta_inf_container_xml = epub3_container_xml;
+ epubWrite.oebps_toc_ncx = doc_abstraction.epub2_oebps_toc_ncx(doc_matters);
+ epubWrite.oebps_toc_nav_xhtml = doc_abstraction.epub3_oebps_toc_nav_xhtml(doc_matters);
+ epubWrite.oebps_content_opf = doc_abstraction.epub3_oebps_content(doc_matters, oepbs_content_parts);
+ epubWrite.epub3_write_output_files(doc_matters);
+ }
+ void epub3_write_output_files(W,M)(
+ W epub_write,
+ M doc_matters,
+ ) {
+ debug(asserts) {
+ static assert(is(typeof(epub_write.doc_epub3) == string[][string]));
+ static assert(is(typeof(epub_write.mimetypes) == string));
+ static assert(is(typeof(epub_write.meta_inf_container_xml) == string));
+ static assert(is(typeof(epub_write.oebps_toc_nav_xhtml) == string));
+ static assert(is(typeof(epub_write.oebps_toc_ncx) == string));
+ static assert(is(typeof(epub_write.oebps_content_opf) == string));
+ }
+ static auto rgx = Rgx();
+ auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
+ auto xhtml_format = outputXHTMLs();
+ /+ zip file +/
+ auto fn_epub = pth_epub3.epub_file(doc_matters.src.filename);
+ auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
+ /+ zip archive member files +/
+ void EPUBzip()(string contents, string fn) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ (doc_matters.opt.action.debug_do)
+ ? zip_data.write(contents.dup)
+ : zip_data.write(contents.dup
+ .replaceAll(rgx.spaces_line_start, "")
+ .replaceAll(rgx.newline, " ")
+ .strip
+ );
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_epub, zip.build());
+ }
+ try {
+ if (!exists(pth_epub3.base)) {
+ pth_epub3.base.mkdirRecurse;
+ }
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse;
+ }
+ if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename).mkdirRecurse;
+ }
+ if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename))) {
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename).mkdirRecurse;
+ }
+ }
+ }
+ { /+ OEBPS/[segments].xhtml (the document contents) +/
+ foreach (seg_filename; doc_matters.has.segnames_lv_0_to_4) {
+ string fn = pth_epub3.fn_oebps_content_xhtml(seg_filename);
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
+ auto f = File(fn_dbg, "w");
+ foreach (docseg; epub_write.doc_epub3[seg_filename]) {
+ f.writeln(docseg);
+ }
+ foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) {
+ f.writeln(docseg);
+ }
+ f.writeln(xhtml_format.tail);
+ }
+ }
+ foreach (docseg; epub_write.doc_epub3[seg_filename]) {
+ zip_data.write(docseg.dup);
+ }
+ foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) {
+ zip_data.write(docseg.dup);
+ }
+ 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 +/
+ createZipFile!()(fn_epub, zip.build());
+ }
+ }
+ string fn;
+ string fn_dbg;
+ File f;
+ { /+ mimetypes (identify zip file type) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.mimetypes);
+ }
+ }
+ fn = pth_epub3.fn_mimetypes;
+ EPUBzip(epub_write.mimetypes, fn);
+ }
+ { /+ META-INF/container.xml (identify doc root) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.meta_inf_container_xml);
+ }
+ }
+ fn = pth_epub3.fn_dmi_container_xml;
+ EPUBzip(epub_write.meta_inf_container_xml, fn);
+ }
+ { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.oebps_toc_nav_xhtml);
+ }
+ }
+ fn = pth_epub3.fn_oebps_toc_nav_xhtml;
+ EPUBzip(epub_write.oebps_toc_nav_xhtml, fn);
+ }
+ { /+ OEBPS/toc.ncx (navigation toc epub2) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.oebps_toc_ncx);
+ }
+ }
+ fn = pth_epub3.fn_oebps_toc_ncx;
+ EPUBzip(epub_write.oebps_toc_ncx, fn);
+ }
+ { /+ OEBPS/content.opf (doc manifest) +/
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(epub_write.oebps_content_opf);
+ }
+ }
+ fn = pth_epub3.fn_oebps_content_opf;
+ EPUBzip(epub_write.oebps_content_opf, fn);
+ }
+ { /+ OEBPS/_dr/image (images) +/
+ foreach (image; doc_matters.srcs.image_list) {
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ if (doc_matters.opt.action.very_verbose) {
+ writeln(
+ doc_matters.src.image_dir_path, "/", image, " -> ",
+ pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
+ );
+ }
+ if (exists(doc_matters.src.image_dir_path ~ "/" ~ image)) {
+ (doc_matters.src.image_dir_path ~ "/" ~ image)
+ .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image);
+ }
+ }
+ }
+ auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_out = pth_epub3.doc_oebps_image ~ "/" ~ image;
+ if (exists(fn_src)) {
+ {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_out;
+ auto zip_data = new OutBuffer();
+ zip_data.write(cast(char[]) ((fn_src).read));
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_epub, zip.build());
+ }
+ }
+ }
+ }
+ { /+ OEBPS/epub.css +/
+ auto css = spineCss(doc_matters);
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do) {
+ fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename);
+ File(fn_dbg, "w").writeln(css.epub);
+ }
+ }
+ fn = pth_epub3.fn_oebps_css;
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ zip_data.write(css.epub.dup);
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_epub, zip.build());
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", fn_epub);
+ }
+ debug(epub_archive) {
+ if (exists(fn_epub)) {
+ try {
+ auto zipped = new ZipArchive((fn_epub).read);
+ foreach (filename, member; zipped.directory) {
+ auto data = zipped.expand(member);
+ writeln(filename, " length ", data.length);
+ }
+ } catch (ZipException ex) {
+ // Handle errors
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/doc_reform/io_out/html.d b/src/doc_reform/io_out/html.d
new file mode 100644
index 0000000..36e0219
--- /dev/null
+++ b/src/doc_reform/io_out/html.d
@@ -0,0 +1,536 @@
+module doc_reform.io_out.html;
+template outputHTML() {
+ import doc_reform.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.xmls,
+ doc_reform.io_out.xmls_css;
+ mixin outputXHTMLs;
+ void scroll(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ mixin spineOutputRgxInit;
+ auto xhtml_format = outputXHTMLs();
+ auto rgx = Rgx();
+ string[] doc_html;
+ string[] doc;
+ string suffix = ".html";
+ string previous_part = "";
+ string delimit = "";
+ foreach (part; doc_matters.has.keys_seq.scroll) {
+ foreach (obj; doc_abstraction[part]) {
+ delimit = xhtml_format.div_delimit(part, previous_part);
+ 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) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "toc":
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": assert(part == "body" || "head");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "para":
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters);
+ break;
+ case "group":
+ doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters);
+ break;
+ case "block":
+ doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters);
+ break;
+ case "poem":
+ break;
+ case "verse":
+ doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "code":
+ doc_html ~= xhtml_format.code(_txt, obj, doc_matters);
+ break;
+ case "table":
+ doc_html ~= xhtml_format.table(_txt, obj, doc_matters);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "endnote": assert(part == "endnotes");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "glossary": assert(part == "glossary");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "bibliography": assert(part == "bibliography");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "bookindex": assert(part == "bookindex");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ case "blurb": assert(part == "blurb");
+ doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ }
+ }
+ }
+ doc = xhtml_format.html_head(doc_matters, "scroll") ~ doc_html ~ xhtml_format.tail;
+ scroll_write_output(doc, doc_matters);
+ }
+ void scroll_write_output(D,M)(
+ D doc,
+ M doc_matters,
+ ) {
+ debug(asserts) {
+ static assert(is(typeof(doc) == string[]));
+ }
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ try {
+ if (!exists(pth_html.base)) {
+ pth_html.base.mkdirRecurse;
+ }
+ auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w");
+ foreach (o; doc) {
+ f.writeln(o);
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", pth_html.fn_scroll(doc_matters.src.filename));
+ }
+ }
+ void seg(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ mixin spineOutputRgxInit;
+ auto rgx = Rgx();
+ auto xhtml_format = outputXHTMLs();
+ string[][string] doc_html;
+ string[][string] doc_html_endnotes;
+ string[] doc;
+ string segment_filename;
+ string[] top_level_headings = ["","","",""];
+ string previous_seg_filename = "";
+ string suffix = ".html";
+ string previous_part = "";
+ string delimit = "";
+ foreach (part; doc_matters.has.keys_seq.seg) {
+ foreach (obj; doc_abstraction[part]) {
+ delimit = xhtml_format.div_delimit(part, previous_part);
+ 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) {
+ case 0: .. case 3:
+ /+ fill buffer, and replace with new levels from 1 to 3 +/
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0:
+ top_level_headings[0] = "";
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 1:
+ top_level_headings[1] = "";
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 2:
+ top_level_headings[2] = "";
+ top_level_headings[3] = "";
+ goto default;
+ case 3:
+ top_level_headings[3] = "";
+ goto default;
+ default:
+ auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
+ top_level_headings[obj.metainfo.heading_lev_markup] = t[0];
+ break;
+ }
+ break;
+ case 4:
+ segment_filename = obj.tags.segment_anchor_tag_epub;
+ doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg");
+ auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters);
+ doc_html[segment_filename] ~= navigation_bar.toc_pre_next;
+ previous_seg_filename = segment_filename;
+ foreach (top_level_heading; top_level_headings) {
+ doc_html[segment_filename] ~= top_level_heading;
+ }
+ auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters);
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case 5: .. case 7:
+ auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case 8: .. case 9:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
+ }
+ }
+ break;
+ }
+ } else {
+ assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head" || "toc");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "toc":
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": assert(part == "body");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "para":
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "group":
+ auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "block":
+ auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "poem":
+ break;
+ case "verse":
+ auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0].to!string;
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "code":
+ doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
+ break;
+ case "table":
+ doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
+ doc_html_endnotes[segment_filename] ~= "";
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "endnote": assert(part == "endnotes");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ break;
+ case "glossary": assert(part == "glossary");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bibliography": assert(part == "bibliography");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "bookindex": assert(part == "bookindex");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ case "blurb": assert(part == "blurb");
+ auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
+ doc_html[segment_filename] ~= t[0];
+ doc_html_endnotes[segment_filename] ~= t[1];
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+ seg_write_output(doc_html, doc_html_endnotes, doc_matters);
+ }
+ void seg_write_output(D,E,M)(
+ D doc_html,
+ E doc_html_endnotes,
+ M doc_matters,
+ ) {
+ debug(asserts) {
+ static assert(is(typeof(doc_html) == string[][string]));
+ }
+ mixin spineOutputRgxInit;
+ auto rgx = Rgx();
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ auto xhtml_format = outputXHTMLs();
+ auto m = doc_matters.src.filename.matchFirst(rgx.src_fn);
+ try {
+ if (!exists(pth_html.seg(doc_matters.src.filename))) {
+ pth_html.seg(doc_matters.src.filename).mkdirRecurse;
+ }
+ foreach (seg_filename; doc_matters.has.segnames_lv4) {
+ auto f = File(pth_html.fn_seg(doc_matters.src.filename, seg_filename), "w");
+ foreach (docseg; doc_html[seg_filename]) {
+ f.writeln(docseg);
+ }
+ foreach (docseg; doc_html_endnotes[seg_filename]) {
+ f.writeln(docseg);
+ }
+ f.writeln(xhtml_format.tail);
+ }
+ } catch (ErrnoException ex) {
+ // handle error
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc"));
+ }
+ }
+ void css(M)(M doc_matters) {
+ auto css = spineCss(doc_matters);
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ try {
+ if (!exists(pth_html.css)) {
+ (pth_html.css).mkdirRecurse;
+ }
+ auto f = File(pth_html.fn_seg_css, "w");
+ f.writeln(css.html_seg);
+ f = File(pth_html.fn_scroll_css, "w");
+ f.writeln(css.html_scroll);
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ }
+ void images_cp(M)(
+ M doc_matters,
+ ) {
+ { /+ (copy html images) +/
+
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ if (!exists(pth_html.image)) {
+ pth_html.image.mkdirRecurse;
+ }
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_src_out = pth_html.image ~ "/" ~ image;
+ debug(images_html) {
+ writeln(fn_src_in, " -> ", fn_src_out);
+ }
+ if (exists(fn_src_in)) {
+ fn_src_in.copy(fn_src_out);
+ } else {
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln("WARNING image not found: ", fn_src_in);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/hub.d b/src/doc_reform/io_out/hub.d
new file mode 100644
index 0000000..8de07d8
--- /dev/null
+++ b/src/doc_reform/io_out/hub.d
@@ -0,0 +1,135 @@
+/++
+ output hub
+ check & generate output types requested
++/
+module doc_reform.io_out.hub;
+template outputHub() {
+ import doc_reform.io_out,
+ doc_reform.io_out.xmls,
+ doc_reform.io_out.odt,
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.paths_output;
+ import std.parallelism;
+ void outputHub(D,I)(const D doc_abstraction, I doc_matters) {
+ mixin spineOutputRgxInit;
+ mixin Msg;
+ auto msg = Msg!()(doc_matters);
+ static auto rgx = Rgx();
+ enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff }
+ void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) {
+ auto msg = Msg!()(doc_matters);
+ if (sched == outTask.source_or_pod) {
+ if (doc_matters.opt.action.source) {
+ msg.v("spine (doc reform) source processing... ");
+ }
+ if (doc_matters.opt.action.pod) {
+ msg.v("spine (doc reform) source pod processing... ");
+ }
+ import doc_reform.io_out.source_pod;
+ spinePod!()(doc_matters);
+ if (doc_matters.opt.action.source) {
+ msg.vv("spine (doc reform) source done");
+ }
+ if (doc_matters.opt.action.pod) {
+ msg.vv("spine (doc reform) source pod done");
+ }
+ }
+ if (sched == outTask.epub) {
+ msg.v("epub3 processing... ");
+ import doc_reform.io_out.epub3;
+ doc_abstraction.outputEPub3!()(doc_matters);
+ msg.vv("epub3 done");
+ }
+ if (sched == outTask.html_scroll) {
+ msg.v("html scroll processing... ");
+ import doc_reform.io_out.html;
+ outputHTML!().scroll(doc_abstraction, doc_matters);
+ msg.vv("html scroll done");
+ }
+ if (sched == outTask.html_seg) {
+ msg.v("html seg processing... ");
+ import doc_reform.io_out.html;
+ outputHTML!().seg(doc_abstraction, doc_matters);
+ msg.vv("html seg done");
+ }
+ if (sched == outTask.html_stuff) {
+ import doc_reform.io_out.html;
+ outputHTML!().css(doc_matters);
+ outputHTML!().images_cp(doc_matters);
+ msg.vv("html css & images done");
+ }
+ if (sched == outTask.latex) {
+ msg.v("latex processing... (available for downstream processing & pdf output");
+ import doc_reform.io_out.latex;
+ outputLaTeX!()(doc_abstraction, doc_matters);
+ msg.vv("latex done");
+ }
+ if (sched == outTask.odt) {
+ msg.v("odf:odt processing... ");
+ import doc_reform.io_out.odt;
+ outputODT!()(doc_abstraction, doc_matters);
+ msg.vv("odf:odt done");
+ }
+ if (sched == outTask.sqlite) {
+ msg.v("sqlite processing... ");
+ import doc_reform.io_out.sqlite;
+ doc_abstraction.SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters);
+ msg.vv("sqlite done");
+ }
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", doc_matters.src.filename_base);
+ }
+ if (!(doc_matters.opt.action.parallelise_subprocesses)) {
+ foreach(schedule; doc_matters.opt.action.output_task_scheduler) {
+ Scheduled!()(schedule, doc_abstraction, doc_matters);
+ }
+ } else {
+ foreach(schedule; parallel(doc_matters.opt.action.output_task_scheduler)) {
+ Scheduled!()(schedule, doc_abstraction, doc_matters);
+ }
+ }
+ if (doc_matters.opt.action.sqlite_update) {
+ msg.v("sqlite update processing...");
+ import doc_reform.io_out.sqlite;
+ doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters);
+ msg.vv("sqlite update done");
+ } else if (doc_matters.opt.action.sqlite_delete) {
+ msg.v("sqlite delete processing...");
+ import doc_reform.io_out.sqlite;
+ doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters);
+ msg.vv("sqlite delete done");
+ }
+ }
+}
+template outputHubOp() {
+ import doc_reform.io_out,
+ doc_reform.io_out.xmls,
+ doc_reform.io_out.odt,
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.paths_output;
+ void outputHubOp(E,O)(E env, O opt_action) {
+ mixin spineOutputRgxInit;
+ static auto rgx = Rgx();
+ if ((opt_action.sqlite_db_drop)) {
+ if ((opt_action.verbose)) {
+ writeln("sqlite drop db...");
+ }
+ import doc_reform.io_out.sqlite;
+ SQLiteDbDrop!()(opt_action);
+ if ((opt_action.very_verbose)) {
+ writeln("sqlite drop db done");
+ }
+ }
+ if ((opt_action.sqlite_db_create)) {
+ if ((opt_action.verbose)) {
+ writeln("sqlite create table...");
+ }
+ import doc_reform.io_out.sqlite;
+ SQLiteTablesCreate!()(env, opt_action);
+ if ((opt_action.very_verbose)) {
+ writeln("sqlite create table done");
+ }
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/latex.d b/src/doc_reform/io_out/latex.d
new file mode 100644
index 0000000..6e651dd
--- /dev/null
+++ b/src/doc_reform/io_out/latex.d
@@ -0,0 +1,1204 @@
+module doc_reform.io_out.latex;
+template outputLaTeX() {
+ import doc_reform.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.conv : to;
+ mixin InternalMarkup; // watch
+ mixin spineOutputRgxInit;
+ auto rgx = Rgx();
+ mixin spineLanguageCodes;
+ auto lang = Lang();
+ auto paper() {
+ struct PaperType {
+ auto a4() {
+ struct A4 {
+ auto portrait() {
+ struct V {
+ uint w = 160;
+ uint h = 228;
+ uint img_px = 450;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ uint w = 238;
+ uint h = 160;
+ uint img_px = 300;
+ }
+ return H();
+ }
+ }
+ return A4();
+ }
+ auto a5() {
+ struct A5 {
+ auto portrait() {
+ struct V {
+ uint w = 112;
+ uint h = 162;
+ uint img_px = 280;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ uint w = 152;
+ uint h = 100;
+ uint img_px = 190;
+ }
+ return H();
+ }
+ }
+ return A5();
+ }
+ auto b4() {
+ struct B4 {
+ auto portrait() {
+ struct V {
+ uint w = 140;
+ uint h = 204;
+ uint img_px = 356;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ uint w = 200;
+ uint h = 130;
+ uint img_px = 260;
+ }
+ return H();
+ }
+ }
+ return B4();
+ }
+ auto letter() {
+ struct Letter {
+ auto portrait() {
+ struct V {
+ uint w = 166;
+ uint h = 212;
+ uint img_px = 468;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ uint w = 226;
+ uint h = 166;
+ uint img_px = 290;
+ }
+ return H();
+ }
+ }
+ return Letter();
+ }
+ auto legal() {
+ struct Legal {
+ auto portrait() {
+ struct V {
+ uint w = 168;
+ uint h = 286;
+ uint img_px = 474;
+ }
+ return V();
+ }
+ auto landscape() {
+ struct H {
+ uint w = 296;
+ uint h = 166;
+ uint img_px = 420;
+ }
+ return H();
+ }
+ }
+ return Legal();
+ }
+ }
+ return PaperType();
+ }
+ string sp_char_esc(O)(
+ string _txt,
+ const O obj,
+ ) {
+ string _unescape_sp_char_esc()(string _txt) {
+ _txt = _txt
+ .replaceAll(rgx.latex_special_char_escaped,
+ format(q"┃%s┃", "$1"))
+ .replaceAll(rgx.latex_special_char_escaped_braced,
+ format(q"┃%s┃", "$1"));
+ return _txt;
+ }
+ string _unescape_fontface_esc()(string _txt) {
+ _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface,
+ format(q"┃%s%s┃", "$1", "$2"));
+ return _txt;
+ }
+ if (obj.metainfo.is_a != "code") {
+ _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape);
+ _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces);
+ _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link);
+ _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface);
+ }
+ return _txt;
+ }
+ string sp_char_esc_txt()(
+ string _txt,
+ ) {
+ string _unescape_sp_char_esc()(string _txt) {
+ _txt = _txt
+ .replaceAll(rgx.latex_special_char_escaped,
+ format(q"┃%s┃", "$1"))
+ .replaceAll(rgx.latex_special_char_escaped_braced,
+ format(q"┃%s┃", "$1"));
+ return _txt;
+ }
+ string _unescape_fontface_esc()(string _txt) {
+ _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface,
+ format(q"┃%s%s┃", "$1", "$2"));
+ return _txt;
+ }
+ _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape);
+ _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces);
+ _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link);
+ _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface);
+ return _txt;
+ }
+ string fontface()(
+ string _txt,
+ ) {
+ _txt = _txt
+ .replaceAll(rgx.inline_emphasis, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1"))
+ .replaceAll(rgx.inline_bold, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃\emph{%s}┃", "$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃\uline{%s}┃", "$1"))
+ .replaceAll(rgx.inline_superscript, format(q"┃$$^{\textrm{%s}}$$┃", "$1"))
+ .replaceAll(rgx.inline_subscript, format(q"┃$$_{\textrm{%s}}$$┃", "$1"))
+ .replaceAll(rgx.inline_strike, format(q"┃\sout{%s}┃", "$1"))
+ .replaceAll(rgx.inline_insert, format(q"┃\uline{%s}┃", "$1"))
+ .replaceAll(rgx.inline_mono, format(q"┃\begin{monosp}%s\end{monosp}┃", "$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃``%s''┃", "$1"));
+ return _txt;
+ }
+ string leading_hardspaces()(
+ string _txt,
+ ) {
+ string hardspaces(string _spaces) {
+ _spaces = _spaces
+ .replaceAll(rgx.space, "\\hardspace ");
+ return _spaces;
+ }
+ _txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start);
+ return _txt;
+ }
+ string nbsp_char()(string _txt) {
+ if (_txt.match(rgx.nbsp_char)) {
+ _txt = _txt.replaceAll(rgx.nbsp_char, "\\hardspace ");
+ }
+ return _txt;
+ }
+ string nbsp_char_to_space()(string _txt) {
+ if (_txt.match(rgx.nbsp_char)) {
+ _txt = _txt.replaceAll(rgx.nbsp_char, " ");
+ }
+ return _txt;
+ }
+ string links_and_images(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ if (obj.has.inline_links) { // TODO some images do not have inline links ... image without link
+ string _width_adjust(string _width) {
+ if (_width.to!int > 300) { _width = "300"; } // will need to vary max with papersize & orientation
+ return _width;
+ }
+ string _latex_image_path(string _image_path) {
+ auto pth_latex = spinePathsLaTeX(doc_matters);
+ _image_path = pth_latex.latex_path_stuff ~ "/" ~ _image_path;
+ return _image_path;
+ }
+ string _if_images(string _linked_content) {
+ if (_linked_content.match(rgx.inline_image_info)) {
+ _linked_content = replaceAll!(m =>
+ format(q"┃\includegraphics*[width=%spt]{%s}%s┃",
+ _width_adjust(m[2]), _latex_image_path(m[1]), " \\\\\n")
+ )(_linked_content, rgx.inline_image_info);
+ }
+ return _linked_content;
+ }
+ string _check_link(string _link) {
+ _link = _link
+ .replaceFirst(rgx.latex_clean_internal_link, "")
+ .replaceAll(rgx.latex_special_char_for_escape_url, "\\$1");
+ return _link;
+ }
+ if (obj.metainfo.is_a != "code") {
+ _txt = replaceAll!(m =>
+ m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├"
+ )(_txt, rgx.inline_link_number_only);
+ _txt = replaceAll!(m =>
+ ((m[1] == m[2]) && (m[2].match(rgx.uri)))
+ ? format(q"┃\begin{scriptsize}\lefthalfcap\url{%s}\righthalfcup\end{scriptsize}┃", _check_link(m[1]))
+ : (m[2].match(rgx.uri)) // ERROR
+ ? format(q"┃%s\href{%s}%s{%s}┃", "\\\\\n", _check_link(m[2]), "\n", _if_images(m[1]))
+ : format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1]))
+ )(_txt, rgx.inline_link);
+ }
+ }
+ return _txt;
+ }
+ string footnotes()(
+ string _txt,
+ ) {
+ if (_txt.match(rgx.inline_notes_al_gen)) {
+ string _tex_note = q"┃\hypertarget{noteref_%s}{}\footnote[%s]{%%
+ \label{note_%s}%s}┃";
+ _txt = _txt.replaceAll(rgx.inline_notes_al_regular_number_note,
+ format(_tex_note,
+ "$1", "$1", "$1",
+ "$2".strip
+ ).strip
+ );
+ }
+ return _txt;
+ }
+ string remove_footnotes()(
+ string _txt,
+ ) {
+ if (_txt.match(rgx.inline_notes_al_gen)) {
+ _txt = replaceAll!(m => "")(_txt, rgx.inline_notes_al_gen);
+ }
+ return _txt;
+ }
+ string para(O)(
+ string _txt,
+ O obj,
+ ) {
+ if (obj.metainfo.is_of_type == "para") {
+ string _tex_para;
+ _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.footnotes
+ ).strip;
+ }
+ return _txt;
+ }
+ string bookindex(O)(
+ string _txt,
+ O obj,
+ ) {
+ if (obj.metainfo.is_of_type == "para"
+ && obj.metainfo.is_a == "bookindex"
+ ) {
+ string _tex_para;
+ _tex_para = q"┃%s┃";
+ _txt = format(_tex_para,
+ _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\\\\n"
+ );
+ }
+ return _txt;
+ }
+ string heading(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+ string _part = ""
+ ) {
+ if (obj.metainfo.is_a == "heading") {
+ string _tex_para;
+ string _pg_break;
+ string _sect;
+ string _post;
+ string _title_add;
+ string _columns = "";
+ switch (obj.metainfo.heading_lev_markup) {
+ case 0: // A == TITLE
+ _pg_break = "\\begin{document}\n";
+ goto default;
+ case 1: // B == part: section heading level
+ _pg_break = "\\clearpage\n";
+ goto default;
+ case 2: // C == part: section heading level
+ _pg_break = "\\clearpage\n";
+ goto default;
+ case 3: // D == part: section heading level
+ _pg_break = "\\clearpage\n";
+ goto default;
+ case 4: // 1 == section
+ _columns = (_part != "bookindex")
+ ? "" : "\n\\\\\n\\begin{multicols}{2}";
+ _pg_break = "\\clearpage\n";
+ _sect = "section";
+ _post = "";
+ _title_add = format(q"┃
+\markboth{%s}{%s}┃",
+ doc_matters.conf_make_meta.meta.title_full,
+ doc_matters.conf_make_meta.meta.title_full,
+ );
+ goto default;
+ case 5: // 2 == subsection
+ _pg_break = "";
+ // _pg_break = "newpage"; // doubt this is necessary
+ _sect = "subsection";
+ _post = " \\\n";
+ _title_add = "";
+ goto default;
+ case 6: // 3 == subsubsection
+ _pg_break = "";
+ // _pg_break = "newpage"; // doubt this is necessary
+ _sect = "subsubsection";
+ _post = " \\\n";
+ _title_add = "";
+ goto default;
+ default:
+ if (obj.metainfo.heading_lev_markup == 0) {
+ _tex_para = q"┃\begin{document}
+\title{%s}
+\author{ \textnormal{%s}}
+\date{\begin{tiny}%s\end{tiny}}
+\pagenumbering{roman}\maketitle
+\pagestyle{fancy}
+\newpage
+\markboth{%s}{%s}
+\\\\[3]\ \linebreak Copyright {\begin{small}{\copyright\end{small}} %s \\
+%s
+\pagestyle{fancy}
+\clearpage┃";
+ _txt = format(_tex_para,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.date_published).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.rights_copyright).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.rights_license).sp_char_esc_txt,
+ );
+ } else if (obj.metainfo.heading_lev_markup < 4) {
+ _tex_para = q"┃%s\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s}
+\addcontentsline{toc}{part}{%s}
+\markboth{%s}┃";
+ _txt = format(_tex_para,
+ _pg_break,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.strip.footnotes,
+ _txt.strip.remove_footnotes,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ );
+ } else if (obj.metainfo.heading_lev_markup > 3) {
+ if (obj.metainfo.heading_lev_markup == 4
+ && _txt.match(regex(r"^Table of Contents$"))) {
+ _tex_para = q"┃
+\pagenumbering{none}
+\setcounter{page}{1}
+\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{1}{1}\end{tiny}}}%s \newline %s}
+
+\clearpage
+\markboth{%s}{%s}
+\pagenumbering{gobble}
+\renewcommand{\contentsname}{}
+\tableofcontents
+\markboth{%s}{%s}
+
+\clearpage
+\pagenumbering{arabic}
+\setcounter{page}{1}
+\markboth{%s}{%s}
+%% \null
+\clearpage
+\setcounter{page}{1}┃";
+ _txt = format(_tex_para,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
+ );
+ } else if (obj.metainfo.heading_lev_markup == 4
+ && _part == "bookindex"
+ && _txt.match(regex(r"^Index$"))
+ ) {
+ _tex_para = q"┃%s\%s*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s}
+\addcontentsline{toc}{%s}{%s%s}%s%s┃";
+ _txt = format(_tex_para,
+ _pg_break,
+ _sect.strip,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.footnotes.strip,
+ _sect,
+ _txt.remove_footnotes.strip,
+ _post,
+ _title_add,
+ _columns,
+ );
+ } else if (obj.metainfo.dummy_heading
+ && obj.metainfo.heading_lev_markup == 4
+ ) { /+ dummy headings completely omitted +/
+ _txt = "";
+ } else {
+ _tex_para = q"┃%s\%s*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s}
+\addcontentsline{toc}{%s}{%s%s}%s┃";
+ _txt = format(_tex_para,
+ _pg_break,
+ _sect.strip,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.footnotes.strip,
+ _sect,
+ _txt.remove_footnotes.strip,
+ _post,
+ _title_add,
+ );
+ }
+ }
+ break;
+ }
+ }
+ return _txt.strip;
+ }
+string group(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+) {
+ if (obj.metainfo.is_a == "group") {
+ string _tex_para;
+ _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
+\begin{footnotesize}
+%s
+\end{footnotesize}
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.footnotes.strip
+ ).strip;
+ }
+ return _txt;
+}
+string block(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+) {
+ if (obj.metainfo.is_a == "block") {
+ // _txt = _txt.nbsp_char;
+ string _tex_para;
+ _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
+\begin{footnotesize}
+%s
+\end{footnotesize}
+\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+┃"; // \hardspace
+ /+ try both: +/
+ _txt = _txt.split(rgx.br_newlines_linebreaks).join("\n\n"); // _txt = _txt.split(rgx.br_newlines_linebreaks).join(" \\\n");
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.nbsp_char.footnotes.strip
+ ).strip;
+ }
+ return _txt;
+}
+string verse(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+) {
+ if (obj.metainfo.is_a == "verse") {
+ string _tex_para;
+ _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.1ex plus0.1ex minus0.1ex}
+\begin{footnotesize}
+
+%s
+
+\end{footnotesize}
+\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+\linebreak
+┃"; // \hardspace
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.nbsp_char.footnotes.split("\n").join("\n\n").strip
+ ).strip;
+ }
+ return _txt;
+}
+string codeblock(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+) {
+ if (obj.metainfo.is_a == "code") {
+ string _tex_para;
+ _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\begin{Codeblock}
+\begin{lstlisting}
+%s
+\end{lstlisting}
+\end{Codeblock}
+\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _txt.nbsp_char_to_space
+ ).strip;
+ }
+ return _txt;
+}
+auto tablarize(O)(
+ string _txt,
+ const O obj,
+) {
+ string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
+ string[] _table_cols;
+ string _table;
+ string _tablenote;
+ foreach(row_idx, row; _table_rows) {
+ _table_cols = row.split(rgx.table_delimiter_col);
+ _table ~= "";
+ 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)
+ _tablenote ~= cell;
+ } else {
+ // // _table ~= "\\bfseries ";
+ // _table ~= cell;
+ // _table ~= (_table_cols.length > (col_idx + 1)) ? "&" : "";
+ _table ~= format(q"┃%s%s┃",
+ cell,
+ (_table_cols.length > (col_idx + 1)) ? "&" : ""
+ );
+ }
+ }
+ _table ~= "\\\\";
+ }
+ auto t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+}
+string table(O,M)(
+ string _txt,
+ O obj,
+ M doc_matters,
+) {
+ if (obj.metainfo.is_a == "table") {
+ auto _t = _txt.tablarize(obj);
+ string _table = _t[0];
+ string _t_n = _t[1];
+ string papertype = "a4";
+ uint pw = 0;
+ switch (papertype) {
+ case "a4": pw = (paper.a4.portrait.w - 20); break;
+ case "a5": pw = (paper.a5.portrait.w - 20); break;
+ case "b4": pw = (paper.b4.portrait.w - 20); break;
+ case "letter": pw = (paper.letter.portrait.w - 20); break;
+ case "legal": pw = (paper.legal.portrait.w - 20); break;
+ default: pw = 0; break;
+ }
+ // auto textwidth = (pw - 24);
+ string _colw = "";
+ foreach (w; obj.table.column_widths) {
+ _colw ~= format(q"┃p{%.0fmm}┃",
+ (w * pw / 100)
+ // (w * (pw - 24)/ 100)
+ // (w * textwidth / 100)
+ );
+ }
+ string _tex_para;
+ _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}
+\setlength{\LTleft}{0pt}
+\setlength{\LTright}{\fill}
+\begin{tiny}
+\begin{longtable}{%s}
+%s
+\end{longtable}
+\end{tiny}
+┃";
+ _txt = format(_tex_para,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _colw,
+ _table,
+ ).strip;
+ }
+ return _txt;
+}
+ string bullets_and_indentation(O)(
+ string _txt,
+ O obj,
+ ) {
+ string _tex_para;
+ string _hang; string _indent;
+ int _paper_margin = -10;
+ int _indent_increment = 8; // 5; 10;
+ if (obj.attrib.bullet) {
+ int _bullet_space = 5;
+ _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin + _bullet_space).to!string;
+ _txt = format(q"┃\begin{Bullet}{%smm}$\txtbullet$\hspace{\enspace}%s\end{Bullet}┃",
+ _indent,
+ _txt.footnotes
+ ).strip;
+ } else if (
+ obj.attrib.indent_base != 0
+ && obj.attrib.indent_base == obj.attrib.indent_hang
+ ) {
+ _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string;
+ _tex_para = q"┃\begin{ParagraphIndent}{%smm}%s \end{ParagraphIndent}┃";
+ _txt = format(_tex_para,
+ _indent,
+ _txt.footnotes
+ ).strip;
+ } else if (
+ obj.attrib.indent_base != 0
+ || obj.attrib.indent_hang != 0
+ ) {
+ _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string;
+ _hang = (((obj.attrib.indent_hang - obj.attrib.indent_base) * _indent_increment)).to!string;
+ _tex_para = q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃";
+ _txt = format(_tex_para,
+ _indent, _hang,
+ _txt.footnotes
+ ).strip;
+ }
+ return _txt;
+ }
+ string latex_head(M)(
+ M doc_matters,
+ ) {
+ struct paperType {
+ string a4_portrait;
+ string a4_landscape;
+ string us_letter_portrait;
+ string us_letter_landscape;
+ }
+ auto paper = paperType();
+ string _footer(M)(M doc_matters) {
+ string _ft = "\\lfoot[\\textrm{\\thepage}]";
+ string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "http://sisudoc.org", "SiSU",);
+ string _ft_2 = format(q"┃
+ \cfoot{\href{%s}{%s}}┃", "http://git.sisudoc.org", "git",);
+ if (doc_matters.conf_make_meta.make.footer.length > 0) {
+ if (doc_matters.conf_make_meta.make.footer.length > 0) {
+ if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) {
+ _ft ~= doc_matters.conf_make_meta.make.footer[0]
+ .replace(rgx.inline_link, "{\\tiny \\href{$2}{$1}}");
+ } else {
+ _ft ~= _ft_1;
+ }
+ }
+ if (doc_matters.conf_make_meta.make.footer.length > 1) {
+ if (doc_matters.conf_make_meta.make.footer[1].matchAll(rgx.inline_link)) {
+ _ft ~= doc_matters.conf_make_meta.make.footer[1]
+ .replace(rgx.inline_link, "\n\\cfoot{\\href{$2}{$1}}");
+ } else {
+ _ft ~= _ft_2;
+ }
+ }
+ } else {
+ _ft ~= _ft_1;
+ _ft ~= _ft_2;
+ }
+ return _ft;
+ }
+ paper.a4_portrait = format(q"┃
+\documentclass[12pt,a4paper,titlepage]{scrartcl}
+\setlength{\textheight}{228mm} \setlength{\textwidth}{160mm}
+┃",
+ );
+ paper.a4_landscape = format(q"┃
+\documentclass[11pt,a4paper,landscape,titlepage,twocolumn]{scrartcl}
+\setlength{\textheight}{160mm} \setlength{\textwidth}{238mm}
+┃",
+ );
+ paper.us_letter_portrait = format(q"┃
+\documentclass[12pt,letterpaper,titlepage]{scrartcl}
+\setlength{\textheight}{212mm} \setlength{\textwidth}{166mm}
+┃",
+ );
+ paper.us_letter_landscape = format(q"┃
+\documentclass[11pt,letterpaper,landscape,titlepage,twocolumn]{scrartcl}
+\setlength{\textheight}{166mm} \setlength{\textwidth}{226mm}
+┃",
+ );
+ struct paperMargins {
+ string portrait;
+ string landscape;
+ }
+ auto margins = paperMargins();
+ margins.portrait = format(q"┃
+\setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm}
+\setlength{\topmargin}{-12pt} \setlength{\headheight}{12pt}
+\setlength{\headsep}{35pt}
+┃",
+ );
+ margins.landscape = format(q"┃
+\setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm}
+\setlength{\topmargin}{-12mm} \setlength{\headheight}{12pt}
+\setlength{\headsep}{20pt}
+┃",
+ );
+ struct columnsMulti {
+ string portrait;
+ string landscape;
+ }
+ auto multicol = columnsMulti();
+ multicol.portrait = format(q"┃
+\usepackage{multicol}
+┃",
+ );
+ multicol.landscape = "";
+ struct colorLinks {
+ string mono;
+ string color;
+ }
+ auto links = colorLinks();
+ links.mono = format(q"┃
+\usepackage[xetex,
+ colorlinks=true,
+ urlcolor=myblack,
+ filecolor=myblack,
+ linkcolor=myblack,
+┃",
+ );
+ links.color = format(q"┃
+\usepackage[xetex,
+ colorlinks=true,
+ urlcolor=myblue, %% \href{...}{...} external url
+ filecolor=mygreen, %% \href{...} local file
+ linkcolor=myred, %% \href{...} and \pageref{...}
+ ┃",
+ );
+ string _latex_head = format(q"┃%%%% spine LaTeX output
+%%%% Generated by: %s
+%%%% D version: %s
+%%%% LaTeX output last Generated on: %s
+%%%% %s %s
+
+%s
+%s
+\setlength{\marginparsep}{4mm}
+\setlength{\marginparwidth}{8mm}
+%s
+\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode}
+\setmainlanguage{%s}
+\setotherlanguage{%s}
+\setmainfont{Liberation Sans}
+\setmonofont[Scale=0.85]{Liberation Mono}
+\usepackage{alltt}
+\usepackage{thumbpdf}
+%s
+ pdftitle={%s},
+ pdfauthor={%s},
+ pdfsubject={%s},
+ pdfkeywords={},
+ pageanchor=true,
+ plainpages=true,
+ pdfpagelabels=true,
+ pagebackref,
+ bookmarks=true,
+ bookmarksopen=true,
+ pdfmenubar=true,
+ pdfpagemode=UseOutline,
+ pdffitwindow=true,
+ pdfwindowui=true,
+ plainpages=false,
+ pdfstartview=FitH
+]
+{hyperref}
+\usepackage[usenames]{color}
+\definecolor{myblack}{rgb}{0,0,0}
+\definecolor{myred}{rgb}{0.75,0,0}
+\definecolor{mygreen}{rgb}{0,0.5,0}
+\definecolor{myblue}{rgb}{0,0,0.5}
+\definecolor{mywhite}{rgb}{1,1,1}
+\usepackage{url}
+\urlstyle{sf}
+\usepackage{textcomp}
+\usepackage[parfill]{parskip}
+\usepackage[normalem]{ulem}
+\usepackage{soul}
+\usepackage{longtable}
+\usepackage[tc]{titlepic}
+\usepackage{graphicx}
+\makeatletter
+\parindent0pt
+\usepackage{amssymb}
+\usepackage{listings}
+\usepackage{color}
+\usepackage{textcomp}
+\setcounter{secnumdepth}{2}
+\setcounter{tocdepth}{4}
+\makeatletter
+\usepackage[multiple,ragged]{footmisc}
+\setlength\footnotemargin{12pt}
+\usepackage[para]{manyfoot}
+\DeclareNewFootnote{A}
+\newenvironment{ParagraphIndent}[1]%%
+{
+\begin{list}{}{%%
+\setlength\topsep{0pt}%%
+\addtolength{\leftmargin}{#1}
+\setlength\parsep{0pt plus 1pt}%%
+}
+\item[]
+}
+{\end{list}}
+\newenvironment{ParagraphHang}[2]%%
+{
+\begin{list}{}{%%
+\setlength\topsep{0pt}%%
+\addtolength{\leftmargin}{#1}
+\itemindent=#2
+\setlength\parsep{0pt plus 1pt}%%
+}
+\item[]
+}
+{\end{list}}
+\newenvironment{Bullet}[1]%%
+{
+\begin{list}{}{%%
+\setlength\topsep{0pt}%%
+\addtolength{\leftmargin}{#1}
+\itemindent=-1em
+\setlength\parsep{0pt plus 1pt}%%
+}
+\item[]
+}
+{\end{list}}
+\usepackage{fancyhdr}
+\lhead{}
+\renewcommand{\part}{\@startsection
+ {part}{1}{-2mm}%%
+ {-\baselineskip}{0.5\baselineskip}%%
+ {\bfseries\large\upshape\raggedright}}
+\renewcommand{\section}{\@startsection
+ {section}{2}{-2mm}%%
+ {-\baselineskip}{0.5\baselineskip}%%
+ {\bfseries\large\upshape\raggedright}}
+\renewcommand{\subsection}{\@startsection
+ {subsection}{3}{-2mm}%%
+ {-\baselineskip}{0.5\baselineskip}%%
+ {\bfseries\large\upshape\raggedright}}
+\renewcommand{\subsubsection}{\@startsection
+ {subsubsection}{4}{-2mm}%%
+ {-\baselineskip}{0.5\baselineskip}%%
+ {\normalfont\normalsize\bfseries\raggedright}}
+\renewcommand{\paragraph}{\@startsection
+ {paragraph}{5}{-2mm}%%
+ {-\baselineskip}{0.5\baselineskip}%%
+ {\normalfont\normalsize\itshape\raggedright}}
+\renewcommand{\subparagraph}{\@startsection
+ {subparagraph}%%{6}%%{-2mm}%%
+ {-\baselineskip}{0.5\baselineskip}%%
+ {\normalfont\normalsize\itshape\raggedright}}
+\selectlanguage{%s}
+\lhead[ ]{ }
+\chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark }
+\rhead[ ]{ }
+%s
+\rfoot[\tiny \href{}{}]{\textrm{\thepage}}
+\tolerance=300
+\clubpenalty=300
+\widowpenalty=300
+\makeatother
+\makeatother
+\chardef\txtbullet="2022
+\chardef\tilde="7E
+\def\asterisk{{\rm \char42} }
+\definecolor{Light}{gray}{.92}
+\newcommand{\Codeblock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
+\newcommand{\monosp}[1]{\normaltext\ttfamily\texbackslash#1}
+\newcommand{\parasep}{\\ \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \\}
+\newcommand{\hardspace}{{~}}
+\newcommand{\caret}{{\^{~}}}
+\newcommand{\pipe}{{\textbar}}
+\newcommand{\curlyopen}{{}
+\newcommand{\curlyclose}{}}
+\newcommand{\lt}{{UseTextSymbol{OML}{<}}}
+\newcommand{\gt}{{UseTextSymbol{OML}{>}}}
+\newcommand{\slash}{{/}}
+\newcommand{\underscore}{\_}
+\newcommand{\exclaim}{\Verbatim{!}}
+\definecolor{listinggray}{gray}{0.9}
+\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
+\lstset{
+ backgroundcolor=\color{lbcolor},
+ tabsize=4,
+ rulecolor=,
+ language=,
+ basicstyle=\scriptsize,
+ upquote=true,
+ aboveskip={1.5\baselineskip},
+ columns=fixed,
+ showstringspaces=false,
+ extendedchars=true,
+ breaklines=true,
+ prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
+ frame=single,
+ showtabs=false,
+ showspaces=false,
+ showstringspaces=false,
+ identifierstyle=\ttfamily,
+ keywordstyle=\color[rgb]{0,0,1},
+ commentstyle=\color[rgb]{0.133,0.545,0.133},
+ stringstyle=\color[rgb]{0.627,0.126,0.941},
+}
+ ┃",
+ doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version.strip,
+ doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.compiler.strip,
+ doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.stime.strip,
+ doc_matters.generator_program.project_name.strip,
+ doc_matters.generator_program.url_home.strip,
+ paper.a4_portrait.strip,
+ margins.portrait.strip,
+ multicol.portrait.strip,
+ lang.codes[doc_matters.src.language]["xlp"],
+ "english",
+ links.mono.strip, // links.color.strip,
+ doc_matters.conf_make_meta.meta.title_full.strip,
+ doc_matters.conf_make_meta.meta.creator_author.strip,
+ doc_matters.conf_make_meta.meta.classify_subject.strip,
+ lang.codes[doc_matters.src.language]["xlp"],
+ _footer(doc_matters),
+ );
+ return _latex_head.strip;
+ }
+ string latex_body(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ string _latex_body = "";
+ bool _multicolumns = false;
+ string _txt;
+ foreach (part; doc_matters.has.keys_seq.latex) {
+ foreach (obj; doc_abstraction[part]) {
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head" || "toc");
+ _txt = obj.text
+ .sp_char_esc(obj)
+ .fontface;
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = _txt.heading(obj, doc_matters);
+ goto default;
+ case "toc":
+ break;
+ default:
+ _latex_body ~= _txt ~ "\n\n";
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "body": assert(part == "body" || "head"); // surprise
+ _txt = obj.text
+ .sp_char_esc(obj)
+ .fontface;
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = _txt.heading(obj, doc_matters);
+ goto default;
+ case "para":
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ default:
+ _latex_body ~= _txt ~ "\n\n";
+ _txt = "";
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ goto default; // TODO
+ case "group":
+ /+ (hardspaces not honored) [remove any hardspace marker] +/
+ _txt = _txt.group(obj, doc_matters)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "block":
+ /+ (hardspace honored) \hardspace +/
+ _txt = _txt.block(obj, doc_matters)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "verse":
+ /+ (hardspace honored) \hardspace +/
+ _txt = _txt.verse(obj, doc_matters)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "code":
+ /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/
+ _txt = _txt.codeblock(obj, doc_matters);
+ goto default;
+ case "table":
+ _txt = _txt.table(obj, doc_matters);
+ goto default; // TODO
+ default:
+ _latex_body ~= _txt ~ "\n\n";
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ _txt = obj.text
+ .sp_char_esc(obj)
+ .fontface;
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ if (part != "bookindex" && _multicolumns) {
+ _multicolumns = false;
+ _latex_body ~= "\n\\end{multicols}\n";
+ }
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ if (part == "bookindex") {
+ _multicolumns = true;
+ }
+ _txt = _txt.heading(obj, doc_matters, part);
+ goto default;
+ case "endnote": assert(part == "endnotes");
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "glossary": assert(part == "glossary");
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "bibliography": assert(part == "bibliography");
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj);
+ goto default;
+ case "bookindex": assert(part == "bookindex");
+ /+ two column, special section +/
+ _txt = _txt.bookindex(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ case "blurb": assert(part == "blurb");
+ _txt = _txt.para(obj)
+ .bullets_and_indentation(obj)
+ .links_and_images(obj, doc_matters);
+ goto default;
+ default:
+ _latex_body ~= (part == "bookindex" && obj.metainfo.is_a != "heading")
+ ? _txt : (_txt ~ "\n\n");
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ }
+ }
+ }
+ if (_multicolumns) {
+ _multicolumns = false;
+ _latex_body ~= "\n\\end{multicols}\n";
+ }
+ return _latex_body;
+ }
+ string latex_tail(M)(
+ M doc_matters,
+ ) {
+ string _latex_tail = format(q"┃
+
+\end{document}
+ ┃",
+ // doc_matters.conf_make_meta.meta.title_full,
+ // doc_matters.conf_make_meta.meta.creator_author,
+ );
+ return _latex_tail;
+ }
+ void writeOutputLaTeX(T,M)(
+ const T latex_content,
+ M doc_matters,
+ ) {
+ auto pth_latex = spinePathsLaTeX(doc_matters);
+ try {
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(latex_content.head);
+ writeln(latex_content.content);
+ writeln(latex_content.tail);
+ }
+ }
+ if (!exists(pth_latex.latex_path_stuff)) {
+ (pth_latex.latex_path_stuff).mkdirRecurse;
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", pth_latex.latex_file_with_path);
+ }
+ auto f = File(pth_latex.latex_file_with_path, "w");
+ f.writeln(latex_content.head);
+ f.writeln(latex_content.content);
+ f.writeln(latex_content.tail);
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_src_out_file = pth_latex.latex_path_stuff ~ "/" ~ image;
+ if (exists(fn_src_in)) {
+ fn_src_in.copy(fn_src_out_file);
+ }
+ }
+ } catch (ErrnoException ex) {
+ // handle error
+ }
+ }
+ void outputLaTeX(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ struct LaTeX {
+ string head;
+ string content;
+ string tail;
+ }
+ auto latex = LaTeX();
+ latex.head = latex_head(doc_matters);
+ latex.content = latex_body(doc_abstraction, doc_matters);
+ latex.tail = latex_tail(doc_matters);
+ latex.writeOutputLaTeX(doc_matters);
+ }
+}
diff --git a/src/doc_reform/io_out/odt.d b/src/doc_reform/io_out/odt.d
new file mode 100644
index 0000000..dbb8e5d
--- /dev/null
+++ b/src/doc_reform/io_out/odt.d
@@ -0,0 +1,2076 @@
+module doc_reform.io_out.odt;
+template formatODT() {
+ import doc_reform.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.xmls,
+ doc_reform.io_out.xmls_css;
+ mixin spineOutputRgxInit;
+ struct formatODT {
+ static auto rgx = Rgx();
+ string _tags(O)(const O obj){
+ string _tags = "";
+ if (obj.tags.anchor_tags.length > 0) {
+ foreach (tag_; obj.tags.anchor_tags) {
+ if (tag_.length > 0) {
+ _tags ~= format(q"┃
+
+
+
+ ┃",
+ _special_characters(tag_, obj),
+ _special_characters(tag_, obj),
+ );
+ }
+ }
+ }
+ return _tags;
+ }
+ string _xhtml_anchor_tags(O)(O obj) {
+ const(string[]) anchor_tags = obj.tags.anchor_tags;
+ string tags="";
+ if (anchor_tags.length > 0) {
+ foreach (tag; anchor_tags) {
+ if (!(tag.empty)) {
+ tags ~= " ";
+ }
+ }
+ }
+ return tags;
+ }
+ string obj_num(O)(const O obj){ // TODO
+ string _on;
+ _on = (obj.metainfo.object_number.empty)
+ ? ""
+ : (format(q"┃
+ 「%s」 ┃",
+ obj.metainfo.object_number,
+ ));
+ return _on;
+ }
+ string _footnotes()(string _txt){
+ static auto rgx = Rgx();
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_regular_number_note,
+ format(q"┃
+
+ %s
+
+
+
+ %s
+
+
+ ┃",
+ "$1", "$1", "$2",
+ )
+ );
+ return _txt;
+ }
+ string _bullet(O)(const O obj){
+ string _b = "";
+ if (obj.attrib.bullet) {
+ _b = format(q"┃● ┃",);
+ }
+ return _b;
+ }
+ string _indent(O)(string _txt, const O obj) { // TODO
+ // if (obj.attrib.indent_base > 0 ||
+ // obj.attrib.indent_hang > 0
+ // ) {
+ if (obj.metainfo.is_a == "toc") {
+ _txt = format(q"┃
+ %s
+ %s%s%s
+ ┃",
+ (obj.attrib.indent_base < 4)
+ ? "\n " : "",
+ obj.attrib.indent_base,
+ obj.attrib.indent_base,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else if (!empty(obj.metainfo.object_number)) {
+ if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) {
+ _txt = format(q"┃
+ %s
+
+
+
+
+ %s%s%s
+ ┃",
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else if (obj.attrib.indent_base == obj.attrib.indent_hang) {
+ _txt = format(q"┃
+ %s
+
+
+
+
+ %s%s%s
+ ┃",
+ obj.attrib.indent_base,
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else {
+ _txt = format(q"┃
+ %s
+
+
+
+
+ %s%s%s
+ ┃",
+ obj.attrib.indent_base,
+ obj.attrib.indent_hang,
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ }
+ } else {
+ if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) { /+ can omit and would explicitly set indent base and hang as 0 each below +/
+ _txt = format(q"┃
+ %s
+ %s%s%s
+ ┃",
+ _bullet(obj),
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else if (obj.attrib.indent_base == obj.attrib.indent_hang) {
+ _txt = format(q"┃
+ %s
+ %s%s%s
+ ┃",
+ obj.attrib.indent_base,
+ _bullet(obj),
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ } else {
+ _txt = format(q"┃
+ %s
+ %s%s%s
+ ┃",
+ _bullet(obj),
+ obj.attrib.indent_base,
+ obj.attrib.indent_hang,
+ _tags(obj),
+ _txt,
+ obj_num(obj),
+ );
+ }
+ }
+ return _txt;
+ }
+ string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO
+ string _block = "";
+ foreach (i, _line; _block_lines) {
+ _line = _footnotes(_line);
+ if (i == 0) {
+ _block ~= format(q"┃
+ %s
+
+
+
+
+ %s
+ ┃",
+ _bullet(obj),
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ // _tags(obj),
+ _line,
+ );
+ } else {
+ _block ~= format(q"┃
+ %s ┃",
+ _line);
+ }
+ }
+ _block ~= format(q"┃
+
+ 「%s」
+
+ ┃",
+ obj_num(obj));
+ return _block;
+ }
+ string _special_characters(O)(string _txt, const O obj) {
+ _txt = _txt
+ .replaceAll(rgx.xhtml_ampersand, "&")
+ .replaceAll(rgx.xhtml_quotation, """)
+ .replaceAll(rgx.xhtml_less_than, "<")
+ .replaceAll(rgx.xhtml_greater_than, ">")
+ .replaceAll(rgx.nbsp_char, " ");
+ return _txt;
+ }
+ string _preserve_white_spaces(O)(string _txt, const O obj) {
+ if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
+ _txt = _txt
+ .replaceAll(rgx.space, " ");
+ }
+ return _txt;
+ }
+ string _font_face(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.inline_strike, "$1")
+ .replaceAll(rgx.inline_insert, "$1 ")
+ .replaceAll(rgx.inline_cite, "$1 ")
+ .replaceAll(rgx.inline_emphasis, format(q"┃%s ┃","$1"))
+ .replaceAll(rgx.inline_bold, format(q"┃%s ┃","$1"))
+ .replaceAll(rgx.inline_italics, format(q"┃%s ┃","$1"))
+ .replaceAll(rgx.inline_underscore, format(q"┃%s ┃","$1"))
+ .replaceAll(rgx.inline_superscript, format(q"┃%s ┃","$1"))
+ .replaceAll(rgx.inline_subscript, format(q"┃%s ┃","$1"))
+ .replaceAll(rgx.inline_mono, format(q"┃%s ┃","$1"));
+ return _txt;
+ }
+ auto _obj_num(O)(O obj) { // NOT USED YET
+ struct objNum {
+ string reference() {
+ return format(q"┃
+
+
+ ┃",
+ obj.object_number,
+ obj.object_number,
+ );
+ }
+ string display() {
+ return format(q"┃
+ %s%s%s
+ ┃",
+ on_o,
+ obj.object_number,
+ on_c,
+ );
+ }
+ }
+ return objNum();
+ }
+ string _break_page()() {
+ return format(q"┃
+
+ ┃",
+ );
+ }
+ string _empty_line_break(O)(string _txt, const O obj) {
+ if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
+ _txt = _txt
+ .replaceAll(rgx.br_empty_line, " ");
+ }
+ return _txt;
+ }
+ string _links(O)(string _txt, const O obj) {
+ if (obj.metainfo.is_a != "code") {
+ if (obj.metainfo.is_a == "toc") {
+ _txt = replaceAll!(m =>
+ m[1] ~ "┤"
+ ~ (replaceAll!(n =>
+ n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
+ )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
+ ~ "├"
+ )(_txt, rgx.inline_link_number_only)
+ .replaceAll(rgx.inline_link,
+ format(q"┃%s ┃",
+ _special_characters("$3", obj),
+ _special_characters("$1", obj)
+ ));
+ } else {
+ _txt = replaceAll!(m =>
+ m[1] ~ "┤"
+ ~ (replaceAll!(n =>
+ n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
+ )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
+ ~ "├"
+ )(_txt, rgx.inline_link_number_only)
+ .replaceAll(rgx.inline_link,
+ format(q"┃%s ┃",
+ _special_characters("$2", obj),
+ _special_characters("$1", obj)
+ ));
+ }
+ }
+ debug(links) {
+ if (obj.text.match(rgx.inline_link_number)
+ && _txt.match(rgx.inline_link_number_only)
+ ) {
+ writeln(">> ", _txt);
+ writeln("is_a: ", obj.metainfo.is_a);
+ }
+ }
+ return _txt;
+ }
+ string _images(O)(string _txt, const O obj) {
+ if (_txt.match(rgx.inline_image)) {
+ _txt = _txt
+ .replaceAll(rgx.inline_image,
+ ("$1 $6"))
+ .replaceAll(
+ rgx.inline_link_empty,
+ ("$1"));
+ }
+ return _txt;
+ }
+ string markup(O)(const O obj) {
+ /+ markup TODO +/
+ string _txt = obj.text;
+ _txt = _special_characters(_txt, obj); // TODO & why both obj & obj.text, consider also in output_xmls.org
+ if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
+ _txt = replaceAll!(m => _preserve_white_spaces(m[1], obj))(_txt, rgx.spaces_keep);
+ } // check that this does what you want, keep: leading spaces (indent) & more than single spaces within text
+ // _txt = _preserve_white_spaces(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block")
+ _txt = _font_face(_txt);
+ _txt = _images(_txt, obj); // (obj.metainfo.is_a != "code")
+ _txt = _links(_txt, obj); // (obj.metainfo.is_a != "code")
+ _txt = _empty_line_break(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block")
+ return _txt;
+ }
+ string heading(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "heading");
+ string _o_txt_odt = markup(obj);
+ if (obj.metainfo.dummy_heading
+ && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
+ _o_txt_odt = "";
+ } else if (obj.metainfo.is_a == "toc") {
+ _o_txt_odt = format(q"┃%s
+ %s%s%s
+ ┃",
+ _break_page,
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.heading_lev_markup,
+ _tags(obj),
+ _o_txt_odt,
+ obj_num(obj),
+ );
+ } else {
+ _o_txt_odt = _footnotes(_o_txt_odt);
+ _o_txt_odt = format(q"┃%s
+
+
+
+
+ %s%s%s
+ ┃",
+ _break_page,
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _tags(obj),
+ _o_txt_odt,
+ obj_num(obj),
+ );
+ }
+ return _o_txt_odt;
+ }
+ string para(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "para" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ string _o_txt_odt;
+ if (obj.metainfo.dummy_heading
+ && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
+ _o_txt_odt = "";
+ } else {
+ _o_txt_odt = markup(obj);
+ _o_txt_odt = _footnotes(_o_txt_odt);
+ _o_txt_odt = _indent(_o_txt_odt, obj); // final setting?
+ }
+ return _o_txt_odt;
+ }
+ string quote(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "quote");
+ string _o_txt_odt = markup(obj);
+ _o_txt_odt = _footnotes(_o_txt_odt); // decide
+ return _o_txt_odt;
+ }
+ string group(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "group");
+ string _o_txt_odt = markup(obj);
+ /+ TODO
+ - split lines
+ - only double newlines (paragraph delimiter), (not line breaks, single new lines)
+ - no hard space indentation
+ +/
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ _o_txt_odt = _block_type_delimiters(_block_lines, obj);
+ return _o_txt_odt;
+ }
+ string block(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "block");
+ string _o_txt_odt = markup(obj);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ _o_txt_odt = _block_type_delimiters(_block_lines, obj);
+ return _o_txt_odt;
+ }
+ string verse(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "verse");
+ string _o_txt_odt = markup(obj);
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ _o_txt_odt = _block_type_delimiters(_block_lines, obj);
+ return _o_txt_odt;
+ }
+ string code(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "code");
+ string _o_txt_odt = markup(obj);
+ /+ TODO
+ - split lines
+ - each line including empty lines
+ - hard space indentation
+ - "^[ ]"
+ - count number only at beginning of line and replace each
+ +/
+ string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
+ string _block = "";
+ foreach (i, _line; _block_lines) {
+ if (i == 1) {
+ _block ~= format(q"┃
+
+
+
+
+
+ %s
+ ┃",
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ _line,
+ );
+ } else {
+ _block ~= format(q"┃
+ %s ┃",
+ _line);
+ }
+ }
+ _block ~= format(q"┃
+
+ 「%s」
+
+ ┃",
+ obj_num(obj));
+ _o_txt_odt = _block;
+ return _o_txt_odt;
+ }
+ auto tablarize(O)(
+ const O obj,
+ string _txt,
+ ) {
+ string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
+ string[] _table_cols;
+ string _table;
+ string _tablenote;
+ foreach(row_idx, row; _table_rows) {
+ _table_cols = row.split(rgx.table_delimiter_col);
+ _table ~= "";
+ 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)
+ _tablenote ~= cell;
+ } else {
+ _table ~= format(q"┃
+
+ %s
+
+ ┃",
+ (row_idx == 0 && obj.table.heading) ? "Table_Heading" : "P_table_cell",
+ cell,
+ );
+ }
+ }
+ _table ~= " ";
+ }
+ auto t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+ }
+ int _table_number = 0;
+ string table(O,M)(
+ const O obj,
+ const M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "table");
+ string _o_txt_odt = markup(obj);
+ auto t = tablarize(obj, _o_txt_odt);
+ string _note = t[1];
+ _o_txt_odt = format(q"┃
+
+
+
+
+
+
+ %s
+
+
+ 「%s」
+ ┃",
+ _table_number++,
+ obj.metainfo.object_number,
+ obj.metainfo.object_number,
+ obj.table.number_of_columns,
+ t[0],
+ obj.metainfo.object_number,
+ // _note,
+ );
+ return _o_txt_odt;
+ }
+ }
+}
+template outputODT() {
+ import doc_reform.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.xmls,
+ doc_reform.io_out.xmls_css;
+ mixin InternalMarkup;
+ mixin spineOutputRgxInit;
+ auto rgx = Rgx();
+ // mixin outputXmlODT;
+ string odt_head(I)(I doc_matters) {
+ string _has_tables = format(q"┃
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ┃",);
+ string _odt_head = format(q"┃
+
+
+
+
+
+
+
+
+
+
+
+
+
+ %s
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ┃",
+ (doc_matters.has.tables > 0) ? _has_tables : "",
+ );
+ return _odt_head;
+ }
+ string odt_body(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ mixin formatODT;
+ auto odt_format = formatODT();
+ string delimit = "";
+ string doc_odt = "";
+ string _txt = "";
+ foreach (part; doc_matters.has.keys_seq.scroll) {
+ foreach (obj; doc_abstraction[part]) {
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head" || "toc");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = delimit ~ odt_format.heading(obj, doc_matters);
+ goto default;
+ case "toc":
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "body": assert(part == "body" || "head"); // surprise
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = delimit ~ odt_format.heading(obj, doc_matters);
+ goto default;
+ case "para":
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ _txt = odt_format.quote(obj, doc_matters);
+ goto default;
+ case "group":
+ _txt = odt_format.group(obj, doc_matters);
+ goto default;
+ case "block":
+ _txt = odt_format.block(obj, doc_matters);
+ goto default;
+ case "verse":
+ _txt = odt_format.verse(obj, doc_matters);
+ goto default;
+ case "code":
+ _txt = odt_format.code(obj, doc_matters);
+ goto default;
+ case "table":
+ _txt = odt_format.table(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ _txt = delimit ~ odt_format.heading(obj, doc_matters);
+ goto default;
+ case "endnote": assert(part == "endnotes");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "glossary": assert(part == "glossary");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "bibliography": assert(part == "bibliography");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "bookindex": assert(part == "bookindex");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ case "blurb": assert(part == "blurb");
+ _txt = odt_format.para(obj, doc_matters);
+ goto default;
+ default:
+ doc_odt ~= _txt;
+ _txt = "";
+ break;
+ }
+ break;
+ default: break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text);
+ }
+ }
+ break;
+ }
+ }
+ }
+ return doc_odt;
+ }
+
+ string odt_tail() {
+ string _odt_tail = format(q"┃spine: <www.doc_reform.org > and <www.sisudoc.org >
+ ┃",);
+ return _odt_tail;
+ }
+ string content_xml(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ string _content_xml;
+ string break_line = (doc_matters.opt.action.debug_do) ? "\n" : "";
+ string odt_break_page = format(q"┃ ┃",);
+ string br_pg = format(q"┃ ┃",);
+ _content_xml ~= odt_head(doc_matters);
+ _content_xml ~= odt_body(doc_abstraction, doc_matters);
+ _content_xml ~= odt_tail;
+ return _content_xml;
+ }
+ string manifest_xml(M)(
+ auto ref M doc_matters,
+ ) {
+ string _bullet = format(q"┃ ┃");
+ string[] _images = [ _bullet ];
+ foreach (image; doc_matters.srcs.image_list) {
+ _images ~= format(q"┃ ┃", image);
+ }
+ string _manifest_xml = format(q"┃
+
+
+
+
+ %s
+
+
+
+
+
+ ┃",
+ _images.join("\n"),
+ );
+ return _manifest_xml;
+ }
+ void images_cp(M)(
+ auto ref M doc_matters,
+ ) {
+ { /+ (copy odt images) +/
+ auto pth_odt = spinePathsODT!()(doc_matters);
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_src_out_file = pth_odt.image_dir("fs") ~ "/" ~ image;
+ auto fn_src_out_zip = pth_odt.image_dir("zip") ~ "/" ~ image;
+ if (exists(fn_src_in)) {
+ if (doc_matters.opt.action.debug_do) {
+ if (doc_matters.opt.action.debug_do) {
+ fn_src_in.copy(fn_src_out_file);
+ }
+ }
+ }
+ }
+ }
+ // return 0;
+ }
+ string meta_xml(M)(
+ auto ref M doc_matters,
+ ) {
+ /+ (meta_xml includes output time-stamp) +/
+ string _meta_xml = format(q"┃
+
+
+ %s
+ %s
+ %s
+ en-US
+
+
+ ┃",
+ doc_matters.generator_program.name_and_version,
+ doc_matters.generated_time,
+ doc_matters.generated_time,
+ );
+ return _meta_xml;
+ }
+ void dirtree(I)(
+ I doc_matters,
+ ) {
+ auto pth_odt = spinePathsODT!()(doc_matters);
+ if (doc_matters.opt.action.debug_do) { /+ (dir tree) +/
+ if (!exists(pth_odt.meta_inf_dir("fs"))) {
+ pth_odt.meta_inf_dir("fs").mkdirRecurse;
+ }
+ if (!exists(pth_odt.image_dir("fs"))) {
+ pth_odt.image_dir("fs").mkdirRecurse;
+ }
+ }
+ if (!exists(pth_odt.base_pth)) {
+ pth_odt.base_pth.mkdirRecurse;
+ }
+ // return 0;
+ }
+ string mimetype() {
+ string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");
+ return mimetype_;
+ }
+ string manifest_rdf() {
+ string _manifest_rdf = format(q"┃
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ┃");
+ return _manifest_rdf;
+ }
+ string settings_xml() {
+ string _settings_xml = format(q"┃
+
+
+
+ 0
+ 0
+ 0
+ 0
+ true
+ false
+
+
+ view2
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 0
+ 2
+ true
+ 100
+ false
+
+
+
+
+ true
+ false
+ false
+ true
+ true
+ false
+ true
+ false
+ false
+
+ false
+ false
+ false
+ true
+ true
+ 0
+ false
+ false
+ false
+ false
+ true
+ false
+ false
+ false
+ false
+ true
+ true
+ false
+ false
+ true
+ false
+ true
+ false
+ high-resolution
+ 1
+ 0
+ true
+
+
+ false
+ true
+
+ false
+ true
+ false
+ true
+ false
+ true
+ false
+
+ true
+ true
+ false
+ true
+ true
+ true
+ false
+ false
+
+ false
+ 0
+ false
+ false
+ true
+ true
+
+
+
+ ┃");
+ return _settings_xml;
+ }
+ string styles_xml() {
+ string _styles_xml = format(q"┃
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ┃");
+ return _styles_xml;
+ }
+
+ void writeOutputODT(W,I)(
+ const W odt_content,
+ I doc_matters,
+ ) {
+ auto pth_odt = spinePathsODT!()(doc_matters);
+ auto fn_odt = pth_odt.odt_file;
+ auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
+ void ODTzip()(string contents, string fn) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn;
+ auto zip_data = new OutBuffer();
+ (doc_matters.opt.action.debug_do)
+ ? zip_data.write(contents.dup)
+ : zip_data.write(contents.dup
+ .replaceAll(rgx.spaces_line_start, "")
+ .replaceAll(rgx.newline, "")
+ .strip
+ );
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_odt, zip.build());
+ }
+ try {
+ if (!exists(pth_odt.base_pth)) { // check
+ pth_odt.base_pth.mkdirRecurse;
+ }
+ string fn;
+ File f;
+ { fn = pth_odt.mimetype("zip");
+ ODTzip(odt_content.mimetype, fn);
+ }
+ { fn = pth_odt.manifest_rdf("zip");
+ ODTzip(odt_content.manifest_rdf, fn);
+ }
+ { fn = pth_odt.settings_xml("zip");
+ ODTzip(odt_content.settings_xml, fn);
+ }
+ { fn = pth_odt.styles_xml("zip");
+ ODTzip(odt_content.styles_xml, fn);
+ }
+ { fn = pth_odt.content_xml("zip");
+ ODTzip(odt_content.content_xml, fn);
+ }
+ { fn = pth_odt.manifest_xml("zip");
+ ODTzip(odt_content.manifest_xml, fn);
+ }
+ { fn = pth_odt.meta_xml("zip");
+ ODTzip(odt_content.meta_xml, fn);
+ }
+ { /+ (images) +/
+ foreach (image; doc_matters.srcs.image_list) {
+ auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_out = pth_odt.image_dir("zip") ~ "/" ~ image;
+ if (exists(fn_src)) {
+ {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = fn_out;
+ auto zip_data = new OutBuffer();
+ zip_data.write(cast(char[]) ((fn_src).read));
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ createZipFile!()(fn_odt, zip.build());
+ }
+ }
+ }
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", pth_odt.odt_file);
+ }
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ if (doc_matters.opt.action.debug_do) {
+ pth_odt.mimetype("fs"); /+ (mimetype) +/
+ pth_odt.manifest_rdf("fs"); /+ (manifest.rdf) +/
+ pth_odt.settings_xml("fs"); /+ (settings.xml) +/
+ pth_odt.styles_xml("fs"); /+ (styles_xml) +/
+
+ pth_odt.content_xml("fs");
+ pth_odt.manifest_xml("fs");
+ pth_odt.meta_xml("fs");
+ }
+ }
+ void outputODT(D,I)(
+ const D doc_abstraction,
+ I doc_matters,
+ ) {
+ struct ODT {
+ /+ fixed output +/
+ string mimetype;
+ string manifest_rdf;
+ string settings_xml;
+ string styles_xml;
+ /+ variable output +/
+ string content_xml; // substantive content
+ string manifest_xml; // image list changes
+ string meta_xml; // time stamp
+ }
+ // auto pth_odt = spinePathsODT!()(doc_matters);
+ auto odt = ODT();
+ odt.mimetype = mimetype;
+ odt.manifest_rdf = manifest_rdf;
+ odt.settings_xml = settings_xml;
+ odt.styles_xml = styles_xml;
+ odt.content_xml = content_xml(doc_abstraction, doc_matters);
+ odt.manifest_xml = manifest_xml(doc_matters);
+ odt.meta_xml = meta_xml(doc_matters);
+ odt.writeOutputODT(doc_matters);
+ dirtree(doc_matters);
+ images_cp(doc_matters); // copy images
+ }
+}
diff --git a/src/doc_reform/io_out/package.d b/src/doc_reform/io_out/package.d
new file mode 100644
index 0000000..1f11046
--- /dev/null
+++ b/src/doc_reform/io_out/package.d
@@ -0,0 +1,22 @@
+module doc_reform.io_out;
+public import
+ std.algorithm,
+ std.array,
+ std.container,
+ std.exception,
+ std.path,
+ std.process,
+ std.range,
+ std.regex,
+ std.stdio,
+ std.string,
+ std.traits,
+ std.typecons,
+ // std.uni,
+ std.utf;
+public import
+ doc_reform.share.defaults,
+ doc_reform.io_in.paths_source,
+ doc_reform.io_out.defaults,
+ doc_reform.io_out.paths_output,
+ doc_reform.io_out.rgx;
diff --git a/src/doc_reform/io_out/paths_output.d b/src/doc_reform/io_out/paths_output.d
new file mode 100644
index 0000000..5f474a6
--- /dev/null
+++ b/src/doc_reform/io_out/paths_output.d
@@ -0,0 +1,531 @@
+/++
+ default settings
++/
+module doc_reform.io_out.paths_output;
+import std.array,
+ std.path,
+ std.regex,
+ std.stdio;
+import doc_reform.meta.rgx;
+template spineOutPaths() {
+ auto spineOutPaths()(
+ string output_pth_root,
+ string lng = "",
+ ) {
+ struct _PathsStruct {
+ string output_root() {
+ return (output_pth_root.length > 0)
+ ? output_pth_root : "";
+ }
+ string output_base() {
+ return ((output_root.chainPath(lng)).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spineOutPathSQLite() {
+ auto spineOutPathSQLite(Po)(
+ Po output_pth_root,
+ ) {
+ struct _PathsStruct {
+ string output_root() {
+ return (output_pth_root.length > 0)
+ ? output_pth_root : "";
+ }
+ string output_base() {
+ return ((output_root).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spineOutPathsFnPd() {
+ /+ TODO stuff to work out here +/
+ auto spineOutPathsFnPd(Fn,Pn)(
+ Fn fn_src_pth,
+ Pn pod_name_with_path
+ ) {
+ struct _PathsStruct {
+ string base_filename() {
+ return fn_src_pth.baseName.stripExtension;
+ }
+ string base_pod_and_filename() { // TODO
+ /+
+ - if pod,
+ - pod_name
+ - file_name
+ - if pod_name == file_name
+ - file_name
+ - else if pod_name != file_name
+ - pod_name.file_name
+ +/
+ string _fn_src = fn_src_pth.baseName.stripExtension;
+ string _output_base_name;
+ if (!(pod_name_with_path.empty)) {
+ if (pod_name_with_path == _fn_src) {
+ _output_base_name = _fn_src;
+ } else {
+ _output_base_name = pod_name_with_path ~ "." ~ _fn_src;
+ }
+ } else {
+ _output_base_name = _fn_src;
+ }
+ return _output_base_name;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+
+template spineDocRootTreeHTML() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spineDocRootTreeHTML()(string lng) {
+ auto lng_pth = spineOutPaths!()("", lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base_filename_scroll(string fn_src) {
+ return base_filename(fn_src);
+ }
+ string base_filename_seg(string fn_src) {
+ return base_filename(fn_src);
+ }
+ string doc_root() {
+ return ((lng_pth.output_root).asNormalizedPath).array;
+ }
+ string base() {
+ return (((lng).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string image() {
+ return (("image").asNormalizedPath).array;
+ }
+ string css() {
+ return (("css").asNormalizedPath).array;
+ }
+ string fn_seg_css() {
+ return ((css.chainPath("html_seg.css")).asNormalizedPath).array;
+ }
+ string fn_scroll_css() {
+ return ((css.chainPath("html_scroll.css")).asNormalizedPath).array;
+ }
+ string seg(string fn_src) {
+ return ((base.chainPath(base_filename_seg(fn_src))).asNormalizedPath).array;
+ }
+ string fn_scroll(string fn_src) {
+ return ((base.chainPath(base_filename_scroll(fn_src) ~ suffix)).asNormalizedPath).array;
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return ((seg(fn_src).chainPath(seg_filename ~ suffix)).asNormalizedPath).array;
+ }
+ string tail_seg(string fn_src) {
+ return lng ~ "/html/" ~ base_filename_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return lng ~ "/html/" ~ base_filename_scroll(fn_src) ~ suffix;
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return lng ~ "/html/" ~ seg(fn_src) ~ "/" ~ seg_filename ~ suffix;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsHTML() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spinePathsHTML()(
+ string output_path_root,
+ string lng,
+ ) {
+ auto doc_tree = spineDocRootTreeHTML!()(lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string doc_root() {
+ return ((output_path_root.chainPath(doc_tree.doc_root)).asNormalizedPath).array;
+ }
+ string harvest(string fn_harvest) {
+ return doc_root ~ "/" ~ fn_harvest;
+ }
+ string base() {
+ return ((output_path_root.chainPath(doc_tree.base)).asNormalizedPath).array;
+ }
+ string image() {
+ return ((output_path_root.chainPath(doc_tree.image)).asNormalizedPath).array;
+ }
+ string css() {
+ return ((output_path_root.chainPath(doc_tree.css)).asNormalizedPath).array;
+ }
+ string fn_seg_css() {
+ return ((output_path_root.chainPath(doc_tree.fn_seg_css)).asNormalizedPath).array;
+ }
+ string fn_scroll_css() {
+ return ((output_path_root.chainPath(doc_tree.fn_scroll_css)).asNormalizedPath).array;
+ }
+ string seg(string fn_src) {
+ return ((output_path_root.chainPath(doc_tree.seg(fn_src))).asNormalizedPath).array;
+ }
+ string fn_scroll(string fn_src) {
+ return ((output_path_root.chainPath(doc_tree.fn_scroll(fn_src))).asNormalizedPath).array;
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return ((output_path_root.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).asNormalizedPath).array;
+ }
+ string tail_seg(string fn_src) {
+ return doc_tree.tail_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return doc_tree.tail_fn_scroll(fn_src);
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return doc_tree.tail_fn_seg(fn_src, seg_filename);
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spineUrlsHTML() {
+ import std.format;
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spineUrlsHTML()(
+ string url_doc_root,
+ string lng,
+ ) {
+ auto doc_tree = spineDocRootTreeHTML!()(lng);
+ string base_dir = "html";
+ string suffix = ".html";
+ struct _PathsStruct {
+ string doc_root() {
+ return url_doc_root ~ ((doc_tree.doc_root).asNormalizedPath).array;
+ }
+ string harvest(string fn_harvest) {
+ return format(q"┃%s/%s┃",
+ doc_root,
+ fn_harvest,
+ );
+ }
+ string base() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.base).asNormalizedPath).array,
+ );
+ }
+ string image() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.image).asNormalizedPath).array,
+ );
+ }
+ string css() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.css).asNormalizedPath).array,
+ );
+ }
+ string fn_seg_css() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_seg_css).asNormalizedPath).array,
+ );
+ }
+ string fn_scroll_css() {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_scroll_css).asNormalizedPath).array,
+ );
+ }
+ string seg(string fn_src) {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.seg(fn_src)).asNormalizedPath).array,
+ );
+ }
+ string fn_scroll(string fn_src) {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array,
+ );
+ }
+ string fn_seg(string fn_src, string seg_filename) {
+ return format(q"┃%s/%s┃",
+ url_doc_root,
+ ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array,
+ );
+ }
+ string fn_scroll_obj_num(string fn_src, string obj_num) {
+ return format(q"┃%s/%s#%s┃",
+ url_doc_root,
+ ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array,
+ obj_num,
+ );
+ }
+ string fn_seg_obj_num(string fn_src, string seg_filename, string obj_num) {
+ return format(q"┃%s/%s#%s┃",
+ url_doc_root,
+ ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array,
+ obj_num,
+ );
+ }
+ string tail_seg(string fn_src) {
+ return doc_tree.tail_seg(fn_src);
+ }
+ string tail_fn_scroll(string fn_src) {
+ return doc_tree.tail_fn_scroll(fn_src);
+ }
+ string tail_fn_seg(string fn_src, string seg_filename) {
+ return doc_tree.tail_fn_seg(fn_src, seg_filename);
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsEPUB() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spinePathsEPUB()(
+ string output_pth_root,
+ string lng,
+ ) {
+ auto out_pth = spineOutPaths!()(output_pth_root, lng);
+ string base_dir = "epub";
+ struct _PathsStruct {
+ string base() {
+ return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base_filename_epub(string fn_src) {
+ return base_filename(fn_src) ~ "." ~ lng;
+ }
+ string doc_meta_inf() {
+ return (("META-INF").asNormalizedPath).array;
+ }
+ string doc_oebps() {
+ return (("OEBPS").asNormalizedPath).array;
+ }
+ string doc_oebps_css() {
+ return ((doc_oebps.chainPath("css")).asNormalizedPath).array;
+ }
+ string doc_oebps_image() {
+ return ((doc_oebps.chainPath("image")).asNormalizedPath).array;
+ }
+ string epub_file(string fn_src) {
+ return ((base.chainPath(base_filename_epub(fn_src) ~ ".epub")).asNormalizedPath).array;
+ }
+ string dirtop() {
+ return "".chainPath("").array;
+ }
+ string fn_mimetypes() {
+ return ((dirtop.chainPath("mimetypes")).asNormalizedPath).array;
+ }
+ string fn_dmi_container_xml() {
+ return ((doc_meta_inf.chainPath("container.xml")).asNormalizedPath).array;
+ }
+ string fn_oebps_toc_nav_xhtml() {
+ return ((doc_oebps.chainPath("toc_nav.xhtml")).asNormalizedPath).array;
+ }
+ string fn_oebps_toc_ncx() {
+ return ((doc_oebps.chainPath("toc.ncx")).asNormalizedPath).array;
+ }
+ string fn_oebps_content_opf() {
+ return ((doc_oebps.chainPath("content.opf")).asNormalizedPath).array;
+ }
+ string fn_oebps_content_xhtml(string seg_filename) {
+ return ((doc_oebps.chainPath(seg_filename ~ ".xhtml")).asNormalizedPath).array;
+ }
+ string fn_oebps_css() {
+ return ((doc_oebps_css.chainPath("epub.css")).asNormalizedPath).array;
+ }
+ /+ debug +/
+ string dbg_docdir(string fn_src) {
+ return base.chainPath(base_filename(fn_src)).array;
+ }
+ string dbg_docdir_oebps(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("OEBPS").array;
+ }
+ string dbg_doc_meta_inf(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("META-INF").array;
+ }
+ string dbg_doc_oebps(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("OEBPS").array;
+ }
+ string dbg_doc_oebps_css(string fn_src) {
+ return dbg_doc_oebps(fn_src).chainPath("css").array;
+ }
+ string dbg_doc_oebps_image(string fn_src) {
+ return dbg_doc_oebps(fn_src).chainPath("image").array;
+ }
+ string dbg_fn_mimetypes(string fn_src) {
+ return dbg_docdir(fn_src).chainPath("mimetypes").array;
+ }
+ string dbg_fn_dmi_container_xml(string fn_src) {
+ return dbg_doc_meta_inf(fn_src).chainPath("container.xml").array;
+ }
+ string dbg_fn_oebps_toc_nav_xhtml(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("toc_nav.xhtml").array;
+ }
+ string dbg_fn_oebps_toc_ncx(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("toc.ncx").array;
+ }
+ string dbg_fn_oebps_content_opf(string fn_src) {
+ return dbg_docdir_oebps(fn_src).chainPath("content.opf").array;
+ }
+ string dbg_fn_oebps_content_xhtml(string fn_src, string seg_filename) {
+ return dbg_docdir_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array;
+ }
+ string dbg_fn_oebps_css(string fn_src) {
+ return dbg_doc_oebps_css(fn_src).chainPath("epub.css").array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsODT() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spinePathsODT(M)(
+ M doc_matters,
+ ) {
+ auto out_pth = spineOutPaths!()( doc_matters.output_path, doc_matters.src.language);
+ string base_dir = "odf";
+ struct _PathsStruct {
+ string base_pth() { // dir will contain odt document file (also debug file tree)
+ return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string odt_file() {
+ return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".odt")).asNormalizedPath).array;
+ }
+ string dirtop(string type) {
+ return (type == "zip")
+ ? "".chainPath("").array
+ : ((base_pth.chainPath(doc_matters.src.doc_uid_out)).asNormalizedPath).array;
+ }
+ string mimetype(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("mimetype")).asNormalizedPath).array;
+ }
+ string manifest_rdf(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("manifest.rdf")).asNormalizedPath).array;
+ }
+ string settings_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("settings.xml")).asNormalizedPath).array;
+ }
+ string styles_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("styles.xml")).asNormalizedPath).array;
+ }
+ string image_dir(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("Pictures")).asNormalizedPath).array;
+ }
+ string image(string image_fn_src, string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((image_dir(type).chainPath(image_fn_src)).asNormalizedPath).array;
+ }
+ string content_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("content.xml")).asNormalizedPath).array;
+ }
+ string meta_inf_dir(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("META-INF")).asNormalizedPath).array;
+ }
+ string manifest_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((meta_inf_dir(type).chainPath("manifest.xml")).asNormalizedPath).array;
+ }
+ string meta_xml(string type="fs") {
+ assert(type == "zip" || "fs");
+ return ((dirtop(type).chainPath("meta.xml")).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsLaTeX() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spinePathsLaTeX(M)(
+ M doc_matters,
+ ) {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base() {
+ auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language);
+ string base_dir = "latex";
+ return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string latex_path_stuff() {
+ return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array;
+ }
+ string latex_file_with_path() {
+ return ((base.chainPath(base_filename(doc_matters.src.filename) ~ "." ~ doc_matters.src.language ~ ".tex")).asNormalizedPath).array;
+ }
+ string images() {
+ string image_dir = "image";
+ return (((base).chainPath(image_dir)).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsSQLiteDiscrete() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spinePathsSQLiteDiscrete()(
+ string output_pth_root,
+ string lng,
+ ) {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base() {
+ auto out_pth = spineOutPaths!()(output_pth_root, lng);
+ string base_dir = "sqlite";
+ return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string seg(string fn_src) {
+ return ((base.chainPath(base_filename(fn_src))).asNormalizedPath).array;
+ }
+ string sqlite_file(string fn_src) {
+ return ((base.chainPath(base_filename(fn_src) ~ ".sql.db")).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
+template spinePathsSQLite() {
+ mixin spineRgxInit;
+ static auto rgx = Rgx();
+ auto spinePathsSQLite(DbN, Po)(
+ DbN db_name,
+ Po output_pth_root,
+ ) {
+ struct _PathsStruct {
+ string base_filename(string fn_src) {
+ return fn_src.baseName.stripExtension;
+ }
+ string base() {
+ auto out_pth = spineOutPathSQLite!()(output_pth_root); // decide whether to have separate files for each language
+ string base_dir = "sqlite";
+ return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array;
+ }
+ string sqlite_file() {
+ return ((base.chainPath(base_filename(db_name) ~ ".sql.db")).asNormalizedPath).array;
+ }
+ }
+ return _PathsStruct();
+ }
+}
diff --git a/src/doc_reform/io_out/rgx.d b/src/doc_reform/io_out/rgx.d
new file mode 100644
index 0000000..4d0801c
--- /dev/null
+++ b/src/doc_reform/io_out/rgx.d
@@ -0,0 +1,114 @@
+/++
+ regex: regular expressions used in sisu document parser
++/
+module doc_reform.io_out.rgx;
+static template spineOutputRgxInit() {
+ import doc_reform.io_out.defaults;
+ static struct Rgx {
+ static newline = ctRegex!("\n", "mg");
+ static space = ctRegex!(`[ ]`, "mg");
+ static spaces_keep = ctRegex!(`(?P^[ ]+|[ ]{2,})`, "mg"); // code, verse, block
+ static spaces_line_start = ctRegex!(`^(?P[ ]+)`, "mg");
+ static nbsp_char = ctRegex!(`░`, "mg");
+ static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`);
+ static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`);
+ static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`);
+ static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`);
+ static src_pth_types =
+ ctRegex!(`^(?P[/]?[a-zA-Z0-9._-]+/)*(?P(?P[a-zA-Z0-9._-]+[.]ss[tm])|(?P[a-zA-Z0-9._-]+/pod[.]manifest)|(?P[a-zA-Z0-9._-]+[.]zip))$`);
+ static src_fn =
+ ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P(?P[a-zA-Z0-9._-]+)[.](?Pss[tm]))$`);
+ static src_fn_master = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ssm)$`);
+ static src_fn_find_inserts = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ss[im])$`);
+ static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`);
+ static src_base_parent_dir_name = ctRegex!(`[/](?P(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
+ static src_formalised_file_path_parts = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+?)(?P[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
+ /+ line breaks +/
+ 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");
+ /+ inline markup footnotes endnotes +/
+ 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.+?)】`, "m");
+ static inline_notes_al_gen_ref = ctRegex!(`【(?P[[*+]\s+)\s*(?P].+?)】`, "mg");
+ static inline_notes_al_all_note = ctRegex!(`【(?P\d+|(?:[*]|[+])+)\s+(?P.+?)\s*】`, "mg");
+ static inline_notes_al_regular_number_note = ctRegex!(`【(?P\d+)\s+(?P.+?)\s*】`, "mg");
+ static inline_notes_al_special_char_note = ctRegex!(`【(?P(?:[*]|[+])+)\s+(?P.+?)】`, "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_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
+ /+ inline markup links +/
+ static inline_image = ctRegex!(`(?P┥)☼(?P(?P [a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.*?├)`, "mg");
+ static inline_image_without_dimensions = ctRegex!(`(?P┥)☼(?P(?P [a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.*?├)`, "mg");
+ static inline_image_info = ctRegex!(`☼?(?P [a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+)`, "mg");
+ static inline_link_anchor = ctRegex!(`┃(?P\S+?)┃`, "mg"); // TODO *~text_link_anchor
+ static inline_link = ctRegex!(`┥(?P.+?)┝┤(?P #?(\S+?))├`, "mg");
+ static inline_link_empty = ctRegex!(`┥(?P.+?)┝┤├`, "mg");
+ static inline_link_number = ctRegex!(`┥(?P.+?)┝┤(?P[0-9]+)├`, "mg"); // not used
+ static inline_link_number_only = ctRegex!(`(┥.+?┝)┤(?P[0-9]+)├`, "mg");
+ static inline_link_stow_uri = ctRegex!(`┥(?P.+?)┝┤(?P [^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links
+ static inline_link_hash = ctRegex!(`┥(?P.+?)┝┤(?P #(?P\S+?))├`, "mg");
+ static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
+ static inline_link_toc_to_backmatter = ctRegex!(`┤#(?P endnotes|bibliography|bookindex|glossary|blurb)├`, "mg");
+ static url = ctRegex!(`https?://`, "mg");
+ static uri = ctRegex!(`(?:https?|git)://`, "mg");
+ static uri_identify_components = ctRegex!(`(?P(?:https?|git)://)(?P\S+?/)(?P[^/]+)$`, "mg");
+ static inline_link_subtoc = ctRegex!(`^(?P[5-7])~ ┥(?P.+?)┝┤(?P .+?)├`, "mg");
+ static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
+ static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.fnSuffix`, "mg");
+ static mark_internal_site_lnk = ctRegex!(`¤`, "mg");
+ static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg");
+ /+ inline markup font face mod +/
+ static inline_mark_emphasis = ctRegex!(`(?P[*])\{(?P.+?)\}[*]`, "mg");
+ static inline_mark_bold = ctRegex!(`(?P[!])\{(?P.+?)\}[!]`, "mg");
+ static inline_mark_underscore = ctRegex!(`(?P[_])\{(?P.+?)\}[_]`, "mg");
+ static inline_mark_italics = ctRegex!(`(?P[/])\{(?P.+?)\}[/]`, "mg");
+ static inline_mark_superscript = ctRegex!(`(?P\^)\{(?P.+?)\}\^`, "mg");
+ static inline_mark_subscript = ctRegex!(`(?P[,])\{(?P.+?)\}[,]`, "mg");
+ static inline_mark_strike = ctRegex!(`(?P[-])\{(?P.+?)\}[-]`, "mg");
+ static inline_mark_insert = ctRegex!(`(?P[+])\{(?P.+?)\}[+]`, "mg");
+ static inline_mark_mono = ctRegex!(`(?P[#])\{(?P.+?)\}[#]`, "mg");
+ static inline_mark_cite = ctRegex!(`(?P["])\{(?P.+?)\}["]`, "mg");
+ static inline_faces_line = ctRegex!(`^[*!/_]_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`);
+ static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
+ static inline_bold_line = ctRegex!(`^!_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
+ static inline_italics_line = ctRegex!(`^/_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
+ static inline_underscore_line = ctRegex!(`^__ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
+ /+ inline markup font face mod +/
+ static inline_emphasis = ctRegex!(`[*]┨(?P.+?)┣[*]`, "mg");
+ static inline_bold = ctRegex!(`[!]┨(?P.+?)┣[!]`, "mg");
+ static inline_underscore = ctRegex!(`[_]┨(?P.+?)┣[_]`, "mg");
+ static inline_italics = ctRegex!(`[/]┨(?P.+?)┣[/]`, "mg");
+ static inline_superscript = ctRegex!(`\^┨(?P.+?)┣\^`, "mg");
+ // static inline_superscript = ctRegex!(`[\^]┨(?P.+?)┣[\^]`, "mg");
+ static inline_subscript = ctRegex!(`[,]┨(?P.+?)┣[,]`, "mg");
+ static inline_strike = ctRegex!(`[-]┨(?P.+?)┣[-]`, "mg");
+ static inline_insert = ctRegex!(`[+]┨(?P.+?)┣[+]`, "mg");
+ static inline_mono = ctRegex!(`[■]┨(?P.+?)┣[■]`, "mg");
+ static inline_cite = ctRegex!(`[‖]┨(?P.+?)┣[‖]`, "mg");
+ static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg");
+ /+ table delimiters +/
+ static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg");
+ static table_delimiter_row = ctRegex!("[ ]*\n", "mg");
+ static xhtml_ampersand = ctRegex!(`[&]`, "m"); // &
+ static xhtml_quotation = ctRegex!(`["]`, "m"); // "
+ static xhtml_less_than = ctRegex!(`[<]`, "m"); // <
+ static xhtml_greater_than = ctRegex!(`[>]`, "m"); // >
+ static xhtml_line_break = ctRegex!(` [\\]{2}`, "m"); //
+ static latex_special_char = ctRegex!(`([%${}_#&\\])`);
+ static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`);
+ static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`);
+ static latex_special_char_for_escape_url = ctRegex!(`([%])`);
+ static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`);
+ static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`);
+ static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg");
+ static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m");
+ static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg");
+ static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m");
+ }
+}
diff --git a/src/doc_reform/io_out/source_pod.d b/src/doc_reform/io_out/source_pod.d
new file mode 100644
index 0000000..31c0b45
--- /dev/null
+++ b/src/doc_reform/io_out/source_pod.d
@@ -0,0 +1,374 @@
+module doc_reform.io_out.source_pod;
+template spinePod() {
+ import doc_reform.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.zip,
+ std.conv : to;
+ import
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.xmls;
+ void spinePod(T)(T doc_matters) {
+ debug(asserts) {
+ // static assert(is(typeof(doc_matters) == tuple));
+ }
+ mixin spineOutputRgxInit;
+ string pwd = doc_matters.env.pwd;
+ auto src_path_info = doc_matters.src_path_info;
+ auto pth_dr_doc_src = doc_matters.src_path_info;
+ auto pths_pod = spinePathsPods!()(doc_matters);
+ mixin spineLanguageCodes;
+ auto lang = Lang();
+ static auto rgx = Rgx();
+ assert (doc_matters.src.filename.match(rgx.src_fn));
+ auto pod_archive(Z)(
+ string _source_type,
+ string _data_in,
+ string _pth_out,
+ Z zip
+ ) {
+ auto zip_arc_member_file = new ArchiveMember();
+ zip_arc_member_file.name = _pth_out;
+ auto zip_data = new OutBuffer();
+ switch (_source_type) {
+ case "file_path_bin":
+ zip_data.write(cast(char[]) ((_data_in).read));
+ goto default;
+ case "file_path_text":
+ zip_data.write((_data_in).readText);
+ goto default;
+ case "string":
+ zip_data.write(_data_in);
+ goto default;
+ default:
+ zip_arc_member_file.expandedData = zip_data.toBytes();
+ zip.addMember(zip_arc_member_file);
+ }
+ return zip;
+ }
+ try {
+ /+ create directory structure +/
+ if (!exists(pths_pod.pod_dir_())) {
+ // used both by pod zipped (& pod filesystem (unzipped) which makes its own recursive dirs)
+ pths_pod.pod_dir_().mkdirRecurse;
+ }
+ if (doc_matters.opt.action.source) {
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod);
+ }
+ if (!exists(pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.css(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod)) {
+ pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
+ }
+ if (!exists(pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) {
+ pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse;
+ }
+ }
+ debug(pod) {
+ writeln(__LINE__, ": ",
+ doc_matters.src.filename, " -> ",
+ pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod
+ );
+ }
+ auto zip = new ZipArchive();
+ auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod;
+ { /+ bundle images +/
+ foreach (image; doc_matters.srcs.image_list) {
+ debug(podimages) {
+ writeln(
+ pth_dr_doc_src.image_root.to!string, "/", image, " -> ",
+ pths_pod.image_root(doc_matters.src.filename).zpod, "/", image
+ );
+ }
+ auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.image_root(doc_matters.src.filename).zpod.to!string
+ ~ "/" ~ image;
+ auto fn_src_out_filesystem
+ = pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ image;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_bin", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln("WARNING (io) src out NOT found (image): ", fn_src_in);
+ }
+ }
+ }
+ } { /+ bundle dr_document_make +/
+ auto fn_src_in = ((doc_matters.src.is_pod)
+ ? doc_matters.src.conf_dir_path
+ : pth_dr_doc_src.conf_root).to!string
+ ~ "/" ~ "dr_document_make";
+ auto fn_src_out_pod_zip_base
+ = pths_pod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "dr_document_make";
+ auto fn_src_out_filesystem
+ = pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
+ ~ "/" ~ "dr_document_make";
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
+ }
+ }
+ } { /+ pod manifest +/
+ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_pod.pod_manifest(doc_matters.src.filename).filesystem_open_zpod.to!string; // needed without root path
+ auto fn_src_out_inside_pod
+ = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string; // needed without root path
+ string[] filelist_src_out_pod_arr;
+ string[] filelist_src_zpod_arr;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src in found: ", fn_src_in);
+ }
+ filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base;
+ filelist_src_zpod_arr ~= fn_src_out_inside_pod;
+ {
+ import dyaml;
+ auto pod_filelist_yaml_string
+ = File(pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w");
+ Node _pmy;
+ string _pm = "doc:\n filename: " ~ doc_matters.src.filename ~ "\n language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n";
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ _pmy = Loader.fromString(_pm).load();
+ writeln("pod filename: ", _pmy["doc"]["filename"].get!string);
+ writeln("pod languages: ", doc_matters.pod.manifest_list_of_languages.to!string);
+ writeln("pod languages: ", doc_matters.src.language);
+ // foreach(string _l; _pmy["doc"]["language"]) {
+ // writeln("language: ", _l);
+ // }
+ }
+ if (doc_matters.opt.action.source) {
+ pod_filelist_yaml_string.writeln(_pm);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("string", _pm, fn_src_out_pod_zip_base, zip);
+ }
+ }
+ }
+ } { /+ bundle primary file (.ssm/.sst) +/
+ auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path:
+ auto fn_src_out_inside_pod
+ = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path:
+ string[] filelist_src_out_pod_arr;
+ string[] filelist_src_zpod_arr;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src in found: ", fn_src_in);
+ }
+ filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base;
+ filelist_src_zpod_arr ~= fn_src_out_inside_pod;
+ string _pod_to_markup_file = doc_matters.src.pod_name ~ "/" ~ "media/text/" ~ doc_matters.src.language ~ "/" ~ doc_matters.src.filename;
+ if (doc_matters.opt.action.source) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ auto _rgx = regex(r"(?P\S+?)(?P[a-z_-]+)/(?Pmedia/text/)(?P\S+?)/(?P\S+?\.ss[mt])");
+ if (auto _x = fn_src_in.match(_rgx)){
+ if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) {
+ string _path_to_pod = _x.captures["path_to_pod"];
+ string _podname = _x.captures["podname"];
+ string _root_to_lang = _x.captures["from_root"];
+ string _language = _x.captures["language"];
+ string _filename = _x.captures["filename"];
+ foreach (_lang; doc_matters.pod.manifest_list_of_languages) {
+ string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip);
+ }
+ }
+ } else {
+ zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in);
+ }
+ }
+ } { /+ bundle insert files (.ssi) +/
+ if (doc_matters.srcs.file_insert_list.length > 0) {
+ auto _rgx = regex(r"(?P\S+?)(?P[a-z_-]+)/(?Pmedia/text/)(?P\S+?)/(?P\S+?\.ss[i])");
+ foreach (insert_file; doc_matters.srcs.file_insert_list) {
+ debug(pod) {
+ writeln(
+ insert_file, " -> ",
+ pths_pod.fn_doc_insert(
+ doc_matters.src.filename,
+ insert_file,
+ doc_matters.src.language,
+ ).zpod
+ );
+ }
+ if (auto _x = insert_file.match(_rgx)){
+ if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) {
+ string _path_to_pod = _x.captures["path_to_pod"];
+ string _podname = _x.captures["podname"];
+ string _root_to_lang = _x.captures["from_root"];
+ string _language = _x.captures["language"];
+ string _filename = _x.captures["filename"];
+ foreach (_lang; doc_matters.pod.manifest_list_of_languages) {
+ string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
+ if (exists(_pth_mkup_src_in)) {
+ if (doc_matters.opt.action.source) {
+ auto fn_src_out_filesystem // you need to change language sources
+ = pths_pod.fn_doc_insert(
+ doc_matters.src.filename, // doc_matters.src.filename
+ _pth_mkup_src_in, // insert_file
+ _lang,
+ ).filesystem_open_zpod.to!string;
+ _pth_mkup_src_in.copy(fn_src_out_filesystem); // check why here, thought dealt with elsewhere
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln("WARNING (io) src out NOT found (insert file): ", _pth_mkup_src_in);
+ }
+ }
+ }
+ }
+ } else {
+ auto fn_src_in = insert_file;
+ auto fn_src_out_pod_zip_base
+ = pths_pod.fn_doc_insert(
+ doc_matters.src.filename,
+ insert_file,
+ doc_matters.src.language,
+ ).zpod.to!string;
+ auto fn_src_out_filesystem
+ = pths_pod.fn_doc_insert(
+ doc_matters.src.filename,
+ insert_file,
+ doc_matters.src.language,
+ ).filesystem_open_zpod.to!string;
+ if (exists(fn_src_in)) {
+ debug(io) {
+ writeln("(io debug) src out found: ", fn_src_in);
+ }
+ if (doc_matters.opt.action.source) {
+ fn_src_in.copy(fn_src_out_filesystem);
+ }
+ if (doc_matters.opt.action.pod) {
+ zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
+ }
+ } else {
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in);
+ }
+ }
+ }
+ }
+ }
+ } {
+ auto fn_src_in = doc_matters.src.filename;
+ if (doc_matters.opt.action.pod) {
+ if (exists(doc_matters.src.file_with_absolute_path)) {
+ createZipFile!()(fn_pod, zip.build());
+ } else {
+ writeln("WARNING check missing source file(s): ", doc_matters.opt.action.pod);
+ }
+ if (!(exists(fn_pod))) {
+ writeln("WARNING failed to create pod zip archive: ", fn_pod);
+ }
+ }
+ }
+ if (exists(fn_pod)) {
+ try {
+ if (!(doc_matters.opt.action.quiet)
+ && doc_matters.opt.action.pod) {
+ auto data = (cast(byte[]) (fn_pod).read);
+ if (doc_matters.opt.action.verbose) {
+ writeln(" ", doc_matters.src.filename, " > ");
+ }
+ if (doc_matters.opt.action.pod) {
+ writefln(" %s\n %s %-(%02x%)", fn_pod, "sha256", data.sha256Of);
+ }
+ }
+ debug(pod) {
+ try {
+ auto zipped = new ZipArchive((fn_pod).read);
+ foreach (filename, member; zipped.directory) {
+ auto data = zipped.expand(member);
+ writeln("> ", filename, " length ", data.length);
+ }
+ } catch (ZipException ex) {
+ // Handle errors
+ }
+ if (doc_matters.src.filename == "dr_doc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") {
+ assert(
+ ((data).sha256Of).toHexString
+ == "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E",
+ "\npod: sha256 value for "
+ ~ doc_matters.src.filename
+ ~ " has changed, is now: "
+ ~ ((data).sha256Of).toHexString
+ );
+ }
+ if (doc_matters.src.filename == "dr_doc/media/text/en/sisu_markup_stress_test.sst") {
+ assert(
+ ((data).sha256Of).toHexString
+ == "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91",
+ "\npod: sha256 value for "
+ ~ doc_matters.src.filename
+ ~ " has changed, is now: "
+ ~ ((data).sha256Of).toHexString
+ );
+ }
+ }
+ } catch (ErrnoException ex) {
+ // Handle errors
+ }
+ }
+
+ } catch (ErrnoException ex) {
+ // Handle error
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/sqlite.d b/src/doc_reform/io_out/sqlite.d
new file mode 100644
index 0000000..0995fe1
--- /dev/null
+++ b/src/doc_reform/io_out/sqlite.d
@@ -0,0 +1,1561 @@
+module doc_reform.io_out.sqlite;
+import doc_reform.io_out;
+import
+ std.file,
+ std.uri,
+ std.conv : to;
+import d2sqlite3;
+import std.typecons : Nullable;
+mixin spineOutputRgxInit;
+mixin InternalMarkup;
+static auto rgx = Rgx();
+static auto mkup = InlineMarkup();
+long _metadata_tid_lastrowid;
+template SQLiteHubBuildTablesAndPopulate() {
+ void SQLiteHubBuildTablesAndPopulate(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path);
+ pth_sqlite.base.mkdirRecurse;
+ auto db = Database(pth_sqlite.sqlite_file);
+ template SQLiteDbStatementComposite() {
+ void SQLiteDbStatementComposite(Db,D,M)(
+ Db db,
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ {
+ string _db_statement;
+ {
+ if ((doc_matters.opt.action.sqlite_db_create)) {
+ auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path);
+ pth_sqlite.base.mkdirRecurse;
+ _db_statement ~= SQLiteTablesReCreate!()();
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "TABLE RE-CREATE");
+ }
+ if (doc_matters.opt.action.sqlite_delete) {
+ _db_statement ~= SQLiteDeleteDocument!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document");
+ }
+ if (doc_matters.opt.action.sqlite_update) {
+ _db_statement ~= SQLiteDeleteDocument!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document");
+ _db_statement ~= SQLiteInsertMetadata!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaData");
+ /+ get tid (lastrowid or max) for use in doc_objects table +/
+ _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects");
+ }
+ }
+ db.close;
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", pth_sqlite.sqlite_file);
+ }
+ }
+ }
+ SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters);
+ }
+}
+template SQLiteHubDiscreteBuildTablesAndPopulate() {
+ void SQLiteHubDiscreteBuildTablesAndPopulate(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language);
+ auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language);
+ pth_sqlite.base.mkdirRecurse;
+ auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename));
+ template SQLiteDiscreteDbStatementComposite() {
+ void SQLiteDiscreteDbStatementComposite(Db,D,M)(
+ Db db,
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ {
+ string _db_statement;
+ {
+ _db_statement ~= SQLiteTablesReCreate!()();
+ _db_statement ~= SQLiteInsertMetadata!()(doc_matters);
+ _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters);
+ SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects");
+ }
+ db.close;
+ }
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename));
+ }
+ }
+ }
+ SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters);
+ }
+}
+template SQLiteDbRun() {
+ void SQLiteDbRun(Db,St,O)(
+ Db db,
+ St db_statement,
+ O opt_action,
+ string note,
+ ) {
+ debug(sql_statement) {
+ writeln(db_statement);
+ }
+ try {
+ db.run(
+ "\nBEGIN;\n" ~
+ db_statement ~
+ "\nCOMMIT;\n"
+ );
+ if (!(opt_action.sqlite_discrete)
+ && !(opt_action.sqlite_db_create)
+ ) {
+ }
+ } catch (ErrnoException ex) {
+ writeln("ERROR SQLite : ", ex);
+ } catch (Exception ex) {
+ writeln("ERROR SQLite : ", ex);
+ }
+ { /+ debug +/
+ if (opt_action.debug_do
+ && opt_action.verbose) {
+ writeln(note);
+ if (opt_action.very_verbose) {
+ writeln(db_statement);
+ }
+ }
+ }
+ }
+}
+template SQLinsertDelimiter() {
+ auto SQLinsertDelimiter(string _txt) {
+ _txt = _txt
+ .replaceAll(rgx.quotation_mark_sql_insert_delimiter, "$0$0");
+ return _txt;
+ }
+}
+template SQLiteFormatAndLoadObject() {
+ auto SQLiteFormatAndLoadObject(M)(
+ M doc_matters,
+ ) {
+ mixin spineOutputRgxInit;
+ struct sqlite_format_and_load_objects {
+ string generic_munge_sanitize_text_for_search(
+ string _txt,
+ ) {
+ string _notes;
+ string _urls;
+ if (_txt.matchFirst(rgx.inline_notes_al_gen)) {
+ foreach (m; _txt.matchAll(rgx.inline_notes_al_gen_text)) {
+ _notes ~= "\n" ~ m["text"];
+ }
+ _txt = _txt.replaceAll(rgx.inline_notes_al_gen, "");
+ }
+ if (_txt.matchFirst(rgx.inline_link)) {
+ foreach (m; _txt.matchAll(rgx.inline_link)) {
+ if (m["link"].match(rgx.url)) {
+ _urls ~= "\n" ~ m["link"];
+ }
+ }
+ _txt = _txt.replaceAll(rgx.inline_link_clean, "");
+ }
+ if (_notes.length > 0) {
+ _txt ~= _notes;
+ }
+ if (_urls.length > 0) {
+ _txt ~= _urls;
+ }
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(_txt, "\n");
+ }
+ }
+ debug(sql_text_clean) {
+ writeln(_txt);
+ }
+ return _txt;
+ }
+ string munge_html(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string _html_special_characters(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.xhtml_ampersand, "&")
+ .replaceAll(rgx.xhtml_quotation, """)
+ .replaceAll(rgx.xhtml_less_than, "<")
+ .replaceAll(rgx.xhtml_greater_than, ">")
+ .replaceAll(rgx.nbsp_char, " ")
+ .replaceAll(rgx.xhtml_line_break, " ");
+ return _txt;
+ }
+ string _html_font_face(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.inline_emphasis, "$1 ")
+ .replaceAll(rgx.inline_bold, "$1 ")
+ .replaceAll(rgx.inline_underscore, "$1 ")
+ .replaceAll(rgx.inline_italics, "$1 ")
+ .replaceAll(rgx.inline_superscript, "$1 ")
+ .replaceAll(rgx.inline_subscript, "$1 ")
+ .replaceAll(rgx.inline_strike, "$1")
+ .replaceAll(rgx.inline_insert, "$1 ")
+ .replaceAll(rgx.inline_mono, "$1 ")
+ .replaceAll(rgx.inline_cite, "$1 ");
+ return _txt;
+ }
+ string _notes;
+ string _urls;
+ string _txt = _html_font_face(_html_special_characters(obj.text));
+ if (_txt.matchFirst(rgx.inline_notes_al_gen)) {
+ foreach (m; _txt.matchAll(rgx.inline_notes_al_gen_text)) {
+ _notes ~= "\n" ~ m["text"];
+ }
+ _txt = _txt.replaceAll(rgx.inline_notes_al_gen_ref, "$1 ");
+ }
+ if (_notes.length > 0) {
+ _txt ~= _notes;
+ }
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(_txt, "\n");
+ }
+ }
+ return _txt;
+ }
+ string html_special_characters(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.xhtml_ampersand, "&")
+ .replaceAll(rgx.xhtml_quotation, """)
+ .replaceAll(rgx.xhtml_less_than, "<")
+ .replaceAll(rgx.xhtml_greater_than, ">")
+ .replaceAll(rgx.nbsp_char, " ")
+ .replaceAll(rgx.xhtml_line_break, " ");
+ return _txt;
+ }
+ string html_special_characters_code(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.xhtml_ampersand, "&")
+ .replaceAll(rgx.xhtml_quotation, """)
+ .replaceAll(rgx.xhtml_less_than, "<")
+ .replaceAll(rgx.xhtml_greater_than, ">")
+ .replaceAll(rgx.nbsp_char, " ");
+ return _txt;
+ }
+ string html_font_face(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.inline_emphasis, "$1 ")
+ .replaceAll(rgx.inline_bold, "$1 ")
+ .replaceAll(rgx.inline_underscore, "$1 ")
+ .replaceAll(rgx.inline_italics, "$1 ")
+ .replaceAll(rgx.inline_superscript, "$1 ")
+ .replaceAll(rgx.inline_subscript, "$1 ")
+ .replaceAll(rgx.inline_strike, "$1")
+ .replaceAll(rgx.inline_insert, "$1 ")
+ .replaceAll(rgx.inline_mono, "$1 ")
+ .replaceAll(rgx.inline_cite, "$1 ");
+ return _txt;
+ }
+ string inline_images(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ string _suffix = ".html",
+ string _xml_type = "seg",
+ ) {
+ string _img_pth;
+ if (_xml_type == "epub") {
+ _img_pth = "image/";
+ } else if (_xml_type == "scroll") {
+ _img_pth = "../../image/";
+ } else if (_xml_type == "seg") {
+ _img_pth = "../../../image/";
+ }
+ if (_txt.match(rgx.inline_image)) {
+ _txt = _txt.replaceAll( // TODO bug where image dimensions (w or h) not given & consequently set to 0; should not be used (calculate earlier, abstraction)
+ rgx.inline_image,
+ ("$1 $6"));
+ }
+ return _txt;
+ }
+ string inline_links(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ string _xml_type = "seg",
+ ) {
+ if (obj.has.inline_links) {
+ if (obj.metainfo.is_a != "code") {
+ _txt = replaceAll!(m =>
+ m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├"
+ )(_txt, rgx.inline_link_number_only);
+ }
+ if ((_txt.match(rgx.mark_internal_site_lnk))
+ && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
+ _txt = _txt.replaceAll(
+ rgx.inline_seg_link,
+ "$1");
+ }
+ auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
+ if (_xml_type == "seg") {
+ foreach (m; _txt.match(rgx.inline_link_hash)) {
+ if (m.captures[3] in doc_matters.has.tag_associations) {
+ if (m.captures[3] == doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]) {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_hash,
+ "┥$1┝┤"
+ ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
+ ~ "/"
+ ~ pth_html.tail_fn_seg(doc_matters.src.filename, "$3.html")
+ ~ "├"
+ );
+ } else {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_hash,
+ "┥$1┝┤"
+ ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
+ ~ "/"
+ ~ doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]
+ ~ ".html"
+ ~ "#" ~ "$3"
+ ~ "├"
+ );
+ }
+ } else {
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(
+ "WARNING on internal document links, anchor to link <<"
+ ~ m.captures[3]
+ ~ ">> not found in document, "
+ ~ "anchor: " ~ m.captures[3]
+ ~ " document: " ~ doc_matters.src.filename
+ );
+ }
+ }
+ }
+ } else {
+ if (auto m = _txt.match(rgx.inline_link_hash)) {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_hash,
+ "┥$1┝┤"
+ ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
+ ~ "/"
+ ~ pth_html.tail_fn_scroll(doc_matters.src.filename)
+ ~ "#" ~ "$3"
+ ~ "├"
+ );
+ }
+ }
+ _txt = _txt
+ .replaceAll(
+ rgx.inline_link_fn_suffix,
+ ("$1.html"))
+ .replaceAll(
+ rgx.inline_link,
+ ("$1 "))
+ .replaceAll(
+ rgx.mark_internal_site_lnk,
+ "");
+ }
+ debug(markup_links) {
+ if (_txt.match(rgx.inline_link)) {
+ writeln(__LINE__,
+ " (missed) markup link identified (",
+ obj.has.inline_links,
+ "): ", obj.metainfo.is_a, ": ",
+ obj.text
+ );
+ }
+ }
+ debug(markup) {
+ if (_txt.match(rgx.inline_link)) {
+ writeln(__LINE__,
+ " (missed) markup link identified (",
+ obj.has.inline_links,
+ "): ", obj.metainfo.is_a, ": ",
+ obj.text
+ );
+ }
+ }
+ return _txt;
+ }
+ string inline_notes_scroll(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ ) {
+ if (obj.has.inline_notes_reg) {
+ // _txt = font_face(_txt);
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_regular_number_note,
+ (" $1 ")
+ );
+ }
+ debug(markup_endnotes) {
+ 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_al_regular_number_note)) {
+ writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
+ }
+ }
+ return _txt;
+ }
+ auto inline_notes_seg(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ ) {
+ string[] _endnotes;
+ if (obj.has.inline_notes_reg) {
+ /+ need markup for text, and separated footnote +/
+ 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",
+ "",
+ "",
+ " ",
+ m.captures[1],
+ ". ",
+ m.captures[2],
+ "
"
+ );
+ }
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_regular_number_note,
+ (" $1 ")
+ );
+ } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
+ debug(markup) {
+ writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
+ }
+ }
+ auto t = tuple(
+ _txt,
+ _endnotes,
+ );
+ return t;
+ }
+ string xml_type="seg"; /+ set html document type to be linked to here (seg|scroll) +/
+ string inline_markup(M,O)(
+ M doc_matters,
+ const O obj,
+ string _txt,
+ ) {
+ _txt = inline_images(doc_matters, obj, _txt, xml_type);
+ _txt = inline_links(doc_matters, obj, _txt, xml_type);
+ _txt = inline_notes_scroll(doc_matters, obj, _txt);
+ return _txt;
+ }
+ string html_heading(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "heading");
+ string _txt = munge_html(doc_matters, obj);
+ _txt = inline_markup(doc_matters, obj, _txt);
+ string o = format(q"┃
+ %s
+
┃",
+ obj.metainfo.is_a,
+ _txt,
+ );
+ return o;
+ }
+ string html_para(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "para" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ string _txt = munge_html(doc_matters, obj);
+ _txt = (obj.attrib.bullet) ? ("● " ~ _txt) : _txt;
+ _txt = inline_markup(doc_matters, obj, _txt);
+ string o = format(q"┃
+ %s
+
┃",
+ obj.metainfo.is_a,
+ obj.attrib.indent_hang,
+ obj.attrib.indent_base,
+ _txt
+ );
+ return o;
+ }
+ string html_quote(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "quote");
+ string _txt = munge_html(doc_matters, obj);
+ string o = format(q"┃
+ %s
+
┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_group(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "group");
+ string _txt = munge_html(doc_matters, obj);
+ string o = format(q"┃
+ %s
+
┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_block(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "block");
+ string _txt = munge_html(doc_matters, obj);
+ string o = format(q"┃
+ %s
┃",
+ obj.metainfo.is_a,
+ _txt.stripRight
+ );
+ return o;
+ }
+ string html_verse(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "verse");
+ string _txt = munge_html(doc_matters, obj);
+ string o = format(q"┃%s
┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_code(O)(
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "code");
+ string _txt = html_special_characters_code(obj.text);
+ string o = format(q"┃%s
┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ return o;
+ }
+ string html_table(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "table");
+ auto _tablarize(O)(
+ const O obj,
+ string _txt,
+ ) {
+ string[] _table_rows = _txt.split(rgx.table_delimiter_row);
+ string[] _table_cols;
+ string _table;
+ string _tablenote;
+ foreach(row_idx, row; _table_rows) {
+ _table_cols = row.split(rgx.table_delimiter_col);
+ _table ~= "";
+ 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)
+ _tablenote ~= cell;
+ } else {
+ string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td";
+ string _align = ("style=\"text-align:"
+ ~ ((obj.table.column_aligns[col_idx] == "l")
+ ? "left\"" : "right\""));
+ _table ~= "<"
+ ~ _col_is
+ ~ " width=\""
+ ~ obj.table.column_widths[col_idx].to!string
+ ~ "%\" "
+ ~ _align
+ ~ ">";
+ _table ~= cell;
+ _table ~= ""
+ ~ _col_is
+ ~ ">";
+ }
+ }
+ _table ~= " ";
+ }
+ auto t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+ }
+ string _txt = munge_html(doc_matters, obj);
+ auto t = _tablarize(obj, _txt);
+ _txt = t[0];
+ string _note = t[1];
+ string o = format(q"┃
+
+ %s
+
┃",
+ obj.metainfo.is_a,
+ _txt,
+ _note
+ );
+ return o;
+ }
+ string sqlite_load_string(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string o;
+ return o;
+ }
+ string postgresql_load_string(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string o;
+ return o;
+ }
+ string sqlite_statement(O)(
+ const O obj,
+ string _txt,
+ string _html,
+ ) {
+ void _sql_exe(O)(
+ string _sql,
+ ) {
+ writeln(_html);
+ writeln(_sql);
+ }
+ string _sql;
+ return _sql;
+ }
+ string[string] heading(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_heading(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] para(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_para(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] quote(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_quote(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] group(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_group(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] block(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_block(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] verse(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_verse(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] code(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_code(obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ string[string] table(M,O)(
+ M doc_matters,
+ const O obj,
+ ) {
+ string[string] obj_txt = [
+ "text": generic_munge_sanitize_text_for_search(obj.text),
+ "html": html_table(doc_matters, obj)
+ ];
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ debug(sql_txt) {
+ writeln(obj_txt["text"]);
+ }
+ debug(sql_html) {
+ writeln(obj_txt["html"]);
+ }
+ } else {
+ // load sql
+ }
+ }
+ return obj_txt;
+ }
+ }
+ return sqlite_format_and_load_objects();
+ }
+}
+template SQLiteTablesReCreate() {
+ string SQLiteTablesReCreate()() {
+ string _sql_instruct;
+ _sql_instruct = format(q"┃
+ DROP INDEX IF EXISTS idx_ocn;
+ DROP INDEX IF EXISTS idx_uid;
+ DROP INDEX IF EXISTS idx_digest_clean;
+ DROP INDEX IF EXISTS idx_digest_all;
+ DROP INDEX IF EXISTS idx_clean;
+ DROP INDEX IF EXISTS idx_title;
+ DROP INDEX IF EXISTS idx_creator_author;
+ DROP INDEX IF EXISTS src_filename;
+ DROP INDEX IF EXISTS idx_language_document_char;
+ DROP INDEX IF EXISTS idx_classify_topic_register;
+ DROP TABLE IF EXISTS metadata_and_text;
+ DROP TABLE IF EXISTS topic_register;
+ DROP TABLE IF EXISTS doc_objects;
+ DROP TABLE IF EXISTS urls;
+ CREATE TABLE metadata_and_text (
+ uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/])
+ src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code
+ src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename
+ title VARCHAR(800) NOT NULL,
+ title_main VARCHAR(400) NOT NULL,
+ title_sub VARCHAR(400) NULL,
+ title_short VARCHAR(400) NULL,
+ title_edition VARCHAR(10) NULL,
+ title_language VARCHAR(100) NULL,
+ title_language_char VARCHAR(6) NULL,
+ creator_author VARCHAR(600) NOT NULL,
+ creator_author_email VARCHAR(100) NULL,
+ creator_author_hon VARCHAR(100) NULL,
+ creator_author_nationality VARCHAR(100) NULL,
+ creator_editor VARCHAR(600) NULL,
+ creator_contributor VARCHAR(600) NULL,
+ creator_illustrator VARCHAR(600) NULL,
+ creator_photographer VARCHAR(600) NULL,
+ creator_translator VARCHAR(600) NULL,
+ creator_prepared_by VARCHAR(600) NULL,
+ creator_digitized_by VARCHAR(600) NULL,
+ creator_audio VARCHAR(600) NULL,
+ creator_video VARCHAR(600) NULL,
+ language_document VARCHAR(100) NULL,
+ language_document_char VARCHAR(6) NOT NULL,
+ language_original VARCHAR(100) NULL,
+ language_original_char VARCHAR(6) NULL,
+ date_added_to_site VARCHAR(10) NULL,
+ date_available VARCHAR(10) NULL,
+ date_created VARCHAR(10) NULL,
+ date_issued VARCHAR(10) NULL,
+ date_modified VARCHAR(10) NULL,
+ date_published VARCHAR(10) NULL,
+ date_valid VARCHAR(10) NULL,
+ date_translated VARCHAR(10) NULL,
+ date_original_publication VARCHAR(10) NULL,
+ date_generated VARCHAR(10) NULL,
+ original_title VARCHAR(800) NULL,
+ original_publisher VARCHAR(600) NULL,
+ original_language VARCHAR(100) NULL,
+ original_language_char VARCHAR(6) NULL,
+ original_source VARCHAR(600) NULL,
+ original_institution VARCHAR(600) NULL,
+ original_nationality VARCHAR(100) NULL,
+ rights_copyright VARCHAR(2500) NULL,
+ rights_copyright_audio VARCHAR(2500) NULL,
+ rights_copyright_cover VARCHAR(2500) NULL,
+ rights_copyright_illustrations VARCHAR(2500) NULL,
+ rights_copyright_photographs VARCHAR(2500) NULL,
+ rights_copyright_text VARCHAR(2500) NULL,
+ rights_copyright_translation VARCHAR(2500) NULL,
+ rights_copyright_video VARCHAR(2500) NULL,
+ rights_license VARCHAR(2500) NULL,
+ identifier_oclc VARCHAR(30) NULL,
+ identifier_isbn VARCHAR(16) NULL,
+ classify_topic_register VARCHAR(2500) NULL,
+ classify_subject VARCHAR(600) NULL,
+ classify_loc VARCHAR(30) NULL,
+ classify_dewey VARCHAR(30) NULL,
+ classify_keywords VARCHAR(600) NULL,
+ notes_abstract TEXT NULL,
+ notes_description TEXT NULL,
+ notes_comment TEXT NULL,
+ notes_coverage VARCHAR(200) NULL,
+ notes_relation VARCHAR(200) NULL,
+ notes_history VARCHAR(600) NULL,
+ notes_type VARCHAR(600) NULL,
+ notes_format VARCHAR(600) NULL,
+ notes_prefix TEXT NULL,
+ notes_prefix_a TEXT NULL,
+ notes_prefix_b TEXT NULL,
+ notes_suffix TEXT NULL,
+ publisher VARCHAR(600) NULL,
+ src_filename VARCHAR(256) NOT NULL,
+ src_fingerprint VARCHAR(256) NULL,
+ src_filesize VARCHAR(10) NULL,
+ src_wordcount VARCHAR(10) NULL,
+ pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL,
+ site_url_epub VARCHAR(256) NULL,
+ links TEXT NULL
+ );
+ CREATE TABLE topic_register (
+ -- tid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code
+ -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename
+ topic_register_lv0 VARCHAR(250) NOT NULL,
+ topic_register_lv1 VARCHAR(250) NULL,
+ topic_register_lv2 VARCHAR(250) NULL,
+ topic_register_lv3 VARCHAR(250) NULL,
+ topic_register_lv4 VARCHAR(250) NULL,
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL
+ );
+ CREATE TABLE doc_objects (
+ lid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ ocn SMALLINT,
+ obj_id VARCHAR(6) NULL,
+ clean TEXT NULL,
+ body TEXT NULL,
+ seg VARCHAR(256) NULL,
+ lev_an VARCHAR(1),
+ is_of_type VARCHAR(16),
+ is_a VARCHAR(16),
+ lev SMALLINT NULL,
+ node VARCHAR(16) NULL,
+ parent VARCHAR(16) NULL,
+ last_decendant VARCHAR(16) NULL, -- headings only
+ digest_clean CHAR(256),
+ digest_all CHAR(256),
+ html_seg_url CHAR(256),
+ types CHAR(1) NULL
+ );
+ CREATE INDEX idx_ocn ON doc_objects(ocn);
+ CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);
+ CREATE INDEX idx_digest_all ON doc_objects(digest_all);
+ CREATE INDEX idx_clean ON doc_objects(clean);
+ CREATE INDEX idx_title ON metadata_and_text(title);
+ CREATE INDEX idx_author ON metadata_and_text(creator_author);
+ CREATE INDEX idx_uid ON metadata_and_text(uid);
+ CREATE INDEX idx_filename ON metadata_and_text(src_filename);
+ CREATE INDEX idx_language ON metadata_and_text(language_document_char);
+ CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register);
+ ┃",);
+ return _sql_instruct;
+ }
+}
+template SQLiteDeleteDocument() {
+ string SQLiteDeleteDocument(M)(
+ M doc_matters,
+ ) {
+ string _uid = doc_matters.src.doc_uid;
+ string _delete_uid = format(q"┃
+ DELETE FROM metadata_and_text
+ WHERE uid = '%s';
+ DELETE FROM doc_objects
+ WHERE uid_metadata_and_text = '%s';
+ ┃",
+ _uid,
+ _uid,
+ );
+ return _delete_uid;
+ }
+}
+template SQLiteInsertMetadata() {
+ string SQLiteInsertMetadata(M)(
+ M doc_matters,
+ ) {
+ string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
+ string _insert_metadata = format(q"┃
+ INSERT INTO metadata_and_text (
+ uid,
+ src_filename,
+ src_composite_id_per_txt,
+ src_composite_id_per_pod,
+ title,
+ title_main,
+ title_sub,
+ title_short,
+ title_edition,
+ title_language,
+ creator_author,
+ creator_author_email,
+ creator_illustrator,
+ creator_translator,
+ language_document,
+ language_document_char,
+ date_added_to_site,
+ date_available,
+ date_created,
+ date_issued,
+ date_modified,
+ date_published,
+ date_valid,
+ rights_copyright,
+ rights_copyright_audio,
+ rights_copyright_cover,
+ rights_copyright_illustrations,
+ rights_copyright_photographs,
+ rights_copyright_text,
+ rights_copyright_translation,
+ rights_copyright_video,
+ rights_license,
+ identifier_oclc,
+ identifier_isbn,
+ classify_dewey,
+ classify_keywords,
+ classify_loc,
+ classify_subject,
+ classify_topic_register,
+ original_title,
+ original_publisher,
+ original_language,
+ original_language_char,
+ original_source,
+ notes_abstract,
+ notes_description,
+ publisher,
+ site_url_doc_root
+ )
+ VALUES (
+ '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'
+ );
+ ┃",
+ _uid,
+ SQLinsertDelimiter!()(doc_matters.src.filename),
+ SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_doc),
+ SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_pod),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_full),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_main),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_subtitle),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_short),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_edition),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_language),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_email),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_illustrator),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_translator),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document_char),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_added_to_site),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_available),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_created),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_issued),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_modified),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_published),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_valid),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_audio),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_cover),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_illustrations),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_photographs),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_text),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_translation),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_video),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_license),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_oclc),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_isbn),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_dewey),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_keywords),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_loc),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_subject),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_topic_register),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_abstract),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_description),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_title),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_publisher),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language_char),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_source),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher),
+ SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root)
+ );
+ if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) {
+
+ string _insert_topics;
+ foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr) {
+ string[] subject_tree = topic.split(mkup.sep);
+ _insert_topics ~= format(q"┃
+ INSERT INTO topic_register (
+ uid_metadata_and_text,
+ topic_register_lv0,
+ topic_register_lv1,
+ topic_register_lv2,
+ topic_register_lv3,
+ topic_register_lv4
+ )
+ VALUES (
+ '%s', '%s', '%s', '%s', '%s', '%s'
+ );
+ ┃",
+ _uid,
+ (subject_tree.length > 0) ? subject_tree[0] : "",
+ (subject_tree.length > 1) ? subject_tree[1] : "",
+ (subject_tree.length > 2) ? subject_tree[2] : "",
+ (subject_tree.length > 3) ? subject_tree[3] : "",
+ (subject_tree.length > 4) ? subject_tree[4] : ""
+ );
+ }
+ }
+ return _insert_metadata;
+ }
+}
+template SQLiteInsertDocObjectsLoop() {
+ string SQLiteInsertDocObjectsLoop(D,M)(
+ const D doc_abstraction,
+ M doc_matters,
+ ) {
+ string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
+ auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language);
+ string insertDocObjectsRow(O)(O obj) {
+ string _insert_doc_objects_row = format(q"┃
+ INSERT INTO doc_objects (
+ uid_metadata_and_text,
+ ocn,
+ obj_id,
+ clean,
+ body,
+ lev,
+ is_of_type,
+ is_a,
+ html_seg_url
+ )
+ VALUES (
+ '%s', %s, '%s', '%s', '%s', %s, '%s', '%s', '%s'
+ );
+ ┃",
+ _uid,
+ obj.metainfo.ocn,
+ obj.metainfo.identifier,
+ SQLinsertDelimiter!()(obj_txt["text"]),
+ SQLinsertDelimiter!()(obj_txt["html"]),
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.is_of_type,
+ obj.metainfo.is_a,
+ url_html.fn_seg_obj_num(doc_matters.src.filename, obj.tags.html_segment_anchor_tag_is, obj.metainfo.identifier),
+ );
+ return _insert_doc_objects_row;
+ }
+ auto format_and_sqlite_load = SQLiteFormatAndLoadObject!()(doc_matters);
+ string[string] obj_txt;
+ string doc_text;
+ string[] _insert_doc_objects;
+ foreach (part; doc_matters.has.keys_seq.sql) {
+ foreach (obj; doc_abstraction[part]) {
+ switch (obj.metainfo.is_of_part) {
+ case "frontmatter": assert(part == "head", part);
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "body": // assert(part == "body", part);
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ debug (asserts) {
+ if (part != "body") {
+ writeln(__LINE__, ": ", obj.text);
+ }
+ }
+ obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
+ break;
+ case "para":
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ case "block":
+ switch (obj.metainfo.is_a) {
+ case "quote":
+ obj_txt = format_and_sqlite_load.quote(doc_matters, obj);
+ break;
+ case "group":
+ obj_txt = format_and_sqlite_load.group(doc_matters, obj);
+ break;
+ case "block":
+ obj_txt = format_and_sqlite_load.block(doc_matters, obj);
+ break;
+ case "poem": // double check on keeping both poem & verse
+ break;
+ case "verse":
+ obj_txt = format_and_sqlite_load.verse(doc_matters, obj);
+ break;
+ case "code":
+ obj_txt = format_and_sqlite_load.code(doc_matters, obj);
+ break;
+ case "table":
+ obj_txt = format_and_sqlite_load.table(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "backmatter":
+ assert(part == "glossary" || "bibliography" || "bookindex" || "blurb" || "tail", part);
+ switch (obj.metainfo.is_of_type) {
+ case "para":
+ switch (obj.metainfo.is_a) {
+ case "heading":
+ obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
+ break;
+ case "glossary": assert(part == "glossary", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ case "bibliography": assert(part == "bibliography", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ case "bookindex": assert(part == "bookindex", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ case "blurb": assert(part == "blurb", part);
+ obj_txt = format_and_sqlite_load.para(doc_matters, obj);
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ }
+ }
+ break;
+ }
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
+ }
+ }
+ break;
+ }
+ break;
+ case "comment":
+ break;
+ default:
+ { /+ debug +/
+ if (doc_matters.opt.action.debug_do
+ && doc_matters.opt.action.verbose) {
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); // check where empty value could come from
+ writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
+ writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from
+ }
+ }
+ break;
+ }
+ if (obj.metainfo.is_a == "heading") {
+ if ((doc_matters.opt.action.very_verbose)) {
+ writeln(
+ "markup: ", obj.metainfo.heading_lev_markup,
+ "> ", obj.metainfo.dom_structure_markedup_tags_status,
+ "; collapsed: ", obj.metainfo.heading_lev_collapsed,
+ "> ", obj.metainfo.dom_structure_collapsed_tags_status,
+ "; ocn: ", obj.metainfo.ocn,
+ " node: ", obj.metainfo.node,
+ "; parent: ", obj.metainfo.parent_lev_markup,
+ "; ocn: ", obj.metainfo.parent_ocn,
+ "; ",
+ );
+ }
+ }
+ if (!(obj.metainfo.is_a == "comment")) {
+ _insert_doc_objects ~= insertDocObjectsRow(obj);
+ }
+ } // loop closes
+ }
+ return _insert_doc_objects.join.to!(char[]).toUTF8;
+ }
+}
+template SQLiteTablesCreate() {
+ void SQLiteTablesCreate(E,O)(E env, O opt_action) {
+ import d2sqlite3;
+ template SQLiteTablesReCreate() {
+ string SQLiteTablesReCreate()() {
+ string _sql_instruct;
+ _sql_instruct = format(q"┃
+ DROP INDEX IF EXISTS idx_ocn;
+ DROP INDEX IF EXISTS idx_uid;
+ DROP INDEX IF EXISTS idx_digest_clean;
+ DROP INDEX IF EXISTS idx_digest_all;
+ DROP INDEX IF EXISTS idx_clean;
+ DROP INDEX IF EXISTS idx_title;
+ DROP INDEX IF EXISTS idx_creator_author;
+ DROP INDEX IF EXISTS src_filename;
+ DROP INDEX IF EXISTS idx_language_document_char;
+ DROP INDEX IF EXISTS idx_classify_topic_register;
+ DROP TABLE IF EXISTS metadata_and_text;
+ DROP TABLE IF EXISTS topic_register;
+ DROP TABLE IF EXISTS doc_objects;
+ DROP TABLE IF EXISTS urls;
+ CREATE TABLE metadata_and_text (
+ uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/])
+ src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code
+ src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename
+ title VARCHAR(800) NOT NULL,
+ title_main VARCHAR(400) NOT NULL,
+ title_sub VARCHAR(400) NULL,
+ title_short VARCHAR(400) NULL,
+ title_edition VARCHAR(10) NULL,
+ title_language VARCHAR(100) NULL,
+ title_language_char VARCHAR(6) NULL,
+ creator_author VARCHAR(600) NOT NULL,
+ creator_author_email VARCHAR(100) NULL,
+ creator_author_hon VARCHAR(100) NULL,
+ creator_author_nationality VARCHAR(100) NULL,
+ creator_editor VARCHAR(600) NULL,
+ creator_contributor VARCHAR(600) NULL,
+ creator_illustrator VARCHAR(600) NULL,
+ creator_photographer VARCHAR(600) NULL,
+ creator_translator VARCHAR(600) NULL,
+ creator_prepared_by VARCHAR(600) NULL,
+ creator_digitized_by VARCHAR(600) NULL,
+ creator_audio VARCHAR(600) NULL,
+ creator_video VARCHAR(600) NULL,
+ language_document VARCHAR(100) NULL,
+ language_document_char VARCHAR(6) NOT NULL,
+ language_original VARCHAR(100) NULL,
+ language_original_char VARCHAR(6) NULL,
+ date_added_to_site VARCHAR(10) NULL,
+ date_available VARCHAR(10) NULL,
+ date_created VARCHAR(10) NULL,
+ date_issued VARCHAR(10) NULL,
+ date_modified VARCHAR(10) NULL,
+ date_published VARCHAR(10) NULL,
+ date_valid VARCHAR(10) NULL,
+ date_translated VARCHAR(10) NULL,
+ date_original_publication VARCHAR(10) NULL,
+ date_generated VARCHAR(10) NULL,
+ original_title VARCHAR(800) NULL,
+ original_publisher VARCHAR(600) NULL,
+ original_language VARCHAR(100) NULL,
+ original_language_char VARCHAR(6) NULL,
+ original_source VARCHAR(600) NULL,
+ original_institution VARCHAR(600) NULL,
+ original_nationality VARCHAR(100) NULL,
+ rights_copyright VARCHAR(2500) NULL,
+ rights_copyright_audio VARCHAR(2500) NULL,
+ rights_copyright_cover VARCHAR(2500) NULL,
+ rights_copyright_illustrations VARCHAR(2500) NULL,
+ rights_copyright_photographs VARCHAR(2500) NULL,
+ rights_copyright_text VARCHAR(2500) NULL,
+ rights_copyright_translation VARCHAR(2500) NULL,
+ rights_copyright_video VARCHAR(2500) NULL,
+ rights_license VARCHAR(2500) NULL,
+ identifier_oclc VARCHAR(30) NULL,
+ identifier_isbn VARCHAR(16) NULL,
+ classify_topic_register VARCHAR(2500) NULL,
+ classify_subject VARCHAR(600) NULL,
+ classify_loc VARCHAR(30) NULL,
+ classify_dewey VARCHAR(30) NULL,
+ classify_keywords VARCHAR(600) NULL,
+ notes_abstract TEXT NULL,
+ notes_description TEXT NULL,
+ notes_comment TEXT NULL,
+ notes_coverage VARCHAR(200) NULL,
+ notes_relation VARCHAR(200) NULL,
+ notes_history VARCHAR(600) NULL,
+ notes_type VARCHAR(600) NULL,
+ notes_format VARCHAR(600) NULL,
+ notes_prefix TEXT NULL,
+ notes_prefix_a TEXT NULL,
+ notes_prefix_b TEXT NULL,
+ notes_suffix TEXT NULL,
+ publisher VARCHAR(600) NULL,
+ src_filename VARCHAR(256) NOT NULL,
+ src_fingerprint VARCHAR(256) NULL,
+ src_filesize VARCHAR(10) NULL,
+ src_wordcount VARCHAR(10) NULL,
+ pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here
+ pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL,
+ site_url_epub VARCHAR(256) NULL,
+ links TEXT NULL
+ );
+ CREATE TABLE topic_register (
+ -- tid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code
+ -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename
+ topic_register_lv0 VARCHAR(250) NOT NULL,
+ topic_register_lv1 VARCHAR(250) NULL,
+ topic_register_lv2 VARCHAR(250) NULL,
+ topic_register_lv3 VARCHAR(250) NULL,
+ topic_register_lv4 VARCHAR(250) NULL,
+ site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
+ site_url_html_toc VARCHAR(256) NULL,
+ site_url_html_scroll VARCHAR(256) NULL
+ );
+ CREATE TABLE doc_objects (
+ lid BIGINT PRIMARY KEY,
+ uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
+ ocn SMALLINT,
+ obj_id VARCHAR(6) NULL,
+ clean TEXT NULL,
+ body TEXT NULL,
+ seg VARCHAR(256) NULL,
+ lev_an VARCHAR(1),
+ is_of_type VARCHAR(16),
+ is_a VARCHAR(16),
+ lev SMALLINT NULL,
+ node VARCHAR(16) NULL,
+ parent VARCHAR(16) NULL,
+ last_decendant VARCHAR(16) NULL, -- headings only
+ digest_clean CHAR(256),
+ digest_all CHAR(256),
+ html_seg_url CHAR(256),
+ types CHAR(1) NULL
+ );
+ CREATE INDEX idx_ocn ON doc_objects(ocn);
+ CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);
+ CREATE INDEX idx_digest_all ON doc_objects(digest_all);
+ CREATE INDEX idx_clean ON doc_objects(clean);
+ CREATE INDEX idx_title ON metadata_and_text(title);
+ CREATE INDEX idx_author ON metadata_and_text(creator_author);
+ CREATE INDEX idx_uid ON metadata_and_text(uid);
+ CREATE INDEX idx_filename ON metadata_and_text(src_filename);
+ CREATE INDEX idx_language ON metadata_and_text(language_document_char);
+ CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register);
+ ┃",);
+ return _sql_instruct;
+ }
+ }
+ if (opt_action.sqlite_db_create) {
+ string _db_statement;
+ auto pth_sqlite = spinePathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set);
+ pth_sqlite.base.mkdirRecurse;
+ auto db = Database(pth_sqlite.sqlite_file);
+ {
+ _db_statement ~= SQLiteTablesReCreate!()();
+ }
+ SQLiteDbRun!()(db, _db_statement, opt_action, "TABLE RE-CREATE");
+ }
+ }
+}
+template SQLiteDbDrop() {
+ void SQLiteDbDrop(O)(O opt_action) {
+ writeln("db drop");
+ if ((opt_action.sqlite_db_drop)) {
+ auto pth_sqlite = spinePathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set);
+ writeln("remove(", pth_sqlite.sqlite_file, ")");
+ try {
+ remove(pth_sqlite.sqlite_file);
+ } catch (FileException ex) {
+ // handle error
+ }
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/xmls.d b/src/doc_reform/io_out/xmls.d
new file mode 100644
index 0000000..a906d89
--- /dev/null
+++ b/src/doc_reform/io_out/xmls.d
@@ -0,0 +1,1215 @@
+module doc_reform.io_out.xmls;
+template outputXHTMLs() {
+ import doc_reform.io_out;
+ import
+ std.digest.sha,
+ std.file,
+ std.outbuffer,
+ std.uri,
+ std.zip,
+ std.conv : to;
+ import
+ doc_reform.io_out.create_zip_file,
+ doc_reform.io_out.xmls,
+ doc_reform.io_out.xmls_css;
+ mixin spineOutputRgxInit;
+ struct outputXHTMLs {
+ static auto rgx = Rgx();
+ string div_delimit(
+ string part,
+ return ref string previous_part
+ ){
+ string delimit = "";
+ string delimit_ = "";
+ if (part != previous_part) {
+ switch (part) {
+ case "head":
+ delimit_ ~= "\n\n" ;
+ break;
+ case "toc":
+ delimit_ ~= "\n
\n" ;
+ break;
+ case "bookindex":
+ delimit_ ~= "\n
\n" ;
+ break;
+ default:
+ delimit_ ~= "\n
\n" ;
+ break;
+ }
+ if (previous_part.length > 0) {
+ delimit ~= "\n
";
+ }
+ previous_part = part;
+ delimit ~= delimit_;
+ }
+ // you also need to close the last div, introduce a footer?
+ return delimit;
+ }
+ string special_characters_text(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.xhtml_ampersand, "&")
+ .replaceAll(rgx.xhtml_quotation, """)
+ .replaceAll(rgx.xhtml_less_than, "<")
+ .replaceAll(rgx.xhtml_greater_than, ">")
+ .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, "
");
+ }
+ return _txt;
+ }
+ string font_face(string _txt){
+ _txt = _txt
+ .replaceAll(rgx.inline_emphasis, ("
$1 "))
+ .replaceAll(rgx.inline_bold, ("
$1 "))
+ .replaceAll(rgx.inline_underscore, ("
$1 "))
+ .replaceAll(rgx.inline_italics, ("
$1 "))
+ .replaceAll(rgx.inline_superscript, ("
$1 "))
+ .replaceAll(rgx.inline_subscript, ("
$1 "))
+ .replaceAll(rgx.inline_strike, ("
$1"))
+ .replaceAll(rgx.inline_insert, ("
$1 "))
+ .replaceAll(rgx.inline_mono, ("
$1 "))
+ .replaceAll(rgx.inline_cite, ("
$1 "));
+ return _txt;
+ }
+ string _xhtml_anchor_tags(O)(O obj) {
+ const(string[]) anchor_tags = obj.tags.anchor_tags;
+ string tags="";
+ if (anchor_tags.length > 0) {
+ foreach (tag; anchor_tags) {
+ if (!(tag.empty)) {
+ tags ~= "
";
+ }
+ }
+ }
+ return tags;
+ }
+ string header_metadata(M)(
+ M doc_matters,
+ ) {
+ string _publisher="Publisher"; // TODO
+ string o;
+ o = format(q"┃
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ┃",
+ 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.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version,
+ doc_matters.generator_program.url_home,
+ );
+ return o;
+ }
+ string site_info_button(M)(
+ M doc_matters,
+ ) {
+ string _locations;
+ if (doc_matters.conf_make_meta.make.home_button_text.length > 0) {
+ _locations = (doc_matters.conf_make_meta.make.home_button_text)
+ .replaceAll(
+ rgx.inline_link,
+ ("
$1
"))
+ .replaceAll(
+ rgx.br_line, "")
+ .replaceAll(
+ rgx.br_nl, "");
+ } else {
+ _locations = "
spine
\n
sources / git
\n
www.sisudoc.org
";
+ }
+ string o;
+ o = format(q"┃┃",
+ _locations,
+ );
+ return o;
+ }
+ string inline_search_form(M)(
+ M doc_matters,
+ ) {
+ string _action="http://www.sisudoc.org/cgi-bin/search.cgi";
+ string _db="spine.7a.manual";
+ string o;
+ string _form;
+ if (doc_matters.opt.action.workon) {
+ _form = format(q"┃
+
+
+ ┃",
+ _action,
+ _db,
+ );
+ } else {
+ _form = format(q"┃%s┃",
+ "",
+ );
+ }
+ o = format(q"┃┃",
+ _form,
+ );
+ return o;
+ }
+ string html_head(M)(
+ M doc_matters,
+ string type,
+ ) {
+ string _manifest = "";
+ if (doc_matters.opt.action.workon) {
+ _manifest = format(q"┃
+
+
+ [ document manifest ]
+
+
+ ┃",
+ );
+ }
+ string o;
+ o = format(q"┃
+
+
+
+
+ %s%s
+
+
+ %s
+
+
+
+
+
+
+
+
+ "),
+ );
+ return o;
+ }
+ string epub3_seg_head(M)(
+ M doc_matters,
+ ) {
+ string html_base = format(q"┃
+ ┃",
+ );
+ string html_simple = format(q"┃
+ ┃",
+ doc_matters.src.language,
+ doc_matters.src.language,
+ );
+ string html_strict = format(q"┃
+ ┃",
+ doc_matters.src.language,
+ doc_matters.src.language,
+ );
+ string o;
+ o = format(q"┃%s
+
+
+ %s%s
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
┃",
+ html_simple,
+ 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.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;
+ }
+ string tail() {
+ string o;
+ o = format(q"┃
+
+
+
+ ┃");
+ return o;
+ }
+ string inline_images(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "seg",
+ ) {
+ string _img_pth;
+ if (_xml_type == "epub") {
+ _img_pth = "image/";
+ } else if (_xml_type == "scroll") {
+ _img_pth = "../../image/";
+ } else if (_xml_type == "seg") {
+ _img_pth = "../../../image/";
+ }
+ if (_txt.match(rgx.inline_image)) {
+ _txt = _txt
+ .replaceAll(rgx.inline_image,
+ ("$1
$6"))
+ .replaceAll(
+ rgx.inline_link_empty,
+ ("$1"));
+ }
+ return _txt;
+ }
+ string inline_links(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "seg",
+ ) {
+ string seg_lvs;
+ if (obj.has.inline_links) {
+ if (obj.metainfo.is_a != "code") {
+ _txt = replaceAll!(m =>
+ m[1] ~ "┤"
+ ~ (replaceAll!(n =>
+ n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
+ )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
+ ~ "├"
+ )(_txt, rgx.inline_link_number_only);
+ }
+ if ((_txt.match(rgx.mark_internal_site_lnk))
+ && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
+ _txt = _txt.replaceAll(
+ rgx.inline_seg_link,
+ "$1");
+ }
+ if (_xml_type == "seg" || _xml_type == "epub") {
+ seg_lvs = (_xml_type == "epub") ? "seg_lv1_to_4" : "seg_lv4";
+ foreach (m; _txt.match(rgx.inline_link_hash)) {
+ if (m.captures[3] in doc_matters.has.tag_associations) {
+ if (
+ m.captures[3]
+ == doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]
+ ) {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_hash,
+ "┥$1┝┤$3" ~ _suffix ~ "├"
+ );
+ } else {
+ _txt = _txt.replaceFirst(
+ rgx.inline_link_hash,
+ "┥$1┝┤"
+ ~ doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]
+ ~ _suffix ~ "#" ~ "$3"
+ ~ "├"
+ );
+ }
+ } else {
+ if (!(doc_matters.opt.action.quiet)) {
+ writeln(
+ "WARNING on internal document links, anchor to link <<"
+ ~ m.captures[3]
+ ~ ">> not found in document, "
+ ~ "anchor: " ~ m.captures[3]
+ ~ " document: " ~ doc_matters.src.filename
+ );
+ }
+ }
+ }
+ }
+ _txt = _txt
+ .replaceAll(
+ rgx.inline_link_fn_suffix,
+ ("$1" ~ _suffix))
+ .replaceAll(
+ rgx.inline_link,
+ ("
$1 "))
+ .replaceAll(
+ rgx.mark_internal_site_lnk,
+ "");
+ }
+ debug(markup_links) {
+ if (_txt.match(rgx.inline_link)) {
+ writeln(__LINE__,
+ " (missed) markup link identified (",
+ obj.has.inline_links,
+ "): ", obj.metainfo.is_a, ": ",
+ obj.text
+ );
+ }
+ }
+ debug(markup) {
+ if (_txt.match(rgx.inline_link)) {
+ writeln(__LINE__,
+ " (missed) markup link identified (",
+ obj.has.inline_links,
+ "): ", obj.metainfo.is_a, ": ",
+ obj.text
+ );
+ }
+ }
+ return _txt;
+ }
+ string inline_notes_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ if (obj.has.inline_notes_reg) {
+ _txt = font_face(_txt);
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_regular_number_note,
+ ("
$1 ")
+ );
+ }
+ if (obj.has.inline_notes_star) {
+ _txt = font_face(_txt);
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_special_char_note,
+ ("
$1 ")
+ );
+ }
+ debug(markup_endnotes) {
+ 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_al_regular_number_note)) {
+ writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
+ }
+ }
+ return _txt;
+ }
+ auto inline_notes_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ string[] _endnotes;
+ if (obj.has.inline_notes_star) {
+ _txt = font_face(_txt);
+ /+ need markup for text, and separated footnote +/
+ foreach(m; _txt.matchAll(rgx.inline_notes_al_special_char_note)) {
+ _endnotes ~= format(
+ "%s%s%s%s\n %s%s%s%s%s\n %s\n%s",
+ "
",
+ "",
+ " ",
+ m.captures[1],
+ ". ",
+ m.captures[2],
+ "
"
+ );
+ }
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_special_char_note,
+ ("
$1 ")
+ );
+ }
+ if (obj.has.inline_notes_reg) {
+ _txt = font_face(_txt);
+ /+ need markup for text, and separated footnote +/
+ 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",
+ "
",
+ "",
+ " ",
+ m.captures[1],
+ ". ",
+ m.captures[2],
+ "
"
+ );
+ }
+ _txt = _txt.replaceAll(
+ rgx.inline_notes_al_regular_number_note,
+ ("
$1 ")
+ );
+ } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
+ debug(markup) {
+ writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
+ }
+ }
+ auto t = tuple(
+ _txt,
+ _endnotes,
+ );
+ return t;
+ }
+ string inline_markup_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ ) {
+ if (obj.metainfo.dummy_heading
+ && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
+ _txt = "";
+ } else {
+ _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll");
+ _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll");
+ _txt = inline_notes_scroll(_txt, obj, doc_matters);
+ }
+ return _txt;
+ }
+ auto inline_markup_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "seg",
+ ) {
+ if (obj.metainfo.dummy_heading
+ && ((_xml_type == "epub"
+ && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading"))
+ || obj.metainfo.is_a == "heading")
+ ) {
+ _txt = "";
+ } else {
+ _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
+ _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
+ }
+ auto t = inline_notes_seg(_txt, obj, doc_matters);
+ return t;
+ }
+ string lev4_heading_subtoc(O,M)(
+ const O obj,
+ M doc_matters,
+ ) {
+ char[] lev4_subtoc;
+ lev4_subtoc ~= "
\n";
+ foreach (subtoc; obj.tags.lev4_subtoc) {
+ if (auto m = subtoc.match(rgx.inline_link_subtoc)) {
+ auto indent = (m.captures[1].to!int - 3).to!string; // css assumptions based on use of em for left margin & indent
+ auto text = m.captures[2].to!string;
+ text = font_face(text);
+ auto link = m.captures[3].to!string;
+ lev4_subtoc ~= subtoc.replaceFirst(rgx.inline_link_subtoc,
+ format(q"┃
+ ۰ %s
+
+ ┃",
+ indent,
+ indent,
+ link,
+ text,
+ ));
+ }
+ }
+ lev4_subtoc ~= "
\n";
+ return lev4_subtoc.to!string;
+ }
+ auto nav_pre_next_svg(O,M)(
+ const O obj,
+ M doc_matters,
+ ) {
+ string prev, next, toc;
+ if (obj.tags.segment_anchor_tag_epub == "toc") {
+ toc = "";
+ prev = "";
+ } else {
+ toc = format(q"┃
+
+ ┃",
+ );
+ }
+ if (obj.tags.segname_prev == "") {
+ prev = "";
+ } else {
+ prev = format(q"┃
+
+ ┃",
+ obj.tags.segname_prev,
+ );
+ }
+ if (obj.tags.segname_next == "") {
+ next = "";
+ } else {
+ next = format(q"┃
+
+ ┃",
+ obj.tags.segname_next,
+ );
+ }
+ string _toc_pre_next = format(q"┃
+
+
┃",
+ toc,
+ prev,
+ next,
+ );
+ string _pre_next = format(q"┃
+
+
┃",
+ prev,
+ next,
+ );
+ struct bar {
+ string toc_pre_next() {
+ return _toc_pre_next;
+ }
+ string pre_next() {
+ return _pre_next;
+ }
+ }
+ return bar();
+ }
+ string heading(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _xml_type = "html",
+ ) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "heading");
+ string tags = _xhtml_anchor_tags(obj);
+ string heading_lev_anchor_tag;
+ string _horizontal_rule = " ";
+ if ((_xml_type != "html")
+ || (obj.metainfo.heading_lev_markup == 0 || obj.metainfo.heading_lev_markup > 4)) {
+ _horizontal_rule = "";
+ }
+ _txt = font_face(_txt);
+ string o;
+ heading_lev_anchor_tag = (obj.tags.heading_lev_anchor_tag.empty)
+ ? ""
+ : " ";
+ if (_txt.empty) {
+ o = format(q"┃%s
+ ┃",
+ _horizontal_rule,
+ );
+ } else if (!(obj.metainfo.identifier.empty)) {
+ o = format(q"┃%s
+ ┃",
+ _horizontal_rule,
+ obj.metainfo.identifier,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.is_a,
+ obj.metainfo.identifier,
+ obj.metainfo.identifier,
+ tags,
+ heading_lev_anchor_tag,
+ _txt,
+ obj.metainfo.heading_lev_markup,
+ );
+ } else {
+ o = format(q"┃%s
+
+ %s%s
+ %s
+
+
┃",
+ _horizontal_rule,
+ obj.metainfo.heading_lev_markup,
+ obj.metainfo.is_a,
+ tags,
+ heading_lev_anchor_tag,
+ _txt,
+ obj.metainfo.heading_lev_markup,
+ );
+ }
+ return o;
+ }
+ string heading_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ ) {
+ _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
+ string o = heading(_txt, obj, doc_matters);
+ return o;
+ }
+ auto heading_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
+ _txt = t[0];
+ string[] _endnotes = t[1];
+ string o = heading(_txt, obj, doc_matters, _xml_type);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ string para(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
+ assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "para");
+ assert(obj.metainfo.is_a == "para" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ string tags = _xhtml_anchor_tags(obj);
+ _txt = font_face(_txt);
+ string o;
+ _txt = (obj.attrib.bullet) ? ("● " ~ _txt) : _txt;
+ _txt = _txt.replaceFirst(rgx.inline_link_anchor,
+ " ");
+ if (!(obj.metainfo.identifier.empty)) {
+ o = format(q"┃ ┃",
+ obj.metainfo.identifier,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.is_a,
+ obj.attrib.indent_hang,
+ obj.attrib.indent_base,
+ obj.metainfo.identifier,
+ tags,
+ _txt
+ );
+ } else {
+ o = format(q"┃ ┃",
+ obj.metainfo.is_a,
+ obj.attrib.indent_hang,
+ obj.attrib.indent_base,
+ tags,
+ _txt
+ );
+ }
+ return o;
+ }
+ string para_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ ) {
+ if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) {
+ _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├");
+ }
+ _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
+ string o = para(_txt, obj, doc_matters);
+ return o;
+ }
+ auto para_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
+ _txt = t[0].to!string;
+ string[] _endnotes = t[1];
+ string o = para(_txt, obj, doc_matters);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ string quote(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "quote");
+ _txt = font_face(_txt);
+ string o;
+ if (!(obj.metainfo.identifier.empty)) {
+ o = format(q"┃ ┃",
+ obj.metainfo.identifier,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.is_a,
+ obj.metainfo.identifier,
+ _txt
+ );
+ } else {
+ o = format(q"┃ ┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ }
+ return o;
+ }
+ string quote_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ ) {
+ _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
+ string o = quote(_txt, obj, doc_matters);
+ return o;
+ }
+ auto quote_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
+ _txt = t[0].to!string;
+ string[] _endnotes = t[1];
+ string o = quote(_txt, obj, doc_matters);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ string group(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "group");
+ _txt = font_face(_txt);
+ string o;
+ if (!(obj.metainfo.identifier.empty)) {
+ o = format(q"┃ ┃",
+ obj.metainfo.identifier,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.is_a,
+ obj.metainfo.identifier,
+ _txt
+ );
+ } else {
+ o = format(q"┃ ┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ }
+ return o;
+ }
+ string group_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
+ string o = group(_txt, obj, doc_matters);
+ return o;
+ }
+ auto group_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
+ _txt = t[0].to!string;
+ string[] _endnotes = t[1];
+ string o = group(_txt, obj, doc_matters);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ string block(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "block");
+ _txt = font_face(_txt);
+ string o;
+ if (!(obj.metainfo.identifier.empty)) {
+ o = format(q"┃ ┃",
+ obj.metainfo.identifier,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.is_a,
+ obj.metainfo.identifier,
+ _txt.stripRight
+ );
+ } else {
+ o = format(q"┃ ┃",
+ obj.metainfo.is_a,
+ _txt.stripRight
+ );
+ }
+ return o;
+ }
+ string block_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
+ string o = block(_txt, obj, doc_matters);
+ return o;
+ }
+ auto block_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
+ _txt = t[0].to!string;
+ string[] _endnotes = t[1];
+ string o = block(_txt, obj, doc_matters);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ string verse(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "verse");
+ _txt = font_face(_txt);
+ string o;
+ if (!(obj.metainfo.identifier.empty)) {
+ o = format(q"┃ ┃",
+ obj.metainfo.identifier,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.is_a,
+ obj.metainfo.identifier,
+ _txt
+ );
+ } else {
+ o = format(q"┃ ┃",
+ obj.metainfo.is_a,
+ _txt
+ );
+ }
+ return o;
+ }
+ string verse_scroll(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
+ string o = verse(_txt, obj, doc_matters);
+ return o;
+ }
+ auto verse_seg(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ string _suffix = ".html",
+ string _xml_type = "html",
+ ) {
+ auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
+ _txt = t[0].to!string;
+ string[] _endnotes = t[1];
+ string o = verse(_txt, obj, doc_matters);
+ auto u = tuple(
+ o,
+ _endnotes,
+ );
+ return u;
+ }
+ auto tablarize(O)(
+ string _txt,
+ const O obj,
+ ) {
+ string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
+ string[] _table_cols;
+ string _table;
+ string _tablenote;
+ foreach(row_idx, row; _table_rows) {
+ _table_cols = row.split(rgx.table_delimiter_col);
+ _table ~= "";
+ foreach(col_idx, cell; _table_cols) {
+ if ((_table_cols.length == 1)
+ && (_table_rows.length <= row_idx+2)) {
+ _tablenote ~= cell;
+ } else {
+ string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td";
+ string _align = ("style=\"text-align:"
+ ~ ((obj.table.column_aligns[col_idx] == "l")
+ ? "left\"" : "right\""));
+ _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table.column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">";
+ _table ~= cell;
+ _table ~= "" ~ _col_is ~ ">";
+ }
+ }
+ _table ~= " ";
+ }
+ auto t = tuple(
+ _table,
+ _tablenote,
+ );
+ return t;
+ }
+ string table(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "table");
+ string tags = _xhtml_anchor_tags(obj);
+ _txt = font_face(_txt);
+ auto t = tablarize(_txt, obj);
+ _txt = t[0];
+ string _note = t[1];
+ string o;
+ o = format(q"┃ ┃",
+ obj.metainfo.object_number,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.is_a,
+ obj.metainfo.object_number,
+ tags,
+ _txt,
+ _note
+ );
+ return o;
+ }
+ string code(O,M)(
+ string _txt,
+ const O obj,
+ M doc_matters,
+ ) {
+ assert(obj.metainfo.is_of_part == "body");
+ assert(obj.metainfo.is_of_section == "body");
+ assert(obj.metainfo.is_of_type == "block");
+ assert(obj.metainfo.is_a == "code");
+ string o;
+ string codelines(string _txt) {
+ string _codelines;
+ if (obj.code_block.linenumbers) {
+ string[] _block_lines = (_txt).split(rgx.br_newlines_linebreaks);
+ _codelines = " \n";
+ foreach (k, _line; _block_lines) {
+ if (k == 1) {
+ _codelines ~= format(q"┃ %s
+ ┃",
+ _line,
+ );
+ } else {
+ _codelines ~= format(q"┃ %s
+ ┃",
+ _line,
+ );
+ }
+ }
+ _codelines ~= " ";
+ } else {
+ _codelines = " \n";
+ _codelines ~= _txt;
+ _codelines ~= " ";
+ }
+ return _codelines;
+ }
+ if (!(obj.metainfo.identifier.empty)) {
+ o = format(q"┃ ┃",
+ obj.metainfo.identifier,
+ (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
+ obj.metainfo.is_a,
+ obj.metainfo.identifier,
+ codelines(_txt)
+ );
+ } else {
+ o = format(q"┃ ┃",
+ obj.metainfo.is_a,
+ codelines(_txt)
+ );
+ }
+ return o;
+ }
+ }
+}
diff --git a/src/doc_reform/io_out/xmls_css.d b/src/doc_reform/io_out/xmls_css.d
new file mode 100644
index 0000000..2c3eb77
--- /dev/null
+++ b/src/doc_reform/io_out/xmls_css.d
@@ -0,0 +1,4185 @@
+/++
+ default css settings
++/
+module doc_reform.io_out.xmls_css;
+template spineCss() {
+ import std.format;
+ auto spineCss(M)(M doc_matters) {
+ string _css_indent = format(q"┃
+ /* indent */
+ p.norm { }
+ p.i1 { padding-left : 1em; }
+ p.i2 { padding-left : 2em; }
+ p.i3 { padding-left : 3em; }
+ p.i4 { padding-left : 4em; }
+ p.i5 { padding-left : 5em; }
+ p.i6 { padding-left : 6em; }
+ p.i7 { padding-left : 7em; }
+ p.i8 { padding-left : 8em; }
+ p.i9 { padding-left : 9em; }
+ /* hanging indent */
+ p[indent="h0i0"] {
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p[indent="h0i1"] {
+ padding-left : 1em;
+ text-indent : -1em;
+ }
+ p[indent="h0i2"] {
+ padding-left : 2em;
+ text-indent : -2em;
+ }
+ p[indent="h0i3"] {
+ padding-left : 3em;
+ text-indent : -3em;
+ }
+ p[indent="h0i4"] {
+ padding-left : 4em;
+ text-indent : -4em;
+ }
+ p[indent="h0i5"] {
+ padding-left : 5em;
+ text-indent : -5em;
+ }
+ p[indent="h0i6"] {
+ padding-left : 6em;
+ text-indent : -6em;
+ }
+ p[indent="h0i7"] {
+ padding-left : 7em;
+ text-indent : -7em;
+ }
+ p[indent="h0i8"] {
+ padding-left : 8em;
+ text-indent : -8em;
+ }
+ p[indent="h0i9"] {
+ padding-left : 9em;
+ text-indent : -9em;
+ }
+ p[indent="h1i0"] {
+ padding-left : 0em;
+ text-indent : 1em;
+ }
+ p[indent="h1i1"] {
+ padding-left : 1em;
+ text-indent : 0em;
+ }
+ p[indent="h1i2"] {
+ padding-left : 2em;
+ text-indent : -1em;
+ }
+ p[indent="h1i3"] {
+ padding-left : 3em;
+ text-indent : -2em;
+ }
+ p[indent="h1i4"] {
+ padding-left : 4em;
+ text-indent : -3em;
+ }
+ p[indent="h1i5"] {
+ padding-left : 5em;
+ text-indent : -4em;
+ }
+ p[indent="h1i6"] {
+ padding-left : 6em;
+ text-indent : -5em;
+ }
+ p[indent="h1i7"] {
+ padding-left : 7em;
+ text-indent : -6em;
+ }
+ p[indent="h1i8"] {
+ padding-left : 8em;
+ text-indent : -7em;
+ }
+ p[indent="h1i9"] {
+ padding-left : 9em;
+ text-indent : -8em;
+ }
+ p[indent="h2i0"] {
+ padding-left : 0em;
+ text-indent : 2em;
+ }
+ p[indent="h2i1"] {
+ padding-left : 1em;
+ text-indent : 1em;
+ }
+ p[indent="h2i2"] {
+ padding-left : 2em;
+ text-indent : 0em;
+ }
+ p[indent="h2i3"] {
+ padding-left : 3em;
+ text-indent : -1em;
+ }
+ p[indent="h2i4"] {
+ padding-left : 4em;
+ text-indent : -2em;
+ }
+ p[indent="h2i5"] {
+ padding-left : 5em;
+ text-indent : -3em;
+ }
+ p[indent="h2i6"] {
+ padding-left : 6em;
+ text-indent : -4em;
+ }
+ p[indent="h2i7"] {
+ padding-left : 7em;
+ text-indent : -5em;
+ }
+ p[indent="h2i8"] {
+ padding-left : 8em;
+ text-indent : -6em;
+ }
+ p[indent="h2i9"] {
+ padding-left : 9em;
+ text-indent : -7em;
+ }
+ p[indent="h3i0"] {
+ padding-left : 0em;
+ text-indent : 3em;
+ }
+ p[indent="h3i1"] {
+ padding-left : 1em;
+ text-indent : 2em;
+ }
+ p[indent="h3i2"] {
+ padding-left : 2em;
+ text-indent : 1em;
+ }
+ p[indent="h3i3"] {
+ padding-left : 3em;
+ text-indent : 0em;
+ }
+ p[indent="h3i4"] {
+ padding-left : 4em;
+ text-indent : -1em;
+ }
+ p[indent="h3i5"] {
+ padding-left : 5em;
+ text-indent : -2em;
+ }
+ p[indent="h3i6"] {
+ padding-left : 6em;
+ text-indent : -3em;
+ }
+ p[indent="h3i7"] {
+ padding-left : 7em;
+ text-indent : -4em;
+ }
+ p[indent="h3i8"] {
+ padding-left : 8em;
+ text-indent : -5em;
+ }
+ p[indent="h3i9"] {
+ padding-left : 9em;
+ text-indent : -6em;
+ }
+ p[indent="h4i0"] {
+ padding-left : 0em;
+ text-indent : 4em;
+ }
+ p[indent="h4i1"] {
+ padding-left : 1em;
+ text-indent : 3em;
+ }
+ p[indent="h4i2"] {
+ padding-left : 2em;
+ text-indent : 2em;
+ }
+ p[indent="h4i3"] {
+ padding-left : 3em;
+ text-indent : 1em;
+ }
+ p[indent="h4i4"] {
+ padding-left : 4em;
+ text-indent : 0em;
+ }
+ p[indent="h4i5"] {
+ padding-left : 5em;
+ text-indent : -1em;
+ }
+ p[indent="h4i6"] {
+ padding-left : 6em;
+ text-indent : -2em;
+ }
+ p[indent="h4i7"] {
+ padding-left : 7em;
+ text-indent : -3em;
+ }
+ p[indent="h4i8"] {
+ padding-left : 8em;
+ text-indent : -4em;
+ }
+ p[indent="h4i9"] {
+ padding-left : 9em;
+ text-indent : -5em;
+ }
+ p[indent="h5i0"] {
+ padding-left : 0em;
+ text-indent : 5em;
+ }
+ p[indent="h5i1"] {
+ padding-left : 1em;
+ text-indent : 4em;
+ }
+ p[indent="h5i2"] {
+ padding-left : 2em;
+ text-indent : 3em;
+ }
+ p[indent="h5i3"] {
+ padding-left : 3em;
+ text-indent : 2em;
+ }
+ p[indent="h5i4"] {
+ padding-left : 4em;
+ text-indent : 1em;
+ }
+ p[indent="h5i5"] {
+ padding-left : 5em;
+ text-indent : 0em;
+ }
+ p[indent="h5i6"] {
+ padding-left : 6em;
+ text-indent : -1em;
+ }
+ p[indent="h5i7"] {
+ padding-left : 7em;
+ text-indent : -2em;
+ }
+ p[indent="h5i8"] {
+ padding-left : 8em;
+ text-indent : -3em;
+ }
+ p[indent="h5i9"] {
+ padding-left : 9em;
+ text-indent : -4em;
+ }
+ p[indent="h6i0"] {
+ padding-left : 0em;
+ text-indent : 6em;
+ }
+ p[indent="h6i1"] {
+ padding-left : 1em;
+ text-indent : 5em;
+ }
+ p[indent="h6i2"] {
+ padding-left : 2em;
+ text-indent : 4em;
+ }
+ p[indent="h6i3"] {
+ padding-left : 3em;
+ text-indent : 3em;
+ }
+ p[indent="h6i4"] {
+ padding-left : 4em;
+ text-indent : 2em;
+ }
+ p[indent="h6i5"] {
+ padding-left : 5em;
+ text-indent : 1em;
+ }
+ p[indent="h6i6"] {
+ padding-left : 6em;
+ text-indent : 0em;
+ }
+ p[indent="h6i7"] {
+ padding-left : 7em;
+ text-indent : -1em;
+ }
+ p[indent="h6i8"] {
+ padding-left : 8em;
+ text-indent : -2em;
+ }
+ p[indent="h6i9"] {
+ padding-left : 9em;
+ text-indent : -3em;
+ }
+ p[indent="h7i0"] {
+ padding-left : 0em;
+ text-indent : 7em;
+ }
+ p[indent="h7i1"] {
+ padding-left : 1em;
+ text-indent : 6em;
+ }
+ p[indent="h7i2"] {
+ padding-left : 2em;
+ text-indent : 5em;
+ }
+ p[indent="h7i3"] {
+ padding-left : 3em;
+ text-indent : 4em;
+ }
+ p[indent="h7i4"] {
+ padding-left : 4em;
+ text-indent : 3em;
+ }
+ p[indent="h7i5"] {
+ padding-left : 5em;
+ text-indent : 2em;
+ }
+ p[indent="h7i6"] {
+ padding-left : 6em;
+ text-indent : 1em;
+ }
+ p[indent="h7i7"] {
+ padding-left : 7em;
+ text-indent : 0em;
+ }
+ p[indent="h7i8"] {
+ padding-left : 8em;
+ text-indent : -1em;
+ }
+ p[indent="h7i9"] {
+ padding-left : 9em;
+ text-indent : -2em;
+ }
+ p[indent="h8i0"] {
+ padding-left : 0em;
+ text-indent : 8em;
+ }
+ p[indent="h8i1"] {
+ padding-left : 1em;
+ text-indent : 7em;
+ }
+ p[indent="h8i2"] {
+ padding-left : 2em;
+ text-indent : 6em;
+ }
+ p[indent="h8i3"] {
+ padding-left : 3em;
+ text-indent : 5em;
+ }
+ p[indent="h8i4"] {
+ padding-left : 4em;
+ text-indent : 4em;
+ }
+ p[indent="h8i5"] {
+ padding-left : 5em;
+ text-indent : 3em;
+ }
+ p[indent="h8i6"] {
+ padding-left : 6em;
+ text-indent : 2em;
+ }
+ p[indent="h8i7"] {
+ padding-left : 7em;
+ text-indent : 1em;
+ }
+ p[indent="h8i8"] {
+ padding-left : 8em;
+ text-indent : 0em;
+ }
+ p[indent="h8i9"] {
+ padding-left : 9em;
+ text-indent : -1em;
+ }
+ p[indent="h9i0"] {
+ padding-left : 0em;
+ text-indent : 9em;
+ }
+ p[indent="h9i1"] {
+ padding-left : 1em;
+ text-indent : 8em;
+ }
+ p[indent="h9i2"] {
+ padding-left : 2em;
+ text-indent : 7em;
+ }
+ p[indent="h9i3"] {
+ padding-left : 3em;
+ text-indent : 6em;
+ }
+ p[indent="h9i4"] {
+ padding-left : 4em;
+ text-indent : 5em;
+ }
+ p[indent="h9i5"] {
+ padding-left : 5em;
+ text-indent : 4em;
+ }
+ p[indent="h9i6"] {
+ padding-left : 6em;
+ text-indent : 3em;
+ }
+ p[indent="h9i7"] {
+ padding-left : 7em;
+ text-indent : 2em;
+ }
+ p[indent="h9i8"] {
+ padding-left : 8em;
+ text-indent : 1em;
+ }
+ p[indent="h9i9"] {
+ padding-left : 9em;
+ text-indent : 0em;
+ }
+┃");
+ string _color_ocn_light = (doc_matters.opt.action.ocn_hidden) ? "#FFFFFF" : "#777777";
+ string _color_ocn_dark = (doc_matters.opt.action.ocn_hidden) ? "#000000" : "#BBBBBB";
+ string _css_light_html_seg = format(q"┃
+ *{
+ padding : 0px;
+ margin : 0px;
+ }
+ body {
+ height : 100vh;
+ background-color : #FFFFFF;
+ }
+ body {
+ color : #000000;
+ background : #FFFFFF;
+ background-color : #FFFFFF;
+ }
+ a:link {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+ }
+ a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+ }
+ a.lnkocn:visited {
+ color : #32CD32;
+ text-decoration : none;
+ }
+ a.lnkocn:hover {
+ color : #777777;
+ font-size : 15px;
+ }
+ a:hover img {
+ background-color : #FFFFFF;
+ }
+ a:active {
+ color : #003399;
+ text-decoration : underline;
+ }
+ div {
+ margin-left : 0;
+ margin-right : 0;
+ }
+ div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+ }
+ div.substance {
+ width : 100%%;
+ background-color : #FFFFFF;
+ }
+ div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #FFFFFF;
+ }
+ div.endnote {
+ width : 95%%;
+ background-color : #FFFFFF;
+ }
+ div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #EEEEEE;
+ margin-right : 1em;
+ }
+ div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #EEEEEE;
+ padding-left : 1em;
+ background-color : #EEEEEE;
+ }
+ div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #FFFFFF;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #FFFFFF;
+ padding-left : 5%%;
+ }
+ div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+ }
+ div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 80%%;
+ margin : 0;
+ }
+ div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+ }
+ div.toc li ul a, li ul span.currentlink
+ {
+ font-weight : normal;
+ font-size : 90%%;
+ padding-left : 2em;
+ background-color : #EEEEEE;
+ }
+ div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #0000aa;
+ }
+ hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+ }
+ span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAAA;
+ }
+ div.toc a:visited {
+ color : #0000aa;
+ }
+ div.toc a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+ }
+ nav#toc ol {
+ list-style-type : none;
+ }
+ .norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+ }
+ p {
+ font-size : 100%%;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+ }
+ img {
+ max-width : 100%%;
+ height : auto;
+ }
+ pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+ }
+ pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #EEEEEE;
+ color : #000000;
+ font-size : 95%%;
+ line-height : 100%%;
+ }
+ pre.codeline::before {
+ counter-reset : linenum;
+ }
+ pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+ }
+ pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ /* background-color : #666666; */
+ }
+ pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+ }
+ pre.codeline span.th {
+ width : 4em;
+ }
+ pre.codeline code {
+ display : table-cell;
+ }
+ p.code {
+ border-style : none;
+ }
+ p.spaced { white-space : pre; }
+ p.block {
+ white-space : pre;
+ }
+ p.group { }
+ p.alt { }
+ p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+ }
+ p.caption {
+ text-align : left;
+ font-size : 80%%;
+ display : inline;
+ }
+ p.endnote {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ }
+ p.endnote_indent {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 2em;
+ margin-right : 15mm;
+ }
+ p.center {
+ text-align : center;
+ }
+ p.bold {
+ font-weight : bold;
+ }
+ p.bold_left {
+ font-weight : bold;
+ text-align : left;
+ }
+ p.centerbold {
+ text-align : center;
+ font-weight : bold;
+ }
+ p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+ }
+ p.small {
+ font-size : 80%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ .tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #777777;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.tiny { }
+ p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+ }
+ p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+ }
+ p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+ }
+ p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.concordance_count {
+ font-size : 80%%;
+ color : #777777;
+ display : inline;
+ margin-left : 0em;
+ }
+ p.concordance_object {
+ font-size : 80%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #EEEEEE;
+ color : #000000;
+ }
+%s
+ note { white-space : pre; }
+ label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 5px;
+ margin-right : 5px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+ }
+ tr { }
+ th,td {
+ vertical-align : top;
+ text-align : left;
+ }
+ th {
+ font-weight : bold;
+ }
+ em {
+ font-weight : bold;
+ font-style : italic;
+ }
+ p.left,th.left,td.left {
+ text-align : left;
+ }
+ p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 80%%;
+ }
+ p.right,th.right,td.right {
+ text-align : right;
+ }
+ ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+ }
+ li {
+ background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
+ }
+ ul { }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+ }
+ h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+ }
+ h0 { font-size : 125%%; }
+ h1 { font-size : 120%%; }
+ h2 { font-size : 115%%; }
+ h3 { font-size : 110%%; }
+ h4 { font-size : 105%%; }
+ h5 { font-size : 100%%; }
+ h6 { font-size : 100%%; }
+ h7 { font-size : 100%%; }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #808080;
+ }
+ h1.i { margin-left : 2em; }
+ h2.i { margin-left : 3em; }
+ h3.i { margin-left : 4em; }
+ h4.i { margin-left : 5em; }
+ h5.i { margin-left : 6em; }
+ h6.i { margin-left : 7em; }
+ h7.i { margin-left : 8em; }
+ h8.i { margin-left : 9em; }
+ h9.i { margin-left : 10em; }
+ .toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+ }
+ h0.toc {
+ margin-left : 1em;
+ font-size : 120%%;
+ line-height : 150%%;
+ }
+ h1.toc {
+ margin-left : 1em;
+ font-size : 115%%;
+ line-height : 150%%;
+ }
+ h2.toc {
+ margin-left : 2em;
+ font-size : 110%%;
+ line-height : 140%%;
+ }
+ h3.toc {
+ margin-left : 3em;
+ font-size : 105%%;
+ line-height : 120%%;
+ }
+ h4.toc {
+ margin-left : 4em;
+ font-size : 100%%;
+ line-height : 120%%;
+ }
+ h5.toc {
+ margin-left : 5em;
+ font-size : 95%%;
+ line-height : 110%%;
+ }
+ h6.toc {
+ margin-left : 6em;
+ font-size : 90%%;
+ line-height : 110%%;
+ }
+ h7.toc {
+ margin-left : 7em;
+ font-size : 85%%;
+ line-height : 100%%;
+ }
+ .subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+ }
+ h5.subtoc {
+ margin-left : 2em;
+ font-size : 80%%;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ }
+ h6.subtoc {
+ margin-left : 3em;
+ font-size : 75%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ h7.subtoc {
+ margin-left : 4em;
+ font-size : 70%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ .icon-bar {
+ width : 100%%;
+ overflow : auto;
+ margin : 0em 0em 0em;
+ }
+ .left-bar {
+ width : 85%%;
+ float : left;
+ display : inline;
+ overflow : auto;
+ }
+ .toc-button {
+ position : absolute;
+ top : 8px;
+ width : 2em;
+ height : 2em;
+ border-radius : 50%%;
+ background : #CCCCCC;
+ fill : #333333;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ }
+ .toc-button svg {
+ position : relative;
+ left : 25%%;
+ top : 25%%;
+ width : 150%%;
+ height : 150%%;
+ }
+ .toc-button p {
+ vertical-align : center;
+ font-size : 120%%;
+ }
+ .prev-next-button {
+ position : absolute;
+ top : 8px;
+ width : 2em;
+ height : 2em;
+ border-radius : 50%%;
+ background : #CCCCCC;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ }
+ .prev-next-button svg {
+ position : relative;
+ left : 20%%;
+ top : 20%%;
+ width : 60%%;
+ height : 60%%;
+ }
+ .menu {
+ right : 6em;
+ }
+ .previous {
+ right : 3em;
+ }
+ .next {
+ right : 0em;
+ }
+ .arrow {
+ fill : #333333;
+ }
+ .minitoc {
+ line-height : 100%%;
+ font-size : 90%%;
+ margin-top : 6px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ /* flex */
+ .flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #FFFFFF;
+ }
+ .flex-menu-option {
+ background-color : #FFFFFF;
+ margin-right : 4px;
+ }
+ .flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #FFFFFF;
+ }
+ .flex-list-item {
+ background-color : #FFFFFF;
+ margin : 4px;
+ }
+ /* grid */
+ .wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #FFFFFF;
+ }
+ .delimit {
+ border-style : none;
+ border-color : #FFFFFF;
+ padding : 10px;
+ }
+ .headband {
+ grid-area : headband;
+ background-color : #FFFFFF;
+ }
+ .doc_header {
+ grid-area : doc_header;
+ }
+ .doc_title {
+ grid-area : doc_title;
+ }
+ .doc_toc {
+ grid-area : doc_toc;
+ }
+ .doc_prefix {
+ grid-area : doc_prefix;
+ }
+ .doc_intro {
+ grid-area : doc_intro;
+ }
+ .doc_body {
+ grid-area : doc_body;
+ }
+ .doc_endnotes {
+ grid-area : doc_endnotes;
+ }
+ .doc_glossary {
+ grid-area : doc_glossary;
+ }
+ .doc_biblio {
+ grid-area : doc_biblio;
+ }
+ .doc_bookindex {
+ grid-area : doc_bookindex;
+ }
+ .doc_blurb {
+ grid-area : doc_blurb;
+ }
+ .doc_suffix {
+ grid-area : doc_suffix;
+ }
+ .nav-ul {
+ list-style : none;
+ float : left;
+ }
+ .nav-li {
+ float : left;
+ padding-right : 0.7em;
+ }
+ .nav-li a {
+ text-decoration : none;
+ color : #FFFFFF;
+ }
+ footer {
+ background-color : #00704E;
+ }
+┃",
+ _color_ocn_light,
+ _css_indent,
+ _color_ocn_light,
+);
+ string _css_dark_html_seg = format(q"┃
+ *{
+ padding : 0px;
+ margin : 0px;
+ }
+ body {
+ height : 100vh;
+ background-color : #000000;
+ }
+ body {
+ color : #CCCCCC;
+ background : #000000;
+ background-color : #000000;
+ }
+ a:link {
+ color : #FFFFFF;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #999999;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #555555;
+ }
+ a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+ }
+ a.lnkocn:visited {
+ color : #9ACD32;
+ text-decoration : none;
+ }
+ a.lnkocn:hover {
+ color : #BBBBBB;
+ font-size : 15px;
+ }
+ a:hover img {
+ background-color : #000000;
+ }
+ a:active {
+ color : #888888;
+ text-decoration : underline;
+ }
+ div {
+ margin-left : 0;
+ margin-right : 0;
+ }
+ div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+ }
+ div.substance {
+ width : 100%%;
+ background-color : #000000;
+ }
+ div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #000000;
+ }
+ div.endnote {
+ width : 95%%;
+ background-color : #000000;
+ }
+ div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #111111;
+ margin-right : 1em;
+ }
+ div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #111111;
+ padding-left : 1em;
+ background-color : #111111;
+ }
+ div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #000000;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #000000;
+ padding-left : 5%%;
+ }
+ div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+ }
+ div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 80%%;
+ margin : 0;
+ }
+ div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+ }
+ div.toc li ul a, li ul span.currentlink
+ {
+ font-weight : normal;
+ font-size : 90%%;
+ padding-left : 2em;
+ background-color : #111111;
+ }
+ div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #FF00AA;
+ }
+ hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+ }
+ span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAF9;
+ }
+ div.toc a:visited {
+ color : #FF00AA;
+ }
+ div.toc a:hover {
+ color : #CCCCCC;
+ background-color : #F9F9AA;
+ }
+ nav#toc ol {
+ list-style-type : none;
+ }
+ .norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+ }
+ p {
+ font-size : 100%%;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+ }
+ img {
+ max-width : 100%%;
+ height : auto;
+ }
+ pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+ }
+ pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #555555;
+ color : #DDDDDD;
+ font-size : 95%%;
+ line-height : 100%%;
+ }
+ pre.codeline::before {
+ counter-reset : linenum;
+ }
+ pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+ }
+ pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ }
+ pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+ }
+ pre.codeline span.th {
+ width : 4em;
+ }
+ pre.codeline code {
+ display : table-cell;
+ }
+ p.code {
+ border-style : none;
+ }
+ p.spaced { white-space : pre; }
+ p.block {
+ white-space : pre;
+ }
+ p.group { }
+ p.alt { }
+ p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+ }
+ p.caption {
+ text-align : left;
+ font-size : 80%%;
+ display : inline;
+ }
+ p.endnote {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ }
+ p.endnote_indent {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 2em;
+ margin-right : 15mm;
+ }
+ p.center {
+ text-align : center;
+ }
+ p.bold {
+ font-weight : bold;
+ }
+ p.bold_left {
+ font-weight : bold;
+ text-align : left;
+ }
+ p.centerbold {
+ text-align : center;
+ font-weight : bold;
+ }
+ p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+ }
+ p.small {
+ font-size : 80%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ .tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #EEEEEE;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.tiny { }
+ p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+ }
+ p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+ }
+ p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+ }
+ p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.concordance_count {
+ font-size : 80%%;
+ color : #555555;
+ display : inline;
+ margin-left : 0em;
+ }
+ p.concordance_object {
+ font-size : 80%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #555555;
+ color : #DDDDDD;
+ }
+%s
+ note { white-space : pre; }
+ label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 5px;
+ margin-right : 5px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+ }
+ tr { }
+ th,td {
+ vertical-align : top;
+ text-align : left;
+ }
+ th {
+ font-weight : bold;
+ }
+ em {
+ font-weight : bold;
+ font-style : italic;
+ }
+ p.left,th.left,td.left {
+ text-align : left;
+ }
+ p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 80%%;
+ }
+ p.right,th.right,td.right {
+ text-align : right;
+ }
+ ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+ }
+ li {
+ background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
+ }
+ ul { }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+ }
+ h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+ }
+ h0 { font-size : 125%%; }
+ h1 { font-size : 120%%; }
+ h2 { font-size : 115%%; }
+ h3 { font-size : 110%%; }
+ h4 { font-size : 105%%; }
+ h5 { font-size : 100%%; }
+ h6 { font-size : 100%%; }
+ h7 { font-size : 100%%; }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #999999;
+ }
+ h1.i { margin-left : 2em; }
+ h2.i { margin-left : 3em; }
+ h3.i { margin-left : 4em; }
+ h4.i { margin-left : 5em; }
+ h5.i { margin-left : 6em; }
+ h6.i { margin-left : 7em; }
+ h7.i { margin-left : 8em; }
+ h8.i { margin-left : 9em; }
+ h9.i { margin-left : 10em; }
+ .toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+ }
+ h0.toc {
+ margin-left : 1em;
+ font-size : 120%%;
+ line-height : 150%%;
+ }
+ h1.toc {
+ margin-left : 1em;
+ font-size : 115%%;
+ line-height : 150%%;
+ }
+ h2.toc {
+ margin-left : 2em;
+ font-size : 110%%;
+ line-height : 140%%;
+ }
+ h3.toc {
+ margin-left : 3em;
+ font-size : 105%%;
+ line-height : 120%%;
+ }
+ h4.toc {
+ margin-left : 4em;
+ font-size : 100%%;
+ line-height : 120%%;
+ }
+ h5.toc {
+ margin-left : 5em;
+ font-size : 95%%;
+ line-height : 110%%;
+ }
+ h6.toc {
+ margin-left : 6em;
+ font-size : 90%%;
+ line-height : 110%%;
+ }
+ h7.toc {
+ margin-left : 7em;
+ font-size : 85%%;
+ line-height : 100%%;
+ }
+ .subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+ }
+ h5.subtoc {
+ margin-left : 2em;
+ font-size : 80%%;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ }
+ h6.subtoc {
+ margin-left : 3em;
+ font-size : 75%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ h7.subtoc {
+ margin-left : 4em;
+ font-size : 70%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ .icon-bar {
+ width : 100%%;
+ overflow : auto;
+ margin : 0em 0em 0em;
+ }
+ .left-bar {
+ width : 85%%;
+ float : left;
+ display : inline;
+ overflow : auto;
+ }
+ .toc-button {
+ position : absolute;
+ top : 8px;
+ width : 2em;
+ height : 2em;
+ border-radius : 50%%;
+ background : #555555;
+ fill : #DDDDDD;
+ box-shadow : 0 2px 5px #EEEEEE inset;
+ }
+ .toc-button svg {
+ position : relative;
+ left : 25%%;
+ top : 25%%;
+ width : 150%%;
+ height : 150%%;
+ }
+ .toc-button p {
+ vertical-align : center;
+ font-size : 120%%;
+ }
+ .prev-next-button {
+ position : absolute;
+ top : 8px;
+ width : 2em;
+ height : 2em;
+ border-radius : 50%%;
+ background : #555555;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ }
+ .prev-next-button svg {
+ position : relative;
+ left : 20%%;
+ top : 20%%;
+ width : 60%%;
+ height : 60%%;
+ }
+ .menu {
+ right : 6em;
+ }
+ .previous {
+ right : 3em;
+ }
+ .next {
+ right : 0em;
+ }
+ .arrow {
+ fill : #DDDDDD;
+ }
+ .minitoc {
+ line-height : 100%%;
+ font-size : 90%%;
+ margin-top : 6px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ /* flex */
+ .flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #000000;
+ }
+ .flex-menu-option {
+ background-color : #000000;
+ margin-right : 4px;
+ }
+ .flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #000000;
+ }
+ .flex-list-item {
+ background-color : #000000;
+ margin : 4px;
+ }
+ /* grid */
+ .wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #000000;
+ }
+ .delimit {
+ border-style : none;
+ border-color : #000000;
+ padding : 10px;
+ }
+ .headband {
+ grid-area : headband;
+ background-color : #000000;
+ }
+ .doc_header {
+ grid-area : doc_header;
+ }
+ .doc_title {
+ grid-area : doc_title;
+ }
+ .doc_toc {
+ grid-area : doc_toc;
+ }
+ .doc_prefix {
+ grid-area : doc_prefix;
+ }
+ .doc_intro {
+ grid-area : doc_intro;
+ }
+ .doc_body {
+ grid-area : doc_body;
+ }
+ .doc_endnotes {
+ grid-area : doc_endnotes;
+ }
+ .doc_glossary {
+ grid-area : doc_glossary;
+ }
+ .doc_biblio {
+ grid-area : doc_biblio;
+ }
+ .doc_bookindex {
+ grid-area : doc_bookindex;
+ }
+ .doc_blurb {
+ grid-area : doc_blurb;
+ }
+ .doc_suffix {
+ grid-area : doc_suffix;
+ }
+ .nav-ul {
+ list-style : none;
+ float : left;
+ }
+ .nav-li {
+ float : left;
+ padding-right : 0.7em;
+ }
+ .nav-li a {
+ text-decoration : none;
+ color : #000000;
+ }
+ footer {
+ background-color : #FF704E;
+ }
+┃",
+ _color_ocn_dark,
+ _css_indent,
+ _color_ocn_dark,
+);
+ string _css_light_html_scroll = format(q"┃
+ *{
+ padding : 0px;
+ margin : 0px;
+ }
+ body {
+ height : 100vh;
+ background-color : #FFFFFF;
+ }
+ body {
+ color : #000000;
+ background : #FFFFFF;
+ background-color : #FFFFFF;
+ }
+ a:link {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+ }
+ a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+ }
+ a.lnkocn:visited {
+ color : #32CD32;
+ text-decoration : none;
+ }
+ a.lnkocn:hover {
+ color : #777777;
+ font-size : 15px;
+ }
+ a:hover img {
+ background-color : #FFFFFF;
+ }
+ a:active {
+ color : #003399;
+ text-decoration : underline;
+ }
+ div {
+ margin-left : 0;
+ margin-right : 0;
+ }
+ div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+ }
+ div.substance {
+ width : 100%%;
+ background-color : #FFFFFF;
+ }
+ div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #FFFFFF;
+ }
+ div.endnote {
+ width : 95%%;
+ background-color : #FFFFFF;
+ }
+ div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #EEEEEE;
+ margin-right : 1em;
+ }
+ div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #EEEEEE;
+ padding-left : 1em;
+ background-color : #EEEEEE;
+ }
+ div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #FFFFFF;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #FFFFFF;
+ padding-left : 5%%;
+ }
+ div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+ }
+ div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 80%%;
+ margin : 0;
+ }
+ div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+ }
+ div.toc li ul a, li ul span.currentlink
+ {
+ font-weight : normal;
+ font-size : 90%%;
+ padding-left : 2em;
+ background-color : #EEEEEE;
+ }
+ div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #0000aa;
+ }
+ hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+ }
+ span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAAA;
+ }
+ div.toc a:visited {
+ color : #0000aa;
+ }
+ div.toc a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+ }
+ nav#toc ol {
+ list-style-type : none;
+ }
+ .norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+ }
+ p {
+ font-size : 100%%;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+ }
+ img {
+ max-width : 100%%;
+ height : auto;
+ }
+ pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+ }
+ pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #EEEEEE;
+ color : #000000;
+ font-size : 95%%;
+ line-height : 100%%;
+ }
+ pre.codeline::before {
+ counter-reset : linenum;
+ }
+ pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+ }
+ pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ /* background-color : #666666; */
+ }
+ pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+ }
+ pre.codeline span.th {
+ width : 4em;
+ }
+ pre.codeline code {
+ display : table-cell;
+ }
+ p.code {
+ border-style : none;
+ }
+ p.spaced { white-space : pre; }
+ p.block {
+ white-space : pre;
+ }
+ p.group { }
+ p.alt { }
+ p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+ }
+ p.caption {
+ text-align : left;
+ font-size : 80%%;
+ display : inline;
+ }
+ p.endnote {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ }
+ p.endnote_indent {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 2em;
+ margin-right : 15mm;
+ }
+ p.center {
+ text-align : center;
+ }
+ p.bold {
+ font-weight : bold;
+ }
+ p.bold_left {
+ font-weight : bold;
+ text-align : left;
+ }
+ p.centerbold {
+ text-align : center;
+ font-weight : bold;
+ }
+ p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+ }
+ p.small {
+ font-size : 80%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ .tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #777777;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.tiny { }
+ p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+ }
+ p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+ }
+ p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+ }
+ p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.concordance_count {
+ font-size : 80%%;
+ color : #777777;
+ display : inline;
+ margin-left : 0em;
+ }
+ p.concordance_object {
+ font-size : 80%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #EEEEEE;
+ color : #000000;
+ }
+%s
+ note { white-space : pre; }
+ label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 5px;
+ margin-right : 5px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+ }
+ tr { }
+ th,td {
+ vertical-align : top;
+ text-align : left;
+ }
+ th {
+ font-weight : bold;
+ }
+ em {
+ font-weight : bold;
+ font-style : italic;
+ }
+ p.left,th.left,td.left {
+ text-align : left;
+ }
+ p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 80%%;
+ }
+ p.right,th.right,td.right {
+ text-align : right;
+ }
+ ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+ }
+ li {
+ background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
+ }
+ ul { }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+ }
+ h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+ }
+ h0 { font-size : 125%%; }
+ h1 { font-size : 120%%; }
+ h2 { font-size : 115%%; }
+ h3 { font-size : 110%%; }
+ h4 { font-size : 105%%; }
+ h5 { font-size : 100%%; }
+ h6 { font-size : 100%%; }
+ h7 { font-size : 100%%; }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #808080;
+ }
+ h1.i { margin-left : 2em; }
+ h2.i { margin-left : 3em; }
+ h3.i { margin-left : 4em; }
+ h4.i { margin-left : 5em; }
+ h5.i { margin-left : 6em; }
+ h6.i { margin-left : 7em; }
+ h7.i { margin-left : 8em; }
+ h8.i { margin-left : 9em; }
+ h9.i { margin-left : 10em; }
+ .toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+ }
+ h0.toc {
+ margin-left : 1em;
+ font-size : 120%%;
+ line-height : 150%%;
+ }
+ h1.toc {
+ margin-left : 1em;
+ font-size : 115%%;
+ line-height : 150%%;
+ }
+ h2.toc {
+ margin-left : 2em;
+ font-size : 110%%;
+ line-height : 140%%;
+ }
+ h3.toc {
+ margin-left : 3em;
+ font-size : 105%%;
+ line-height : 120%%;
+ }
+ h4.toc {
+ margin-left : 4em;
+ font-size : 100%%;
+ line-height : 120%%;
+ }
+ h5.toc {
+ margin-left : 5em;
+ font-size : 95%%;
+ line-height : 110%%;
+ }
+ h6.toc {
+ margin-left : 6em;
+ font-size : 90%%;
+ line-height : 110%%;
+ }
+ h7.toc {
+ margin-left : 7em;
+ font-size : 85%%;
+ line-height : 100%%;
+ }
+ .subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+ }
+ h5.subtoc {
+ margin-left : 2em;
+ font-size : 80%%;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ }
+ h6.subtoc {
+ margin-left : 3em;
+ font-size : 75%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ h7.subtoc {
+ margin-left : 4em;
+ font-size : 70%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ /* flex */
+ .flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #FFFFFF;
+ }
+ .flex-menu-option {
+ background-color : #FFFFFF;
+ margin-right : 4px;
+ }
+ .flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #FFFFFF;
+ }
+ .flex-list-item {
+ background-color : #FFFFFF;
+ margin : 4px;
+ }
+ /* grid */
+ .wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #FFFFFF;
+ }
+ .delimit {
+ border-style : none;
+ border-color : #FFFFFF;
+ padding : 10px;
+ }
+ .headband {
+ grid-area : headband;
+ background-color : #FFFFFF;
+ }
+ .doc_header {
+ grid-area : doc_header;
+ }
+ .doc_title {
+ grid-area : doc_title;
+ }
+ .doc_toc {
+ grid-area : doc_toc;
+ }
+ .doc_prefix {
+ grid-area : doc_prefix;
+ }
+ .doc_intro {
+ grid-area : doc_intro;
+ }
+ .doc_body {
+ grid-area : doc_body;
+ }
+ .doc_endnotes {
+ grid-area : doc_endnotes;
+ }
+ .doc_glossary {
+ grid-area : doc_glossary;
+ }
+ .doc_biblio {
+ grid-area : doc_biblio;
+ }
+ .doc_bookindex {
+ grid-area : doc_bookindex;
+ }
+ .doc_blurb {
+ grid-area : doc_blurb;
+ }
+ .doc_suffix {
+ grid-area : doc_suffix;
+ }
+ .nav-ul {
+ list-style : none;
+ float : left;
+ }
+ .nav-li {
+ float : left;
+ padding-right : 0.7em;
+ }
+ .nav-li a {
+ text-decoration : none;
+ color : #FFFFFF;
+ }
+ footer {
+ background-color : #00704E;
+ }
+┃",
+ _color_ocn_light,
+ _css_indent,
+ _color_ocn_light,
+);
+ string _css_dark_html_scroll = format(q"┃
+ *{
+ padding : 0px;
+ margin : 0px;
+ }
+ body {
+ height : 100vh;
+ background-color : #000000;
+ }
+ body {
+ color : #CCCCCC;
+ background : #000000;
+ background-color : #000000;
+ }
+ a:link {
+ color : #FFFFFF;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #999999;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #555555;
+ }
+ a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+ }
+ a.lnkocn:visited {
+ color : #9ACD32;
+ text-decoration : none;
+ }
+ a.lnkocn:hover {
+ color : #BBBBBB;
+ font-size : 15px;
+ }
+ a:hover img {
+ background-color : #000000;
+ }
+ a:active {
+ color : #888888;
+ text-decoration : underline;
+ }
+ div {
+ margin-left : 0;
+ margin-right : 0;
+ }
+ div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+ }
+ div.substance {
+ width : 100%%;
+ background-color : #000000;
+ }
+ div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #000000;
+ }
+ div.endnote {
+ width : 95%%;
+ background-color : #000000;
+ }
+ div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #111111;
+ margin-right : 1em;
+ }
+ div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #111111;
+ padding-left : 1em;
+ background-color : #111111;
+ }
+ div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #000000;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #000000;
+ padding-left : 5%%;
+ }
+ div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+ }
+ div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 80%%;
+ margin : 0;
+ }
+ div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+ }
+ div.toc li ul a, li ul span.currentlink
+ {
+ font-weight : normal;
+ font-size : 90%%;
+ padding-left : 2em;
+ background-color : #111111;
+ }
+ div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #FF00AA;
+ }
+ hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+ }
+ span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAF9;
+ }
+ div.toc a:visited {
+ color : #FF00AA;
+ }
+ div.toc a:hover {
+ color : #CCCCCC;
+ background-color : #F9F9AA;
+ }
+ nav#toc ol {
+ list-style-type : none;
+ }
+ .norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+ }
+ p {
+ font-size : 100%%;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+ }
+ img {
+ max-width : 100%%;
+ height : auto;
+ }
+ pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+ }
+ pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #555555;
+ color : #DDDDDD;
+ font-size : 95%%;
+ line-height : 100%%;
+ }
+ pre.codeline::before {
+ counter-reset : linenum;
+ }
+ pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+ }
+ pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ }
+ pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+ }
+ pre.codeline span.th {
+ width : 4em;
+ }
+ pre.codeline code {
+ display : table-cell;
+ }
+ p.code {
+ border-style : none;
+ }
+ p.spaced { white-space : pre; }
+ p.block {
+ white-space : pre;
+ }
+ p.group { }
+ p.alt { }
+ p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+ }
+ p.caption {
+ text-align : left;
+ font-size : 80%%;
+ display : inline;
+ }
+ p.endnote {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ }
+ p.endnote_indent {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 2em;
+ margin-right : 15mm;
+ }
+ p.center {
+ text-align : center;
+ }
+ p.bold {
+ font-weight : bold;
+ }
+ p.bold_left {
+ font-weight : bold;
+ text-align : left;
+ }
+ p.centerbold {
+ text-align : center;
+ font-weight : bold;
+ }
+ p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+ }
+ p.small {
+ font-size : 80%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ .tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #EEEEEE;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.tiny { }
+ p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+ }
+ p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+ }
+ p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+ }
+ p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.concordance_count {
+ font-size : 80%%;
+ color : #555555;
+ display : inline;
+ margin-left : 0em;
+ }
+ p.concordance_object {
+ font-size : 80%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #555555;
+ color : #DDDDDD;
+ }
+%s
+ note { white-space : pre; }
+ label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 5px;
+ margin-right : 5px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+ }
+ tr { }
+ th,td {
+ vertical-align : top;
+ text-align : left;
+ }
+ th {
+ font-weight : bold;
+ }
+ em {
+ font-weight : bold;
+ font-style : italic;
+ }
+ p.left,th.left,td.left {
+ text-align : left;
+ }
+ p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 80%%;
+ }
+ p.right,th.right,td.right {
+ text-align : right;
+ }
+ ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+ }
+ li {
+ background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
+ }
+ ul { }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+ }
+ h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+ }
+ h0 { font-size : 125%%; }
+ h1 { font-size : 120%%; }
+ h2 { font-size : 115%%; }
+ h3 { font-size : 110%%; }
+ h4 { font-size : 105%%; }
+ h5 { font-size : 100%%; }
+ h6 { font-size : 100%%; }
+ h7 { font-size : 100%%; }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #999999;
+ }
+ h1.i { margin-left : 2em; }
+ h2.i { margin-left : 3em; }
+ h3.i { margin-left : 4em; }
+ h4.i { margin-left : 5em; }
+ h5.i { margin-left : 6em; }
+ h6.i { margin-left : 7em; }
+ h7.i { margin-left : 8em; }
+ h8.i { margin-left : 9em; }
+ h9.i { margin-left : 10em; }
+ .toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+ }
+ h0.toc {
+ margin-left : 1em;
+ font-size : 120%%;
+ line-height : 150%%;
+ }
+ h1.toc {
+ margin-left : 1em;
+ font-size : 115%%;
+ line-height : 150%%;
+ }
+ h2.toc {
+ margin-left : 2em;
+ font-size : 110%%;
+ line-height : 140%%;
+ }
+ h3.toc {
+ margin-left : 3em;
+ font-size : 105%%;
+ line-height : 120%%;
+ }
+ h4.toc {
+ margin-left : 4em;
+ font-size : 100%%;
+ line-height : 120%%;
+ }
+ h5.toc {
+ margin-left : 5em;
+ font-size : 95%%;
+ line-height : 110%%;
+ }
+ h6.toc {
+ margin-left : 6em;
+ font-size : 90%%;
+ line-height : 110%%;
+ }
+ h7.toc {
+ margin-left : 7em;
+ font-size : 85%%;
+ line-height : 100%%;
+ }
+ .subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+ }
+ h5.subtoc {
+ margin-left : 2em;
+ font-size : 80%%;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ }
+ h6.subtoc {
+ margin-left : 3em;
+ font-size : 75%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ h7.subtoc {
+ margin-left : 4em;
+ font-size : 70%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ /* flex */
+ .flex-menu-bar {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-flex-wrap : wrap;
+ -webkit-align-items : center;
+ align-items : center;
+ width : 100%%;
+ margin-left : 5%%;
+ margin-right : 2%%;
+ background-color : #000000;
+ }
+ .flex-menu-option {
+ background-color : #000000;
+ margin-right : 4px;
+ }
+ .flex-list {
+ display : -webkit-flex;
+ display : flex;
+ -webkit-align-items : center;
+ display : block;
+ align-items : center;
+ width : 100%%;
+ background-color : #000000;
+ }
+ .flex-list-item {
+ background-color : #000000;
+ margin : 4px;
+ }
+ /* grid */
+ .wrapper {
+ display : grid;
+ grid-template-columns : 100%%;
+ grid-template-areas :
+ "headband"
+ "doc_header"
+ "doc_title"
+ "doc_toc"
+ "doc_prefix"
+ "doc_intro"
+ "doc_body"
+ "doc_endnotes"
+ "doc_glossary"
+ "doc_biblio"
+ "doc_bookindex"
+ "doc_blurb"
+ "doc_suffix";
+ margin : 0px;
+ padding : 0px;
+ background-color : #000000;
+ }
+ .delimit {
+ border-style : none;
+ border-color : #000000;
+ padding : 10px;
+ }
+ .headband {
+ grid-area : headband;
+ background-color : #000000;
+ }
+ .doc_header {
+ grid-area : doc_header;
+ }
+ .doc_title {
+ grid-area : doc_title;
+ }
+ .doc_toc {
+ grid-area : doc_toc;
+ }
+ .doc_prefix {
+ grid-area : doc_prefix;
+ }
+ .doc_intro {
+ grid-area : doc_intro;
+ }
+ .doc_body {
+ grid-area : doc_body;
+ }
+ .doc_endnotes {
+ grid-area : doc_endnotes;
+ }
+ .doc_glossary {
+ grid-area : doc_glossary;
+ }
+ .doc_biblio {
+ grid-area : doc_biblio;
+ }
+ .doc_bookindex {
+ grid-area : doc_bookindex;
+ }
+ .doc_blurb {
+ grid-area : doc_blurb;
+ }
+ .doc_suffix {
+ grid-area : doc_suffix;
+ }
+ .nav-ul {
+ list-style : none;
+ float : left;
+ }
+ .nav-li {
+ float : left;
+ padding-right : 0.7em;
+ }
+ .nav-li a {
+ text-decoration : none;
+ color : #000000;
+ }
+ footer {
+ background-color : #FF704E;
+ }
+┃",
+ _color_ocn_dark,
+ _css_indent,
+ _color_ocn_dark,
+);
+ string _css_light_epub = format(q"┃
+ *{
+ padding : 0px;
+ margin : 0px;
+ }
+ body {
+ height : 100vh;
+ background-color : #FFFFFF;
+ }
+ body {
+ color : #000000;
+ background : #FFFFFF;
+ background-color : #FFFFFF;
+ }
+ a:link {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #003399;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+ }
+ a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+ }
+ a.lnkocn:visited {
+ color : #32CD32;
+ text-decoration : none;
+ }
+ a.lnkocn:hover {
+ color : #777777;
+ font-size : 15px;
+ }
+ a:hover img {
+ background-color : #FFFFFF;
+ }
+ a:active {
+ color : #003399;
+ text-decoration : underline;
+ }
+ div {
+ margin-left : 0;
+ margin-right : 0;
+ }
+ div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+ }
+ div.substance {
+ width : 100%%;
+ background-color : #FFFFFF;
+ }
+ div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #FFFFFF;
+ }
+ div.endnote {
+ width : 95%%;
+ background-color : #FFFFFF;
+ }
+ div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #EEEEEE;
+ margin-right : 1em;
+ }
+ div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #EEEEEE;
+ padding-left : 1em;
+ background-color : #EEEEEE;
+ }
+ div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #FFFFFF;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #FFFFFF;
+ padding-left : 5%%;
+ }
+ div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+ }
+ div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 80%%;
+ margin : 0;
+ }
+ div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+ }
+ div.toc li ul a, li ul span.currentlink
+ {
+ font-weight : normal;
+ font-size : 90%%;
+ padding-left : 2em;
+ background-color : #EEEEEE;
+ }
+ div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #0000aa;
+ }
+ hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+ }
+ span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAAA;
+ }
+ div.toc a:visited {
+ color : #0000aa;
+ }
+ div.toc a:hover {
+ color : #000000;
+ background-color : #F9F9AA;
+ }
+ nav#toc ol {
+ list-style-type : none;
+ }
+ .norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+ }
+ p {
+ font-size : 100%%;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+ }
+ img {
+ max-width : 100%%;
+ height : auto;
+ }
+ pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+ }
+ pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #EEEEEE;
+ color : #000000;
+ font-size : 95%%;
+ line-height : 100%%;
+ }
+ pre.codeline::before {
+ counter-reset : linenum;
+ }
+ pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+ }
+ pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ /* background-color : #666666; */
+ }
+ pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+ }
+ pre.codeline span.th {
+ width : 4em;
+ }
+ pre.codeline code {
+ display : table-cell;
+ }
+ p.code {
+ border-style : none;
+ }
+ p.spaced { white-space : pre; }
+ p.block {
+ white-space : pre;
+ }
+ p.group { }
+ p.alt { }
+ p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+ }
+ p.caption {
+ text-align : left;
+ font-size : 80%%;
+ display : inline;
+ }
+ p.endnote {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ }
+ p.endnote_indent {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 2em;
+ margin-right : 15mm;
+ }
+ p.center {
+ text-align : center;
+ }
+ p.bold {
+ font-weight : bold;
+ }
+ p.bold_left {
+ font-weight : bold;
+ text-align : left;
+ }
+ p.centerbold {
+ text-align : center;
+ font-weight : bold;
+ }
+ p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+ }
+ p.small {
+ font-size : 80%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ .tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #777777;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.tiny { }
+ p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+ }
+ p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+ }
+ p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+ }
+ p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.concordance_count {
+ font-size : 80%%;
+ color : #777777;
+ display : inline;
+ margin-left : 0em;
+ }
+ p.concordance_object {
+ font-size : 80%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #EEEEEE;
+ color : #000000;
+ }
+%s
+ note { white-space : pre; }
+ label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 5px;
+ margin-right : 5px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+ }
+ tr { }
+ th,td {
+ vertical-align : top;
+ text-align : left;
+ }
+ th {
+ font-weight : bold;
+ }
+ em {
+ font-weight : bold;
+ font-style : italic;
+ }
+ p.left,th.left,td.left {
+ text-align : left;
+ }
+ p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 80%%;
+ }
+ p.right,th.right,td.right {
+ text-align : right;
+ }
+ ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+ }
+ li {
+ background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
+ }
+ ul { }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+ }
+ h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+ }
+ h0 { font-size : 125%%; }
+ h1 { font-size : 120%%; }
+ h2 { font-size : 115%%; }
+ h3 { font-size : 110%%; }
+ h4 { font-size : 105%%; }
+ h5 { font-size : 100%%; }
+ h6 { font-size : 100%%; }
+ h7 { font-size : 100%%; }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #808080;
+ }
+ h1.i { margin-left : 2em; }
+ h2.i { margin-left : 3em; }
+ h3.i { margin-left : 4em; }
+ h4.i { margin-left : 5em; }
+ h5.i { margin-left : 6em; }
+ h6.i { margin-left : 7em; }
+ h7.i { margin-left : 8em; }
+ h8.i { margin-left : 9em; }
+ h9.i { margin-left : 10em; }
+ .toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+ }
+ h0.toc {
+ margin-left : 1em;
+ font-size : 120%%;
+ line-height : 150%%;
+ }
+ h1.toc {
+ margin-left : 1em;
+ font-size : 115%%;
+ line-height : 150%%;
+ }
+ h2.toc {
+ margin-left : 2em;
+ font-size : 110%%;
+ line-height : 140%%;
+ }
+ h3.toc {
+ margin-left : 3em;
+ font-size : 105%%;
+ line-height : 120%%;
+ }
+ h4.toc {
+ margin-left : 4em;
+ font-size : 100%%;
+ line-height : 120%%;
+ }
+ h5.toc {
+ margin-left : 5em;
+ font-size : 95%%;
+ line-height : 110%%;
+ }
+ h6.toc {
+ margin-left : 6em;
+ font-size : 90%%;
+ line-height : 110%%;
+ }
+ h7.toc {
+ margin-left : 7em;
+ font-size : 85%%;
+ line-height : 100%%;
+ }
+ .subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+ }
+ h5.subtoc {
+ margin-left : 2em;
+ font-size : 80%%;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ }
+ h6.subtoc {
+ margin-left : 3em;
+ font-size : 75%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ h7.subtoc {
+ margin-left : 4em;
+ font-size : 70%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+
+┃",
+ _color_ocn_light,
+ _css_indent,
+ _color_ocn_light,
+);
+ string _css_dark_epub = format(q"┃
+ *{
+ padding : 0px;
+ margin : 0px;
+ }
+ body {
+ height : 100vh;
+ background-color : #000000;
+ }
+ body {
+ color : #CCCCCC;
+ background : #000000;
+ background-color : #000000;
+ }
+ a:link {
+ color : #FFFFFF;
+ text-decoration : none;
+ }
+ a:visited {
+ color : #999999;
+ text-decoration : none;
+ }
+ a:hover {
+ color : #000000;
+ background-color : #555555;
+ }
+ a.lnkocn:link {
+ color : %s;
+ text-decoration : none;
+ }
+ a.lnkocn:visited {
+ color : #9ACD32;
+ text-decoration : none;
+ }
+ a.lnkocn:hover {
+ color : #BBBBBB;
+ font-size : 15px;
+ }
+ a:hover img {
+ background-color : #000000;
+ }
+ a:active {
+ color : #888888;
+ text-decoration : underline;
+ }
+ div {
+ margin-left : 0;
+ margin-right : 0;
+ }
+ div.p {
+ margin-left : 5%%;
+ margin-right : 1%%;
+ }
+ div.substance {
+ width : 100%%;
+ background-color : #000000;
+ }
+ div.ocn {
+ width : 5%%;
+ float : right;
+ top : 0;
+ background-color : #000000;
+ }
+ div.endnote {
+ width : 95%%;
+ background-color : #000000;
+ }
+ div.toc {
+ position : absolute;
+ float : left;
+ margin : 0;
+ padding : 0;
+ padding-top : 0.5em;
+ border : 0;
+ width : 13em;
+ background-color : #111111;
+ margin-right : 1em;
+ }
+ div.summary {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #111111;
+ padding-left : 1em;
+ background-color : #111111;
+ }
+ div.content, div.main_column {
+ margin : 0;
+ padding : 0;
+ border-left : 13em solid #000000;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content0, div.main_column0 {
+ margin : 0;
+ padding : 0;
+ border-left : 0%% solid #000000;
+ padding-left : 5%%;
+ }
+ div.scroll {
+ margin : 0;
+ padding : 0;
+ padding-left : 1em;
+ padding-right : 1em;
+ }
+ div.content:after {
+ content : ' ';
+ clear : both;
+ display : block;
+ height : 0;
+ overflow : hidden;
+ }
+ div.footer {
+ clear : left;
+ padding : 0.5em;
+ font-size : 80%%;
+ margin : 0;
+ }
+ div.toc ul {
+ list-style : none;
+ padding : 0;
+ margin : 0;
+ }
+ div.toc li ul a, li ul span.currentlink
+ {
+ font-weight : normal;
+ font-size : 90%%;
+ padding-left : 2em;
+ background-color : #111111;
+ }
+ div.toc a, span.currentlink{
+ display : block;
+ text-decoration : none;
+ padding-left : 0.5em;
+ color : #FF00AA;
+ }
+ hr {
+ width : 90%%;
+ margin-left : 5%%;
+ margin-right : 2em;
+ margin-top : 1.8em;
+ margin-bottom : 1.8em;
+ }
+ span.currentlink {
+ text-decoration : none;
+ background-color : #AAAAF9;
+ }
+ div.toc a:visited {
+ color : #FF00AA;
+ }
+ div.toc a:hover {
+ color : #CCCCCC;
+ background-color : #F9F9AA;
+ }
+ nav#toc ol {
+ list-style-type : none;
+ }
+ .norm, .bold, .verse, .group, .block, .alt {
+ line-height : 133%%;
+ margin-top : 12px;
+ margin-bottom : 0px;
+ padding-left : 0em;
+ text-indent : 0em;
+ }
+ p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
+ display : block;
+ font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
+ margin-left : 5%%;
+ margin-right : 2em;
+ }
+ p {
+ font-size : 100%%;
+ font-weight : normal;
+ line-height : 133%%;
+ text-align : justify;
+ text-indent : 0mm;
+ margin-top : 0.8em;
+ margin-bottom : 0.8em;
+ }
+ img {
+ max-width : 100%%;
+ height : auto;
+ }
+ pre {
+ width : auto;
+ display : block;
+ clear : both;
+ color : #555555;
+ }
+ pre.codeline {
+ display : table;
+ clear : both;
+ table-layout : fixed;
+ margin-left : 5%%;
+ margin-right : 5%%;
+ width : 90%%;
+ white-space : pre-wrap;
+ border-style : none;
+ border-radius : 5px 5px 5px 5px;
+ box-shadow : 0 2px 5px #AAAAAA inset;
+ margin-bottom : 1em;
+ padding : 0.5em 1em;
+ page-break-inside : avoid;
+ word-wrap : break-word;
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ white-space : pre;
+ white-space : pre-wrap;
+ white-space : -moz-pre-wrap;
+ white-space : -o-pre-wrap;
+ background-color : #555555;
+ color : #DDDDDD;
+ font-size : 95%%;
+ line-height : 100%%;
+ }
+ pre.codeline::before {
+ counter-reset : linenum;
+ }
+ pre.codeline span.tr {
+ display : table-row;
+ counter-increment : linenum;
+ }
+ pre.codeline span.th {
+ display : table-cell;
+ user-select : none;
+ -moz-user-select : none;
+ -webkit-user-select : none;
+ padding : 0.5em 0.5em;
+ }
+ pre.codeline span.th::before {
+ content : counter(linenum) ".";
+ color : #999999;
+ text-align : right;
+ display : block;
+ }
+ pre.codeline span.th {
+ width : 4em;
+ }
+ pre.codeline code {
+ display : table-cell;
+ }
+ p.code {
+ border-style : none;
+ }
+ p.spaced { white-space : pre; }
+ p.block {
+ white-space : pre;
+ }
+ p.group { }
+ p.alt { }
+ p.verse {
+ white-space : pre;
+ margin-bottom : 6px;
+ }
+ p.caption {
+ text-align : left;
+ font-size : 80%%;
+ display : inline;
+ }
+ p.endnote {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-right : 15mm;
+ }
+ p.endnote_indent {
+ font-size : 96%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 2em;
+ margin-right : 15mm;
+ }
+ p.center {
+ text-align : center;
+ }
+ p.bold {
+ font-weight : bold;
+ }
+ p.bold_left {
+ font-weight : bold;
+ text-align : left;
+ }
+ p.centerbold {
+ text-align : center;
+ font-weight : bold;
+ }
+ p.em {
+ font-weight : bold;
+ font-style : normal;
+ background : #FFF3B6;
+ }
+ p.small {
+ font-size : 80%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ margin-right : 6px;
+ text-align : left;
+ }
+ .tiny, .tiny_left, .tiny_right, .tiny_center {
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ color : #EEEEEE;
+ margin-right : 6px;
+ text-align : left;
+ }
+ p.tiny { }
+ p.tiny_left {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : left;
+ }
+ p.tiny_right {
+ margin-right : 1em;
+ text-align : right;
+ }
+ p.tiny_center {
+ margin-left : 0px;
+ margin-right : 0px;
+ text-align : center;
+ }
+ p.concordance_word {
+ line-height : 150%%;
+ font-weight : bold;
+ display : inline;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.concordance_count {
+ font-size : 80%%;
+ color : #555555;
+ display : inline;
+ margin-left : 0em;
+ }
+ p.concordance_object {
+ font-size : 80%%;
+ line-height : 120%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ p.book_index_lev1 {
+ line-height : 100%%;
+ margin-top : 4px;
+ margin-bottom : 1px;
+ }
+ p.book_index_lev2 {
+ line-height : 100%%;
+ text-align : left;
+ margin-left : 3em;
+ margin-top : 1px;
+ margin-bottom : 3px;
+ }
+ tt {
+ font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
+ background-color : #555555;
+ color : #DDDDDD;
+ }
+%s
+ note { white-space : pre; }
+ label.ocn {
+ width : 2%%;
+ float : right;
+ top : 0;
+ font-size : 10px;
+ margin-top : 0px;
+ margin-bottom : 5px;
+ margin-right : 5px;
+ text-align : right;
+ color : %s;
+ -khtml-user-select : none;
+ -moz-user-select : none;
+ -ms-user-select : none;
+ -o-user-select : none;
+ -webkit-user-select : none;
+ user-select : none;
+ }
+ table {
+ display : block;
+ margin-left : 5%%;
+ margin-right : 2em;
+ background-color : inherit;
+ }
+ tr { }
+ th,td {
+ vertical-align : top;
+ text-align : left;
+ }
+ th {
+ font-weight : bold;
+ }
+ em {
+ font-weight : bold;
+ font-style : italic;
+ }
+ p.left,th.left,td.left {
+ text-align : left;
+ }
+ p.small_left,th.small_left,td.small_left {
+ text-align : left;
+ font-size : 80%%;
+ }
+ p.right,th.right,td.right {
+ text-align : right;
+ }
+ ul, li {
+ list-style-type : none;
+ list-style : none;
+ padding-left : 20px;
+ font-weight : normal;
+ line-height : 150%%;
+ text-align : left;
+ text-indent : 0mm;
+ margin-left : 1em;
+ margin-right : 2em;
+ margin-top : 3px;
+ margin-bottom : 3px;
+ }
+ li {
+ background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
+ }
+ ul { }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ font-weight : bold;
+ line-height : 120%%;
+ text-align : left;
+ margin-top : 20px;
+ margin-bottom : 10px;
+ }
+ h4.norm, h5.norm, h6.norm, h7.norm {
+ margin-top : 10px;
+ margin-bottom : 0px;
+ }
+ h0 { font-size : 125%%; }
+ h1 { font-size : 120%%; }
+ h2 { font-size : 115%%; }
+ h3 { font-size : 110%%; }
+ h4 { font-size : 105%%; }
+ h5 { font-size : 100%%; }
+ h6 { font-size : 100%%; }
+ h7 { font-size : 100%%; }
+ h0, h1, h2, h3, h4, h5, h6, h7 {
+ text-shadow : .2em .2em .3em #999999;
+ }
+ h1.i { margin-left : 2em; }
+ h2.i { margin-left : 3em; }
+ h3.i { margin-left : 4em; }
+ h4.i { margin-left : 5em; }
+ h5.i { margin-left : 6em; }
+ h6.i { margin-left : 7em; }
+ h7.i { margin-left : 8em; }
+ h8.i { margin-left : 9em; }
+ h9.i { margin-left : 10em; }
+ .toc {
+ font-weight : normal;
+ margin-top : 6px;
+ margin-bottom : 6px;
+ }
+ h0.toc {
+ margin-left : 1em;
+ font-size : 120%%;
+ line-height : 150%%;
+ }
+ h1.toc {
+ margin-left : 1em;
+ font-size : 115%%;
+ line-height : 150%%;
+ }
+ h2.toc {
+ margin-left : 2em;
+ font-size : 110%%;
+ line-height : 140%%;
+ }
+ h3.toc {
+ margin-left : 3em;
+ font-size : 105%%;
+ line-height : 120%%;
+ }
+ h4.toc {
+ margin-left : 4em;
+ font-size : 100%%;
+ line-height : 120%%;
+ }
+ h5.toc {
+ margin-left : 5em;
+ font-size : 95%%;
+ line-height : 110%%;
+ }
+ h6.toc {
+ margin-left : 6em;
+ font-size : 90%%;
+ line-height : 110%%;
+ }
+ h7.toc {
+ margin-left : 7em;
+ font-size : 85%%;
+ line-height : 100%%;
+ }
+ .subtoc {
+ margin-right : 34%%;
+ font-weight : normal;
+ }
+ h5.subtoc {
+ margin-left : 2em;
+ font-size : 80%%;
+ margin-top : 2px;
+ margin-bottom : 2px;
+ }
+ h6.subtoc {
+ margin-left : 3em;
+ font-size : 75%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+ h7.subtoc {
+ margin-left : 4em;
+ font-size : 70%%;
+ margin-top : 0px;
+ margin-bottom : 0px;
+ }
+
+┃",
+ _color_ocn_dark,
+ _css_indent,
+ _color_ocn_dark,
+);
+ auto css_() {
+ struct _CSS {
+ string html_seg = "/* spine css html seg stylesheet */\n";
+ string html_scroll = "/* spine css html scroll stylesheet */\n";
+ string epub = "/* spine css epub stylesheet */\n";
+ }
+ return _CSS();
+ }
+ auto css = css_();
+ if (doc_matters.opt.action.css_theme_default) {
+ css.html_seg ~= _css_light_html_seg;
+ css.html_scroll ~= _css_light_html_scroll;
+ css.epub ~= _css_light_epub;
+ } else {
+ css.html_seg ~= _css_dark_html_seg;
+ css.html_scroll ~= _css_dark_html_scroll;
+ css.epub ~= _css_dark_epub;
+ }
+ return css;
+ }
+}
diff --git a/src/doc_reform/meta/metadoc.d b/src/doc_reform/meta/metadoc.d
index 0d6e7a5..1620281 100644
--- a/src/doc_reform/meta/metadoc.d
+++ b/src/doc_reform/meta/metadoc.d
@@ -17,10 +17,10 @@ template spineAbstraction() {
doc_reform.meta.defaults,
doc_reform.meta.doc_debugs,
doc_reform.meta.rgx,
- doc_reform.source.paths_source,
- doc_reform.source.read_config_files,
- doc_reform.source.read_source_files,
- doc_reform.output.hub;
+ doc_reform.io_in.paths_source,
+ doc_reform.io_in.read_config_files,
+ doc_reform.io_in.read_source_files,
+ doc_reform.io_out.hub;
mixin spineRgxInit;
mixin contentJSONtoSpineStruct;
mixin spineBiblio;
diff --git a/src/doc_reform/meta/metadoc_from_src.d b/src/doc_reform/meta/metadoc_from_src.d
index 511f761..ab87eb2 100644
--- a/src/doc_reform/meta/metadoc_from_src.d
+++ b/src/doc_reform/meta/metadoc_from_src.d
@@ -15,7 +15,7 @@ template docAbstraction() {
std.path;
import
doc_reform.meta.defaults,
- doc_reform.meta.object_setter,
+ doc_reform.meta.metadoc_object_setter,
doc_reform.meta.rgx;
/+ ↓ abstraction mixins +/
mixin ObjectSetter;
diff --git a/src/doc_reform/meta/metadoc_harvest.d b/src/doc_reform/meta/metadoc_harvest.d
index 37c375a..ca9801f 100644
--- a/src/doc_reform/meta/metadoc_harvest.d
+++ b/src/doc_reform/meta/metadoc_harvest.d
@@ -20,7 +20,7 @@ template spineMetaDocHarvest() {
std.conv : to;
mixin InternalMarkup;
auto markup = InlineMarkup();
- import doc_reform.output.paths_output;
+ import doc_reform.io_out.paths_output;
auto pth_html_abs = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
auto pth_html_rel = spineDocRootTreeHTML!()(doc_matters.src.language);
hvst.harvest.title = doc_matters.conf_make_meta.meta.title_full;
diff --git a/src/doc_reform/meta/metadoc_harvests_authors.d b/src/doc_reform/meta/metadoc_harvests_authors.d
index 21e8f28..f733a80 100644
--- a/src/doc_reform/meta/metadoc_harvests_authors.d
+++ b/src/doc_reform/meta/metadoc_harvests_authors.d
@@ -347,7 +347,7 @@ string theme_light_1 = format(q"┃
┃") ~ "\n";
- import doc_reform.output.paths_output;
+ import doc_reform.io_out.paths_output;
auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, "");
try {
auto f = File(out_pth.harvest("authors.html"), "w");
diff --git a/src/doc_reform/meta/metadoc_harvests_topics.d b/src/doc_reform/meta/metadoc_harvests_topics.d
index ea43d5a..7c7efc3 100644
--- a/src/doc_reform/meta/metadoc_harvests_topics.d
+++ b/src/doc_reform/meta/metadoc_harvests_topics.d
@@ -506,7 +506,7 @@ string theme_light_1 = format(q"┃
┃") ~ "\n";
- import doc_reform.output.paths_output;
+ import doc_reform.io_out.paths_output;
auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, "");
try {
auto f = File(out_pth.harvest("topics.html"), "w");
diff --git a/src/doc_reform/meta/metadoc_object_setter.d b/src/doc_reform/meta/metadoc_object_setter.d
new file mode 100644
index 0000000..908d168
--- /dev/null
+++ b/src/doc_reform/meta/metadoc_object_setter.d
@@ -0,0 +1,141 @@
+/++
+ object setter:
+ setting of sisu objects for downstream processing
+ metadoc_object_setter.d
++/
+module doc_reform.meta.metadoc_object_setter;
+template ObjectSetter() {
+ /+ structs +/
+ struct DocObj_MetaInfo_ {
+ string is_of_part = ""; // frontmatter, body, backmatter
+ string is_of_section = ""; // toc, body, glossary, biography, book index, blurb
+ string is_of_type = ""; // para, block ?
+ string is_a = ""; // heading, para, table, code block, group, verse/poem ...
+ alias of_part = is_of_part;
+ alias of_section = is_of_section;
+ alias is_of = is_of_type;
+ string attrib = "";
+ string lang = ""; // blocks: group, block, quote; not codeblock;
+ string syntax = ""; // codeblock only
+ /+ o_n +/
+ int o_n_substantive = 0;
+ int o_n_non_substantive = 0;
+ int o_n_glossary = 0;
+ int o_n_bibliography = 0;
+ int o_n_book_index = 0;
+ int o_n_blurb = 0;
+ string object_number_substantive() const @property {
+ return (o_n_substantive==0) ? "" : o_n_substantive.to!string;
+ }
+ string object_number_non_substantive() const @property {
+ return (o_n_non_substantive==0) ? "" : o_n_non_substantive.to!string;
+ }
+ string object_number_glossary() const @property {
+ return (o_n_glossary==0) ? "" : o_n_glossary.to!string;
+ }
+ string object_number_bibliography() const @property {
+ return (o_n_bibliography==0) ? "" : o_n_bibliography.to!string;
+ }
+ string object_number_book_index() const @property {
+ return (o_n_book_index==0) ? "" : o_n_book_index.to!string;
+ }
+ string object_number_blurb() const @property {
+ return (o_n_blurb==0) ? "" : o_n_blurb.to!string;
+ }
+ bool object_number_off = false;
+ bool visible_object_number = false;
+ int object_number_type = 0; // { ocn, non, bkidx }
+ /+ node +/
+ string[string][string] node;
+ int ocn = 0;
+ string identifier = "";
+ string object_number() const @property {
+ return (ocn==0) ? "" : ocn.to!string;
+ }
+ int o_n_type = 0;
+ int heading_lev_markup = 9;
+ int heading_lev_collapsed = 9;
+ string marked_up_level() const @property {
+ string _out;
+ switch (heading_lev_markup) {
+ case 0 : _out = "A"; break;
+ case 1 : _out = "B"; break;
+ case 2 : _out = "C"; break;
+ case 3 : _out = "D"; break;
+ case 4 : _out = "1"; break;
+ case 5 : _out = "2"; break;
+ case 6 : _out = "3"; break;
+ case 7 : _out = "4"; break;
+ default : _out = ""; break; // "9";
+ }
+ return _out;
+ }
+ bool dummy_heading = false;
+ int[] markedup_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,];
+ int[] collapsed_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,];
+ int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,];
+ int[] dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,];
+ int parent_lev_markup = 0;
+ int parent_ocn = 0;
+ int last_decendant_ocn = 0;
+ }
+ struct DocObj_TxtAttrib_ {
+ int indent_base = 0;
+ int indent_hang = 0;
+ bool bullet = false;
+ string language = "";
+ }
+ struct DocObj_Has_ {
+ bool inline_links = false;
+ bool inline_notes_reg = false;
+ bool inline_notes_star = false;
+ bool images = false;
+ bool image_without_dimensions = false;
+ }
+ struct DocObj_Table_ {
+ int number_of_columns = 0;
+ double[] column_widths = [];
+ string[] column_aligns = [];
+ bool heading = false;
+ bool walls = false;
+ }
+ struct DocObj_CodeBlock_ {
+ string syntax = "";
+ bool linenumbers = false;
+ }
+ struct DocObj_Stow_ {
+ string[] link = [];
+ }
+ struct DocObj_Pointer_ {
+ int doc_object = 0;
+ int html_segnames = 0;
+ int heading = 0;
+ }
+ struct DocObj_Tags_ {
+ string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ];
+ string anchor_tag_html = "";
+ string in_segment_html = "";
+ string segment_anchor_tag_epub = "";
+ string html_segment_anchor_tag_is = "";
+ string epub_segment_anchor_tag_is = "";
+ string heading_lev_anchor_tag = "";
+ string segname_prev = "";
+ string segname_next = "";
+ string[] lev4_subtoc = [];
+ string[] anchor_tags = [];
+ }
+ struct ObjGenericComposite {
+ string text = "";
+ DocObj_MetaInfo_ metainfo;
+ DocObj_TxtAttrib_ attrib;
+ DocObj_Tags_ tags;
+ DocObj_Has_ has;
+ DocObj_Table_ table;
+ DocObj_CodeBlock_ code_block;
+ DocObj_Stow_ stow;
+ DocObj_Pointer_ ptr;
+ }
+ struct TheObjects {
+ ObjGenericComposite[] oca;
+ }
+}
diff --git a/src/doc_reform/meta/object_setter.d b/src/doc_reform/meta/object_setter.d
deleted file mode 100644
index 0ce74fd..0000000
--- a/src/doc_reform/meta/object_setter.d
+++ /dev/null
@@ -1,141 +0,0 @@
-/++
- object setter:
- setting of sisu objects for downstream processing
- meta_object_setter.d
-+/
-module doc_reform.meta.object_setter;
-template ObjectSetter() {
- /+ structs +/
- struct DocObj_MetaInfo_ {
- string is_of_part = ""; // frontmatter, body, backmatter
- string is_of_section = ""; // toc, body, glossary, biography, book index, blurb
- string is_of_type = ""; // para, block ?
- string is_a = ""; // heading, para, table, code block, group, verse/poem ...
- alias of_part = is_of_part;
- alias of_section = is_of_section;
- alias is_of = is_of_type;
- string attrib = "";
- string lang = ""; // blocks: group, block, quote; not codeblock;
- string syntax = ""; // codeblock only
- /+ o_n +/
- int o_n_substantive = 0;
- int o_n_non_substantive = 0;
- int o_n_glossary = 0;
- int o_n_bibliography = 0;
- int o_n_book_index = 0;
- int o_n_blurb = 0;
- string object_number_substantive() const @property {
- return (o_n_substantive==0) ? "" : o_n_substantive.to!string;
- }
- string object_number_non_substantive() const @property {
- return (o_n_non_substantive==0) ? "" : o_n_non_substantive.to!string;
- }
- string object_number_glossary() const @property {
- return (o_n_glossary==0) ? "" : o_n_glossary.to!string;
- }
- string object_number_bibliography() const @property {
- return (o_n_bibliography==0) ? "" : o_n_bibliography.to!string;
- }
- string object_number_book_index() const @property {
- return (o_n_book_index==0) ? "" : o_n_book_index.to!string;
- }
- string object_number_blurb() const @property {
- return (o_n_blurb==0) ? "" : o_n_blurb.to!string;
- }
- bool object_number_off = false;
- bool visible_object_number = false;
- int object_number_type = 0; // { ocn, non, bkidx }
- /+ node +/
- string[string][string] node;
- int ocn = 0;
- string identifier = "";
- string object_number() const @property {
- return (ocn==0) ? "" : ocn.to!string;
- }
- int o_n_type = 0;
- int heading_lev_markup = 9;
- int heading_lev_collapsed = 9;
- string marked_up_level() const @property {
- string _out;
- switch (heading_lev_markup) {
- case 0 : _out = "A"; break;
- case 1 : _out = "B"; break;
- case 2 : _out = "C"; break;
- case 3 : _out = "D"; break;
- case 4 : _out = "1"; break;
- case 5 : _out = "2"; break;
- case 6 : _out = "3"; break;
- case 7 : _out = "4"; break;
- default : _out = ""; break; // "9";
- }
- return _out;
- }
- bool dummy_heading = false;
- int[] markedup_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,];
- int[] collapsed_ancestors = [ 0, 0, 0, 0, 0, 0, 0, 0,];
- int[] dom_structure_markedup_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,];
- int[] dom_structure_collapsed_tags_status = [ 0, 0, 0, 0, 0, 0, 0, 0,];
- int parent_lev_markup = 0;
- int parent_ocn = 0;
- int last_decendant_ocn = 0;
- }
- struct DocObj_TxtAttrib_ {
- int indent_base = 0;
- int indent_hang = 0;
- bool bullet = false;
- string language = "";
- }
- struct DocObj_Has_ {
- bool inline_links = false;
- bool inline_notes_reg = false;
- bool inline_notes_star = false;
- bool images = false;
- bool image_without_dimensions = false;
- }
- struct DocObj_Table_ {
- int number_of_columns = 0;
- double[] column_widths = [];
- string[] column_aligns = [];
- bool heading = false;
- bool walls = false;
- }
- struct DocObj_CodeBlock_ {
- string syntax = "";
- bool linenumbers = false;
- }
- struct DocObj_Stow_ {
- string[] link = [];
- }
- struct DocObj_Pointer_ {
- int doc_object = 0;
- int html_segnames = 0;
- int heading = 0;
- }
- struct DocObj_Tags_ {
- string[] heading_ancestors_text = [ "", "", "", "", "", "", "", "", ];
- string anchor_tag_html = "";
- string in_segment_html = "";
- string segment_anchor_tag_epub = "";
- string html_segment_anchor_tag_is = "";
- string epub_segment_anchor_tag_is = "";
- string heading_lev_anchor_tag = "";
- string segname_prev = "";
- string segname_next = "";
- string[] lev4_subtoc = [];
- string[] anchor_tags = [];
- }
- struct ObjGenericComposite {
- string text = "";
- DocObj_MetaInfo_ metainfo;
- DocObj_TxtAttrib_ attrib;
- DocObj_Tags_ tags;
- DocObj_Has_ has;
- DocObj_Table_ table;
- DocObj_CodeBlock_ code_block;
- DocObj_Stow_ stow;
- DocObj_Pointer_ ptr;
- }
- struct TheObjects {
- ObjGenericComposite[] oca;
- }
-}
diff --git a/src/doc_reform/output/create_zip_file.d b/src/doc_reform/output/create_zip_file.d
deleted file mode 100644
index fa752ad..0000000
--- a/src/doc_reform/output/create_zip_file.d
+++ /dev/null
@@ -1,17 +0,0 @@
-module doc_reform.output.create_zip_file;
-template createZipFile() {
- import std.file;
- import std.outbuffer;
- import std.string;
- import std.zip;
- void createZipFile(
- string zip_file_name,
- void[] compressed_zip_data,
- ) {
- try {
- write(zip_file_name, compressed_zip_data);
- } catch (ZipException ex) {
- // Handle Errors
- }
- }
-}
diff --git a/src/doc_reform/output/defaults.d b/src/doc_reform/output/defaults.d
deleted file mode 100644
index fc31ea9..0000000
--- a/src/doc_reform/output/defaults.d
+++ /dev/null
@@ -1,135 +0,0 @@
-/++
- default settings
-+/
-module doc_reform.output.defaults;
-
-template InternalMarkup() {
- import std.array;
- static struct InlineMarkup {
- string en_a_o = "【"; string en_a_c = "】";
- string en_b_o = "〖"; string en_b_c = "〗";
- string quote_o = "“"; string quote_c = "”";
- string ff_o = "┨"; string ff_c = "┣"; // fontface
- string lnk_o = "┥"; string lnk_c = "┝";
- string url_o = "┤"; string url_c = "├";
- string emph = "*";
- string bold = "!";
- string italic = "/";
- string underscore = "_";
- string superscript = "^";
- string subscript = ",";
- string mono = "■";
- string cite = "‖";
- string mark_internal_site_lnk = "¤";
- string nbsp = "░";
- string br_line = "┘";
- string br_nl = "┙";
- string br_paragraph = "┚";
- string br_obj = "break_obj";
- string br_page_line = "┼";
- string br_page = "┿";
- string br_page_new = "╂";
- string tc_s = "┊";
- string tc_o = "┏";
- string tc_c = "┚";
- string tc_p = "┆";
- string img = "☼";
- string sep = "␣";
- string on_o = "「"; auto on_c = "」";
- string mk_bullet = "● ";
- static string indent_by_spaces_provided(int indent, string _indent_spaces ="░░") {
- _indent_spaces = replicate(_indent_spaces, indent);
- return _indent_spaces;
- }
- static string repeat_character_by_number_provided(C,N)(C _character ="-", N number=10) {
- _character = replicate(_character, number);
- return _character;
- }
- }
-}
-template spineLanguageCodes() {
- /+ language codes +/
- struct Lang {
- static string[string][string] codes() {
- auto _lang_codes = [
- "am": [ "c": "am", "n": "Amharic", "t": "Amharic", "xlp": "amharic" ],
- "bg": [ "c": "bg", "n": "Bulgarian", "t": "Български (Bəlgarski)", "xlp": "bulgarian" ],
- "bn": [ "c": "bn", "n": "Bengali", "t": "Bengali", "xlp": "bengali" ],
- "br": [ "c": "br", "n": "Breton", "t": "Breton", "xlp": "breton" ],
- "ca": [ "c": "ca", "n": "Catalan", "t": "catalan", "xlp": "catalan" ],
- "cs": [ "c": "cs", "n": "Czech", "t": "česky", "xlp": "czech" ],
- "cy": [ "c": "cy", "n": "Welsh", "t": "Welsh", "xlp": "welsh" ],
- "da": [ "c": "da", "n": "Danish", "t": "dansk", "xlp": "danish" ],
- "de": [ "c": "de", "n": "German", "t": "Deutsch", "xlp": "german" ],
- "el": [ "c": "el", "n": "Greek", "t": "Ελληνικά (Ellinika)", "xlp": "greek" ],
- "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
- "eo": [ "c": "eo", "n": "Esperanto", "t": "Esperanto", "xlp": "esperanto" ],
- "es": [ "c": "es", "n": "Spanish", "t": "español", "xlp": "spanish" ],
- "et": [ "c": "et", "n": "Estonian", "t": "Estonian", "xlp": "estonian" ],
- "eu": [ "c": "eu", "n": "Basque", "t": "basque", "xlp": "basque" ],
- "fi": [ "c": "fi", "n": "Finnish", "t": "suomi", "xlp": "finnish" ],
- "fr": [ "c": "fr", "n": "French", "t": "français", "xlp": "french" ],
- "ga": [ "c": "ga", "n": "Irish", "t": "Irish", "xlp": "irish" ],
- "gl": [ "c": "gl", "n": "Galician", "t": "Galician", "xlp": "galician" ],
- "he": [ "c": "he", "n": "Hebrew", "t": "Hebrew", "xlp": "hebrew" ],
- "hi": [ "c": "hi", "n": "Hindi", "t": "Hindi", "xlp": "hindi" ],
- "hr": [ "c": "hr", "n": "Croatian", "t": "Croatian", "xlp": "croatian" ],
- "hy": [ "c": "hy", "n": "Armenian", "t": "Armenian", "xlp": "armenian" ],
- "ia": [ "c": "ia", "n": "Interlingua", "t": "Interlingua", "xlp": "interlingua" ],
- "is": [ "c": "is", "n": "Icelandic", "t": "Icelandic", "xlp": "icelandic" ],
- "it": [ "c": "it", "n": "Italian", "t": "Italiano", "xlp": "italian" ],
- "ja": [ "c": "ja", "n": "Japanese", "t": "日本語 (Nihongo)", "xlp": "japanese" ],
- "ko": [ "c": "ko", "n": "Korean", "t": "Korean", "xlp": "korean" ],
- "la": [ "c": "la", "n": "Latin", "t": "Latin", "xlp": "latin" ],
- "lo": [ "c": "lo", "n": "Lao", "t": "Lao", "xlp": "lao" ],
- "lt": [ "c": "lt", "n": "Lithuanian", "t": "Lithuanian", "xlp": "lithuanian" ],
- "lv": [ "c": "lv", "n": "Latvian", "t": "Latvian", "xlp": "latvian" ],
- "ml": [ "c": "ml", "n": "Malayalam", "t": "Malayalam", "xlp": "malayalam" ],
- "mr": [ "c": "mr", "n": "Marathi", "t": "Marathi", "xlp": "marathi" ],
- "nl": [ "c": "nl", "n": "Dutch", "t": "Nederlands", "xlp": "dutch" ],
- "no": [ "c": "no", "n": "Norwegian", "t": "norsk", "xlp": "norsk" ],
- "nn": [ "c": "nn", "n": "Norwegian Nynorsk", "t": "nynorsk", "xlp": "nynorsk" ],
- "oc": [ "c": "oc", "n": "Occitan", "t": "Occitan", "xlp": "occitan" ],
- "pl": [ "c": "pl", "n": "Polish", "t": "polski", "xlp": "polish" ],
- "pt": [ "c": "pt", "n": "Portuguese", "t": "Português", "xlp": "portuges" ],
- "pt_BR": [ "c": "pt_BR", "n": "Portuguese Brazil", "t": "Brazilian Português", "xlp": "brazilian" ],
- "ro": [ "c": "ro", "n": "Romanian", "t": "română", "xlp": "romanian" ],
- "ru": [ "c": "ru", "n": "Russian", "t": "Русский (Russkij)", "xlp": "russian" ],
- "sa": [ "c": "sa", "n": "Sanskrit", "t": "Sanskrit", "xlp": "sanskrit" ],
- "se": [ "c": "se", "n": "Sami", "t": "Samin", "xlp": "samin" ],
- "sk": [ "c": "sk", "n": "Slovak", "t": "slovensky", "xlp": "slovak" ],
- "sl": [ "c": "sl", "n": "Slovenian", "t": "Slovenian", "xlp": "slovenian" ],
- "sq": [ "c": "sq", "n": "Albanian", "t": "Albanian", "xlp": "albanian" ],
- "sr": [ "c": "sr", "n": "Serbian", "t": "Serbian", "xlp": "serbian" ],
- "sv": [ "c": "sv", "n": "Swedish", "t": "svenska", "xlp": "swedish" ],
- "ta": [ "c": "ta", "n": "Tamil", "t": "Tamil", "xlp": "tamil" ],
- "te": [ "c": "te", "n": "Telugu", "t": "Telugu", "xlp": "telugu" ],
- "th": [ "c": "th", "n": "Thai", "t": "Thai", "xlp": "thai" ],
- "tk": [ "c": "tk", "n": "Turkmen", "t": "Turkmen", "xlp": "turkmen" ],
- "tr": [ "c": "tr", "n": "Turkish", "t": "Türkçe", "xlp": "turkish" ],
- "uk": [ "c": "uk", "n": "Ukranian", "t": "українська (ukrajins\"ka)", "xlp": "ukrainian" ],
- "ur": [ "c": "ur", "n": "Urdu", "t": "Urdu", "xlp": "urdu" ],
- "us": [ "c": "en", "n": "English (American)","t": "English", "xlp": "english" ],
- "vi": [ "c": "vi", "n": "Vietnamese", "t": "Vietnamese", "xlp": "vietnamese" ],
- "zh": [ "c": "zh", "n": "Chinese", "t": "中文", "xlp": "chinese" ],
- "en": [ "c": "en", "n": "English", "t": "English", "xlp": "english" ],
- "xx": [ "c": "xx", "n": "Default", "t": "English", "xlp": "english" ],
- ];
- return _lang_codes;
- }
- static string[] code_arr_ptr() {
- string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "us", "vi", "zh", "en", "xx",];
- return _lang_codes;
- }
- static string[] code_arr() {
- string[] _lang_codes = ["am", "bg", "bn", "br", "ca", "cs", "cy", "da", "de", "el", "en", "eo", "es", "et", "eu", "fi", "fr", "ga", "gl", "he", "hi", "hr", "hy", "ia", "is", "it", "ja", "ko", "la", "lo", "lt", "lv", "ml", "mr", "nl", "no", "nn", "oc", "pl", "pt", "pt_BR", "ro", "ru", "sa", "se", "sk", "sl", "sq", "sr", "sv", "ta", "te", "th", "tk", "tr", "uk", "ur", "vi", "zh"];
- return _lang_codes;
- }
- static auto codes_() {
- return "(" ~ join(code_arr,"|") ~ ")";
- }
- static auto codes_regex() {
- return regex(codes_);
- }
- }
-}
diff --git a/src/doc_reform/output/epub3.d b/src/doc_reform/output/epub3.d
deleted file mode 100644
index f46ff6e..0000000
--- a/src/doc_reform/output/epub3.d
+++ /dev/null
@@ -1,814 +0,0 @@
-module doc_reform.output.epub3;
-template outputEPub3() {
- import doc_reform.output;
- import
- std.digest.sha,
- std.file,
- std.outbuffer,
- std.uri,
- std.zip,
- std.conv : to;
- import
- doc_reform.output.create_zip_file,
- doc_reform.output.xmls,
- doc_reform.output.xmls_css;
- mixin InternalMarkup;
- mixin outputXHTMLs;
- string epub3_mimetypes() {
- string o;
- o = format(q"┃application/epub+zip┃") ~ "\n";
- return o;
- }
- string epub3_container_xml() {
- string o;
- o = format(q"┃┃") ~ "\n";
- o ~= format(q"┃
-
-
- ┃") ~ "\n \n";
- return o;
- }
- string epub3_oebps_content(D,M,P)(D doc_abstraction, M doc_matters, P parts) {
- auto xhtml_format = outputXHTMLs();
- auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
- string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO sort uuid in doc_matters!
- string content = format(q"┃
-
-
-
- %s
- main
- %s
- subtitle
- %s
- %s
- %s
- Copyright: %s
- %s
- urn:uuid:%s
-
-
-
-
-
-
-
-
-
- ┃",
- _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)
- ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.title_sub),
- (doc_matters.conf_make_meta.meta.creator_author.empty)
- ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
- (doc_matters.conf_make_meta.meta.creator_author.empty)
- ? "" : xhtml_format.special_characters_text(doc_matters.conf_make_meta.meta.creator_author),
- doc_matters.src.language, // language, fix (needed in dochead metadata)
- (doc_matters.conf_make_meta.meta.date_published.empty)
- ? "" : 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,
- (pth_epub3.fn_oebps_css).chompPrefix("OEBPS/"),
- );
- content ~= " " ~ "" ~ "\n ";
- content ~= parts["manifest_documents"];
- // TODO sort jpg & png
- content ~= " " ~ "" ~ "\n ";
- foreach (image; doc_matters.srcs.image_list) {
- content ~= format(q"┃
- ┃",
- image.baseName.stripExtension,
- (pth_epub3.doc_oebps_image).chompPrefix("OEBPS/"),
- image,
- image.extension.chompPrefix("."),
- );
- }
- content ~= " " ~ " " ~ "\n ";
- content ~= " " ~ "" ~ "\n ";
- content ~= parts["spine"];
- content ~= " " ~ " " ~ "\n ";
- content ~= " " ~ "" ~ "\n ";
- content ~= parts["guide"];
- content ~= " " ~ " " ~ "\n ";
- content ~= "" ~ " ";
- debug(epubmanifest) {
- foreach (part; doc_matters.has.keys_seq.seg) { // TODO
- foreach (obj; doc_abstraction[part]) {
- if (obj.metainfo.is_a == "heading") {
- if (obj.metainfo.heading_lev_markup == 4) {
- writefln(
- "%s~ [%s.xhtml] %s",
- obj.marked_up_level,
- obj.tags.segment_anchor_tag_epub,
- obj.text
- );
- } else if (obj.metainfo.heading_lev_markup > 4) {
- writefln(
- "%s~ [%s.xhtml#%s] %s",
- obj.marked_up_level,
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- obj.text
- );
- }
- }
- }
- }
- }
- return content;
- }
- string epub3_oebps_toc_nav_xhtml(D,I)(D doc_abstraction, I doc_matters) {
- enum DomTags { none, open, close, close_and_open, open_still, }
- auto markup = InlineMarkup();
- auto rgx = Rgx();
- string toc =format("
-
- %s
-
-
-
-
- \n",
- doc_matters.conf_make_meta.meta.title_full,
- );
- foreach (sect; doc_matters.has.keys_seq.seg) {
- foreach (obj; doc_abstraction[sect]) {
- if (obj.metainfo.is_a == "heading") {
- string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
- foreach_reverse (n; 0 .. 7) {
- string k = n.to!string;
- switch (obj.metainfo.dom_structure_collapsed_tags_status[n]) {
- case DomTags.close :
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n";
- toc ~= markup.indent_by_spaces_provided(n, " ") ~ "" ~ "\n";
- break;
- case DomTags.close_and_open :
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n";
- if (obj.metainfo.heading_lev_markup < 4) {
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ ""
- ~ _txt
- ~ " " ~ "\n";
- } else {
- string hashtag =(obj.metainfo.heading_lev_markup == 4)
- ? ""
- : ("#" ~ obj.metainfo.ocn.to!string);
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ " " ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ ""
- ~ _txt
- ~ " " ~ "\n";
- }
- break;
- case DomTags.open :
- toc ~= markup.indent_by_spaces_provided(n, " ") ~ "" ~ "\n";
- if (obj.metainfo.heading_lev_markup < 4) {
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ "" ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ ""
- ~ _txt
- ~ " " ~ "\n";
- } else {
- string hashtag =(obj.metainfo.heading_lev_markup == 4)
- ? ""
- : ("#" ~ obj.metainfo.ocn.to!string);
- toc ~= markup.indent_by_spaces_provided((n + 1), " ") ~ " " ~ "\n"
- ~ markup.indent_by_spaces_provided((n + 2), " ")
- ~ ""
- ~ _txt
- ~ " " ~ "\n";
- }
- break;
- default :
- break;
- }
- }
- }
- }
- }
- toc ~="
-
-
- \n";
- return toc;
- }
- string epub2_oebps_toc_ncx(D,I)(D doc_abstraction, I doc_matters) {
- int counter = 0;
- string _uuid = "18275d951861c77f78acd05672c9906924c59f18a2e0ba06dad95959693e9bd8"; // TODO shared elsewhere
- auto markup = InlineMarkup();
- auto rgx = Rgx();
- enum DomTags { none, open, close, close_and_open, open_still, }
- string toc = format(q"┃
-
-
-
- %s%s
-
-
-
-
-
-
-
-
- %s
-
-
- %s
-
- ┃",
- 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
- "3", // content depth
- doc_matters.conf_make_meta.meta.title_full, // title
- (doc_matters.conf_make_meta.meta.creator_author.empty) ? ""
- : doc_matters.conf_make_meta.meta.creator_author, // author
- );
- foreach (sect; doc_matters.has.keys_seq.seg) {
- foreach (obj; doc_abstraction[sect]) {
- if (obj.metainfo.is_a == "heading") {
- string _txt = obj.text.replaceAll(rgx.inline_notes_al_gen, "").strip;
- string hashtag =(obj.metainfo.heading_lev_markup <= 4) ? "" : ("#" ~ obj.metainfo.ocn.to!string);
- foreach_reverse (k; 0 .. 7) {
- switch (obj.metainfo.dom_structure_markedup_tags_status[k]) {
- case DomTags.close :
- toc ~= "\n ";
- break;
- case DomTags.close_and_open :
- ++counter;
- toc ~= "\n ";
- toc ~= format(q"┃
-
-
- %s
-
- ┃",
- counter,
- _txt,
- obj.tags.segment_anchor_tag_epub,
- hashtag,
- );
- break;
- case DomTags.open :
- ++counter;
- toc ~= format(q"┃
-
-
- %s
-
- ┃",
- counter,
- _txt,
- obj.tags.segment_anchor_tag_epub,
- hashtag,
- );
- break;
- default :
- break;
- }
- }
- }
- }
- }
- toc ~= format(q"┃
-
-
-
-
- ┃");
- return toc;
- }
-
- void outputEPub3(D,I)(
- const D doc_abstraction,
- I doc_matters,
- ) {
- mixin spineOutputRgxInit;
- auto xhtml_format = outputXHTMLs();
- auto rgx = Rgx();
- string[] doc;
- string segment_filename;
- string[] top_level_headings = ["","","",""];
- string[string] oepbs_content_parts;
- string suffix = ".xhtml";
- struct writeOut { /+ epub specific documents +/
- /+ fixed output +/
- string mimetypes;
- string meta_inf_container_xml;
- string oebps_toc_ncx;
- string oebps_toc_nav_xhtml;
- /+ variable output +/
- string oebps_content_opf;
- string[][string] doc_epub3;
- string[][string] doc_epub3_endnotes;
- string[] doc_parts;
- }
- auto epubWrite = writeOut();
- foreach (part; doc_matters.has.keys_seq.seg) {
- foreach (obj; doc_abstraction[part]) {
- 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) {
- case 0: .. case 3:
- /+ fill buffer, and replace with new levels from 1 to 3 +/
- switch (obj.metainfo.heading_lev_markup) {
- case 0:
- top_level_headings[0] = "";
- top_level_headings[1] = "";
- top_level_headings[2] = "";
- top_level_headings[3] = "";
- goto default;
- case 1:
- top_level_headings[1] = "";
- top_level_headings[2] = "";
- top_level_headings[3] = "";
- goto default;
- case 2:
- top_level_headings[2] = "";
- top_level_headings[3] = "";
- goto default;
- case 3:
- top_level_headings[3] = "";
- goto default;
- default:
- epubWrite.doc_parts ~= obj.tags.segment_anchor_tag_epub;
- epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= xhtml_format.epub3_seg_head(doc_matters);
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[obj.tags.segment_anchor_tag_epub] ~= t[0];
- epubWrite.doc_epub3_endnotes[obj.tags.segment_anchor_tag_epub] ~= t[1];
- break;
- }
- break;
- case 4:
- segment_filename = obj.tags.segment_anchor_tag_epub;
- epubWrite.doc_epub3[segment_filename] ~= xhtml_format.epub3_seg_head(doc_matters);
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case 5: .. case 7:
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case 8: .. case 9:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
- }
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- }
- }
- break;
- }
- } else {
- assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
- switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head" || "toc");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "toc":
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "body": assert(part == "body");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "para":
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- case "block":
- switch (obj.metainfo.is_a) {
- case "quote":
- auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "group":
- auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "block":
- auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "poem":
- break;
- case "verse":
- auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0].to!string;
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "code":
- epubWrite.doc_epub3[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
- break;
- case "table":
- epubWrite.doc_epub3[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
- epubWrite.doc_epub3_endnotes[segment_filename] ~= "";
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "endnote": assert(part == "endnotes");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- break;
- case "glossary": assert(part == "glossary");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "bibliography": assert(part == "bibliography");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "bookindex": assert(part == "bookindex");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- case "blurb": assert(part == "blurb");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "epub");
- epubWrite.doc_epub3[segment_filename] ~= t[0];
- epubWrite.doc_epub3_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "comment":
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
- }
- }
- break;
- }
- }
- if (obj.metainfo.is_a == "heading") {
- assert(obj.text.length > 0);
- if (obj.metainfo.heading_lev_markup <= 4) {
- oepbs_content_parts["manifest_documents"] ~=
- format(q"┃
- ┃",
- obj.tags.segment_anchor_tag_epub,
- obj.tags.segment_anchor_tag_epub,
- );
- oepbs_content_parts["spine"] ~=
- format(q"┃
- ┃",
- obj.tags.segment_anchor_tag_epub,
- );
- oepbs_content_parts["guide"] ~=
- format(q"┃
- ┃",
- obj.tags.segment_anchor_tag_epub,
- obj.tags.segment_anchor_tag_epub,
- );
- } else if (obj.metainfo.heading_lev_markup > 4) {
- oepbs_content_parts["manifest_documents"] ~=
- format(q"┃
- ┃",
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- );
- oepbs_content_parts["spine"] ~=
- format(q"┃
- ┃",
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- );
- oepbs_content_parts["guide"] ~=
- format(q"┃
- ┃",
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- obj.tags.segment_anchor_tag_epub,
- obj.metainfo.object_number,
- );
- }
- }
- }
- }
- /+ epub specific documents +/
- epubWrite.mimetypes = epub3_mimetypes;
- epubWrite.meta_inf_container_xml = epub3_container_xml;
- epubWrite.oebps_toc_ncx = doc_abstraction.epub2_oebps_toc_ncx(doc_matters);
- epubWrite.oebps_toc_nav_xhtml = doc_abstraction.epub3_oebps_toc_nav_xhtml(doc_matters);
- epubWrite.oebps_content_opf = doc_abstraction.epub3_oebps_content(doc_matters, oepbs_content_parts);
- epubWrite.epub3_write_output_files(doc_matters);
- }
- void epub3_write_output_files(W,M)(
- W epub_write,
- M doc_matters,
- ) {
- debug(asserts) {
- static assert(is(typeof(epub_write.doc_epub3) == string[][string]));
- static assert(is(typeof(epub_write.mimetypes) == string));
- static assert(is(typeof(epub_write.meta_inf_container_xml) == string));
- static assert(is(typeof(epub_write.oebps_toc_nav_xhtml) == string));
- static assert(is(typeof(epub_write.oebps_toc_ncx) == string));
- static assert(is(typeof(epub_write.oebps_content_opf) == string));
- }
- static auto rgx = Rgx();
- auto pth_epub3 = spinePathsEPUB!()(doc_matters.output_path, doc_matters.src.language);
- auto xhtml_format = outputXHTMLs();
- /+ zip file +/
- auto fn_epub = pth_epub3.epub_file(doc_matters.src.filename);
- auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
- /+ zip archive member files +/
- void EPUBzip()(string contents, string fn) {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn;
- auto zip_data = new OutBuffer();
- (doc_matters.opt.action.debug_do)
- ? zip_data.write(contents.dup)
- : zip_data.write(contents.dup
- .replaceAll(rgx.spaces_line_start, "")
- .replaceAll(rgx.newline, " ")
- .strip
- );
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- createZipFile!()(fn_epub, zip.build());
- }
- try {
- if (!exists(pth_epub3.base)) {
- pth_epub3.base.mkdirRecurse;
- }
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- if (!exists(pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename))) {
- pth_epub3.dbg_doc_meta_inf(doc_matters.src.filename).mkdirRecurse;
- }
- if (!exists(pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename))) {
- pth_epub3.dbg_doc_oebps_css(doc_matters.src.filename).mkdirRecurse;
- }
- if (!exists(pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename))) {
- pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename).mkdirRecurse;
- }
- }
- }
- { /+ OEBPS/[segments].xhtml (the document contents) +/
- foreach (seg_filename; doc_matters.has.segnames_lv_0_to_4) {
- string fn = pth_epub3.fn_oebps_content_xhtml(seg_filename);
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn;
- auto zip_data = new OutBuffer();
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- string fn_dbg = pth_epub3.dbg_fn_oebps_content_xhtml(doc_matters.src.filename, seg_filename);
- auto f = File(fn_dbg, "w");
- foreach (docseg; epub_write.doc_epub3[seg_filename]) {
- f.writeln(docseg);
- }
- foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) {
- f.writeln(docseg);
- }
- f.writeln(xhtml_format.tail);
- }
- }
- foreach (docseg; epub_write.doc_epub3[seg_filename]) {
- zip_data.write(docseg.dup);
- }
- foreach (docseg; epub_write.doc_epub3_endnotes[seg_filename]) {
- zip_data.write(docseg.dup);
- }
- 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 +/
- createZipFile!()(fn_epub, zip.build());
- }
- }
- string fn;
- string fn_dbg;
- File f;
- { /+ mimetypes (identify zip file type) +/
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- fn_dbg = pth_epub3.dbg_fn_mimetypes(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(epub_write.mimetypes);
- }
- }
- fn = pth_epub3.fn_mimetypes;
- EPUBzip(epub_write.mimetypes, fn);
- }
- { /+ META-INF/container.xml (identify doc root) +/
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- fn_dbg = pth_epub3.dbg_fn_dmi_container_xml(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(epub_write.meta_inf_container_xml);
- }
- }
- fn = pth_epub3.fn_dmi_container_xml;
- EPUBzip(epub_write.meta_inf_container_xml, fn);
- }
- { /+ OEBPS/toc_nav.xhtml (navigation toc epub3) +/
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_nav_xhtml(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(epub_write.oebps_toc_nav_xhtml);
- }
- }
- fn = pth_epub3.fn_oebps_toc_nav_xhtml;
- EPUBzip(epub_write.oebps_toc_nav_xhtml, fn);
- }
- { /+ OEBPS/toc.ncx (navigation toc epub2) +/
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- fn_dbg = pth_epub3.dbg_fn_oebps_toc_ncx(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(epub_write.oebps_toc_ncx);
- }
- }
- fn = pth_epub3.fn_oebps_toc_ncx;
- EPUBzip(epub_write.oebps_toc_ncx, fn);
- }
- { /+ OEBPS/content.opf (doc manifest) +/
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- fn_dbg = pth_epub3.dbg_fn_oebps_content_opf(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(epub_write.oebps_content_opf);
- }
- }
- fn = pth_epub3.fn_oebps_content_opf;
- EPUBzip(epub_write.oebps_content_opf, fn);
- }
- { /+ OEBPS/_dr/image (images) +/
- foreach (image; doc_matters.srcs.image_list) {
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- if (doc_matters.opt.action.very_verbose) {
- writeln(
- doc_matters.src.image_dir_path, "/", image, " -> ",
- pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename), "/", image
- );
- }
- if (exists(doc_matters.src.image_dir_path ~ "/" ~ image)) {
- (doc_matters.src.image_dir_path ~ "/" ~ image)
- .copy((pth_epub3.dbg_doc_oebps_image(doc_matters.src.filename)) ~ "/" ~ image);
- }
- }
- }
- auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
- auto fn_out = pth_epub3.doc_oebps_image ~ "/" ~ image;
- if (exists(fn_src)) {
- {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn_out;
- auto zip_data = new OutBuffer();
- zip_data.write(cast(char[]) ((fn_src).read));
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- createZipFile!()(fn_epub, zip.build());
- }
- }
- }
- }
- { /+ OEBPS/epub.css +/
- auto css = spineCss(doc_matters);
- { /+ debug +/
- if (doc_matters.opt.action.debug_do) {
- fn_dbg = pth_epub3.dbg_fn_oebps_css(doc_matters.src.filename);
- File(fn_dbg, "w").writeln(css.epub);
- }
- }
- fn = pth_epub3.fn_oebps_css;
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn;
- auto zip_data = new OutBuffer();
- zip_data.write(css.epub.dup);
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- createZipFile!()(fn_epub, zip.build());
- }
- } catch (ErrnoException ex) {
- // Handle error
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", fn_epub);
- }
- debug(epub_archive) {
- if (exists(fn_epub)) {
- try {
- auto zipped = new ZipArchive((fn_epub).read);
- foreach (filename, member; zipped.directory) {
- auto data = zipped.expand(member);
- writeln(filename, " length ", data.length);
- }
- } catch (ZipException ex) {
- // Handle errors
- }
- }
- }
- }
-
-}
diff --git a/src/doc_reform/output/html.d b/src/doc_reform/output/html.d
deleted file mode 100644
index 07da3c1..0000000
--- a/src/doc_reform/output/html.d
+++ /dev/null
@@ -1,536 +0,0 @@
-module doc_reform.output.html;
-template outputHTML() {
- import doc_reform.output;
- import
- std.digest.sha,
- std.file,
- std.outbuffer,
- std.uri,
- std.zip,
- std.conv : to;
- import
- doc_reform.output.create_zip_file,
- doc_reform.output.xmls,
- doc_reform.output.xmls_css;
- mixin outputXHTMLs;
- void scroll(D,M)(
- const D doc_abstraction,
- M doc_matters,
- ) {
- mixin spineOutputRgxInit;
- auto xhtml_format = outputXHTMLs();
- auto rgx = Rgx();
- string[] doc_html;
- string[] doc;
- string suffix = ".html";
- string previous_part = "";
- string delimit = "";
- foreach (part; doc_matters.has.keys_seq.scroll) {
- foreach (obj; doc_abstraction[part]) {
- delimit = xhtml_format.div_delimit(part, previous_part);
- 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) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "toc":
- doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "body": assert(part == "body" || "head");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "para":
- doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- case "block":
- switch (obj.metainfo.is_a) {
- case "quote":
- doc_html ~= xhtml_format.quote_scroll(_txt, obj, doc_matters);
- break;
- case "group":
- doc_html ~= xhtml_format.group_scroll(_txt, obj, doc_matters);
- break;
- case "block":
- doc_html ~= xhtml_format.block_scroll(_txt, obj, doc_matters);
- break;
- case "poem":
- break;
- case "verse":
- doc_html ~= xhtml_format.verse_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "code":
- doc_html ~= xhtml_format.code(_txt, obj, doc_matters);
- break;
- case "table":
- doc_html ~= xhtml_format.table(_txt, obj, doc_matters);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- doc_html ~= delimit ~ xhtml_format.heading_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "endnote": assert(part == "endnotes");
- doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "glossary": assert(part == "glossary");
- doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "bibliography": assert(part == "bibliography");
- doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "bookindex": assert(part == "bookindex");
- doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
- break;
- case "blurb": assert(part == "blurb");
- doc_html ~= xhtml_format.para_scroll(_txt, obj, doc_matters, suffix);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "comment":
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
- }
- }
- break;
- }
- }
- }
- doc = xhtml_format.html_head(doc_matters, "scroll") ~ doc_html ~ xhtml_format.tail;
- scroll_write_output(doc, doc_matters);
- }
- void scroll_write_output(D,M)(
- D doc,
- M doc_matters,
- ) {
- debug(asserts) {
- static assert(is(typeof(doc) == string[]));
- }
- auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
- try {
- if (!exists(pth_html.base)) {
- pth_html.base.mkdirRecurse;
- }
- auto f = File(pth_html.fn_scroll(doc_matters.src.filename), "w");
- foreach (o; doc) {
- f.writeln(o);
- }
- } catch (ErrnoException ex) {
- // Handle error
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", pth_html.fn_scroll(doc_matters.src.filename));
- }
- }
- void seg(D,M)(
- const D doc_abstraction,
- M doc_matters,
- ) {
- mixin spineOutputRgxInit;
- auto rgx = Rgx();
- auto xhtml_format = outputXHTMLs();
- string[][string] doc_html;
- string[][string] doc_html_endnotes;
- string[] doc;
- string segment_filename;
- string[] top_level_headings = ["","","",""];
- string previous_seg_filename = "";
- string suffix = ".html";
- string previous_part = "";
- string delimit = "";
- foreach (part; doc_matters.has.keys_seq.seg) {
- foreach (obj; doc_abstraction[part]) {
- delimit = xhtml_format.div_delimit(part, previous_part);
- 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) {
- case 0: .. case 3:
- /+ fill buffer, and replace with new levels from 1 to 3 +/
- switch (obj.metainfo.heading_lev_markup) {
- case 0:
- top_level_headings[0] = "";
- top_level_headings[1] = "";
- top_level_headings[2] = "";
- top_level_headings[3] = "";
- goto default;
- case 1:
- top_level_headings[1] = "";
- top_level_headings[2] = "";
- top_level_headings[3] = "";
- goto default;
- case 2:
- top_level_headings[2] = "";
- top_level_headings[3] = "";
- goto default;
- case 3:
- top_level_headings[3] = "";
- goto default;
- default:
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
- top_level_headings[obj.metainfo.heading_lev_markup] = t[0];
- break;
- }
- break;
- case 4:
- segment_filename = obj.tags.segment_anchor_tag_epub;
- doc_html[segment_filename] ~= xhtml_format.html_head(doc_matters, "seg");
- auto navigation_bar = xhtml_format.nav_pre_next_svg(obj, doc_matters);
- doc_html[segment_filename] ~= navigation_bar.toc_pre_next;
- previous_seg_filename = segment_filename;
- foreach (top_level_heading; top_level_headings) {
- doc_html[segment_filename] ~= top_level_heading;
- }
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- doc_html[segment_filename] ~= xhtml_format.lev4_heading_subtoc(obj, doc_matters);
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case 5: .. case 7:
- auto t = xhtml_format.heading_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case 8: .. case 9:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
- }
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a, ": ", obj.metainfo.heading_lev_markup);
- }
- }
- break;
- }
- } else {
- assert(part == "head" || "toc" || "body" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
- switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head" || "toc");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "toc":
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- case "body": assert(part == "body");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "para":
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- case "block":
- switch (obj.metainfo.is_a) {
- case "quote":
- auto t = xhtml_format.quote_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case "group":
- auto t = xhtml_format.group_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case "block":
- auto t = xhtml_format.block_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case "poem":
- break;
- case "verse":
- auto t = xhtml_format.verse_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0].to!string;
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case "code":
- doc_html[segment_filename] ~= xhtml_format.code(_txt, obj, doc_matters);
- break;
- case "table":
- doc_html[segment_filename] ~= xhtml_format.table(_txt, obj, doc_matters);
- doc_html_endnotes[segment_filename] ~= "";
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "endnote": assert(part == "endnotes");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0];
- break;
- case "glossary": assert(part == "glossary");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0];
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case "bibliography": assert(part == "bibliography");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0];
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case "bookindex": assert(part == "bookindex");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0];
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- case "blurb": assert(part == "blurb");
- auto t = xhtml_format.para_seg(_txt, obj, doc_matters, suffix, "seg");
- doc_html[segment_filename] ~= t[0];
- doc_html_endnotes[segment_filename] ~= t[1];
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "comment":
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
- }
- }
- break;
- }
- }
- }
- }
- seg_write_output(doc_html, doc_html_endnotes, doc_matters);
- }
- void seg_write_output(D,E,M)(
- D doc_html,
- E doc_html_endnotes,
- M doc_matters,
- ) {
- debug(asserts) {
- static assert(is(typeof(doc_html) == string[][string]));
- }
- mixin spineOutputRgxInit;
- auto rgx = Rgx();
- auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
- auto xhtml_format = outputXHTMLs();
- auto m = doc_matters.src.filename.matchFirst(rgx.src_fn);
- try {
- if (!exists(pth_html.seg(doc_matters.src.filename))) {
- pth_html.seg(doc_matters.src.filename).mkdirRecurse;
- }
- foreach (seg_filename; doc_matters.has.segnames_lv4) {
- auto f = File(pth_html.fn_seg(doc_matters.src.filename, seg_filename), "w");
- foreach (docseg; doc_html[seg_filename]) {
- f.writeln(docseg);
- }
- foreach (docseg; doc_html_endnotes[seg_filename]) {
- f.writeln(docseg);
- }
- f.writeln(xhtml_format.tail);
- }
- } catch (ErrnoException ex) {
- // handle error
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", pth_html.fn_seg(doc_matters.src.filename, "toc"));
- }
- }
- void css(M)(M doc_matters) {
- auto css = spineCss(doc_matters);
- auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
- try {
- if (!exists(pth_html.css)) {
- (pth_html.css).mkdirRecurse;
- }
- auto f = File(pth_html.fn_seg_css, "w");
- f.writeln(css.html_seg);
- f = File(pth_html.fn_scroll_css, "w");
- f.writeln(css.html_scroll);
- } catch (ErrnoException ex) {
- // Handle error
- }
- }
- void images_cp(M)(
- M doc_matters,
- ) {
- { /+ (copy html images) +/
-
- auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
- if (!exists(pth_html.image)) {
- pth_html.image.mkdirRecurse;
- }
- foreach (image; doc_matters.srcs.image_list) {
- auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
- auto fn_src_out = pth_html.image ~ "/" ~ image;
- debug(images_html) {
- writeln(fn_src_in, " -> ", fn_src_out);
- }
- if (exists(fn_src_in)) {
- fn_src_in.copy(fn_src_out);
- } else {
- if (!(doc_matters.opt.action.quiet)) {
- writeln("WARNING image not found: ", fn_src_in);
- }
- }
- }
- }
- }
-}
diff --git a/src/doc_reform/output/hub.d b/src/doc_reform/output/hub.d
deleted file mode 100644
index acb8a68..0000000
--- a/src/doc_reform/output/hub.d
+++ /dev/null
@@ -1,135 +0,0 @@
-/++
- output hub
- check & generate output types requested
-+/
-module doc_reform.output.hub;
-template outputHub() {
- import doc_reform.output,
- doc_reform.output.xmls,
- doc_reform.output.odt,
- doc_reform.output.create_zip_file,
- doc_reform.output.paths_output;
- import std.parallelism;
- void outputHub(D,I)(const D doc_abstraction, I doc_matters) {
- mixin spineOutputRgxInit;
- mixin Msg;
- auto msg = Msg!()(doc_matters);
- static auto rgx = Rgx();
- enum outTask { source_or_pod, sqlite, sqlite_multi, latex, odt, epub, html_scroll, html_seg, html_stuff }
- void Scheduled(D,I)(int sched, D doc_abstraction, I doc_matters) {
- auto msg = Msg!()(doc_matters);
- if (sched == outTask.source_or_pod) {
- if (doc_matters.opt.action.source) {
- msg.v("spine (doc reform) source processing... ");
- }
- if (doc_matters.opt.action.pod) {
- msg.v("spine (doc reform) source pod processing... ");
- }
- import doc_reform.output.source_pod;
- spinePod!()(doc_matters);
- if (doc_matters.opt.action.source) {
- msg.vv("spine (doc reform) source done");
- }
- if (doc_matters.opt.action.pod) {
- msg.vv("spine (doc reform) source pod done");
- }
- }
- if (sched == outTask.epub) {
- msg.v("epub3 processing... ");
- import doc_reform.output.epub3;
- doc_abstraction.outputEPub3!()(doc_matters);
- msg.vv("epub3 done");
- }
- if (sched == outTask.html_scroll) {
- msg.v("html scroll processing... ");
- import doc_reform.output.html;
- outputHTML!().scroll(doc_abstraction, doc_matters);
- msg.vv("html scroll done");
- }
- if (sched == outTask.html_seg) {
- msg.v("html seg processing... ");
- import doc_reform.output.html;
- outputHTML!().seg(doc_abstraction, doc_matters);
- msg.vv("html seg done");
- }
- if (sched == outTask.html_stuff) {
- import doc_reform.output.html;
- outputHTML!().css(doc_matters);
- outputHTML!().images_cp(doc_matters);
- msg.vv("html css & images done");
- }
- if (sched == outTask.latex) {
- msg.v("latex processing... (available for downstream processing & pdf output");
- import doc_reform.output.latex;
- outputLaTeX!()(doc_abstraction, doc_matters);
- msg.vv("latex done");
- }
- if (sched == outTask.odt) {
- msg.v("odf:odt processing... ");
- import doc_reform.output.odt;
- outputODT!()(doc_abstraction, doc_matters);
- msg.vv("odf:odt done");
- }
- if (sched == outTask.sqlite) {
- msg.v("sqlite processing... ");
- import doc_reform.output.sqlite;
- doc_abstraction.SQLiteHubDiscreteBuildTablesAndPopulate!()(doc_matters);
- msg.vv("sqlite done");
- }
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", doc_matters.src.filename_base);
- }
- if (!(doc_matters.opt.action.parallelise_subprocesses)) {
- foreach(schedule; doc_matters.opt.action.output_task_scheduler) {
- Scheduled!()(schedule, doc_abstraction, doc_matters);
- }
- } else {
- foreach(schedule; parallel(doc_matters.opt.action.output_task_scheduler)) {
- Scheduled!()(schedule, doc_abstraction, doc_matters);
- }
- }
- if (doc_matters.opt.action.sqlite_update) {
- msg.v("sqlite update processing...");
- import doc_reform.output.sqlite;
- doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters);
- msg.vv("sqlite update done");
- } else if (doc_matters.opt.action.sqlite_delete) {
- msg.v("sqlite delete processing...");
- import doc_reform.output.sqlite;
- doc_abstraction.SQLiteHubBuildTablesAndPopulate!()(doc_matters);
- msg.vv("sqlite delete done");
- }
- }
-}
-template outputHubOp() {
- import doc_reform.output,
- doc_reform.output.xmls,
- doc_reform.output.odt,
- doc_reform.output.create_zip_file,
- doc_reform.output.paths_output;
- void outputHubOp(E,O)(E env, O opt_action) {
- mixin spineOutputRgxInit;
- static auto rgx = Rgx();
- if ((opt_action.sqlite_db_drop)) {
- if ((opt_action.verbose)) {
- writeln("sqlite drop db...");
- }
- import doc_reform.output.sqlite;
- SQLiteDbDrop!()(opt_action);
- if ((opt_action.very_verbose)) {
- writeln("sqlite drop db done");
- }
- }
- if ((opt_action.sqlite_db_create)) {
- if ((opt_action.verbose)) {
- writeln("sqlite create table...");
- }
- import doc_reform.output.sqlite;
- SQLiteTablesCreate!()(env, opt_action);
- if ((opt_action.very_verbose)) {
- writeln("sqlite create table done");
- }
- }
- }
-}
diff --git a/src/doc_reform/output/latex.d b/src/doc_reform/output/latex.d
deleted file mode 100644
index 8308067..0000000
--- a/src/doc_reform/output/latex.d
+++ /dev/null
@@ -1,1204 +0,0 @@
-module doc_reform.output.latex;
-template outputLaTeX() {
- import doc_reform.output;
- import
- std.digest.sha,
- std.file,
- std.outbuffer,
- std.uri,
- std.conv : to;
- mixin InternalMarkup; // watch
- mixin spineOutputRgxInit;
- auto rgx = Rgx();
- mixin spineLanguageCodes;
- auto lang = Lang();
- auto paper() {
- struct PaperType {
- auto a4() {
- struct A4 {
- auto portrait() {
- struct V {
- uint w = 160;
- uint h = 228;
- uint img_px = 450;
- }
- return V();
- }
- auto landscape() {
- struct H {
- uint w = 238;
- uint h = 160;
- uint img_px = 300;
- }
- return H();
- }
- }
- return A4();
- }
- auto a5() {
- struct A5 {
- auto portrait() {
- struct V {
- uint w = 112;
- uint h = 162;
- uint img_px = 280;
- }
- return V();
- }
- auto landscape() {
- struct H {
- uint w = 152;
- uint h = 100;
- uint img_px = 190;
- }
- return H();
- }
- }
- return A5();
- }
- auto b4() {
- struct B4 {
- auto portrait() {
- struct V {
- uint w = 140;
- uint h = 204;
- uint img_px = 356;
- }
- return V();
- }
- auto landscape() {
- struct H {
- uint w = 200;
- uint h = 130;
- uint img_px = 260;
- }
- return H();
- }
- }
- return B4();
- }
- auto letter() {
- struct Letter {
- auto portrait() {
- struct V {
- uint w = 166;
- uint h = 212;
- uint img_px = 468;
- }
- return V();
- }
- auto landscape() {
- struct H {
- uint w = 226;
- uint h = 166;
- uint img_px = 290;
- }
- return H();
- }
- }
- return Letter();
- }
- auto legal() {
- struct Legal {
- auto portrait() {
- struct V {
- uint w = 168;
- uint h = 286;
- uint img_px = 474;
- }
- return V();
- }
- auto landscape() {
- struct H {
- uint w = 296;
- uint h = 166;
- uint img_px = 420;
- }
- return H();
- }
- }
- return Legal();
- }
- }
- return PaperType();
- }
- string sp_char_esc(O)(
- string _txt,
- const O obj,
- ) {
- string _unescape_sp_char_esc()(string _txt) {
- _txt = _txt
- .replaceAll(rgx.latex_special_char_escaped,
- format(q"┃%s┃", "$1"))
- .replaceAll(rgx.latex_special_char_escaped_braced,
- format(q"┃%s┃", "$1"));
- return _txt;
- }
- string _unescape_fontface_esc()(string _txt) {
- _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface,
- format(q"┃%s%s┃", "$1", "$2"));
- return _txt;
- }
- if (obj.metainfo.is_a != "code") {
- _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape);
- _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces);
- _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link);
- _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface);
- }
- return _txt;
- }
- string sp_char_esc_txt()(
- string _txt,
- ) {
- string _unescape_sp_char_esc()(string _txt) {
- _txt = _txt
- .replaceAll(rgx.latex_special_char_escaped,
- format(q"┃%s┃", "$1"))
- .replaceAll(rgx.latex_special_char_escaped_braced,
- format(q"┃%s┃", "$1"));
- return _txt;
- }
- string _unescape_fontface_esc()(string _txt) {
- _txt = _txt.replaceAll(rgx.latex_identify_inline_fontface,
- format(q"┃%s%s┃", "$1", "$2"));
- return _txt;
- }
- _txt = replaceAll!(m => "\\" ~ m[1])(_txt, rgx.latex_special_char_for_escape);
- _txt = replaceAll!(m => "{\\" ~ m[1] ~ "}")(_txt, rgx.latex_special_char_for_escape_and_braces);
- _txt = replaceAll!(m => _unescape_sp_char_esc(m[0]))(_txt, rgx.latex_identify_inline_link);
- _txt = replaceAll!(m => _unescape_fontface_esc(m[0]))(_txt, rgx.latex_identify_inline_fontface);
- return _txt;
- }
- string fontface()(
- string _txt,
- ) {
- _txt = _txt
- .replaceAll(rgx.inline_emphasis, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1"))
- .replaceAll(rgx.inline_bold, format(q"┃\begin{bfseries}%s\end{bfseries}┃", "$1"))
- .replaceAll(rgx.inline_italics, format(q"┃\emph{%s}┃", "$1"))
- .replaceAll(rgx.inline_italics, format(q"┃\uline{%s}┃", "$1"))
- .replaceAll(rgx.inline_superscript, format(q"┃$$^{\textrm{%s}}$$┃", "$1"))
- .replaceAll(rgx.inline_subscript, format(q"┃$$_{\textrm{%s}}$$┃", "$1"))
- .replaceAll(rgx.inline_strike, format(q"┃\sout{%s}┃", "$1"))
- .replaceAll(rgx.inline_insert, format(q"┃\uline{%s}┃", "$1"))
- .replaceAll(rgx.inline_mono, format(q"┃\begin{monosp}%s\end{monosp}┃", "$1"))
- .replaceAll(rgx.inline_italics, format(q"┃``%s''┃", "$1"));
- return _txt;
- }
- string leading_hardspaces()(
- string _txt,
- ) {
- string hardspaces(string _spaces) {
- _spaces = _spaces
- .replaceAll(rgx.space, "\\hardspace ");
- return _spaces;
- }
- _txt = replaceAll!(m => hardspaces(m[0]))(_txt, rgx.spaces_line_start);
- return _txt;
- }
- string nbsp_char()(string _txt) {
- if (_txt.match(rgx.nbsp_char)) {
- _txt = _txt.replaceAll(rgx.nbsp_char, "\\hardspace ");
- }
- return _txt;
- }
- string nbsp_char_to_space()(string _txt) {
- if (_txt.match(rgx.nbsp_char)) {
- _txt = _txt.replaceAll(rgx.nbsp_char, " ");
- }
- return _txt;
- }
- string links_and_images(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- if (obj.has.inline_links) { // TODO some images do not have inline links ... image without link
- string _width_adjust(string _width) {
- if (_width.to!int > 300) { _width = "300"; } // will need to vary max with papersize & orientation
- return _width;
- }
- string _latex_image_path(string _image_path) {
- auto pth_latex = spinePathsLaTeX(doc_matters);
- _image_path = pth_latex.latex_path_stuff ~ "/" ~ _image_path;
- return _image_path;
- }
- string _if_images(string _linked_content) {
- if (_linked_content.match(rgx.inline_image_info)) {
- _linked_content = replaceAll!(m =>
- format(q"┃\includegraphics*[width=%spt]{%s}%s┃",
- _width_adjust(m[2]), _latex_image_path(m[1]), " \\\\\n")
- )(_linked_content, rgx.inline_image_info);
- }
- return _linked_content;
- }
- string _check_link(string _link) {
- _link = _link
- .replaceFirst(rgx.latex_clean_internal_link, "")
- .replaceAll(rgx.latex_special_char_for_escape_url, "\\$1");
- return _link;
- }
- if (obj.metainfo.is_a != "code") {
- _txt = replaceAll!(m =>
- m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├"
- )(_txt, rgx.inline_link_number_only);
- _txt = replaceAll!(m =>
- ((m[1] == m[2]) && (m[2].match(rgx.uri)))
- ? format(q"┃\begin{scriptsize}\lefthalfcap\url{%s}\righthalfcup\end{scriptsize}┃", _check_link(m[1]))
- : (m[2].match(rgx.uri)) // ERROR
- ? format(q"┃%s\href{%s}%s{%s}┃", "\\\\\n", _check_link(m[2]), "\n", _if_images(m[1]))
- : format(q"┃\hyperlink{%s}{%s}┃", _check_link(m[2]), _if_images(m[1]))
- )(_txt, rgx.inline_link);
- }
- }
- return _txt;
- }
- string footnotes()(
- string _txt,
- ) {
- if (_txt.match(rgx.inline_notes_al_gen)) {
- string _tex_note = q"┃\hypertarget{noteref_%s}{}\footnote[%s]{%%
- \label{note_%s}%s}┃";
- _txt = _txt.replaceAll(rgx.inline_notes_al_regular_number_note,
- format(_tex_note,
- "$1", "$1", "$1",
- "$2".strip
- ).strip
- );
- }
- return _txt;
- }
- string remove_footnotes()(
- string _txt,
- ) {
- if (_txt.match(rgx.inline_notes_al_gen)) {
- _txt = replaceAll!(m => "")(_txt, rgx.inline_notes_al_gen);
- }
- return _txt;
- }
- string para(O)(
- string _txt,
- O obj,
- ) {
- if (obj.metainfo.is_of_type == "para") {
- string _tex_para;
- _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s┃";
- _txt = format(_tex_para,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.footnotes
- ).strip;
- }
- return _txt;
- }
- string bookindex(O)(
- string _txt,
- O obj,
- ) {
- if (obj.metainfo.is_of_type == "para"
- && obj.metainfo.is_a == "bookindex"
- ) {
- string _tex_para;
- _tex_para = q"┃%s┃";
- _txt = format(_tex_para,
- _txt.replaceAll(rgx.latex_clean_bookindex_linebreak, "\n") ~ "\n\\\\\n"
- );
- }
- return _txt;
- }
- string heading(O,M)(
- string _txt,
- O obj,
- M doc_matters,
- string _part = ""
- ) {
- if (obj.metainfo.is_a == "heading") {
- string _tex_para;
- string _pg_break;
- string _sect;
- string _post;
- string _title_add;
- string _columns = "";
- switch (obj.metainfo.heading_lev_markup) {
- case 0: // A == TITLE
- _pg_break = "\\begin{document}\n";
- goto default;
- case 1: // B == part: section heading level
- _pg_break = "\\clearpage\n";
- goto default;
- case 2: // C == part: section heading level
- _pg_break = "\\clearpage\n";
- goto default;
- case 3: // D == part: section heading level
- _pg_break = "\\clearpage\n";
- goto default;
- case 4: // 1 == section
- _columns = (_part != "bookindex")
- ? "" : "\n\\\\\n\\begin{multicols}{2}";
- _pg_break = "\\clearpage\n";
- _sect = "section";
- _post = "";
- _title_add = format(q"┃
-\markboth{%s}{%s}┃",
- doc_matters.conf_make_meta.meta.title_full,
- doc_matters.conf_make_meta.meta.title_full,
- );
- goto default;
- case 5: // 2 == subsection
- _pg_break = "";
- // _pg_break = "newpage"; // doubt this is necessary
- _sect = "subsection";
- _post = " \\\n";
- _title_add = "";
- goto default;
- case 6: // 3 == subsubsection
- _pg_break = "";
- // _pg_break = "newpage"; // doubt this is necessary
- _sect = "subsubsection";
- _post = " \\\n";
- _title_add = "";
- goto default;
- default:
- if (obj.metainfo.heading_lev_markup == 0) {
- _tex_para = q"┃\begin{document}
-\title{%s}
-\author{ \textnormal{%s}}
-\date{\begin{tiny}%s\end{tiny}}
-\pagenumbering{roman}\maketitle
-\pagestyle{fancy}
-\newpage
-\markboth{%s}{%s}
-\\\\[3]\ \linebreak Copyright {\begin{small}{\copyright\end{small}} %s \\
-%s
-\pagestyle{fancy}
-\clearpage┃";
- _txt = format(_tex_para,
- (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.date_published).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.rights_copyright).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.rights_license).sp_char_esc_txt,
- );
- } else if (obj.metainfo.heading_lev_markup < 4) {
- _tex_para = q"┃%s\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s}
-\addcontentsline{toc}{part}{%s}
-\markboth{%s}┃";
- _txt = format(_tex_para,
- _pg_break,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.strip.footnotes,
- _txt.strip.remove_footnotes,
- (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
- );
- } else if (obj.metainfo.heading_lev_markup > 3) {
- if (obj.metainfo.heading_lev_markup == 4
- && _txt.match(regex(r"^Table of Contents$"))) {
- _tex_para = q"┃
-\pagenumbering{none}
-\setcounter{page}{1}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-\part*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{1}{1}\end{tiny}}}%s \newline %s}
-
-\clearpage
-\markboth{%s}{%s}
-\pagenumbering{gobble}
-\renewcommand{\contentsname}{}
-\tableofcontents
-\markboth{%s}{%s}
-
-\clearpage
-\pagenumbering{arabic}
-\setcounter{page}{1}
-\markboth{%s}{%s}
-%% \null
-\clearpage
-\setcounter{page}{1}┃";
- _txt = format(_tex_para,
- (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.creator_author).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_main).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
- (doc_matters.conf_make_meta.meta.title_full).sp_char_esc_txt,
- );
- } else if (obj.metainfo.heading_lev_markup == 4
- && _part == "bookindex"
- && _txt.match(regex(r"^Index$"))
- ) {
- _tex_para = q"┃%s\%s*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s}
-\addcontentsline{toc}{%s}{%s%s}%s%s┃";
- _txt = format(_tex_para,
- _pg_break,
- _sect.strip,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.footnotes.strip,
- _sect,
- _txt.remove_footnotes.strip,
- _post,
- _title_add,
- _columns,
- );
- } else if (obj.metainfo.dummy_heading
- && obj.metainfo.heading_lev_markup == 4
- ) { /+ dummy headings completely omitted +/
- _txt = "";
- } else {
- _tex_para = q"┃%s\%s*{\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}%s}
-\addcontentsline{toc}{%s}{%s%s}%s┃";
- _txt = format(_tex_para,
- _pg_break,
- _sect.strip,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.footnotes.strip,
- _sect,
- _txt.remove_footnotes.strip,
- _post,
- _title_add,
- );
- }
- }
- break;
- }
- }
- return _txt.strip;
- }
-string group(O,M)(
- string _txt,
- O obj,
- M doc_matters,
-) {
- if (obj.metainfo.is_a == "group") {
- string _tex_para;
- _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
-\begin{footnotesize}
-%s
-\end{footnotesize}
-┃";
- _txt = format(_tex_para,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.footnotes.strip
- ).strip;
- }
- return _txt;
-}
-string block(O,M)(
- string _txt,
- O obj,
- M doc_matters,
-) {
- if (obj.metainfo.is_a == "block") {
- // _txt = _txt.nbsp_char;
- string _tex_para;
- _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}
-\begin{footnotesize}
-%s
-\end{footnotesize}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-┃"; // \hardspace
- /+ try both: +/
- _txt = _txt.split(rgx.br_newlines_linebreaks).join("\n\n"); // _txt = _txt.split(rgx.br_newlines_linebreaks).join(" \\\n");
- _txt = format(_tex_para,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.nbsp_char.footnotes.strip
- ).strip;
- }
- return _txt;
-}
-string verse(O,M)(
- string _txt,
- O obj,
- M doc_matters,
-) {
- if (obj.metainfo.is_a == "verse") {
- string _tex_para;
- _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.1ex plus0.1ex minus0.1ex}
-\begin{footnotesize}
-
-%s
-
-\end{footnotesize}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-\linebreak
-┃"; // \hardspace
- _txt = format(_tex_para,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.nbsp_char.footnotes.split("\n").join("\n\n").strip
- ).strip;
- }
- return _txt;
-}
-string codeblock(O,M)(
- string _txt,
- O obj,
- M doc_matters,
-) {
- if (obj.metainfo.is_a == "code") {
- string _tex_para;
- _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}\setlength{\parskip}{0.5ex plus0.2ex minus0.1ex}\begin{Codeblock}
-\begin{lstlisting}
-%s
-\end{lstlisting}
-\end{Codeblock}
-\setlength{\parskip}{1ex plus0.5ex minus0.2ex}
-┃";
- _txt = format(_tex_para,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _txt.nbsp_char_to_space
- ).strip;
- }
- return _txt;
-}
-auto tablarize(O)(
- string _txt,
- const O obj,
-) {
- string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
- string[] _table_cols;
- string _table;
- string _tablenote;
- foreach(row_idx, row; _table_rows) {
- _table_cols = row.split(rgx.table_delimiter_col);
- _table ~= "";
- 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)
- _tablenote ~= cell;
- } else {
- // // _table ~= "\\bfseries ";
- // _table ~= cell;
- // _table ~= (_table_cols.length > (col_idx + 1)) ? "&" : "";
- _table ~= format(q"┃%s%s┃",
- cell,
- (_table_cols.length > (col_idx + 1)) ? "&" : ""
- );
- }
- }
- _table ~= "\\\\";
- }
- auto t = tuple(
- _table,
- _tablenote,
- );
- return t;
-}
-string table(O,M)(
- string _txt,
- O obj,
- M doc_matters,
-) {
- if (obj.metainfo.is_a == "table") {
- auto _t = _txt.tablarize(obj);
- string _table = _t[0];
- string _t_n = _t[1];
- string papertype = "a4";
- uint pw = 0;
- switch (papertype) {
- case "a4": pw = (paper.a4.portrait.w - 20); break;
- case "a5": pw = (paper.a5.portrait.w - 20); break;
- case "b4": pw = (paper.b4.portrait.w - 20); break;
- case "letter": pw = (paper.letter.portrait.w - 20); break;
- case "legal": pw = (paper.legal.portrait.w - 20); break;
- default: pw = 0; break;
- }
- // auto textwidth = (pw - 24);
- string _colw = "";
- foreach (w; obj.table.column_widths) {
- _colw ~= format(q"┃p{%.0fmm}┃",
- (w * pw / 100)
- // (w * (pw - 24)/ 100)
- // (w * textwidth / 100)
- );
- }
- string _tex_para;
- _tex_para = q"┃\begin{tiny}\hspace{0mm}\end{tiny}{\marginpar{\begin{tiny}\hspace{0mm}\hypertarget{%s}{%s}\end{tiny}}}
-\setlength{\LTleft}{0pt}
-\setlength{\LTright}{\fill}
-\begin{tiny}
-\begin{longtable}{%s}
-%s
-\end{longtable}
-\end{tiny}
-┃";
- _txt = format(_tex_para,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _colw,
- _table,
- ).strip;
- }
- return _txt;
-}
- string bullets_and_indentation(O)(
- string _txt,
- O obj,
- ) {
- string _tex_para;
- string _hang; string _indent;
- int _paper_margin = -10;
- int _indent_increment = 8; // 5; 10;
- if (obj.attrib.bullet) {
- int _bullet_space = 5;
- _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin + _bullet_space).to!string;
- _txt = format(q"┃\begin{Bullet}{%smm}$\txtbullet$\hspace{\enspace}%s\end{Bullet}┃",
- _indent,
- _txt.footnotes
- ).strip;
- } else if (
- obj.attrib.indent_base != 0
- && obj.attrib.indent_base == obj.attrib.indent_hang
- ) {
- _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string;
- _tex_para = q"┃\begin{ParagraphIndent}{%smm}%s \end{ParagraphIndent}┃";
- _txt = format(_tex_para,
- _indent,
- _txt.footnotes
- ).strip;
- } else if (
- obj.attrib.indent_base != 0
- || obj.attrib.indent_hang != 0
- ) {
- _indent = ((obj.attrib.indent_base * _indent_increment) + _paper_margin).to!string;
- _hang = (((obj.attrib.indent_hang - obj.attrib.indent_base) * _indent_increment)).to!string;
- _tex_para = q"┃\begin{ParagraphHang}{%smm}{%smm}%s \end{ParagraphHang}┃";
- _txt = format(_tex_para,
- _indent, _hang,
- _txt.footnotes
- ).strip;
- }
- return _txt;
- }
- string latex_head(M)(
- M doc_matters,
- ) {
- struct paperType {
- string a4_portrait;
- string a4_landscape;
- string us_letter_portrait;
- string us_letter_landscape;
- }
- auto paper = paperType();
- string _footer(M)(M doc_matters) {
- string _ft = "\\lfoot[\\textrm{\\thepage}]";
- string _ft_1 = format(q"┃{\tiny \href{%s}{%s}}┃", "http://sisudoc.org", "SiSU",);
- string _ft_2 = format(q"┃
- \cfoot{\href{%s}{%s}}┃", "http://git.sisudoc.org", "git",);
- if (doc_matters.conf_make_meta.make.footer.length > 0) {
- if (doc_matters.conf_make_meta.make.footer.length > 0) {
- if (doc_matters.conf_make_meta.make.footer[0].matchAll(rgx.inline_link)) {
- _ft ~= doc_matters.conf_make_meta.make.footer[0]
- .replace(rgx.inline_link, "{\\tiny \\href{$2}{$1}}");
- } else {
- _ft ~= _ft_1;
- }
- }
- if (doc_matters.conf_make_meta.make.footer.length > 1) {
- if (doc_matters.conf_make_meta.make.footer[1].matchAll(rgx.inline_link)) {
- _ft ~= doc_matters.conf_make_meta.make.footer[1]
- .replace(rgx.inline_link, "\n\\cfoot{\\href{$2}{$1}}");
- } else {
- _ft ~= _ft_2;
- }
- }
- } else {
- _ft ~= _ft_1;
- _ft ~= _ft_2;
- }
- return _ft;
- }
- paper.a4_portrait = format(q"┃
-\documentclass[12pt,a4paper,titlepage]{scrartcl}
-\setlength{\textheight}{228mm} \setlength{\textwidth}{160mm}
-┃",
- );
- paper.a4_landscape = format(q"┃
-\documentclass[11pt,a4paper,landscape,titlepage,twocolumn]{scrartcl}
-\setlength{\textheight}{160mm} \setlength{\textwidth}{238mm}
-┃",
- );
- paper.us_letter_portrait = format(q"┃
-\documentclass[12pt,letterpaper,titlepage]{scrartcl}
-\setlength{\textheight}{212mm} \setlength{\textwidth}{166mm}
-┃",
- );
- paper.us_letter_landscape = format(q"┃
-\documentclass[11pt,letterpaper,landscape,titlepage,twocolumn]{scrartcl}
-\setlength{\textheight}{166mm} \setlength{\textwidth}{226mm}
-┃",
- );
- struct paperMargins {
- string portrait;
- string landscape;
- }
- auto margins = paperMargins();
- margins.portrait = format(q"┃
-\setlength{\oddsidemargin}{0mm} \setlength{\evensidemargin}{0mm}
-\setlength{\topmargin}{-12pt} \setlength{\headheight}{12pt}
-\setlength{\headsep}{35pt}
-┃",
- );
- margins.landscape = format(q"┃
-\setlength{\oddsidemargin}{6mm} \setlength{\evensidemargin}{6mm}
-\setlength{\topmargin}{-12mm} \setlength{\headheight}{12pt}
-\setlength{\headsep}{20pt}
-┃",
- );
- struct columnsMulti {
- string portrait;
- string landscape;
- }
- auto multicol = columnsMulti();
- multicol.portrait = format(q"┃
-\usepackage{multicol}
-┃",
- );
- multicol.landscape = "";
- struct colorLinks {
- string mono;
- string color;
- }
- auto links = colorLinks();
- links.mono = format(q"┃
-\usepackage[xetex,
- colorlinks=true,
- urlcolor=myblack,
- filecolor=myblack,
- linkcolor=myblack,
-┃",
- );
- links.color = format(q"┃
-\usepackage[xetex,
- colorlinks=true,
- urlcolor=myblue, %% \href{...}{...} external url
- filecolor=mygreen, %% \href{...} local file
- linkcolor=myred, %% \href{...} and \pageref{...}
- ┃",
- );
- string _latex_head = format(q"┃%%%% spine LaTeX output
-%%%% Generated by: %s
-%%%% D version: %s
-%%%% LaTeX output last Generated on: %s
-%%%% %s %s
-
-%s
-%s
-\setlength{\marginparsep}{4mm}
-\setlength{\marginparwidth}{8mm}
-%s
-\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode}
-\setmainlanguage{%s}
-\setotherlanguage{%s}
-\setmainfont{Liberation Sans}
-\setmonofont[Scale=0.85]{Liberation Mono}
-\usepackage{alltt}
-\usepackage{thumbpdf}
-%s
- pdftitle={%s},
- pdfauthor={%s},
- pdfsubject={%s},
- pdfkeywords={},
- pageanchor=true,
- plainpages=true,
- pdfpagelabels=true,
- pagebackref,
- bookmarks=true,
- bookmarksopen=true,
- pdfmenubar=true,
- pdfpagemode=UseOutline,
- pdffitwindow=true,
- pdfwindowui=true,
- plainpages=false,
- pdfstartview=FitH
-]
-{hyperref}
-\usepackage[usenames]{color}
-\definecolor{myblack}{rgb}{0,0,0}
-\definecolor{myred}{rgb}{0.75,0,0}
-\definecolor{mygreen}{rgb}{0,0.5,0}
-\definecolor{myblue}{rgb}{0,0,0.5}
-\definecolor{mywhite}{rgb}{1,1,1}
-\usepackage{url}
-\urlstyle{sf}
-\usepackage{textcomp}
-\usepackage[parfill]{parskip}
-\usepackage[normalem]{ulem}
-\usepackage{soul}
-\usepackage{longtable}
-\usepackage[tc]{titlepic}
-\usepackage{graphicx}
-\makeatletter
-\parindent0pt
-\usepackage{amssymb}
-\usepackage{listings}
-\usepackage{color}
-\usepackage{textcomp}
-\setcounter{secnumdepth}{2}
-\setcounter{tocdepth}{4}
-\makeatletter
-\usepackage[multiple,ragged]{footmisc}
-\setlength\footnotemargin{12pt}
-\usepackage[para]{manyfoot}
-\DeclareNewFootnote{A}
-\newenvironment{ParagraphIndent}[1]%%
-{
-\begin{list}{}{%%
-\setlength\topsep{0pt}%%
-\addtolength{\leftmargin}{#1}
-\setlength\parsep{0pt plus 1pt}%%
-}
-\item[]
-}
-{\end{list}}
-\newenvironment{ParagraphHang}[2]%%
-{
-\begin{list}{}{%%
-\setlength\topsep{0pt}%%
-\addtolength{\leftmargin}{#1}
-\itemindent=#2
-\setlength\parsep{0pt plus 1pt}%%
-}
-\item[]
-}
-{\end{list}}
-\newenvironment{Bullet}[1]%%
-{
-\begin{list}{}{%%
-\setlength\topsep{0pt}%%
-\addtolength{\leftmargin}{#1}
-\itemindent=-1em
-\setlength\parsep{0pt plus 1pt}%%
-}
-\item[]
-}
-{\end{list}}
-\usepackage{fancyhdr}
-\lhead{}
-\renewcommand{\part}{\@startsection
- {part}{1}{-2mm}%%
- {-\baselineskip}{0.5\baselineskip}%%
- {\bfseries\large\upshape\raggedright}}
-\renewcommand{\section}{\@startsection
- {section}{2}{-2mm}%%
- {-\baselineskip}{0.5\baselineskip}%%
- {\bfseries\large\upshape\raggedright}}
-\renewcommand{\subsection}{\@startsection
- {subsection}{3}{-2mm}%%
- {-\baselineskip}{0.5\baselineskip}%%
- {\bfseries\large\upshape\raggedright}}
-\renewcommand{\subsubsection}{\@startsection
- {subsubsection}{4}{-2mm}%%
- {-\baselineskip}{0.5\baselineskip}%%
- {\normalfont\normalsize\bfseries\raggedright}}
-\renewcommand{\paragraph}{\@startsection
- {paragraph}{5}{-2mm}%%
- {-\baselineskip}{0.5\baselineskip}%%
- {\normalfont\normalsize\itshape\raggedright}}
-\renewcommand{\subparagraph}{\@startsection
- {subparagraph}%%{6}%%{-2mm}%%
- {-\baselineskip}{0.5\baselineskip}%%
- {\normalfont\normalsize\itshape\raggedright}}
-\selectlanguage{%s}
-\lhead[ ]{ }
-\chead[ \fancyplain{} \bfseries \footnotesize \leftmark ]{ \fancyplain{} \bfseries \footnotesize \rightmark }
-\rhead[ ]{ }
-%s
-\rfoot[\tiny \href{}{}]{\textrm{\thepage}}
-\tolerance=300
-\clubpenalty=300
-\widowpenalty=300
-\makeatother
-\makeatother
-\chardef\txtbullet="2022
-\chardef\tilde="7E
-\def\asterisk{{\rm \char42} }
-\definecolor{Light}{gray}{.92}
-\newcommand{\Codeblock}[1]{\normaltext\raggedright\small\ttfamily\texbackslash#1}
-\newcommand{\monosp}[1]{\normaltext\ttfamily\texbackslash#1}
-\newcommand{\parasep}{\\ \begin{center}*\hspace{2em}*\hspace{2em}*\end{center} \\}
-\newcommand{\hardspace}{{~}}
-\newcommand{\caret}{{\^{~}}}
-\newcommand{\pipe}{{\textbar}}
-\newcommand{\curlyopen}{{}
-\newcommand{\curlyclose}{}}
-\newcommand{\lt}{{UseTextSymbol{OML}{<}}}
-\newcommand{\gt}{{UseTextSymbol{OML}{>}}}
-\newcommand{\slash}{{/}}
-\newcommand{\underscore}{\_}
-\newcommand{\exclaim}{\Verbatim{!}}
-\definecolor{listinggray}{gray}{0.9}
-\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
-\lstset{
- backgroundcolor=\color{lbcolor},
- tabsize=4,
- rulecolor=,
- language=,
- basicstyle=\scriptsize,
- upquote=true,
- aboveskip={1.5\baselineskip},
- columns=fixed,
- showstringspaces=false,
- extendedchars=true,
- breaklines=true,
- prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
- frame=single,
- showtabs=false,
- showspaces=false,
- showstringspaces=false,
- identifierstyle=\ttfamily,
- keywordstyle=\color[rgb]{0,0,1},
- commentstyle=\color[rgb]{0.133,0.545,0.133},
- stringstyle=\color[rgb]{0.627,0.126,0.941},
-}
- ┃",
- doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version.strip,
- doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.compiler.strip,
- doc_matters.opt.action.debug_do ? "" : doc_matters.generator_program.stime.strip,
- doc_matters.generator_program.project_name.strip,
- doc_matters.generator_program.url_home.strip,
- paper.a4_portrait.strip,
- margins.portrait.strip,
- multicol.portrait.strip,
- lang.codes[doc_matters.src.language]["xlp"],
- "english",
- links.mono.strip, // links.color.strip,
- doc_matters.conf_make_meta.meta.title_full.strip,
- doc_matters.conf_make_meta.meta.creator_author.strip,
- doc_matters.conf_make_meta.meta.classify_subject.strip,
- lang.codes[doc_matters.src.language]["xlp"],
- _footer(doc_matters),
- );
- return _latex_head.strip;
- }
- string latex_body(D,M)(
- const D doc_abstraction,
- M doc_matters,
- ) {
- string _latex_body = "";
- bool _multicolumns = false;
- string _txt;
- foreach (part; doc_matters.has.keys_seq.latex) {
- foreach (obj; doc_abstraction[part]) {
- switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head" || "toc");
- _txt = obj.text
- .sp_char_esc(obj)
- .fontface;
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- _txt = _txt.heading(obj, doc_matters);
- goto default;
- case "toc":
- break;
- default:
- _latex_body ~= _txt ~ "\n\n";
- _txt = "";
- break;
- }
- break;
- default: break;
- }
- break;
- case "body": assert(part == "body" || "head"); // surprise
- _txt = obj.text
- .sp_char_esc(obj)
- .fontface;
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- _txt = _txt.heading(obj, doc_matters);
- goto default;
- case "para":
- _txt = _txt.para(obj)
- .bullets_and_indentation(obj)
- .links_and_images(obj, doc_matters);
- goto default;
- default:
- _latex_body ~= _txt ~ "\n\n";
- _txt = "";
- break;
- }
- break;
- case "block":
- switch (obj.metainfo.is_a) {
- case "quote":
- goto default; // TODO
- case "group":
- /+ (hardspaces not honored) [remove any hardspace marker] +/
- _txt = _txt.group(obj, doc_matters)
- .links_and_images(obj, doc_matters);
- goto default;
- case "block":
- /+ (hardspace honored) \hardspace +/
- _txt = _txt.block(obj, doc_matters)
- .links_and_images(obj, doc_matters);
- goto default;
- case "verse":
- /+ (hardspace honored) \hardspace +/
- _txt = _txt.verse(obj, doc_matters)
- .links_and_images(obj, doc_matters);
- goto default;
- case "code":
- /+ (hardspace honored) \begin{lstlisting} clear hardspace marker +/
- _txt = _txt.codeblock(obj, doc_matters);
- goto default;
- case "table":
- _txt = _txt.table(obj, doc_matters);
- goto default; // TODO
- default:
- _latex_body ~= _txt ~ "\n\n";
- _txt = "";
- break;
- }
- break;
- default: break;
- }
- break;
- case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
- _txt = obj.text
- .sp_char_esc(obj)
- .fontface;
- switch (obj.metainfo.is_of_type) {
- case "para":
- if (part != "bookindex" && _multicolumns) {
- _multicolumns = false;
- _latex_body ~= "\n\\end{multicols}\n";
- }
- switch (obj.metainfo.is_a) {
- case "heading":
- if (part == "bookindex") {
- _multicolumns = true;
- }
- _txt = _txt.heading(obj, doc_matters, part);
- goto default;
- case "endnote": assert(part == "endnotes");
- _txt = _txt.para(obj)
- .bullets_and_indentation(obj)
- .links_and_images(obj, doc_matters);
- goto default;
- case "glossary": assert(part == "glossary");
- _txt = _txt.para(obj)
- .bullets_and_indentation(obj)
- .links_and_images(obj, doc_matters);
- goto default;
- case "bibliography": assert(part == "bibliography");
- _txt = _txt.para(obj)
- .bullets_and_indentation(obj);
- goto default;
- case "bookindex": assert(part == "bookindex");
- /+ two column, special section +/
- _txt = _txt.bookindex(obj)
- .links_and_images(obj, doc_matters);
- goto default;
- case "blurb": assert(part == "blurb");
- _txt = _txt.para(obj)
- .bullets_and_indentation(obj)
- .links_and_images(obj, doc_matters);
- goto default;
- default:
- _latex_body ~= (part == "bookindex" && obj.metainfo.is_a != "heading")
- ? _txt : (_txt ~ "\n\n");
- _txt = "";
- break;
- }
- break;
- default: break;
- }
- break;
- case "comment":
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
- }
- }
- break;
- }
- }
- }
- if (_multicolumns) {
- _multicolumns = false;
- _latex_body ~= "\n\\end{multicols}\n";
- }
- return _latex_body;
- }
- string latex_tail(M)(
- M doc_matters,
- ) {
- string _latex_tail = format(q"┃
-
-\end{document}
- ┃",
- // doc_matters.conf_make_meta.meta.title_full,
- // doc_matters.conf_make_meta.meta.creator_author,
- );
- return _latex_tail;
- }
- void writeOutputLaTeX(T,M)(
- const T latex_content,
- M doc_matters,
- ) {
- auto pth_latex = spinePathsLaTeX(doc_matters);
- try {
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(latex_content.head);
- writeln(latex_content.content);
- writeln(latex_content.tail);
- }
- }
- if (!exists(pth_latex.latex_path_stuff)) {
- (pth_latex.latex_path_stuff).mkdirRecurse;
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", pth_latex.latex_file_with_path);
- }
- auto f = File(pth_latex.latex_file_with_path, "w");
- f.writeln(latex_content.head);
- f.writeln(latex_content.content);
- f.writeln(latex_content.tail);
- foreach (image; doc_matters.srcs.image_list) {
- auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
- auto fn_src_out_file = pth_latex.latex_path_stuff ~ "/" ~ image;
- if (exists(fn_src_in)) {
- fn_src_in.copy(fn_src_out_file);
- }
- }
- } catch (ErrnoException ex) {
- // handle error
- }
- }
- void outputLaTeX(D,M)(
- const D doc_abstraction,
- M doc_matters,
- ) {
- struct LaTeX {
- string head;
- string content;
- string tail;
- }
- auto latex = LaTeX();
- latex.head = latex_head(doc_matters);
- latex.content = latex_body(doc_abstraction, doc_matters);
- latex.tail = latex_tail(doc_matters);
- latex.writeOutputLaTeX(doc_matters);
- }
-}
diff --git a/src/doc_reform/output/odt.d b/src/doc_reform/output/odt.d
deleted file mode 100644
index 2d0c45d..0000000
--- a/src/doc_reform/output/odt.d
+++ /dev/null
@@ -1,2076 +0,0 @@
-module doc_reform.output.odt;
-template formatODT() {
- import doc_reform.output;
- import
- std.digest.sha,
- std.file,
- std.outbuffer,
- std.uri,
- std.zip,
- std.conv : to;
- import
- doc_reform.output.create_zip_file,
- doc_reform.output.xmls,
- doc_reform.output.xmls_css;
- mixin spineOutputRgxInit;
- struct formatODT {
- static auto rgx = Rgx();
- string _tags(O)(const O obj){
- string _tags = "";
- if (obj.tags.anchor_tags.length > 0) {
- foreach (tag_; obj.tags.anchor_tags) {
- if (tag_.length > 0) {
- _tags ~= format(q"┃
-
-
-
- ┃",
- _special_characters(tag_, obj),
- _special_characters(tag_, obj),
- );
- }
- }
- }
- return _tags;
- }
- string _xhtml_anchor_tags(O)(O obj) {
- const(string[]) anchor_tags = obj.tags.anchor_tags;
- string tags="";
- if (anchor_tags.length > 0) {
- foreach (tag; anchor_tags) {
- if (!(tag.empty)) {
- tags ~= " ";
- }
- }
- }
- return tags;
- }
- string obj_num(O)(const O obj){ // TODO
- string _on;
- _on = (obj.metainfo.object_number.empty)
- ? ""
- : (format(q"┃
- 「%s」 ┃",
- obj.metainfo.object_number,
- ));
- return _on;
- }
- string _footnotes()(string _txt){
- static auto rgx = Rgx();
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_regular_number_note,
- format(q"┃
-
- %s
-
-
-
- %s
-
-
- ┃",
- "$1", "$1", "$2",
- )
- );
- return _txt;
- }
- string _bullet(O)(const O obj){
- string _b = "";
- if (obj.attrib.bullet) {
- _b = format(q"┃● ┃",);
- }
- return _b;
- }
- string _indent(O)(string _txt, const O obj) { // TODO
- // if (obj.attrib.indent_base > 0 ||
- // obj.attrib.indent_hang > 0
- // ) {
- if (obj.metainfo.is_a == "toc") {
- _txt = format(q"┃
- %s
- %s%s%s
- ┃",
- (obj.attrib.indent_base < 4)
- ? "\n " : "",
- obj.attrib.indent_base,
- obj.attrib.indent_base,
- _tags(obj),
- _txt,
- obj_num(obj),
- );
- } else if (!empty(obj.metainfo.object_number)) {
- if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) {
- _txt = format(q"┃
- %s
-
-
-
-
- %s%s%s
- ┃",
- _bullet(obj),
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _tags(obj),
- _txt,
- obj_num(obj),
- );
- } else if (obj.attrib.indent_base == obj.attrib.indent_hang) {
- _txt = format(q"┃
- %s
-
-
-
-
- %s%s%s
- ┃",
- obj.attrib.indent_base,
- _bullet(obj),
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _tags(obj),
- _txt,
- obj_num(obj),
- );
- } else {
- _txt = format(q"┃
- %s
-
-
-
-
- %s%s%s
- ┃",
- obj.attrib.indent_base,
- obj.attrib.indent_hang,
- _bullet(obj),
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _tags(obj),
- _txt,
- obj_num(obj),
- );
- }
- } else {
- if (obj.attrib.indent_base == 0 && obj.attrib.indent_hang == 0) { /+ can omit and would explicitly set indent base and hang as 0 each below +/
- _txt = format(q"┃
- %s
- %s%s%s
- ┃",
- _bullet(obj),
- _tags(obj),
- _txt,
- obj_num(obj),
- );
- } else if (obj.attrib.indent_base == obj.attrib.indent_hang) {
- _txt = format(q"┃
- %s
- %s%s%s
- ┃",
- obj.attrib.indent_base,
- _bullet(obj),
- _tags(obj),
- _txt,
- obj_num(obj),
- );
- } else {
- _txt = format(q"┃
- %s
- %s%s%s
- ┃",
- _bullet(obj),
- obj.attrib.indent_base,
- obj.attrib.indent_hang,
- _tags(obj),
- _txt,
- obj_num(obj),
- );
- }
- }
- return _txt;
- }
- string _block_type_delimiters(O)(string[] _block_lines, const O obj) { // TODO
- string _block = "";
- foreach (i, _line; _block_lines) {
- _line = _footnotes(_line);
- if (i == 0) {
- _block ~= format(q"┃
- %s
-
-
-
-
- %s
- ┃",
- _bullet(obj),
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- // _tags(obj),
- _line,
- );
- } else {
- _block ~= format(q"┃
- %s ┃",
- _line);
- }
- }
- _block ~= format(q"┃
-
- 「%s」
-
- ┃",
- obj_num(obj));
- return _block;
- }
- string _special_characters(O)(string _txt, const O obj) {
- _txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&")
- .replaceAll(rgx.xhtml_quotation, """)
- .replaceAll(rgx.xhtml_less_than, "<")
- .replaceAll(rgx.xhtml_greater_than, ">")
- .replaceAll(rgx.nbsp_char, " ");
- return _txt;
- }
- string _preserve_white_spaces(O)(string _txt, const O obj) {
- if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
- _txt = _txt
- .replaceAll(rgx.space, " ");
- }
- return _txt;
- }
- string _font_face(string _txt){
- _txt = _txt
- .replaceAll(rgx.inline_strike, "$1")
- .replaceAll(rgx.inline_insert, "$1 ")
- .replaceAll(rgx.inline_cite, "$1 ")
- .replaceAll(rgx.inline_emphasis, format(q"┃%s ┃","$1"))
- .replaceAll(rgx.inline_bold, format(q"┃%s ┃","$1"))
- .replaceAll(rgx.inline_italics, format(q"┃%s ┃","$1"))
- .replaceAll(rgx.inline_underscore, format(q"┃%s ┃","$1"))
- .replaceAll(rgx.inline_superscript, format(q"┃%s ┃","$1"))
- .replaceAll(rgx.inline_subscript, format(q"┃%s ┃","$1"))
- .replaceAll(rgx.inline_mono, format(q"┃%s ┃","$1"));
- return _txt;
- }
- auto _obj_num(O)(O obj) { // NOT USED YET
- struct objNum {
- string reference() {
- return format(q"┃
-
-
- ┃",
- obj.object_number,
- obj.object_number,
- );
- }
- string display() {
- return format(q"┃
- %s%s%s
- ┃",
- on_o,
- obj.object_number,
- on_c,
- );
- }
- }
- return objNum();
- }
- string _break_page()() {
- return format(q"┃
-
- ┃",
- );
- }
- string _empty_line_break(O)(string _txt, const O obj) {
- if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
- _txt = _txt
- .replaceAll(rgx.br_empty_line, " ");
- }
- return _txt;
- }
- string _links(O)(string _txt, const O obj) {
- if (obj.metainfo.is_a != "code") {
- if (obj.metainfo.is_a == "toc") {
- _txt = replaceAll!(m =>
- m[1] ~ "┤"
- ~ (replaceAll!(n =>
- n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
- )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
- ~ "├"
- )(_txt, rgx.inline_link_number_only)
- .replaceAll(rgx.inline_link,
- format(q"┃%s ┃",
- _special_characters("$3", obj),
- _special_characters("$1", obj)
- ));
- } else {
- _txt = replaceAll!(m =>
- m[1] ~ "┤"
- ~ (replaceAll!(n =>
- n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
- )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
- ~ "├"
- )(_txt, rgx.inline_link_number_only)
- .replaceAll(rgx.inline_link,
- format(q"┃%s ┃",
- _special_characters("$2", obj),
- _special_characters("$1", obj)
- ));
- }
- }
- debug(links) {
- if (obj.text.match(rgx.inline_link_number)
- && _txt.match(rgx.inline_link_number_only)
- ) {
- writeln(">> ", _txt);
- writeln("is_a: ", obj.metainfo.is_a);
- }
- }
- return _txt;
- }
- string _images(O)(string _txt, const O obj) {
- if (_txt.match(rgx.inline_image)) {
- _txt = _txt
- .replaceAll(rgx.inline_image,
- ("$1 $6"))
- .replaceAll(
- rgx.inline_link_empty,
- ("$1"));
- }
- return _txt;
- }
- string markup(O)(const O obj) {
- /+ markup TODO +/
- string _txt = obj.text;
- _txt = _special_characters(_txt, obj); // TODO & why both obj & obj.text, consider also in output_xmls.org
- if (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block") {
- _txt = replaceAll!(m => _preserve_white_spaces(m[1], obj))(_txt, rgx.spaces_keep);
- } // check that this does what you want, keep: leading spaces (indent) & more than single spaces within text
- // _txt = _preserve_white_spaces(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block")
- _txt = _font_face(_txt);
- _txt = _images(_txt, obj); // (obj.metainfo.is_a != "code")
- _txt = _links(_txt, obj); // (obj.metainfo.is_a != "code")
- _txt = _empty_line_break(_txt, obj); // (obj.metainfo.is_a == "code" || obj.metainfo.is_a == "verse" || obj.metainfo.is_a == "block")
- return _txt;
- }
- string heading(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "heading");
- string _o_txt_odt = markup(obj);
- if (obj.metainfo.dummy_heading
- && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
- _o_txt_odt = "";
- } else if (obj.metainfo.is_a == "toc") {
- _o_txt_odt = format(q"┃%s
- %s%s%s
- ┃",
- _break_page,
- obj.metainfo.heading_lev_markup,
- obj.metainfo.heading_lev_markup,
- _tags(obj),
- _o_txt_odt,
- obj_num(obj),
- );
- } else {
- _o_txt_odt = _footnotes(_o_txt_odt);
- _o_txt_odt = format(q"┃%s
-
-
-
-
- %s%s%s
- ┃",
- _break_page,
- obj.metainfo.heading_lev_markup,
- obj.metainfo.heading_lev_markup,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _tags(obj),
- _o_txt_odt,
- obj_num(obj),
- );
- }
- return _o_txt_odt;
- }
- string para(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "para" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- string _o_txt_odt;
- if (obj.metainfo.dummy_heading
- && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
- _o_txt_odt = "";
- } else {
- _o_txt_odt = markup(obj);
- _o_txt_odt = _footnotes(_o_txt_odt);
- _o_txt_odt = _indent(_o_txt_odt, obj); // final setting?
- }
- return _o_txt_odt;
- }
- string quote(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "quote");
- string _o_txt_odt = markup(obj);
- _o_txt_odt = _footnotes(_o_txt_odt); // decide
- return _o_txt_odt;
- }
- string group(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "group");
- string _o_txt_odt = markup(obj);
- /+ TODO
- - split lines
- - only double newlines (paragraph delimiter), (not line breaks, single new lines)
- - no hard space indentation
- +/
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
- _o_txt_odt = _block_type_delimiters(_block_lines, obj);
- return _o_txt_odt;
- }
- string block(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "block");
- string _o_txt_odt = markup(obj);
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
- _o_txt_odt = _block_type_delimiters(_block_lines, obj);
- return _o_txt_odt;
- }
- string verse(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "verse");
- string _o_txt_odt = markup(obj);
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
- _o_txt_odt = _block_type_delimiters(_block_lines, obj);
- return _o_txt_odt;
- }
- string code(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "code");
- string _o_txt_odt = markup(obj);
- /+ TODO
- - split lines
- - each line including empty lines
- - hard space indentation
- - "^[ ]"
- - count number only at beginning of line and replace each
- +/
- string[] _block_lines = (_o_txt_odt).split(rgx.br_newlines_linebreaks);
- string _block = "";
- foreach (i, _line; _block_lines) {
- if (i == 1) {
- _block ~= format(q"┃
-
-
-
-
-
- %s
- ┃",
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- _line,
- );
- } else {
- _block ~= format(q"┃
- %s ┃",
- _line);
- }
- }
- _block ~= format(q"┃
-
- 「%s」
-
- ┃",
- obj_num(obj));
- _o_txt_odt = _block;
- return _o_txt_odt;
- }
- auto tablarize(O)(
- const O obj,
- string _txt,
- ) {
- string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
- string[] _table_cols;
- string _table;
- string _tablenote;
- foreach(row_idx, row; _table_rows) {
- _table_cols = row.split(rgx.table_delimiter_col);
- _table ~= "";
- 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)
- _tablenote ~= cell;
- } else {
- _table ~= format(q"┃
-
- %s
-
- ┃",
- (row_idx == 0 && obj.table.heading) ? "Table_Heading" : "P_table_cell",
- cell,
- );
- }
- }
- _table ~= " ";
- }
- auto t = tuple(
- _table,
- _tablenote,
- );
- return t;
- }
- int _table_number = 0;
- string table(O,M)(
- const O obj,
- const M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "table");
- string _o_txt_odt = markup(obj);
- auto t = tablarize(obj, _o_txt_odt);
- string _note = t[1];
- _o_txt_odt = format(q"┃
-
-
-
-
-
-
- %s
-
-
- 「%s」
- ┃",
- _table_number++,
- obj.metainfo.object_number,
- obj.metainfo.object_number,
- obj.table.number_of_columns,
- t[0],
- obj.metainfo.object_number,
- // _note,
- );
- return _o_txt_odt;
- }
- }
-}
-template outputODT() {
- import doc_reform.output;
- import
- std.digest.sha,
- std.file,
- std.outbuffer,
- std.uri,
- std.zip,
- std.conv : to;
- import
- doc_reform.output.create_zip_file,
- doc_reform.output.xmls,
- doc_reform.output.xmls_css;
- mixin InternalMarkup;
- mixin spineOutputRgxInit;
- auto rgx = Rgx();
- // mixin outputXmlODT;
- string odt_head(I)(I doc_matters) {
- string _has_tables = format(q"┃
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ┃",);
- string _odt_head = format(q"┃
-
-
-
-
-
-
-
-
-
-
-
-
-
- %s
-
-
-
-
-
-
-
-
-
-
-
-
-
- ┃",
- (doc_matters.has.tables > 0) ? _has_tables : "",
- );
- return _odt_head;
- }
- string odt_body(D,I)(
- const D doc_abstraction,
- I doc_matters,
- ) {
- mixin formatODT;
- auto odt_format = formatODT();
- string delimit = "";
- string doc_odt = "";
- string _txt = "";
- foreach (part; doc_matters.has.keys_seq.scroll) {
- foreach (obj; doc_abstraction[part]) {
- switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head" || "toc");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- _txt = delimit ~ odt_format.heading(obj, doc_matters);
- goto default;
- case "toc":
- _txt = odt_format.para(obj, doc_matters);
- goto default;
- default:
- doc_odt ~= _txt;
- _txt = "";
- break;
- }
- break;
- default: break;
- }
- break;
- case "body": assert(part == "body" || "head"); // surprise
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- _txt = delimit ~ odt_format.heading(obj, doc_matters);
- goto default;
- case "para":
- _txt = odt_format.para(obj, doc_matters);
- goto default;
- default:
- doc_odt ~= _txt;
- _txt = "";
- break;
- }
- break;
- case "block":
- switch (obj.metainfo.is_a) {
- case "quote":
- _txt = odt_format.quote(obj, doc_matters);
- goto default;
- case "group":
- _txt = odt_format.group(obj, doc_matters);
- goto default;
- case "block":
- _txt = odt_format.block(obj, doc_matters);
- goto default;
- case "verse":
- _txt = odt_format.verse(obj, doc_matters);
- goto default;
- case "code":
- _txt = odt_format.code(obj, doc_matters);
- goto default;
- case "table":
- _txt = odt_format.table(obj, doc_matters);
- goto default;
- default:
- doc_odt ~= _txt;
- _txt = "";
- break;
- }
- break;
- default: break;
- }
- break;
- case "backmatter":
- assert(part == "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb" || "tail");
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- _txt = delimit ~ odt_format.heading(obj, doc_matters);
- goto default;
- case "endnote": assert(part == "endnotes");
- _txt = odt_format.para(obj, doc_matters);
- goto default;
- case "glossary": assert(part == "glossary");
- _txt = odt_format.para(obj, doc_matters);
- goto default;
- case "bibliography": assert(part == "bibliography");
- _txt = odt_format.para(obj, doc_matters);
- goto default;
- case "bookindex": assert(part == "bookindex");
- _txt = odt_format.para(obj, doc_matters);
- goto default;
- case "blurb": assert(part == "blurb");
- _txt = odt_format.para(obj, doc_matters);
- goto default;
- default:
- doc_odt ~= _txt;
- _txt = "";
- break;
- }
- break;
- default: break;
- }
- break;
- case "comment":
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part);
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text);
- }
- }
- break;
- }
- }
- }
- return doc_odt;
- }
-
- string odt_tail() {
- string _odt_tail = format(q"┃spine: <www.doc_reform.org > and <www.sisudoc.org >
- ┃",);
- return _odt_tail;
- }
- string content_xml(D,I)(
- const D doc_abstraction,
- I doc_matters,
- ) {
- string _content_xml;
- string break_line = (doc_matters.opt.action.debug_do) ? "\n" : "";
- string odt_break_page = format(q"┃ ┃",);
- string br_pg = format(q"┃ ┃",);
- _content_xml ~= odt_head(doc_matters);
- _content_xml ~= odt_body(doc_abstraction, doc_matters);
- _content_xml ~= odt_tail;
- return _content_xml;
- }
- string manifest_xml(M)(
- auto ref M doc_matters,
- ) {
- string _bullet = format(q"┃ ┃");
- string[] _images = [ _bullet ];
- foreach (image; doc_matters.srcs.image_list) {
- _images ~= format(q"┃ ┃", image);
- }
- string _manifest_xml = format(q"┃
-
-
-
-
- %s
-
-
-
-
-
- ┃",
- _images.join("\n"),
- );
- return _manifest_xml;
- }
- void images_cp(M)(
- auto ref M doc_matters,
- ) {
- { /+ (copy odt images) +/
- auto pth_odt = spinePathsODT!()(doc_matters);
- foreach (image; doc_matters.srcs.image_list) {
- auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
- auto fn_src_out_file = pth_odt.image_dir("fs") ~ "/" ~ image;
- auto fn_src_out_zip = pth_odt.image_dir("zip") ~ "/" ~ image;
- if (exists(fn_src_in)) {
- if (doc_matters.opt.action.debug_do) {
- if (doc_matters.opt.action.debug_do) {
- fn_src_in.copy(fn_src_out_file);
- }
- }
- }
- }
- }
- // return 0;
- }
- string meta_xml(M)(
- auto ref M doc_matters,
- ) {
- /+ (meta_xml includes output time-stamp) +/
- string _meta_xml = format(q"┃
-
-
- %s
- %s
- %s
- en-US
-
-
- ┃",
- doc_matters.generator_program.name_and_version,
- doc_matters.generated_time,
- doc_matters.generated_time,
- );
- return _meta_xml;
- }
- void dirtree(I)(
- I doc_matters,
- ) {
- auto pth_odt = spinePathsODT!()(doc_matters);
- if (doc_matters.opt.action.debug_do) { /+ (dir tree) +/
- if (!exists(pth_odt.meta_inf_dir("fs"))) {
- pth_odt.meta_inf_dir("fs").mkdirRecurse;
- }
- if (!exists(pth_odt.image_dir("fs"))) {
- pth_odt.image_dir("fs").mkdirRecurse;
- }
- }
- if (!exists(pth_odt.base_pth)) {
- pth_odt.base_pth.mkdirRecurse;
- }
- // return 0;
- }
- string mimetype() {
- string mimetype_ = format(q"┃application/vnd.oasis.opendocument.text┃");
- return mimetype_;
- }
- string manifest_rdf() {
- string _manifest_rdf = format(q"┃
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ┃");
- return _manifest_rdf;
- }
- string settings_xml() {
- string _settings_xml = format(q"┃
-
-
-
- 0
- 0
- 0
- 0
- true
- false
-
-
- view2
- 0
- 0
- 0
- 0
- 0
- 0
- 0
- 2
- true
- 100
- false
-
-
-
-
- true
- false
- false
- true
- true
- false
- true
- false
- false
-
- false
- false
- false
- true
- true
- 0
- false
- false
- false
- false
- true
- false
- false
- false
- false
- true
- true
- false
- false
- true
- false
- true
- false
- high-resolution
- 1
- 0
- true
-
-
- false
- true
-
- false
- true
- false
- true
- false
- true
- false
-
- true
- true
- false
- true
- true
- true
- false
- false
-
- false
- 0
- false
- false
- true
- true
-
-
-
- ┃");
- return _settings_xml;
- }
- string styles_xml() {
- string _styles_xml = format(q"┃
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ┃");
- return _styles_xml;
- }
-
- void writeOutputODT(W,I)(
- const W odt_content,
- I doc_matters,
- ) {
- auto pth_odt = spinePathsODT!()(doc_matters);
- auto fn_odt = pth_odt.odt_file;
- auto zip = new ZipArchive(); // ZipArchive zip = new ZipArchive();
- void ODTzip()(string contents, string fn) {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn;
- auto zip_data = new OutBuffer();
- (doc_matters.opt.action.debug_do)
- ? zip_data.write(contents.dup)
- : zip_data.write(contents.dup
- .replaceAll(rgx.spaces_line_start, "")
- .replaceAll(rgx.newline, "")
- .strip
- );
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- createZipFile!()(fn_odt, zip.build());
- }
- try {
- if (!exists(pth_odt.base_pth)) { // check
- pth_odt.base_pth.mkdirRecurse;
- }
- string fn;
- File f;
- { fn = pth_odt.mimetype("zip");
- ODTzip(odt_content.mimetype, fn);
- }
- { fn = pth_odt.manifest_rdf("zip");
- ODTzip(odt_content.manifest_rdf, fn);
- }
- { fn = pth_odt.settings_xml("zip");
- ODTzip(odt_content.settings_xml, fn);
- }
- { fn = pth_odt.styles_xml("zip");
- ODTzip(odt_content.styles_xml, fn);
- }
- { fn = pth_odt.content_xml("zip");
- ODTzip(odt_content.content_xml, fn);
- }
- { fn = pth_odt.manifest_xml("zip");
- ODTzip(odt_content.manifest_xml, fn);
- }
- { fn = pth_odt.meta_xml("zip");
- ODTzip(odt_content.meta_xml, fn);
- }
- { /+ (images) +/
- foreach (image; doc_matters.srcs.image_list) {
- auto fn_src = doc_matters.src.image_dir_path ~ "/" ~ image;
- auto fn_out = pth_odt.image_dir("zip") ~ "/" ~ image;
- if (exists(fn_src)) {
- {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = fn_out;
- auto zip_data = new OutBuffer();
- zip_data.write(cast(char[]) ((fn_src).read));
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- createZipFile!()(fn_odt, zip.build());
- }
- }
- }
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", pth_odt.odt_file);
- }
- } catch (ErrnoException ex) {
- // Handle error
- }
- if (doc_matters.opt.action.debug_do) {
- pth_odt.mimetype("fs"); /+ (mimetype) +/
- pth_odt.manifest_rdf("fs"); /+ (manifest.rdf) +/
- pth_odt.settings_xml("fs"); /+ (settings.xml) +/
- pth_odt.styles_xml("fs"); /+ (styles_xml) +/
-
- pth_odt.content_xml("fs");
- pth_odt.manifest_xml("fs");
- pth_odt.meta_xml("fs");
- }
- }
- void outputODT(D,I)(
- const D doc_abstraction,
- I doc_matters,
- ) {
- struct ODT {
- /+ fixed output +/
- string mimetype;
- string manifest_rdf;
- string settings_xml;
- string styles_xml;
- /+ variable output +/
- string content_xml; // substantive content
- string manifest_xml; // image list changes
- string meta_xml; // time stamp
- }
- // auto pth_odt = spinePathsODT!()(doc_matters);
- auto odt = ODT();
- odt.mimetype = mimetype;
- odt.manifest_rdf = manifest_rdf;
- odt.settings_xml = settings_xml;
- odt.styles_xml = styles_xml;
- odt.content_xml = content_xml(doc_abstraction, doc_matters);
- odt.manifest_xml = manifest_xml(doc_matters);
- odt.meta_xml = meta_xml(doc_matters);
- odt.writeOutputODT(doc_matters);
- dirtree(doc_matters);
- images_cp(doc_matters); // copy images
- }
-}
diff --git a/src/doc_reform/output/package.d b/src/doc_reform/output/package.d
deleted file mode 100644
index 5e14e8a..0000000
--- a/src/doc_reform/output/package.d
+++ /dev/null
@@ -1,22 +0,0 @@
-module doc_reform.output;
-public import
- std.algorithm,
- std.array,
- std.container,
- std.exception,
- std.path,
- std.process,
- std.range,
- std.regex,
- std.stdio,
- std.string,
- std.traits,
- std.typecons,
- // std.uni,
- std.utf;
-public import
- doc_reform.share.defaults,
- doc_reform.source.paths_source,
- doc_reform.output.defaults,
- doc_reform.output.paths_output,
- doc_reform.output.rgx;
diff --git a/src/doc_reform/output/paths_output.d b/src/doc_reform/output/paths_output.d
deleted file mode 100644
index bc4da76..0000000
--- a/src/doc_reform/output/paths_output.d
+++ /dev/null
@@ -1,531 +0,0 @@
-/++
- default settings
-+/
-module doc_reform.output.paths_output;
-import std.array,
- std.path,
- std.regex,
- std.stdio;
-import doc_reform.meta.rgx;
-template spineOutPaths() {
- auto spineOutPaths()(
- string output_pth_root,
- string lng = "",
- ) {
- struct _PathsStruct {
- string output_root() {
- return (output_pth_root.length > 0)
- ? output_pth_root : "";
- }
- string output_base() {
- return ((output_root.chainPath(lng)).asNormalizedPath).array;
- }
- }
- return _PathsStruct();
- }
-}
-template spineOutPathSQLite() {
- auto spineOutPathSQLite(Po)(
- Po output_pth_root,
- ) {
- struct _PathsStruct {
- string output_root() {
- return (output_pth_root.length > 0)
- ? output_pth_root : "";
- }
- string output_base() {
- return ((output_root).asNormalizedPath).array;
- }
- }
- return _PathsStruct();
- }
-}
-template spineOutPathsFnPd() {
- /+ TODO stuff to work out here +/
- auto spineOutPathsFnPd(Fn,Pn)(
- Fn fn_src_pth,
- Pn pod_name_with_path
- ) {
- struct _PathsStruct {
- string base_filename() {
- return fn_src_pth.baseName.stripExtension;
- }
- string base_pod_and_filename() { // TODO
- /+
- - if pod,
- - pod_name
- - file_name
- - if pod_name == file_name
- - file_name
- - else if pod_name != file_name
- - pod_name.file_name
- +/
- string _fn_src = fn_src_pth.baseName.stripExtension;
- string _output_base_name;
- if (!(pod_name_with_path.empty)) {
- if (pod_name_with_path == _fn_src) {
- _output_base_name = _fn_src;
- } else {
- _output_base_name = pod_name_with_path ~ "." ~ _fn_src;
- }
- } else {
- _output_base_name = _fn_src;
- }
- return _output_base_name;
- }
- }
- return _PathsStruct();
- }
-}
-
-template spineDocRootTreeHTML() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spineDocRootTreeHTML()(string lng) {
- auto lng_pth = spineOutPaths!()("", lng);
- string base_dir = "html";
- string suffix = ".html";
- struct _PathsStruct {
- string base_filename(string fn_src) {
- return fn_src.baseName.stripExtension;
- }
- string base_filename_scroll(string fn_src) {
- return base_filename(fn_src);
- }
- string base_filename_seg(string fn_src) {
- return base_filename(fn_src);
- }
- string doc_root() {
- return ((lng_pth.output_root).asNormalizedPath).array;
- }
- string base() {
- return (((lng).chainPath(base_dir)).asNormalizedPath).array;
- }
- string image() {
- return (("image").asNormalizedPath).array;
- }
- string css() {
- return (("css").asNormalizedPath).array;
- }
- string fn_seg_css() {
- return ((css.chainPath("html_seg.css")).asNormalizedPath).array;
- }
- string fn_scroll_css() {
- return ((css.chainPath("html_scroll.css")).asNormalizedPath).array;
- }
- string seg(string fn_src) {
- return ((base.chainPath(base_filename_seg(fn_src))).asNormalizedPath).array;
- }
- string fn_scroll(string fn_src) {
- return ((base.chainPath(base_filename_scroll(fn_src) ~ suffix)).asNormalizedPath).array;
- }
- string fn_seg(string fn_src, string seg_filename) {
- return ((seg(fn_src).chainPath(seg_filename ~ suffix)).asNormalizedPath).array;
- }
- string tail_seg(string fn_src) {
- return lng ~ "/html/" ~ base_filename_seg(fn_src);
- }
- string tail_fn_scroll(string fn_src) {
- return lng ~ "/html/" ~ base_filename_scroll(fn_src) ~ suffix;
- }
- string tail_fn_seg(string fn_src, string seg_filename) {
- return lng ~ "/html/" ~ seg(fn_src) ~ "/" ~ seg_filename ~ suffix;
- }
- }
- return _PathsStruct();
- }
-}
-template spinePathsHTML() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spinePathsHTML()(
- string output_path_root,
- string lng,
- ) {
- auto doc_tree = spineDocRootTreeHTML!()(lng);
- string base_dir = "html";
- string suffix = ".html";
- struct _PathsStruct {
- string doc_root() {
- return ((output_path_root.chainPath(doc_tree.doc_root)).asNormalizedPath).array;
- }
- string harvest(string fn_harvest) {
- return doc_root ~ "/" ~ fn_harvest;
- }
- string base() {
- return ((output_path_root.chainPath(doc_tree.base)).asNormalizedPath).array;
- }
- string image() {
- return ((output_path_root.chainPath(doc_tree.image)).asNormalizedPath).array;
- }
- string css() {
- return ((output_path_root.chainPath(doc_tree.css)).asNormalizedPath).array;
- }
- string fn_seg_css() {
- return ((output_path_root.chainPath(doc_tree.fn_seg_css)).asNormalizedPath).array;
- }
- string fn_scroll_css() {
- return ((output_path_root.chainPath(doc_tree.fn_scroll_css)).asNormalizedPath).array;
- }
- string seg(string fn_src) {
- return ((output_path_root.chainPath(doc_tree.seg(fn_src))).asNormalizedPath).array;
- }
- string fn_scroll(string fn_src) {
- return ((output_path_root.chainPath(doc_tree.fn_scroll(fn_src))).asNormalizedPath).array;
- }
- string fn_seg(string fn_src, string seg_filename) {
- return ((output_path_root.chainPath(doc_tree.fn_seg(fn_src, seg_filename))).asNormalizedPath).array;
- }
- string tail_seg(string fn_src) {
- return doc_tree.tail_seg(fn_src);
- }
- string tail_fn_scroll(string fn_src) {
- return doc_tree.tail_fn_scroll(fn_src);
- }
- string tail_fn_seg(string fn_src, string seg_filename) {
- return doc_tree.tail_fn_seg(fn_src, seg_filename);
- }
- }
- return _PathsStruct();
- }
-}
-template spineUrlsHTML() {
- import std.format;
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spineUrlsHTML()(
- string url_doc_root,
- string lng,
- ) {
- auto doc_tree = spineDocRootTreeHTML!()(lng);
- string base_dir = "html";
- string suffix = ".html";
- struct _PathsStruct {
- string doc_root() {
- return url_doc_root ~ ((doc_tree.doc_root).asNormalizedPath).array;
- }
- string harvest(string fn_harvest) {
- return format(q"┃%s/%s┃",
- doc_root,
- fn_harvest,
- );
- }
- string base() {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.base).asNormalizedPath).array,
- );
- }
- string image() {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.image).asNormalizedPath).array,
- );
- }
- string css() {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.css).asNormalizedPath).array,
- );
- }
- string fn_seg_css() {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.fn_seg_css).asNormalizedPath).array,
- );
- }
- string fn_scroll_css() {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.fn_scroll_css).asNormalizedPath).array,
- );
- }
- string seg(string fn_src) {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.seg(fn_src)).asNormalizedPath).array,
- );
- }
- string fn_scroll(string fn_src) {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array,
- );
- }
- string fn_seg(string fn_src, string seg_filename) {
- return format(q"┃%s/%s┃",
- url_doc_root,
- ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array,
- );
- }
- string fn_scroll_obj_num(string fn_src, string obj_num) {
- return format(q"┃%s/%s#%s┃",
- url_doc_root,
- ((doc_tree.fn_scroll(fn_src)).asNormalizedPath).array,
- obj_num,
- );
- }
- string fn_seg_obj_num(string fn_src, string seg_filename, string obj_num) {
- return format(q"┃%s/%s#%s┃",
- url_doc_root,
- ((doc_tree.fn_seg(fn_src, seg_filename)).asNormalizedPath).array,
- obj_num,
- );
- }
- string tail_seg(string fn_src) {
- return doc_tree.tail_seg(fn_src);
- }
- string tail_fn_scroll(string fn_src) {
- return doc_tree.tail_fn_scroll(fn_src);
- }
- string tail_fn_seg(string fn_src, string seg_filename) {
- return doc_tree.tail_fn_seg(fn_src, seg_filename);
- }
- }
- return _PathsStruct();
- }
-}
-template spinePathsEPUB() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spinePathsEPUB()(
- string output_pth_root,
- string lng,
- ) {
- auto out_pth = spineOutPaths!()(output_pth_root, lng);
- string base_dir = "epub";
- struct _PathsStruct {
- string base() {
- return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
- }
- string base_filename(string fn_src) {
- return fn_src.baseName.stripExtension;
- }
- string base_filename_epub(string fn_src) {
- return base_filename(fn_src) ~ "." ~ lng;
- }
- string doc_meta_inf() {
- return (("META-INF").asNormalizedPath).array;
- }
- string doc_oebps() {
- return (("OEBPS").asNormalizedPath).array;
- }
- string doc_oebps_css() {
- return ((doc_oebps.chainPath("css")).asNormalizedPath).array;
- }
- string doc_oebps_image() {
- return ((doc_oebps.chainPath("image")).asNormalizedPath).array;
- }
- string epub_file(string fn_src) {
- return ((base.chainPath(base_filename_epub(fn_src) ~ ".epub")).asNormalizedPath).array;
- }
- string dirtop() {
- return "".chainPath("").array;
- }
- string fn_mimetypes() {
- return ((dirtop.chainPath("mimetypes")).asNormalizedPath).array;
- }
- string fn_dmi_container_xml() {
- return ((doc_meta_inf.chainPath("container.xml")).asNormalizedPath).array;
- }
- string fn_oebps_toc_nav_xhtml() {
- return ((doc_oebps.chainPath("toc_nav.xhtml")).asNormalizedPath).array;
- }
- string fn_oebps_toc_ncx() {
- return ((doc_oebps.chainPath("toc.ncx")).asNormalizedPath).array;
- }
- string fn_oebps_content_opf() {
- return ((doc_oebps.chainPath("content.opf")).asNormalizedPath).array;
- }
- string fn_oebps_content_xhtml(string seg_filename) {
- return ((doc_oebps.chainPath(seg_filename ~ ".xhtml")).asNormalizedPath).array;
- }
- string fn_oebps_css() {
- return ((doc_oebps_css.chainPath("epub.css")).asNormalizedPath).array;
- }
- /+ debug +/
- string dbg_docdir(string fn_src) {
- return base.chainPath(base_filename(fn_src)).array;
- }
- string dbg_docdir_oebps(string fn_src) {
- return dbg_docdir(fn_src).chainPath("OEBPS").array;
- }
- string dbg_doc_meta_inf(string fn_src) {
- return dbg_docdir(fn_src).chainPath("META-INF").array;
- }
- string dbg_doc_oebps(string fn_src) {
- return dbg_docdir(fn_src).chainPath("OEBPS").array;
- }
- string dbg_doc_oebps_css(string fn_src) {
- return dbg_doc_oebps(fn_src).chainPath("css").array;
- }
- string dbg_doc_oebps_image(string fn_src) {
- return dbg_doc_oebps(fn_src).chainPath("image").array;
- }
- string dbg_fn_mimetypes(string fn_src) {
- return dbg_docdir(fn_src).chainPath("mimetypes").array;
- }
- string dbg_fn_dmi_container_xml(string fn_src) {
- return dbg_doc_meta_inf(fn_src).chainPath("container.xml").array;
- }
- string dbg_fn_oebps_toc_nav_xhtml(string fn_src) {
- return dbg_docdir_oebps(fn_src).chainPath("toc_nav.xhtml").array;
- }
- string dbg_fn_oebps_toc_ncx(string fn_src) {
- return dbg_docdir_oebps(fn_src).chainPath("toc.ncx").array;
- }
- string dbg_fn_oebps_content_opf(string fn_src) {
- return dbg_docdir_oebps(fn_src).chainPath("content.opf").array;
- }
- string dbg_fn_oebps_content_xhtml(string fn_src, string seg_filename) {
- return dbg_docdir_oebps(fn_src).chainPath(seg_filename ~ ".xhtml").array;
- }
- string dbg_fn_oebps_css(string fn_src) {
- return dbg_doc_oebps_css(fn_src).chainPath("epub.css").array;
- }
- }
- return _PathsStruct();
- }
-}
-template spinePathsODT() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spinePathsODT(M)(
- M doc_matters,
- ) {
- auto out_pth = spineOutPaths!()( doc_matters.output_path, doc_matters.src.language);
- string base_dir = "odf";
- struct _PathsStruct {
- string base_pth() { // dir will contain odt document file (also debug file tree)
- return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
- }
- string odt_file() {
- return ((base_pth.chainPath(doc_matters.src.doc_uid_out ~ ".odt")).asNormalizedPath).array;
- }
- string dirtop(string type) {
- return (type == "zip")
- ? "".chainPath("").array
- : ((base_pth.chainPath(doc_matters.src.doc_uid_out)).asNormalizedPath).array;
- }
- string mimetype(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("mimetype")).asNormalizedPath).array;
- }
- string manifest_rdf(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("manifest.rdf")).asNormalizedPath).array;
- }
- string settings_xml(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("settings.xml")).asNormalizedPath).array;
- }
- string styles_xml(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("styles.xml")).asNormalizedPath).array;
- }
- string image_dir(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("Pictures")).asNormalizedPath).array;
- }
- string image(string image_fn_src, string type="fs") {
- assert(type == "zip" || "fs");
- return ((image_dir(type).chainPath(image_fn_src)).asNormalizedPath).array;
- }
- string content_xml(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("content.xml")).asNormalizedPath).array;
- }
- string meta_inf_dir(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("META-INF")).asNormalizedPath).array;
- }
- string manifest_xml(string type="fs") {
- assert(type == "zip" || "fs");
- return ((meta_inf_dir(type).chainPath("manifest.xml")).asNormalizedPath).array;
- }
- string meta_xml(string type="fs") {
- assert(type == "zip" || "fs");
- return ((dirtop(type).chainPath("meta.xml")).asNormalizedPath).array;
- }
- }
- return _PathsStruct();
- }
-}
-template spinePathsLaTeX() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spinePathsLaTeX(M)(
- M doc_matters,
- ) {
- struct _PathsStruct {
- string base_filename(string fn_src) {
- return fn_src.baseName.stripExtension;
- }
- string base() {
- auto out_pth = spineOutPaths!()(doc_matters.output_path, doc_matters.src.language);
- string base_dir = "latex";
- return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array;
- }
- string latex_path_stuff() {
- return ((base.chainPath(base_filename(doc_matters.src.filename))).asNormalizedPath).array;
- }
- string latex_file_with_path() {
- return ((base.chainPath(base_filename(doc_matters.src.filename) ~ "." ~ doc_matters.src.language ~ ".tex")).asNormalizedPath).array;
- }
- string images() {
- string image_dir = "image";
- return (((base).chainPath(image_dir)).asNormalizedPath).array;
- }
- }
- return _PathsStruct();
- }
-}
-template spinePathsSQLiteDiscrete() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spinePathsSQLiteDiscrete()(
- string output_pth_root,
- string lng,
- ) {
- struct _PathsStruct {
- string base_filename(string fn_src) {
- return fn_src.baseName.stripExtension;
- }
- string base() {
- auto out_pth = spineOutPaths!()(output_pth_root, lng);
- string base_dir = "sqlite";
- return (((out_pth.output_base).chainPath(base_dir)).asNormalizedPath).array;
- }
- string seg(string fn_src) {
- return ((base.chainPath(base_filename(fn_src))).asNormalizedPath).array;
- }
- string sqlite_file(string fn_src) {
- return ((base.chainPath(base_filename(fn_src) ~ ".sql.db")).asNormalizedPath).array;
- }
- }
- return _PathsStruct();
- }
-}
-template spinePathsSQLite() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spinePathsSQLite(DbN, Po)(
- DbN db_name,
- Po output_pth_root,
- ) {
- struct _PathsStruct {
- string base_filename(string fn_src) {
- return fn_src.baseName.stripExtension;
- }
- string base() {
- auto out_pth = spineOutPathSQLite!()(output_pth_root); // decide whether to have separate files for each language
- string base_dir = "sqlite";
- return (((out_pth.output_root).chainPath(base_dir)).asNormalizedPath).array;
- }
- string sqlite_file() {
- return ((base.chainPath(base_filename(db_name) ~ ".sql.db")).asNormalizedPath).array;
- }
- }
- return _PathsStruct();
- }
-}
diff --git a/src/doc_reform/output/rgx.d b/src/doc_reform/output/rgx.d
deleted file mode 100644
index cda3d5e..0000000
--- a/src/doc_reform/output/rgx.d
+++ /dev/null
@@ -1,114 +0,0 @@
-/++
- regex: regular expressions used in sisu document parser
-+/
-module doc_reform.output.rgx;
-static template spineOutputRgxInit() {
- import doc_reform.output.defaults;
- static struct Rgx {
- static newline = ctRegex!("\n", "mg");
- static space = ctRegex!(`[ ]`, "mg");
- static spaces_keep = ctRegex!(`(?P^[ ]+|[ ]{2,})`, "mg"); // code, verse, block
- static spaces_line_start = ctRegex!(`^(?P[ ]+)`, "mg");
- static nbsp_char = ctRegex!(`░`, "mg");
- static src_pth_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.](?Pss[tm]))$`);
- static src_pth_pod_sst_or_ssm = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)media/text/[a-z]{2}/(?P[a-zA-Z0-9][a-zA-Z0-9._-]*?[.]ss[tm])$`);
- static src_pth_contents = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9][a-zA-Z0-9._-]*)/pod[.]manifest$`);
- static src_pth_zip = ctRegex!(`^(?P[/]?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]zip)$`);
- static src_pth_types =
- ctRegex!(`^(?P[/]?[a-zA-Z0-9._-]+/)*(?P(?P[a-zA-Z0-9._-]+[.]ss[tm])|(?P[a-zA-Z0-9._-]+/pod[.]manifest)|(?P[a-zA-Z0-9._-]+[.]zip))$`);
- static src_fn =
- ctRegex!(`^([/]?(?:[a-zA-Z0-9._-]+/)*)(?P(?P[a-zA-Z0-9._-]+)[.](?Pss[tm]))$`);
- static src_fn_master = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ssm)$`);
- static src_fn_find_inserts = ctRegex!(`^(?P/?(?:[a-zA-Z0-9._-]+/)*)(?P[a-zA-Z0-9._-]+[.]ss[im])$`);
- static insert_src_fn_ssi_or_sst = ctRegex!(`^<<\s*(?P[a-zA-Z0-9._-]+/)*(?P[a-zA-Z0-9._-]+[.]ss[ti])$`);
- static src_base_parent_dir_name = ctRegex!(`[/](?P(?:[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
- static src_formalised_file_path_parts = ctRegex!(`(?P(?:[/a-zA-Z0-9._-]+?)(?P[a-zA-Z0-9._-]+))(?:/media/text/[a-z]{2})$`); // formalizes dir structure
- /+ line breaks +/
- 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");
- /+ inline markup footnotes endnotes +/
- 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.+?)】`, "m");
- static inline_notes_al_gen_ref = ctRegex!(`【(?P[[*+]\s+)\s*(?P].+?)】`, "mg");
- static inline_notes_al_all_note = ctRegex!(`【(?P\d+|(?:[*]|[+])+)\s+(?P.+?)\s*】`, "mg");
- static inline_notes_al_regular_number_note = ctRegex!(`【(?P\d+)\s+(?P.+?)\s*】`, "mg");
- static inline_notes_al_special_char_note = ctRegex!(`【(?P(?:[*]|[+])+)\s+(?P.+?)】`, "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_text_and_note_al_ = ctRegex!(`(.+?(?:【[*+]*\s+.+?】|$))`, "mg");
- /+ inline markup links +/
- static inline_image = ctRegex!(`(?P┥)☼(?P(?P [a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+))\s*(?P.*?┝┤.*?├)`, "mg");
- static inline_image_without_dimensions = ctRegex!(`(?P┥)☼(?P(?P [a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P0)h(?P0))\s*(?P.*?┝┤.*?├)`, "mg");
- static inline_image_info = ctRegex!(`☼?(?P [a-zA-Z0-9._-]+?\.(?:jpg|gif|png)),w(?P\d+)h(?P\d+)`, "mg");
- static inline_link_anchor = ctRegex!(`┃(?P\S+?)┃`, "mg"); // TODO *~text_link_anchor
- static inline_link = ctRegex!(`┥(?P.+?)┝┤(?P #?(\S+?))├`, "mg");
- static inline_link_empty = ctRegex!(`┥(?P.+?)┝┤├`, "mg");
- static inline_link_number = ctRegex!(`┥(?P.+?)┝┤(?P[0-9]+)├`, "mg"); // not used
- static inline_link_number_only = ctRegex!(`(┥.+?┝)┤(?P[0-9]+)├`, "mg");
- static inline_link_stow_uri = ctRegex!(`┥(?P.+?)┝┤(?P [^ 0-9#┥┝┤├][^ 0-9┥┝┤├]+)├`, "mg"); // will not stow (stowed links) or object number internal links
- static inline_link_hash = ctRegex!(`┥(?P.+?)┝┤(?P #(?P\S+?))├`, "mg");
- static inline_link_clean = ctRegex!(`┤(?:.+?)├|[┥┝]`, "mg");
- static inline_link_toc_to_backmatter = ctRegex!(`┤#(?P endnotes|bibliography|bookindex|glossary|blurb)├`, "mg");
- static url = ctRegex!(`https?://`, "mg");
- static uri = ctRegex!(`(?:https?|git)://`, "mg");
- static uri_identify_components = ctRegex!(`(?P(?:https?|git)://)(?P\S+?/)(?P[^/]+)$`, "mg");
- static inline_link_subtoc = ctRegex!(`^(?P[5-7])~ ┥(?P.+?)┝┤(?P .+?)├`, "mg");
- static inline_link_fn_suffix = ctRegex!(`¤(.+?)(\.fnSuffix)`, "mg");
- static inline_seg_link = ctRegex!(`(¤)(?:.+?)\.fnSuffix`, "mg");
- static mark_internal_site_lnk = ctRegex!(`¤`, "mg");
- static quotation_mark_sql_insert_delimiter = ctRegex!("[']", "mg");
- /+ inline markup font face mod +/
- static inline_mark_emphasis = ctRegex!(`(?P[*])\{(?P.+?)\}[*]`, "mg");
- static inline_mark_bold = ctRegex!(`(?P[!])\{(?P.+?)\}[!]`, "mg");
- static inline_mark_underscore = ctRegex!(`(?P[_])\{(?P.+?)\}[_]`, "mg");
- static inline_mark_italics = ctRegex!(`(?P[/])\{(?P.+?)\}[/]`, "mg");
- static inline_mark_superscript = ctRegex!(`(?P\^)\{(?P.+?)\}\^`, "mg");
- static inline_mark_subscript = ctRegex!(`(?P[,])\{(?P.+?)\}[,]`, "mg");
- static inline_mark_strike = ctRegex!(`(?P[-])\{(?P.+?)\}[-]`, "mg");
- static inline_mark_insert = ctRegex!(`(?P[+])\{(?P.+?)\}[+]`, "mg");
- static inline_mark_mono = ctRegex!(`(?P[#])\{(?P.+?)\}[#]`, "mg");
- static inline_mark_cite = ctRegex!(`(?P["])\{(?P.+?)\}["]`, "mg");
- static inline_faces_line = ctRegex!(`^[*!/_]_ (?P.+?)((?: [\\]{2}|[~]#){0,2}$)`);
- static inline_emphasis_line = ctRegex!(`^\*_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
- static inline_bold_line = ctRegex!(`^!_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
- static inline_italics_line = ctRegex!(`^/_ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
- static inline_underscore_line = ctRegex!(`^__ (?P.+?)(?P(?: [\\]{2}|[~]#){0,2}$)`);
- /+ inline markup font face mod +/
- static inline_emphasis = ctRegex!(`[*]┨(?P.+?)┣[*]`, "mg");
- static inline_bold = ctRegex!(`[!]┨(?P.+?)┣[!]`, "mg");
- static inline_underscore = ctRegex!(`[_]┨(?P.+?)┣[_]`, "mg");
- static inline_italics = ctRegex!(`[/]┨(?P.+?)┣[/]`, "mg");
- static inline_superscript = ctRegex!(`\^┨(?P.+?)┣\^`, "mg");
- // static inline_superscript = ctRegex!(`[\^]┨(?P.+?)┣[\^]`, "mg");
- static inline_subscript = ctRegex!(`[,]┨(?P.+?)┣[,]`, "mg");
- static inline_strike = ctRegex!(`[-]┨(?P.+?)┣[-]`, "mg");
- static inline_insert = ctRegex!(`[+]┨(?P.+?)┣[+]`, "mg");
- static inline_mono = ctRegex!(`[■]┨(?P.+?)┣[■]`, "mg");
- static inline_cite = ctRegex!(`[‖]┨(?P.+?)┣[‖]`, "mg");
- static inline_fontface_clean = ctRegex!(`[*!_/^,+■‖-]┨|┣[*!_/^,+■‖-]`, "mg");
- /+ table delimiters +/
- static table_delimiter_col = ctRegex!("[ ]*[┊][ ]*", "mg");
- static table_delimiter_row = ctRegex!("[ ]*\n", "mg");
- static xhtml_ampersand = ctRegex!(`[&]`, "m"); // &
- static xhtml_quotation = ctRegex!(`["]`, "m"); // "
- static xhtml_less_than = ctRegex!(`[<]`, "m"); // <
- static xhtml_greater_than = ctRegex!(`[>]`, "m"); // >
- static xhtml_line_break = ctRegex!(` [\\]{2}`, "m"); //
- static latex_special_char = ctRegex!(`([%${}_#&\\])`);
- static latex_special_char_for_escape = ctRegex!(`([%${}_#\\])`);
- static latex_special_char_for_escape_and_braces = ctRegex!(`([&])`);
- static latex_special_char_for_escape_url = ctRegex!(`([%])`);
- static latex_special_char_escaped = ctRegex!(`\\([%${}_#\\])`);
- static latex_special_char_escaped_braced = ctRegex!(`[{]\\([&])[}]`);
- static latex_identify_inline_link = ctRegex!(`┥.+?┝┤\S+?├`, "mg");
- static latex_clean_internal_link = ctRegex!(`^(?:#|¤\S+?#)`, "m");
- static latex_identify_inline_fontface = ctRegex!(`\\([_#$]┨.+?┣)\\([_#$])`, "mg");
- static latex_clean_bookindex_linebreak = ctRegex!(`\s*\\\\\\\\\s*`, "m");
- }
-}
diff --git a/src/doc_reform/output/source_pod.d b/src/doc_reform/output/source_pod.d
deleted file mode 100644
index 8fbfa0c..0000000
--- a/src/doc_reform/output/source_pod.d
+++ /dev/null
@@ -1,374 +0,0 @@
-module doc_reform.output.source_pod;
-template spinePod() {
- import doc_reform.output;
- import
- std.digest.sha,
- std.file,
- std.outbuffer,
- std.zip,
- std.conv : to;
- import
- doc_reform.output.create_zip_file,
- doc_reform.output.xmls;
- void spinePod(T)(T doc_matters) {
- debug(asserts) {
- // static assert(is(typeof(doc_matters) == tuple));
- }
- mixin spineOutputRgxInit;
- string pwd = doc_matters.env.pwd;
- auto src_path_info = doc_matters.src_path_info;
- auto pth_dr_doc_src = doc_matters.src_path_info;
- auto pths_pod = spinePathsPods!()(doc_matters);
- mixin spineLanguageCodes;
- auto lang = Lang();
- static auto rgx = Rgx();
- assert (doc_matters.src.filename.match(rgx.src_fn));
- auto pod_archive(Z)(
- string _source_type,
- string _data_in,
- string _pth_out,
- Z zip
- ) {
- auto zip_arc_member_file = new ArchiveMember();
- zip_arc_member_file.name = _pth_out;
- auto zip_data = new OutBuffer();
- switch (_source_type) {
- case "file_path_bin":
- zip_data.write(cast(char[]) ((_data_in).read));
- goto default;
- case "file_path_text":
- zip_data.write((_data_in).readText);
- goto default;
- case "string":
- zip_data.write(_data_in);
- goto default;
- default:
- zip_arc_member_file.expandedData = zip_data.toBytes();
- zip.addMember(zip_arc_member_file);
- }
- return zip;
- }
- try {
- /+ create directory structure +/
- if (!exists(pths_pod.pod_dir_())) {
- // used both by pod zipped (& pod filesystem (unzipped) which makes its own recursive dirs)
- pths_pod.pod_dir_().mkdirRecurse;
- }
- if (doc_matters.opt.action.source) {
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod);
- }
- if (!exists(pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod)) {
- pths_pod.text_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
- }
- if (!exists(pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod)) {
- pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
- }
- if (!exists(pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod)) {
- pths_pod.media_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
- }
- if (!exists(pths_pod.css(doc_matters.src.filename).filesystem_open_zpod)) {
- pths_pod.css(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
- }
- if (!exists(pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod)) {
- pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.mkdirRecurse;
- }
- if (!exists(pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod)) {
- pths_pod.doc_lng(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.mkdirRecurse;
- }
- }
- debug(pod) {
- writeln(__LINE__, ": ",
- doc_matters.src.filename, " -> ",
- pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod
- );
- }
- auto zip = new ZipArchive();
- auto fn_pod = pths_pod.pod_filename(doc_matters.src.filename).zpod;
- { /+ bundle images +/
- foreach (image; doc_matters.srcs.image_list) {
- debug(podimages) {
- writeln(
- pth_dr_doc_src.image_root.to!string, "/", image, " -> ",
- pths_pod.image_root(doc_matters.src.filename).zpod, "/", image
- );
- }
- auto fn_src_in = doc_matters.src.image_dir_path ~ "/" ~ image;
- auto fn_src_out_pod_zip_base
- = pths_pod.image_root(doc_matters.src.filename).zpod.to!string
- ~ "/" ~ image;
- auto fn_src_out_filesystem
- = pths_pod.image_root(doc_matters.src.filename).filesystem_open_zpod.to!string
- ~ "/" ~ image;
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("(io debug) src out found: ", fn_src_in);
- }
- if (doc_matters.opt.action.source) {
- fn_src_in.copy(fn_src_out_filesystem);
- }
- if (doc_matters.opt.action.pod) {
- zip = pod_archive("file_path_bin", fn_src_in, fn_src_out_pod_zip_base, zip);
- }
- } else {
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln("WARNING (io) src out NOT found (image): ", fn_src_in);
- }
- }
- }
- } { /+ bundle dr_document_make +/
- auto fn_src_in = ((doc_matters.src.is_pod)
- ? doc_matters.src.conf_dir_path
- : pth_dr_doc_src.conf_root).to!string
- ~ "/" ~ "dr_document_make";
- auto fn_src_out_pod_zip_base
- = pths_pod.conf_root(doc_matters.src.filename).zpod.to!string ~ "/" ~ "dr_document_make";
- auto fn_src_out_filesystem
- = pths_pod.conf_root(doc_matters.src.filename).filesystem_open_zpod.to!string
- ~ "/" ~ "dr_document_make";
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("(io debug) src out found: ", fn_src_in);
- }
- if (doc_matters.opt.action.source) {
- fn_src_in.copy(fn_src_out_filesystem);
- }
- if (doc_matters.opt.action.pod) {
- zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
- }
- } else {
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln("WARNING (io) src out NOT found (document make): ", fn_src_in);
- }
- }
- } { /+ pod manifest +/
- auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
- auto fn_src_out_pod_zip_base
- = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string;
- auto fn_src_out_filesystem
- = pths_pod.pod_manifest(doc_matters.src.filename).filesystem_open_zpod.to!string; // needed without root path
- auto fn_src_out_inside_pod
- = pths_pod.pod_manifest(doc_matters.src.filename).zpod.to!string; // needed without root path
- string[] filelist_src_out_pod_arr;
- string[] filelist_src_zpod_arr;
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("(io debug) src in found: ", fn_src_in);
- }
- filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base;
- filelist_src_zpod_arr ~= fn_src_out_inside_pod;
- {
- import dyaml;
- auto pod_filelist_yaml_string
- = File(pths_pod.fn_pod_filelist(doc_matters.src.filename).filesystem_open_zpod, "w");
- Node _pmy;
- string _pm = "doc:\n filename: " ~ doc_matters.src.filename ~ "\n language: " ~ doc_matters.pod.manifest_list_of_languages.to!string ~ "\n";
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- _pmy = Loader.fromString(_pm).load();
- writeln("pod filename: ", _pmy["doc"]["filename"].get!string);
- writeln("pod languages: ", doc_matters.pod.manifest_list_of_languages.to!string);
- writeln("pod languages: ", doc_matters.src.language);
- // foreach(string _l; _pmy["doc"]["language"]) {
- // writeln("language: ", _l);
- // }
- }
- if (doc_matters.opt.action.source) {
- pod_filelist_yaml_string.writeln(_pm);
- }
- if (doc_matters.opt.action.pod) {
- zip = pod_archive("string", _pm, fn_src_out_pod_zip_base, zip);
- }
- }
- }
- } { /+ bundle primary file (.ssm/.sst) +/
- auto fn_src_in = doc_matters.src.file_with_absolute_path.to!string;
- auto fn_src_out_pod_zip_base
- = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string;
- auto fn_src_out_filesystem
- = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).filesystem_open_zpod.to!string; // needed without root path:
- auto fn_src_out_inside_pod
- = pths_pod.fn_doc(doc_matters.src.filename, doc_matters.src.language).zpod.to!string; // needed without root path:
- string[] filelist_src_out_pod_arr;
- string[] filelist_src_zpod_arr;
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("(io debug) src in found: ", fn_src_in);
- }
- filelist_src_out_pod_arr ~= fn_src_out_pod_zip_base;
- filelist_src_zpod_arr ~= fn_src_out_inside_pod;
- string _pod_to_markup_file = doc_matters.src.pod_name ~ "/" ~ "media/text/" ~ doc_matters.src.language ~ "/" ~ doc_matters.src.filename;
- if (doc_matters.opt.action.source) {
- fn_src_in.copy(fn_src_out_filesystem);
- }
- if (doc_matters.opt.action.pod) {
- auto _rgx = regex(r"(?P\S+?)(?P[a-z_-]+)/(?Pmedia/text/)(?P\S+?)/(?P\S+?\.ss[mt])");
- if (auto _x = fn_src_in.match(_rgx)){
- if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) {
- string _path_to_pod = _x.captures["path_to_pod"];
- string _podname = _x.captures["podname"];
- string _root_to_lang = _x.captures["from_root"];
- string _language = _x.captures["language"];
- string _filename = _x.captures["filename"];
- foreach (_lang; doc_matters.pod.manifest_list_of_languages) {
- string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
- string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
- zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip);
- }
- }
- } else {
- zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
- }
- }
- } else {
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln("WARNING (io) src in NOT found (markup source): ", fn_src_in);
- }
- }
- } { /+ bundle insert files (.ssi) +/
- if (doc_matters.srcs.file_insert_list.length > 0) {
- auto _rgx = regex(r"(?P\S+?)(?P[a-z_-]+)/(?Pmedia/text/)(?P\S+?)/(?P\S+?\.ss[i])");
- foreach (insert_file; doc_matters.srcs.file_insert_list) {
- debug(pod) {
- writeln(
- insert_file, " -> ",
- pths_pod.fn_doc_insert(
- doc_matters.src.filename,
- insert_file,
- doc_matters.src.language,
- ).zpod
- );
- }
- if (auto _x = insert_file.match(_rgx)){
- if (doc_matters.src.lng == doc_matters.pod.manifest_list_of_languages[$-1]) {
- string _path_to_pod = _x.captures["path_to_pod"];
- string _podname = _x.captures["podname"];
- string _root_to_lang = _x.captures["from_root"];
- string _language = _x.captures["language"];
- string _filename = _x.captures["filename"];
- foreach (_lang; doc_matters.pod.manifest_list_of_languages) {
- string _pth_mkup_src_in = _path_to_pod ~ _podname ~ "/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
- string _pth_mkup_src_out = "pod/" ~ _root_to_lang ~ _lang ~ "/" ~ _filename;
- if (exists(_pth_mkup_src_in)) {
- if (doc_matters.opt.action.source) {
- auto fn_src_out_filesystem // you need to change language sources
- = pths_pod.fn_doc_insert(
- doc_matters.src.filename, // doc_matters.src.filename
- _pth_mkup_src_in, // insert_file
- _lang,
- ).filesystem_open_zpod.to!string;
- _pth_mkup_src_in.copy(fn_src_out_filesystem); // check why here, thought dealt with elsewhere
- }
- if (doc_matters.opt.action.pod) {
- zip = pod_archive("file_path_text", _pth_mkup_src_in, _pth_mkup_src_out, zip);
- }
- } else {
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln("WARNING (io) src out NOT found (insert file): ", _pth_mkup_src_in);
- }
- }
- }
- }
- } else {
- auto fn_src_in = insert_file;
- auto fn_src_out_pod_zip_base
- = pths_pod.fn_doc_insert(
- doc_matters.src.filename,
- insert_file,
- doc_matters.src.language,
- ).zpod.to!string;
- auto fn_src_out_filesystem
- = pths_pod.fn_doc_insert(
- doc_matters.src.filename,
- insert_file,
- doc_matters.src.language,
- ).filesystem_open_zpod.to!string;
- if (exists(fn_src_in)) {
- debug(io) {
- writeln("(io debug) src out found: ", fn_src_in);
- }
- if (doc_matters.opt.action.source) {
- fn_src_in.copy(fn_src_out_filesystem);
- }
- if (doc_matters.opt.action.pod) {
- zip = pod_archive("file_path_text", fn_src_in, fn_src_out_pod_zip_base, zip);
- }
- } else {
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln("WARNING (io) src out NOT found (insert file): ", fn_src_in);
- }
- }
- }
- }
- }
- } {
- auto fn_src_in = doc_matters.src.filename;
- if (doc_matters.opt.action.pod) {
- if (exists(doc_matters.src.file_with_absolute_path)) {
- createZipFile!()(fn_pod, zip.build());
- } else {
- writeln("WARNING check missing source file(s): ", doc_matters.opt.action.pod);
- }
- if (!(exists(fn_pod))) {
- writeln("WARNING failed to create pod zip archive: ", fn_pod);
- }
- }
- }
- if (exists(fn_pod)) {
- try {
- if (!(doc_matters.opt.action.quiet)
- && doc_matters.opt.action.pod) {
- auto data = (cast(byte[]) (fn_pod).read);
- if (doc_matters.opt.action.verbose) {
- writeln(" ", doc_matters.src.filename, " > ");
- }
- if (doc_matters.opt.action.pod) {
- writefln(" %s\n %s %-(%02x%)", fn_pod, "sha256", data.sha256Of);
- }
- }
- debug(pod) {
- try {
- auto zipped = new ZipArchive((fn_pod).read);
- foreach (filename, member; zipped.directory) {
- auto data = zipped.expand(member);
- writeln("> ", filename, " length ", data.length);
- }
- } catch (ZipException ex) {
- // Handle errors
- }
- if (doc_matters.src.filename == "dr_doc/media/text/en/the_wealth_of_networks.yochai_benkler.sst") {
- assert(
- ((data).sha256Of).toHexString
- == "626F83A31ED82F42CF528E922C1643498A137ABA3F2E5AFF8A379EA79EA22A1E",
- "\npod: sha256 value for "
- ~ doc_matters.src.filename
- ~ " has changed, is now: "
- ~ ((data).sha256Of).toHexString
- );
- }
- if (doc_matters.src.filename == "dr_doc/media/text/en/sisu_markup_stress_test.sst") {
- assert(
- ((data).sha256Of).toHexString
- == "AAE0C87AB3F6D5F7385AEEA6EE661F56D40475CFE87AD930C78C9FE07FFB0D91",
- "\npod: sha256 value for "
- ~ doc_matters.src.filename
- ~ " has changed, is now: "
- ~ ((data).sha256Of).toHexString
- );
- }
- }
- } catch (ErrnoException ex) {
- // Handle errors
- }
- }
-
- } catch (ErrnoException ex) {
- // Handle error
- }
- }
-}
diff --git a/src/doc_reform/output/sqlite.d b/src/doc_reform/output/sqlite.d
deleted file mode 100644
index 3f277c0..0000000
--- a/src/doc_reform/output/sqlite.d
+++ /dev/null
@@ -1,1561 +0,0 @@
-module doc_reform.output.sqlite;
-import doc_reform.output;
-import
- std.file,
- std.uri,
- std.conv : to;
-import d2sqlite3;
-import std.typecons : Nullable;
-mixin spineOutputRgxInit;
-mixin InternalMarkup;
-static auto rgx = Rgx();
-static auto mkup = InlineMarkup();
-long _metadata_tid_lastrowid;
-template SQLiteHubBuildTablesAndPopulate() {
- void SQLiteHubBuildTablesAndPopulate(D,M)(
- const D doc_abstraction,
- M doc_matters,
- ) {
- auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path);
- pth_sqlite.base.mkdirRecurse;
- auto db = Database(pth_sqlite.sqlite_file);
- template SQLiteDbStatementComposite() {
- void SQLiteDbStatementComposite(Db,D,M)(
- Db db,
- const D doc_abstraction,
- M doc_matters,
- ) {
- {
- string _db_statement;
- {
- if ((doc_matters.opt.action.sqlite_db_create)) {
- auto pth_sqlite = spinePathsSQLite!()(doc_matters.sqlite.filename, doc_matters.output_path);
- pth_sqlite.base.mkdirRecurse;
- _db_statement ~= SQLiteTablesReCreate!()();
- SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "TABLE RE-CREATE");
- }
- if (doc_matters.opt.action.sqlite_delete) {
- _db_statement ~= SQLiteDeleteDocument!()(doc_matters);
- SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document");
- }
- if (doc_matters.opt.action.sqlite_update) {
- _db_statement ~= SQLiteDeleteDocument!()(doc_matters);
- SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "DELETE Document");
- _db_statement ~= SQLiteInsertMetadata!()(doc_matters);
- SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT MetaData");
- /+ get tid (lastrowid or max) for use in doc_objects table +/
- _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters);
- SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "INSERT DocObjects");
- }
- }
- db.close;
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", pth_sqlite.sqlite_file);
- }
- }
- }
- SQLiteDbStatementComposite!()(db, doc_abstraction, doc_matters);
- }
-}
-template SQLiteHubDiscreteBuildTablesAndPopulate() {
- void SQLiteHubDiscreteBuildTablesAndPopulate(D,M)(
- const D doc_abstraction,
- M doc_matters,
- ) {
- auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language);
- auto pth_sqlite = spinePathsSQLiteDiscrete!()(doc_matters.output_path, doc_matters.src.language);
- pth_sqlite.base.mkdirRecurse;
- auto db = Database(pth_sqlite.sqlite_file(doc_matters.src.filename));
- template SQLiteDiscreteDbStatementComposite() {
- void SQLiteDiscreteDbStatementComposite(Db,D,M)(
- Db db,
- const D doc_abstraction,
- M doc_matters,
- ) {
- {
- string _db_statement;
- {
- _db_statement ~= SQLiteTablesReCreate!()();
- _db_statement ~= SQLiteInsertMetadata!()(doc_matters);
- _db_statement ~= doc_abstraction.SQLiteInsertDocObjectsLoop!()(doc_matters);
- SQLiteDbRun!()(db, _db_statement, doc_matters.opt.action, "table CREATE Tables, INSERT DocObjects");
- }
- db.close;
- }
- if (!(doc_matters.opt.action.quiet)) {
- writeln(" ", pth_sqlite.sqlite_file(doc_matters.src.filename));
- }
- }
- }
- SQLiteDiscreteDbStatementComposite!()(db, doc_abstraction, doc_matters);
- }
-}
-template SQLiteDbRun() {
- void SQLiteDbRun(Db,St,O)(
- Db db,
- St db_statement,
- O opt_action,
- string note,
- ) {
- debug(sql_statement) {
- writeln(db_statement);
- }
- try {
- db.run(
- "\nBEGIN;\n" ~
- db_statement ~
- "\nCOMMIT;\n"
- );
- if (!(opt_action.sqlite_discrete)
- && !(opt_action.sqlite_db_create)
- ) {
- }
- } catch (ErrnoException ex) {
- writeln("ERROR SQLite : ", ex);
- } catch (Exception ex) {
- writeln("ERROR SQLite : ", ex);
- }
- { /+ debug +/
- if (opt_action.debug_do
- && opt_action.verbose) {
- writeln(note);
- if (opt_action.very_verbose) {
- writeln(db_statement);
- }
- }
- }
- }
-}
-template SQLinsertDelimiter() {
- auto SQLinsertDelimiter(string _txt) {
- _txt = _txt
- .replaceAll(rgx.quotation_mark_sql_insert_delimiter, "$0$0");
- return _txt;
- }
-}
-template SQLiteFormatAndLoadObject() {
- auto SQLiteFormatAndLoadObject(M)(
- M doc_matters,
- ) {
- mixin spineOutputRgxInit;
- struct sqlite_format_and_load_objects {
- string generic_munge_sanitize_text_for_search(
- string _txt,
- ) {
- string _notes;
- string _urls;
- if (_txt.matchFirst(rgx.inline_notes_al_gen)) {
- foreach (m; _txt.matchAll(rgx.inline_notes_al_gen_text)) {
- _notes ~= "\n" ~ m["text"];
- }
- _txt = _txt.replaceAll(rgx.inline_notes_al_gen, "");
- }
- if (_txt.matchFirst(rgx.inline_link)) {
- foreach (m; _txt.matchAll(rgx.inline_link)) {
- if (m["link"].match(rgx.url)) {
- _urls ~= "\n" ~ m["link"];
- }
- }
- _txt = _txt.replaceAll(rgx.inline_link_clean, "");
- }
- if (_notes.length > 0) {
- _txt ~= _notes;
- }
- if (_urls.length > 0) {
- _txt ~= _urls;
- }
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(_txt, "\n");
- }
- }
- debug(sql_text_clean) {
- writeln(_txt);
- }
- return _txt;
- }
- string munge_html(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string _html_special_characters(string _txt){
- _txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&")
- .replaceAll(rgx.xhtml_quotation, """)
- .replaceAll(rgx.xhtml_less_than, "<")
- .replaceAll(rgx.xhtml_greater_than, ">")
- .replaceAll(rgx.nbsp_char, " ")
- .replaceAll(rgx.xhtml_line_break, " ");
- return _txt;
- }
- string _html_font_face(string _txt){
- _txt = _txt
- .replaceAll(rgx.inline_emphasis, "$1 ")
- .replaceAll(rgx.inline_bold, "$1 ")
- .replaceAll(rgx.inline_underscore, "$1 ")
- .replaceAll(rgx.inline_italics, "$1 ")
- .replaceAll(rgx.inline_superscript, "$1 ")
- .replaceAll(rgx.inline_subscript, "$1 ")
- .replaceAll(rgx.inline_strike, "$1")
- .replaceAll(rgx.inline_insert, "$1 ")
- .replaceAll(rgx.inline_mono, "$1 ")
- .replaceAll(rgx.inline_cite, "$1 ");
- return _txt;
- }
- string _notes;
- string _urls;
- string _txt = _html_font_face(_html_special_characters(obj.text));
- if (_txt.matchFirst(rgx.inline_notes_al_gen)) {
- foreach (m; _txt.matchAll(rgx.inline_notes_al_gen_text)) {
- _notes ~= "\n" ~ m["text"];
- }
- _txt = _txt.replaceAll(rgx.inline_notes_al_gen_ref, "$1 ");
- }
- if (_notes.length > 0) {
- _txt ~= _notes;
- }
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(_txt, "\n");
- }
- }
- return _txt;
- }
- string html_special_characters(string _txt){
- _txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&")
- .replaceAll(rgx.xhtml_quotation, """)
- .replaceAll(rgx.xhtml_less_than, "<")
- .replaceAll(rgx.xhtml_greater_than, ">")
- .replaceAll(rgx.nbsp_char, " ")
- .replaceAll(rgx.xhtml_line_break, " ");
- return _txt;
- }
- string html_special_characters_code(string _txt){
- _txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&")
- .replaceAll(rgx.xhtml_quotation, """)
- .replaceAll(rgx.xhtml_less_than, "<")
- .replaceAll(rgx.xhtml_greater_than, ">")
- .replaceAll(rgx.nbsp_char, " ");
- return _txt;
- }
- string html_font_face(string _txt){
- _txt = _txt
- .replaceAll(rgx.inline_emphasis, "$1 ")
- .replaceAll(rgx.inline_bold, "$1 ")
- .replaceAll(rgx.inline_underscore, "$1 ")
- .replaceAll(rgx.inline_italics, "$1 ")
- .replaceAll(rgx.inline_superscript, "$1 ")
- .replaceAll(rgx.inline_subscript, "$1 ")
- .replaceAll(rgx.inline_strike, "$1")
- .replaceAll(rgx.inline_insert, "$1 ")
- .replaceAll(rgx.inline_mono, "$1 ")
- .replaceAll(rgx.inline_cite, "$1 ");
- return _txt;
- }
- string inline_images(M,O)(
- M doc_matters,
- const O obj,
- string _txt,
- string _suffix = ".html",
- string _xml_type = "seg",
- ) {
- string _img_pth;
- if (_xml_type == "epub") {
- _img_pth = "image/";
- } else if (_xml_type == "scroll") {
- _img_pth = "../../image/";
- } else if (_xml_type == "seg") {
- _img_pth = "../../../image/";
- }
- if (_txt.match(rgx.inline_image)) {
- _txt = _txt.replaceAll( // TODO bug where image dimensions (w or h) not given & consequently set to 0; should not be used (calculate earlier, abstraction)
- rgx.inline_image,
- ("$1 $6"));
- }
- return _txt;
- }
- string inline_links(M,O)(
- M doc_matters,
- const O obj,
- string _txt,
- string _xml_type = "seg",
- ) {
- if (obj.has.inline_links) {
- if (obj.metainfo.is_a != "code") {
- _txt = replaceAll!(m =>
- m[1] ~ "┤" ~ to!string((obj.stow.link[m[2].to!ulong])).encode ~ "├"
- )(_txt, rgx.inline_link_number_only);
- }
- if ((_txt.match(rgx.mark_internal_site_lnk))
- && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
- _txt = _txt.replaceAll(
- rgx.inline_seg_link,
- "$1");
- }
- auto pth_html = spinePathsHTML!()(doc_matters.output_path, doc_matters.src.language);
- if (_xml_type == "seg") {
- foreach (m; _txt.match(rgx.inline_link_hash)) {
- if (m.captures[3] in doc_matters.has.tag_associations) {
- if (m.captures[3] == doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]) {
- _txt = _txt.replaceFirst(
- rgx.inline_link_hash,
- "┥$1┝┤"
- ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
- ~ "/"
- ~ pth_html.tail_fn_seg(doc_matters.src.filename, "$3.html")
- ~ "├"
- );
- } else {
- _txt = _txt.replaceFirst(
- rgx.inline_link_hash,
- "┥$1┝┤"
- ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
- ~ "/"
- ~ doc_matters.has.tag_associations[(m.captures[3])]["seg_lv4"]
- ~ ".html"
- ~ "#" ~ "$3"
- ~ "├"
- );
- }
- } else {
- if (!(doc_matters.opt.action.quiet)) {
- writeln(
- "WARNING on internal document links, anchor to link <<"
- ~ m.captures[3]
- ~ ">> not found in document, "
- ~ "anchor: " ~ m.captures[3]
- ~ " document: " ~ doc_matters.src.filename
- );
- }
- }
- }
- } else {
- if (auto m = _txt.match(rgx.inline_link_hash)) {
- _txt = _txt.replaceFirst(
- rgx.inline_link_hash,
- "┥$1┝┤"
- ~ doc_matters.conf_make_meta.conf.webserv_url_doc_root
- ~ "/"
- ~ pth_html.tail_fn_scroll(doc_matters.src.filename)
- ~ "#" ~ "$3"
- ~ "├"
- );
- }
- }
- _txt = _txt
- .replaceAll(
- rgx.inline_link_fn_suffix,
- ("$1.html"))
- .replaceAll(
- rgx.inline_link,
- ("$1 "))
- .replaceAll(
- rgx.mark_internal_site_lnk,
- "");
- }
- debug(markup_links) {
- if (_txt.match(rgx.inline_link)) {
- writeln(__LINE__,
- " (missed) markup link identified (",
- obj.has.inline_links,
- "): ", obj.metainfo.is_a, ": ",
- obj.text
- );
- }
- }
- debug(markup) {
- if (_txt.match(rgx.inline_link)) {
- writeln(__LINE__,
- " (missed) markup link identified (",
- obj.has.inline_links,
- "): ", obj.metainfo.is_a, ": ",
- obj.text
- );
- }
- }
- return _txt;
- }
- string inline_notes_scroll(M,O)(
- M doc_matters,
- const O obj,
- string _txt,
- ) {
- if (obj.has.inline_notes_reg) {
- // _txt = font_face(_txt);
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_regular_number_note,
- (" $1 ")
- );
- }
- debug(markup_endnotes) {
- 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_al_regular_number_note)) {
- writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
- }
- }
- return _txt;
- }
- auto inline_notes_seg(M,O)(
- M doc_matters,
- const O obj,
- string _txt,
- ) {
- string[] _endnotes;
- if (obj.has.inline_notes_reg) {
- /+ need markup for text, and separated footnote +/
- 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",
- "",
- "",
- " ",
- m.captures[1],
- ". ",
- m.captures[2],
- "
"
- );
- }
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_regular_number_note,
- (" $1 ")
- );
- } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
- debug(markup) {
- writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
- }
- }
- auto t = tuple(
- _txt,
- _endnotes,
- );
- return t;
- }
- string xml_type="seg"; /+ set html document type to be linked to here (seg|scroll) +/
- string inline_markup(M,O)(
- M doc_matters,
- const O obj,
- string _txt,
- ) {
- _txt = inline_images(doc_matters, obj, _txt, xml_type);
- _txt = inline_links(doc_matters, obj, _txt, xml_type);
- _txt = inline_notes_scroll(doc_matters, obj, _txt);
- return _txt;
- }
- string html_heading(M,O)(
- M doc_matters,
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "heading");
- string _txt = munge_html(doc_matters, obj);
- _txt = inline_markup(doc_matters, obj, _txt);
- string o = format(q"┃
- %s
-
┃",
- obj.metainfo.is_a,
- _txt,
- );
- return o;
- }
- string html_para(M,O)(
- M doc_matters,
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "para" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- string _txt = munge_html(doc_matters, obj);
- _txt = (obj.attrib.bullet) ? ("● " ~ _txt) : _txt;
- _txt = inline_markup(doc_matters, obj, _txt);
- string o = format(q"┃
- %s
-
┃",
- obj.metainfo.is_a,
- obj.attrib.indent_hang,
- obj.attrib.indent_base,
- _txt
- );
- return o;
- }
- string html_quote(M,O)(
- M doc_matters,
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "quote");
- string _txt = munge_html(doc_matters, obj);
- string o = format(q"┃
- %s
-
┃",
- obj.metainfo.is_a,
- _txt
- );
- return o;
- }
- string html_group(M,O)(
- M doc_matters,
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "group");
- string _txt = munge_html(doc_matters, obj);
- string o = format(q"┃
- %s
-
┃",
- obj.metainfo.is_a,
- _txt
- );
- return o;
- }
- string html_block(M,O)(
- M doc_matters,
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "block");
- string _txt = munge_html(doc_matters, obj);
- string o = format(q"┃
- %s
┃",
- obj.metainfo.is_a,
- _txt.stripRight
- );
- return o;
- }
- string html_verse(M,O)(
- M doc_matters,
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "verse");
- string _txt = munge_html(doc_matters, obj);
- string o = format(q"┃%s
┃",
- obj.metainfo.is_a,
- _txt
- );
- return o;
- }
- string html_code(O)(
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "code");
- string _txt = html_special_characters_code(obj.text);
- string o = format(q"┃%s
┃",
- obj.metainfo.is_a,
- _txt
- );
- return o;
- }
- string html_table(M,O)(
- M doc_matters,
- const O obj,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "table");
- auto _tablarize(O)(
- const O obj,
- string _txt,
- ) {
- string[] _table_rows = _txt.split(rgx.table_delimiter_row);
- string[] _table_cols;
- string _table;
- string _tablenote;
- foreach(row_idx, row; _table_rows) {
- _table_cols = row.split(rgx.table_delimiter_col);
- _table ~= "";
- 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)
- _tablenote ~= cell;
- } else {
- string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td";
- string _align = ("style=\"text-align:"
- ~ ((obj.table.column_aligns[col_idx] == "l")
- ? "left\"" : "right\""));
- _table ~= "<"
- ~ _col_is
- ~ " width=\""
- ~ obj.table.column_widths[col_idx].to!string
- ~ "%\" "
- ~ _align
- ~ ">";
- _table ~= cell;
- _table ~= ""
- ~ _col_is
- ~ ">";
- }
- }
- _table ~= " ";
- }
- auto t = tuple(
- _table,
- _tablenote,
- );
- return t;
- }
- string _txt = munge_html(doc_matters, obj);
- auto t = _tablarize(obj, _txt);
- _txt = t[0];
- string _note = t[1];
- string o = format(q"┃
-
- %s
- ┃",
- obj.metainfo.is_a,
- _txt,
- _note
- );
- return o;
- }
- string sqlite_load_string(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string o;
- return o;
- }
- string postgresql_load_string(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string o;
- return o;
- }
- string sqlite_statement(O)(
- const O obj,
- string _txt,
- string _html,
- ) {
- void _sql_exe(O)(
- string _sql,
- ) {
- writeln(_html);
- writeln(_sql);
- }
- string _sql;
- return _sql;
- }
- string[string] heading(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_heading(doc_matters, obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- string[string] para(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_para(doc_matters, obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- string[string] quote(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_quote(doc_matters, obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- string[string] group(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_group(doc_matters, obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- string[string] block(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_block(doc_matters, obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- string[string] verse(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_verse(doc_matters, obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- string[string] code(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_code(obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- string[string] table(M,O)(
- M doc_matters,
- const O obj,
- ) {
- string[string] obj_txt = [
- "text": generic_munge_sanitize_text_for_search(obj.text),
- "html": html_table(doc_matters, obj)
- ];
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- debug(sql_txt) {
- writeln(obj_txt["text"]);
- }
- debug(sql_html) {
- writeln(obj_txt["html"]);
- }
- } else {
- // load sql
- }
- }
- return obj_txt;
- }
- }
- return sqlite_format_and_load_objects();
- }
-}
-template SQLiteTablesReCreate() {
- string SQLiteTablesReCreate()() {
- string _sql_instruct;
- _sql_instruct = format(q"┃
- DROP INDEX IF EXISTS idx_ocn;
- DROP INDEX IF EXISTS idx_uid;
- DROP INDEX IF EXISTS idx_digest_clean;
- DROP INDEX IF EXISTS idx_digest_all;
- DROP INDEX IF EXISTS idx_clean;
- DROP INDEX IF EXISTS idx_title;
- DROP INDEX IF EXISTS idx_creator_author;
- DROP INDEX IF EXISTS src_filename;
- DROP INDEX IF EXISTS idx_language_document_char;
- DROP INDEX IF EXISTS idx_classify_topic_register;
- DROP TABLE IF EXISTS metadata_and_text;
- DROP TABLE IF EXISTS topic_register;
- DROP TABLE IF EXISTS doc_objects;
- DROP TABLE IF EXISTS urls;
- CREATE TABLE metadata_and_text (
- uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/])
- src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code
- src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename
- title VARCHAR(800) NOT NULL,
- title_main VARCHAR(400) NOT NULL,
- title_sub VARCHAR(400) NULL,
- title_short VARCHAR(400) NULL,
- title_edition VARCHAR(10) NULL,
- title_language VARCHAR(100) NULL,
- title_language_char VARCHAR(6) NULL,
- creator_author VARCHAR(600) NOT NULL,
- creator_author_email VARCHAR(100) NULL,
- creator_author_hon VARCHAR(100) NULL,
- creator_author_nationality VARCHAR(100) NULL,
- creator_editor VARCHAR(600) NULL,
- creator_contributor VARCHAR(600) NULL,
- creator_illustrator VARCHAR(600) NULL,
- creator_photographer VARCHAR(600) NULL,
- creator_translator VARCHAR(600) NULL,
- creator_prepared_by VARCHAR(600) NULL,
- creator_digitized_by VARCHAR(600) NULL,
- creator_audio VARCHAR(600) NULL,
- creator_video VARCHAR(600) NULL,
- language_document VARCHAR(100) NULL,
- language_document_char VARCHAR(6) NOT NULL,
- language_original VARCHAR(100) NULL,
- language_original_char VARCHAR(6) NULL,
- date_added_to_site VARCHAR(10) NULL,
- date_available VARCHAR(10) NULL,
- date_created VARCHAR(10) NULL,
- date_issued VARCHAR(10) NULL,
- date_modified VARCHAR(10) NULL,
- date_published VARCHAR(10) NULL,
- date_valid VARCHAR(10) NULL,
- date_translated VARCHAR(10) NULL,
- date_original_publication VARCHAR(10) NULL,
- date_generated VARCHAR(10) NULL,
- original_title VARCHAR(800) NULL,
- original_publisher VARCHAR(600) NULL,
- original_language VARCHAR(100) NULL,
- original_language_char VARCHAR(6) NULL,
- original_source VARCHAR(600) NULL,
- original_institution VARCHAR(600) NULL,
- original_nationality VARCHAR(100) NULL,
- rights_copyright VARCHAR(2500) NULL,
- rights_copyright_audio VARCHAR(2500) NULL,
- rights_copyright_cover VARCHAR(2500) NULL,
- rights_copyright_illustrations VARCHAR(2500) NULL,
- rights_copyright_photographs VARCHAR(2500) NULL,
- rights_copyright_text VARCHAR(2500) NULL,
- rights_copyright_translation VARCHAR(2500) NULL,
- rights_copyright_video VARCHAR(2500) NULL,
- rights_license VARCHAR(2500) NULL,
- identifier_oclc VARCHAR(30) NULL,
- identifier_isbn VARCHAR(16) NULL,
- classify_topic_register VARCHAR(2500) NULL,
- classify_subject VARCHAR(600) NULL,
- classify_loc VARCHAR(30) NULL,
- classify_dewey VARCHAR(30) NULL,
- classify_keywords VARCHAR(600) NULL,
- notes_abstract TEXT NULL,
- notes_description TEXT NULL,
- notes_comment TEXT NULL,
- notes_coverage VARCHAR(200) NULL,
- notes_relation VARCHAR(200) NULL,
- notes_history VARCHAR(600) NULL,
- notes_type VARCHAR(600) NULL,
- notes_format VARCHAR(600) NULL,
- notes_prefix TEXT NULL,
- notes_prefix_a TEXT NULL,
- notes_prefix_b TEXT NULL,
- notes_suffix TEXT NULL,
- publisher VARCHAR(600) NULL,
- src_filename VARCHAR(256) NOT NULL,
- src_fingerprint VARCHAR(256) NULL,
- src_filesize VARCHAR(10) NULL,
- src_wordcount VARCHAR(10) NULL,
- pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here
- pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here
- pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here
- site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
- site_url_html_toc VARCHAR(256) NULL,
- site_url_html_scroll VARCHAR(256) NULL,
- site_url_epub VARCHAR(256) NULL,
- links TEXT NULL
- );
- CREATE TABLE topic_register (
- -- tid BIGINT PRIMARY KEY,
- uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
- -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code
- -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename
- topic_register_lv0 VARCHAR(250) NOT NULL,
- topic_register_lv1 VARCHAR(250) NULL,
- topic_register_lv2 VARCHAR(250) NULL,
- topic_register_lv3 VARCHAR(250) NULL,
- topic_register_lv4 VARCHAR(250) NULL,
- site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
- site_url_html_toc VARCHAR(256) NULL,
- site_url_html_scroll VARCHAR(256) NULL
- );
- CREATE TABLE doc_objects (
- lid BIGINT PRIMARY KEY,
- uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
- ocn SMALLINT,
- obj_id VARCHAR(6) NULL,
- clean TEXT NULL,
- body TEXT NULL,
- seg VARCHAR(256) NULL,
- lev_an VARCHAR(1),
- is_of_type VARCHAR(16),
- is_a VARCHAR(16),
- lev SMALLINT NULL,
- node VARCHAR(16) NULL,
- parent VARCHAR(16) NULL,
- last_decendant VARCHAR(16) NULL, -- headings only
- digest_clean CHAR(256),
- digest_all CHAR(256),
- html_seg_url CHAR(256),
- types CHAR(1) NULL
- );
- CREATE INDEX idx_ocn ON doc_objects(ocn);
- CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);
- CREATE INDEX idx_digest_all ON doc_objects(digest_all);
- CREATE INDEX idx_clean ON doc_objects(clean);
- CREATE INDEX idx_title ON metadata_and_text(title);
- CREATE INDEX idx_author ON metadata_and_text(creator_author);
- CREATE INDEX idx_uid ON metadata_and_text(uid);
- CREATE INDEX idx_filename ON metadata_and_text(src_filename);
- CREATE INDEX idx_language ON metadata_and_text(language_document_char);
- CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register);
- ┃",);
- return _sql_instruct;
- }
-}
-template SQLiteDeleteDocument() {
- string SQLiteDeleteDocument(M)(
- M doc_matters,
- ) {
- string _uid = doc_matters.src.doc_uid;
- string _delete_uid = format(q"┃
- DELETE FROM metadata_and_text
- WHERE uid = '%s';
- DELETE FROM doc_objects
- WHERE uid_metadata_and_text = '%s';
- ┃",
- _uid,
- _uid,
- );
- return _delete_uid;
- }
-}
-template SQLiteInsertMetadata() {
- string SQLiteInsertMetadata(M)(
- M doc_matters,
- ) {
- string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
- string _insert_metadata = format(q"┃
- INSERT INTO metadata_and_text (
- uid,
- src_filename,
- src_composite_id_per_txt,
- src_composite_id_per_pod,
- title,
- title_main,
- title_sub,
- title_short,
- title_edition,
- title_language,
- creator_author,
- creator_author_email,
- creator_illustrator,
- creator_translator,
- language_document,
- language_document_char,
- date_added_to_site,
- date_available,
- date_created,
- date_issued,
- date_modified,
- date_published,
- date_valid,
- rights_copyright,
- rights_copyright_audio,
- rights_copyright_cover,
- rights_copyright_illustrations,
- rights_copyright_photographs,
- rights_copyright_text,
- rights_copyright_translation,
- rights_copyright_video,
- rights_license,
- identifier_oclc,
- identifier_isbn,
- classify_dewey,
- classify_keywords,
- classify_loc,
- classify_subject,
- classify_topic_register,
- original_title,
- original_publisher,
- original_language,
- original_language_char,
- original_source,
- notes_abstract,
- notes_description,
- publisher,
- site_url_doc_root
- )
- VALUES (
- '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s'
- );
- ┃",
- _uid,
- SQLinsertDelimiter!()(doc_matters.src.filename),
- SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_doc),
- SQLinsertDelimiter!()(doc_matters.src.docname_composite_unique_per_src_pod),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_full),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_main),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_subtitle),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_short),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_edition),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.title_language),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_author_email),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_illustrator),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.creator_translator),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.language_document_char),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_added_to_site),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_available),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_created),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_issued),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_modified),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_published),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.date_valid),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_audio),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_cover),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_illustrations),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_photographs),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_text),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_translation),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_copyright_video),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.rights_license),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_oclc),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.identifier_isbn),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_dewey),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_keywords),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_loc),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_subject),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.classify_topic_register),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_abstract),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.notes_description),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_title),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_publisher),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_language_char),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.original_source),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.meta.publisher),
- SQLinsertDelimiter!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root)
- );
- if (doc_matters.conf_make_meta.meta.classify_topic_register_arr.length > 0) {
-
- string _insert_topics;
- foreach (topic; doc_matters.conf_make_meta.meta.classify_topic_register_arr) {
- string[] subject_tree = topic.split(mkup.sep);
- _insert_topics ~= format(q"┃
- INSERT INTO topic_register (
- uid_metadata_and_text,
- topic_register_lv0,
- topic_register_lv1,
- topic_register_lv2,
- topic_register_lv3,
- topic_register_lv4
- )
- VALUES (
- '%s', '%s', '%s', '%s', '%s', '%s'
- );
- ┃",
- _uid,
- (subject_tree.length > 0) ? subject_tree[0] : "",
- (subject_tree.length > 1) ? subject_tree[1] : "",
- (subject_tree.length > 2) ? subject_tree[2] : "",
- (subject_tree.length > 3) ? subject_tree[3] : "",
- (subject_tree.length > 4) ? subject_tree[4] : ""
- );
- }
- }
- return _insert_metadata;
- }
-}
-template SQLiteInsertDocObjectsLoop() {
- string SQLiteInsertDocObjectsLoop(D,M)(
- const D doc_abstraction,
- M doc_matters,
- ) {
- string _uid = SQLinsertDelimiter!()(doc_matters.src.doc_uid);
- auto url_html = spineUrlsHTML!()(doc_matters.conf_make_meta.conf.webserv_url_doc_root, doc_matters.src.language);
- string insertDocObjectsRow(O)(O obj) {
- string _insert_doc_objects_row = format(q"┃
- INSERT INTO doc_objects (
- uid_metadata_and_text,
- ocn,
- obj_id,
- clean,
- body,
- lev,
- is_of_type,
- is_a,
- html_seg_url
- )
- VALUES (
- '%s', %s, '%s', '%s', '%s', %s, '%s', '%s', '%s'
- );
- ┃",
- _uid,
- obj.metainfo.ocn,
- obj.metainfo.identifier,
- SQLinsertDelimiter!()(obj_txt["text"]),
- SQLinsertDelimiter!()(obj_txt["html"]),
- obj.metainfo.heading_lev_markup,
- obj.metainfo.is_of_type,
- obj.metainfo.is_a,
- url_html.fn_seg_obj_num(doc_matters.src.filename, obj.tags.html_segment_anchor_tag_is, obj.metainfo.identifier),
- );
- return _insert_doc_objects_row;
- }
- auto format_and_sqlite_load = SQLiteFormatAndLoadObject!()(doc_matters);
- string[string] obj_txt;
- string doc_text;
- string[] _insert_doc_objects;
- foreach (part; doc_matters.has.keys_seq.sql) {
- foreach (obj; doc_abstraction[part]) {
- switch (obj.metainfo.is_of_part) {
- case "frontmatter": assert(part == "head", part);
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "body": // assert(part == "body", part);
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- debug (asserts) {
- if (part != "body") {
- writeln(__LINE__, ": ", obj.text);
- }
- }
- obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
- break;
- case "para":
- obj_txt = format_and_sqlite_load.para(doc_matters, obj);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- case "block":
- switch (obj.metainfo.is_a) {
- case "quote":
- obj_txt = format_and_sqlite_load.quote(doc_matters, obj);
- break;
- case "group":
- obj_txt = format_and_sqlite_load.group(doc_matters, obj);
- break;
- case "block":
- obj_txt = format_and_sqlite_load.block(doc_matters, obj);
- break;
- case "poem": // double check on keeping both poem & verse
- break;
- case "verse":
- obj_txt = format_and_sqlite_load.verse(doc_matters, obj);
- break;
- case "code":
- obj_txt = format_and_sqlite_load.code(doc_matters, obj);
- break;
- case "table":
- obj_txt = format_and_sqlite_load.table(doc_matters, obj);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "backmatter":
- assert(part == "glossary" || "bibliography" || "bookindex" || "blurb" || "tail", part);
- switch (obj.metainfo.is_of_type) {
- case "para":
- switch (obj.metainfo.is_a) {
- case "heading":
- obj_txt = format_and_sqlite_load.heading(doc_matters, obj);
- break;
- case "glossary": assert(part == "glossary", part);
- obj_txt = format_and_sqlite_load.para(doc_matters, obj);
- break;
- case "bibliography": assert(part == "bibliography", part);
- obj_txt = format_and_sqlite_load.para(doc_matters, obj);
- break;
- case "bookindex": assert(part == "bookindex", part);
- obj_txt = format_and_sqlite_load.para(doc_matters, obj);
- break;
- case "blurb": assert(part == "blurb", part);
- obj_txt = format_and_sqlite_load.para(doc_matters, obj);
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- }
- }
- break;
- }
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_type);
- }
- }
- break;
- }
- break;
- case "comment":
- break;
- default:
- { /+ debug +/
- if (doc_matters.opt.action.debug_do
- && doc_matters.opt.action.verbose) {
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_of_part); // check where empty value could come from
- writeln(__FILE__, ":", __LINE__, ": ", obj.metainfo.is_a);
- writeln(__FILE__, ":", __LINE__, ": ", obj.text); // check where empty value could come from
- }
- }
- break;
- }
- if (obj.metainfo.is_a == "heading") {
- if ((doc_matters.opt.action.very_verbose)) {
- writeln(
- "markup: ", obj.metainfo.heading_lev_markup,
- "> ", obj.metainfo.dom_structure_markedup_tags_status,
- "; collapsed: ", obj.metainfo.heading_lev_collapsed,
- "> ", obj.metainfo.dom_structure_collapsed_tags_status,
- "; ocn: ", obj.metainfo.ocn,
- " node: ", obj.metainfo.node,
- "; parent: ", obj.metainfo.parent_lev_markup,
- "; ocn: ", obj.metainfo.parent_ocn,
- "; ",
- );
- }
- }
- if (!(obj.metainfo.is_a == "comment")) {
- _insert_doc_objects ~= insertDocObjectsRow(obj);
- }
- } // loop closes
- }
- return _insert_doc_objects.join.to!(char[]).toUTF8;
- }
-}
-template SQLiteTablesCreate() {
- void SQLiteTablesCreate(E,O)(E env, O opt_action) {
- import d2sqlite3;
- template SQLiteTablesReCreate() {
- string SQLiteTablesReCreate()() {
- string _sql_instruct;
- _sql_instruct = format(q"┃
- DROP INDEX IF EXISTS idx_ocn;
- DROP INDEX IF EXISTS idx_uid;
- DROP INDEX IF EXISTS idx_digest_clean;
- DROP INDEX IF EXISTS idx_digest_all;
- DROP INDEX IF EXISTS idx_clean;
- DROP INDEX IF EXISTS idx_title;
- DROP INDEX IF EXISTS idx_creator_author;
- DROP INDEX IF EXISTS src_filename;
- DROP INDEX IF EXISTS idx_language_document_char;
- DROP INDEX IF EXISTS idx_classify_topic_register;
- DROP TABLE IF EXISTS metadata_and_text;
- DROP TABLE IF EXISTS topic_register;
- DROP TABLE IF EXISTS doc_objects;
- DROP TABLE IF EXISTS urls;
- CREATE TABLE metadata_and_text (
- uid VARCHAR(256) UNIQUE, -- filename, language char, pod/txt (decide on delimiter [,;:/])
- src_composite_id_per_txt VARCHAR(256) NOT NULL, -- UNIQUE, z pod name if any + src filename + language code
- src_composite_id_per_pod VARCHAR(256) NOT NULL, -- z pod name if any + src filename
- title VARCHAR(800) NOT NULL,
- title_main VARCHAR(400) NOT NULL,
- title_sub VARCHAR(400) NULL,
- title_short VARCHAR(400) NULL,
- title_edition VARCHAR(10) NULL,
- title_language VARCHAR(100) NULL,
- title_language_char VARCHAR(6) NULL,
- creator_author VARCHAR(600) NOT NULL,
- creator_author_email VARCHAR(100) NULL,
- creator_author_hon VARCHAR(100) NULL,
- creator_author_nationality VARCHAR(100) NULL,
- creator_editor VARCHAR(600) NULL,
- creator_contributor VARCHAR(600) NULL,
- creator_illustrator VARCHAR(600) NULL,
- creator_photographer VARCHAR(600) NULL,
- creator_translator VARCHAR(600) NULL,
- creator_prepared_by VARCHAR(600) NULL,
- creator_digitized_by VARCHAR(600) NULL,
- creator_audio VARCHAR(600) NULL,
- creator_video VARCHAR(600) NULL,
- language_document VARCHAR(100) NULL,
- language_document_char VARCHAR(6) NOT NULL,
- language_original VARCHAR(100) NULL,
- language_original_char VARCHAR(6) NULL,
- date_added_to_site VARCHAR(10) NULL,
- date_available VARCHAR(10) NULL,
- date_created VARCHAR(10) NULL,
- date_issued VARCHAR(10) NULL,
- date_modified VARCHAR(10) NULL,
- date_published VARCHAR(10) NULL,
- date_valid VARCHAR(10) NULL,
- date_translated VARCHAR(10) NULL,
- date_original_publication VARCHAR(10) NULL,
- date_generated VARCHAR(10) NULL,
- original_title VARCHAR(800) NULL,
- original_publisher VARCHAR(600) NULL,
- original_language VARCHAR(100) NULL,
- original_language_char VARCHAR(6) NULL,
- original_source VARCHAR(600) NULL,
- original_institution VARCHAR(600) NULL,
- original_nationality VARCHAR(100) NULL,
- rights_copyright VARCHAR(2500) NULL,
- rights_copyright_audio VARCHAR(2500) NULL,
- rights_copyright_cover VARCHAR(2500) NULL,
- rights_copyright_illustrations VARCHAR(2500) NULL,
- rights_copyright_photographs VARCHAR(2500) NULL,
- rights_copyright_text VARCHAR(2500) NULL,
- rights_copyright_translation VARCHAR(2500) NULL,
- rights_copyright_video VARCHAR(2500) NULL,
- rights_license VARCHAR(2500) NULL,
- identifier_oclc VARCHAR(30) NULL,
- identifier_isbn VARCHAR(16) NULL,
- classify_topic_register VARCHAR(2500) NULL,
- classify_subject VARCHAR(600) NULL,
- classify_loc VARCHAR(30) NULL,
- classify_dewey VARCHAR(30) NULL,
- classify_keywords VARCHAR(600) NULL,
- notes_abstract TEXT NULL,
- notes_description TEXT NULL,
- notes_comment TEXT NULL,
- notes_coverage VARCHAR(200) NULL,
- notes_relation VARCHAR(200) NULL,
- notes_history VARCHAR(600) NULL,
- notes_type VARCHAR(600) NULL,
- notes_format VARCHAR(600) NULL,
- notes_prefix TEXT NULL,
- notes_prefix_a TEXT NULL,
- notes_prefix_b TEXT NULL,
- notes_suffix TEXT NULL,
- publisher VARCHAR(600) NULL,
- src_filename VARCHAR(256) NOT NULL,
- src_fingerprint VARCHAR(256) NULL,
- src_filesize VARCHAR(10) NULL,
- src_wordcount VARCHAR(10) NULL,
- pod_name VARCHAR(256) NULL, -- zipped pod, work to be done here
- pod_fingerprint VARCHAR(256) NULL, -- zipped pod, work to be done here
- pod_size VARCHAR(10) NULL, -- zipped pod, work to be done here
- site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
- site_url_html_toc VARCHAR(256) NULL,
- site_url_html_scroll VARCHAR(256) NULL,
- site_url_epub VARCHAR(256) NULL,
- links TEXT NULL
- );
- CREATE TABLE topic_register (
- -- tid BIGINT PRIMARY KEY,
- uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
- -- src_composite_id_per_txt VARCHAR(256) NOT NULL, - UNIQUE, - z pod name if any + src filename + language code
- -- src_composite_id_per_pod VARCHAR(256) NOT NULL, - z pod name if any + src filename
- topic_register_lv0 VARCHAR(250) NOT NULL,
- topic_register_lv1 VARCHAR(250) NULL,
- topic_register_lv2 VARCHAR(250) NULL,
- topic_register_lv3 VARCHAR(250) NULL,
- topic_register_lv4 VARCHAR(250) NULL,
- site_url_doc_root VARCHAR(256) NULL, -- url path to doc root
- site_url_html_toc VARCHAR(256) NULL,
- site_url_html_scroll VARCHAR(256) NULL
- );
- CREATE TABLE doc_objects (
- lid BIGINT PRIMARY KEY,
- uid_metadata_and_text VARCHAR(256) REFERENCES metadata_and_text(uid) ON DELETE CASCADE,
- ocn SMALLINT,
- obj_id VARCHAR(6) NULL,
- clean TEXT NULL,
- body TEXT NULL,
- seg VARCHAR(256) NULL,
- lev_an VARCHAR(1),
- is_of_type VARCHAR(16),
- is_a VARCHAR(16),
- lev SMALLINT NULL,
- node VARCHAR(16) NULL,
- parent VARCHAR(16) NULL,
- last_decendant VARCHAR(16) NULL, -- headings only
- digest_clean CHAR(256),
- digest_all CHAR(256),
- html_seg_url CHAR(256),
- types CHAR(1) NULL
- );
- CREATE INDEX idx_ocn ON doc_objects(ocn);
- CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);
- CREATE INDEX idx_digest_all ON doc_objects(digest_all);
- CREATE INDEX idx_clean ON doc_objects(clean);
- CREATE INDEX idx_title ON metadata_and_text(title);
- CREATE INDEX idx_author ON metadata_and_text(creator_author);
- CREATE INDEX idx_uid ON metadata_and_text(uid);
- CREATE INDEX idx_filename ON metadata_and_text(src_filename);
- CREATE INDEX idx_language ON metadata_and_text(language_document_char);
- CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register);
- ┃",);
- return _sql_instruct;
- }
- }
- if (opt_action.sqlite_db_create) {
- string _db_statement;
- auto pth_sqlite = spinePathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set);
- pth_sqlite.base.mkdirRecurse;
- auto db = Database(pth_sqlite.sqlite_file);
- {
- _db_statement ~= SQLiteTablesReCreate!()();
- }
- SQLiteDbRun!()(db, _db_statement, opt_action, "TABLE RE-CREATE");
- }
- }
-}
-template SQLiteDbDrop() {
- void SQLiteDbDrop(O)(O opt_action) {
- writeln("db drop");
- if ((opt_action.sqlite_db_drop)) {
- auto pth_sqlite = spinePathsSQLite!()(opt_action.sqlite_filename, opt_action.output_dir_set);
- writeln("remove(", pth_sqlite.sqlite_file, ")");
- try {
- remove(pth_sqlite.sqlite_file);
- } catch (FileException ex) {
- // handle error
- }
- }
- }
-}
diff --git a/src/doc_reform/output/xmls.d b/src/doc_reform/output/xmls.d
deleted file mode 100644
index ae904bb..0000000
--- a/src/doc_reform/output/xmls.d
+++ /dev/null
@@ -1,1215 +0,0 @@
-module doc_reform.output.xmls;
-template outputXHTMLs() {
- import doc_reform.output;
- import
- std.digest.sha,
- std.file,
- std.outbuffer,
- std.uri,
- std.zip,
- std.conv : to;
- import
- doc_reform.output.create_zip_file,
- doc_reform.output.xmls,
- doc_reform.output.xmls_css;
- mixin spineOutputRgxInit;
- struct outputXHTMLs {
- static auto rgx = Rgx();
- string div_delimit(
- string part,
- return ref string previous_part
- ){
- string delimit = "";
- string delimit_ = "";
- if (part != previous_part) {
- switch (part) {
- case "head":
- delimit_ ~= "\n\n" ;
- break;
- case "toc":
- delimit_ ~= "\n
\n" ;
- break;
- case "bookindex":
- delimit_ ~= "\n
\n" ;
- break;
- default:
- delimit_ ~= "\n
\n" ;
- break;
- }
- if (previous_part.length > 0) {
- delimit ~= "\n
";
- }
- previous_part = part;
- delimit ~= delimit_;
- }
- // you also need to close the last div, introduce a footer?
- return delimit;
- }
- string special_characters_text(string _txt){
- _txt = _txt
- .replaceAll(rgx.xhtml_ampersand, "&")
- .replaceAll(rgx.xhtml_quotation, """)
- .replaceAll(rgx.xhtml_less_than, "<")
- .replaceAll(rgx.xhtml_greater_than, ">")
- .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, "
");
- }
- return _txt;
- }
- string font_face(string _txt){
- _txt = _txt
- .replaceAll(rgx.inline_emphasis, ("
$1 "))
- .replaceAll(rgx.inline_bold, ("
$1 "))
- .replaceAll(rgx.inline_underscore, ("
$1 "))
- .replaceAll(rgx.inline_italics, ("
$1 "))
- .replaceAll(rgx.inline_superscript, ("
$1 "))
- .replaceAll(rgx.inline_subscript, ("
$1 "))
- .replaceAll(rgx.inline_strike, ("
$1"))
- .replaceAll(rgx.inline_insert, ("
$1 "))
- .replaceAll(rgx.inline_mono, ("
$1 "))
- .replaceAll(rgx.inline_cite, ("
$1 "));
- return _txt;
- }
- string _xhtml_anchor_tags(O)(O obj) {
- const(string[]) anchor_tags = obj.tags.anchor_tags;
- string tags="";
- if (anchor_tags.length > 0) {
- foreach (tag; anchor_tags) {
- if (!(tag.empty)) {
- tags ~= "
";
- }
- }
- }
- return tags;
- }
- string header_metadata(M)(
- M doc_matters,
- ) {
- string _publisher="Publisher"; // TODO
- string o;
- o = format(q"┃
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ┃",
- 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.opt.action.debug_do ? "" : doc_matters.generator_program.name_and_version,
- doc_matters.generator_program.url_home,
- );
- return o;
- }
- string site_info_button(M)(
- M doc_matters,
- ) {
- string _locations;
- if (doc_matters.conf_make_meta.make.home_button_text.length > 0) {
- _locations = (doc_matters.conf_make_meta.make.home_button_text)
- .replaceAll(
- rgx.inline_link,
- ("
$1
"))
- .replaceAll(
- rgx.br_line, "")
- .replaceAll(
- rgx.br_nl, "");
- } else {
- _locations = "
spine
\n
sources / git
\n
www.sisudoc.org
";
- }
- string o;
- o = format(q"┃┃",
- _locations,
- );
- return o;
- }
- string inline_search_form(M)(
- M doc_matters,
- ) {
- string _action="http://www.sisudoc.org/cgi-bin/search.cgi";
- string _db="spine.7a.manual";
- string o;
- string _form;
- if (doc_matters.opt.action.workon) {
- _form = format(q"┃
-
-
- ┃",
- _action,
- _db,
- );
- } else {
- _form = format(q"┃%s┃",
- "",
- );
- }
- o = format(q"┃┃",
- _form,
- );
- return o;
- }
- string html_head(M)(
- M doc_matters,
- string type,
- ) {
- string _manifest = "";
- if (doc_matters.opt.action.workon) {
- _manifest = format(q"┃
-
-
- [ document manifest ]
-
-
- ┃",
- );
- }
- string o;
- o = format(q"┃
-
-
-
-
- %s%s
-
-
- %s
-
-
-
-
-
-
-
-
- "),
- );
- return o;
- }
- string epub3_seg_head(M)(
- M doc_matters,
- ) {
- string html_base = format(q"┃
- ┃",
- );
- string html_simple = format(q"┃
- ┃",
- doc_matters.src.language,
- doc_matters.src.language,
- );
- string html_strict = format(q"┃
- ┃",
- doc_matters.src.language,
- doc_matters.src.language,
- );
- string o;
- o = format(q"┃%s
-
-
- %s%s
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
┃",
- html_simple,
- 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.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;
- }
- string tail() {
- string o;
- o = format(q"┃
-
-
-
- ┃");
- return o;
- }
- string inline_images(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "seg",
- ) {
- string _img_pth;
- if (_xml_type == "epub") {
- _img_pth = "image/";
- } else if (_xml_type == "scroll") {
- _img_pth = "../../image/";
- } else if (_xml_type == "seg") {
- _img_pth = "../../../image/";
- }
- if (_txt.match(rgx.inline_image)) {
- _txt = _txt
- .replaceAll(rgx.inline_image,
- ("$1
$6"))
- .replaceAll(
- rgx.inline_link_empty,
- ("$1"));
- }
- return _txt;
- }
- string inline_links(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "seg",
- ) {
- string seg_lvs;
- if (obj.has.inline_links) {
- if (obj.metainfo.is_a != "code") {
- _txt = replaceAll!(m =>
- m[1] ~ "┤"
- ~ (replaceAll!(n =>
- n["type"] ~ n["path"] ~ (n["file"].encodeComponent)
- )((obj.stow.link[m["num"].to!ulong]).to!string, rgx.uri_identify_components))
- ~ "├"
- )(_txt, rgx.inline_link_number_only);
- }
- if ((_txt.match(rgx.mark_internal_site_lnk))
- && (_xml_type == "scroll")) { // conditions reversed to avoid: gdc compiled program run segfault
- _txt = _txt.replaceAll(
- rgx.inline_seg_link,
- "$1");
- }
- if (_xml_type == "seg" || _xml_type == "epub") {
- seg_lvs = (_xml_type == "epub") ? "seg_lv1_to_4" : "seg_lv4";
- foreach (m; _txt.match(rgx.inline_link_hash)) {
- if (m.captures[3] in doc_matters.has.tag_associations) {
- if (
- m.captures[3]
- == doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]
- ) {
- _txt = _txt.replaceFirst(
- rgx.inline_link_hash,
- "┥$1┝┤$3" ~ _suffix ~ "├"
- );
- } else {
- _txt = _txt.replaceFirst(
- rgx.inline_link_hash,
- "┥$1┝┤"
- ~ doc_matters.has.tag_associations[(m.captures[3])][seg_lvs]
- ~ _suffix ~ "#" ~ "$3"
- ~ "├"
- );
- }
- } else {
- if (!(doc_matters.opt.action.quiet)) {
- writeln(
- "WARNING on internal document links, anchor to link <<"
- ~ m.captures[3]
- ~ ">> not found in document, "
- ~ "anchor: " ~ m.captures[3]
- ~ " document: " ~ doc_matters.src.filename
- );
- }
- }
- }
- }
- _txt = _txt
- .replaceAll(
- rgx.inline_link_fn_suffix,
- ("$1" ~ _suffix))
- .replaceAll(
- rgx.inline_link,
- ("
$1 "))
- .replaceAll(
- rgx.mark_internal_site_lnk,
- "");
- }
- debug(markup_links) {
- if (_txt.match(rgx.inline_link)) {
- writeln(__LINE__,
- " (missed) markup link identified (",
- obj.has.inline_links,
- "): ", obj.metainfo.is_a, ": ",
- obj.text
- );
- }
- }
- debug(markup) {
- if (_txt.match(rgx.inline_link)) {
- writeln(__LINE__,
- " (missed) markup link identified (",
- obj.has.inline_links,
- "): ", obj.metainfo.is_a, ": ",
- obj.text
- );
- }
- }
- return _txt;
- }
- string inline_notes_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- if (obj.has.inline_notes_reg) {
- _txt = font_face(_txt);
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_regular_number_note,
- ("
$1 ")
- );
- }
- if (obj.has.inline_notes_star) {
- _txt = font_face(_txt);
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_special_char_note,
- ("
$1 ")
- );
- }
- debug(markup_endnotes) {
- 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_al_regular_number_note)) {
- writeln(__LINE__, " (missed) markup endnote: ", obj.metainfo.is_a, ": ", obj.text);
- }
- }
- return _txt;
- }
- auto inline_notes_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- string[] _endnotes;
- if (obj.has.inline_notes_star) {
- _txt = font_face(_txt);
- /+ need markup for text, and separated footnote +/
- foreach(m; _txt.matchAll(rgx.inline_notes_al_special_char_note)) {
- _endnotes ~= format(
- "%s%s%s%s\n %s%s%s%s%s\n %s\n%s",
- "
",
- "",
- " ",
- m.captures[1],
- ". ",
- m.captures[2],
- "
"
- );
- }
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_special_char_note,
- ("
$1 ")
- );
- }
- if (obj.has.inline_notes_reg) {
- _txt = font_face(_txt);
- /+ need markup for text, and separated footnote +/
- 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",
- "
",
- "",
- " ",
- m.captures[1],
- ". ",
- m.captures[2],
- "
"
- );
- }
- _txt = _txt.replaceAll(
- rgx.inline_notes_al_regular_number_note,
- ("
$1 ")
- );
- } else if (_txt.match(rgx.inline_notes_al_regular_number_note)) {
- debug(markup) {
- writeln(__LINE__, " endnote: ", obj.metainfo.is_a, ": ", obj.text);
- }
- }
- auto t = tuple(
- _txt,
- _endnotes,
- );
- return t;
- }
- string inline_markup_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- if (obj.metainfo.dummy_heading
- && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading")) {
- _txt = "";
- } else {
- _txt = inline_images(_txt, obj, doc_matters, _suffix, "scroll");
- _txt = inline_links(_txt, obj, doc_matters, _suffix, "scroll");
- _txt = inline_notes_scroll(_txt, obj, doc_matters);
- }
- return _txt;
- }
- auto inline_markup_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "seg",
- ) {
- if (obj.metainfo.dummy_heading
- && ((_xml_type == "epub"
- && (obj.metainfo.is_a == "toc" || obj.metainfo.is_a == "heading"))
- || obj.metainfo.is_a == "heading")
- ) {
- _txt = "";
- } else {
- _txt = inline_images(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
- _txt = inline_links(_txt, obj, doc_matters, _suffix, _xml_type); // TODO
- }
- auto t = inline_notes_seg(_txt, obj, doc_matters);
- return t;
- }
- string lev4_heading_subtoc(O,M)(
- const O obj,
- M doc_matters,
- ) {
- char[] lev4_subtoc;
- lev4_subtoc ~= "
\n";
- foreach (subtoc; obj.tags.lev4_subtoc) {
- if (auto m = subtoc.match(rgx.inline_link_subtoc)) {
- auto indent = (m.captures[1].to!int - 3).to!string; // css assumptions based on use of em for left margin & indent
- auto text = m.captures[2].to!string;
- text = font_face(text);
- auto link = m.captures[3].to!string;
- lev4_subtoc ~= subtoc.replaceFirst(rgx.inline_link_subtoc,
- format(q"┃
- ۰ %s
-
- ┃",
- indent,
- indent,
- link,
- text,
- ));
- }
- }
- lev4_subtoc ~= "
\n";
- return lev4_subtoc.to!string;
- }
- auto nav_pre_next_svg(O,M)(
- const O obj,
- M doc_matters,
- ) {
- string prev, next, toc;
- if (obj.tags.segment_anchor_tag_epub == "toc") {
- toc = "";
- prev = "";
- } else {
- toc = format(q"┃
-
- ┃",
- );
- }
- if (obj.tags.segname_prev == "") {
- prev = "";
- } else {
- prev = format(q"┃
-
- ┃",
- obj.tags.segname_prev,
- );
- }
- if (obj.tags.segname_next == "") {
- next = "";
- } else {
- next = format(q"┃
-
- ┃",
- obj.tags.segname_next,
- );
- }
- string _toc_pre_next = format(q"┃
-
-
┃",
- toc,
- prev,
- next,
- );
- string _pre_next = format(q"┃
-
-
┃",
- prev,
- next,
- );
- struct bar {
- string toc_pre_next() {
- return _toc_pre_next;
- }
- string pre_next() {
- return _pre_next;
- }
- }
- return bar();
- }
- string heading(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _xml_type = "html",
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "heading");
- string tags = _xhtml_anchor_tags(obj);
- string heading_lev_anchor_tag;
- string _horizontal_rule = " ";
- if ((_xml_type != "html")
- || (obj.metainfo.heading_lev_markup == 0 || obj.metainfo.heading_lev_markup > 4)) {
- _horizontal_rule = "";
- }
- _txt = font_face(_txt);
- string o;
- heading_lev_anchor_tag = (obj.tags.heading_lev_anchor_tag.empty)
- ? ""
- : " ";
- if (_txt.empty) {
- o = format(q"┃%s
- ┃",
- _horizontal_rule,
- );
- } else if (!(obj.metainfo.identifier.empty)) {
- o = format(q"┃%s
- ┃",
- _horizontal_rule,
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.heading_lev_markup,
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- obj.metainfo.identifier,
- tags,
- heading_lev_anchor_tag,
- _txt,
- obj.metainfo.heading_lev_markup,
- );
- } else {
- o = format(q"┃%s
-
- %s%s
- %s
-
-
┃",
- _horizontal_rule,
- obj.metainfo.heading_lev_markup,
- obj.metainfo.is_a,
- tags,
- heading_lev_anchor_tag,
- _txt,
- obj.metainfo.heading_lev_markup,
- );
- }
- return o;
- }
- string heading_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = heading(_txt, obj, doc_matters);
- return o;
- }
- auto heading_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0];
- string[] _endnotes = t[1];
- string o = heading(_txt, obj, doc_matters, _xml_type);
- auto u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string para(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body" || "frontmatter" || "backmatter");
- assert(obj.metainfo.is_of_section == "body" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "para");
- assert(obj.metainfo.is_a == "para" || "toc" || "endnotes" || "glossary" || "bibliography" || "bookindex" || "blurb");
- string tags = _xhtml_anchor_tags(obj);
- _txt = font_face(_txt);
- string o;
- _txt = (obj.attrib.bullet) ? ("● " ~ _txt) : _txt;
- _txt = _txt.replaceFirst(rgx.inline_link_anchor,
- " ");
- if (!(obj.metainfo.identifier.empty)) {
- o = format(q"┃ ┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.attrib.indent_hang,
- obj.attrib.indent_base,
- obj.metainfo.identifier,
- tags,
- _txt
- );
- } else {
- o = format(q"┃ ┃",
- obj.metainfo.is_a,
- obj.attrib.indent_hang,
- obj.attrib.indent_base,
- tags,
- _txt
- );
- }
- return o;
- }
- string para_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- if (obj.metainfo.is_a == "toc" && _txt.match(rgx.inline_link_toc_to_backmatter)) {
- _txt = _txt.replaceAll(rgx.inline_link_toc_to_backmatter, "┤#section_$1├");
- }
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = para(_txt, obj, doc_matters);
- return o;
- }
- auto para_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = para(_txt, obj, doc_matters);
- auto u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string quote(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "quote");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- o = format(q"┃ ┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt
- );
- } else {
- o = format(q"┃ ┃",
- obj.metainfo.is_a,
- _txt
- );
- }
- return o;
- }
- string quote_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = quote(_txt, obj, doc_matters);
- return o;
- }
- auto quote_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = quote(_txt, obj, doc_matters);
- auto u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string group(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "group");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- o = format(q"┃ ┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt
- );
- } else {
- o = format(q"┃ ┃",
- obj.metainfo.is_a,
- _txt
- );
- }
- return o;
- }
- string group_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = group(_txt, obj, doc_matters);
- return o;
- }
- auto group_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = group(_txt, obj, doc_matters);
- auto u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string block(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "block");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- o = format(q"┃ ┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt.stripRight
- );
- } else {
- o = format(q"┃ ┃",
- obj.metainfo.is_a,
- _txt.stripRight
- );
- }
- return o;
- }
- string block_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = block(_txt, obj, doc_matters);
- return o;
- }
- auto block_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = block(_txt, obj, doc_matters);
- auto u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- string verse(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body" || "glossary" || "bibliography" || "bookindex" || "blurb");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "verse");
- _txt = font_face(_txt);
- string o;
- if (!(obj.metainfo.identifier.empty)) {
- o = format(q"┃ ┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- _txt
- );
- } else {
- o = format(q"┃ ┃",
- obj.metainfo.is_a,
- _txt
- );
- }
- return o;
- }
- string verse_scroll(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- _txt = inline_markup_scroll(_txt, obj, doc_matters, _suffix);
- string o = verse(_txt, obj, doc_matters);
- return o;
- }
- auto verse_seg(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- string _suffix = ".html",
- string _xml_type = "html",
- ) {
- auto t = inline_markup_seg(_txt, obj, doc_matters, _suffix, _xml_type);
- _txt = t[0].to!string;
- string[] _endnotes = t[1];
- string o = verse(_txt, obj, doc_matters);
- auto u = tuple(
- o,
- _endnotes,
- );
- return u;
- }
- auto tablarize(O)(
- string _txt,
- const O obj,
- ) {
- string[] _table_rows = (_txt).split(rgx.table_delimiter_row);
- string[] _table_cols;
- string _table;
- string _tablenote;
- foreach(row_idx, row; _table_rows) {
- _table_cols = row.split(rgx.table_delimiter_col);
- _table ~= "";
- foreach(col_idx, cell; _table_cols) {
- if ((_table_cols.length == 1)
- && (_table_rows.length <= row_idx+2)) {
- _tablenote ~= cell;
- } else {
- string _col_is = (row_idx == 0 && obj.table.heading) ? "th" : "td";
- string _align = ("style=\"text-align:"
- ~ ((obj.table.column_aligns[col_idx] == "l")
- ? "left\"" : "right\""));
- _table ~= "<" ~ _col_is ~ " width=\"" ~ obj.table.column_widths[col_idx].to!string ~ "%\" " ~ _align ~ ">";
- _table ~= cell;
- _table ~= "" ~ _col_is ~ ">";
- }
- }
- _table ~= " ";
- }
- auto t = tuple(
- _table,
- _tablenote,
- );
- return t;
- }
- string table(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "table");
- string tags = _xhtml_anchor_tags(obj);
- _txt = font_face(_txt);
- auto t = tablarize(_txt, obj);
- _txt = t[0];
- string _note = t[1];
- string o;
- o = format(q"┃ ┃",
- obj.metainfo.object_number,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.object_number,
- tags,
- _txt,
- _note
- );
- return o;
- }
- string code(O,M)(
- string _txt,
- const O obj,
- M doc_matters,
- ) {
- assert(obj.metainfo.is_of_part == "body");
- assert(obj.metainfo.is_of_section == "body");
- assert(obj.metainfo.is_of_type == "block");
- assert(obj.metainfo.is_a == "code");
- string o;
- string codelines(string _txt) {
- string _codelines;
- if (obj.code_block.linenumbers) {
- string[] _block_lines = (_txt).split(rgx.br_newlines_linebreaks);
- _codelines = " \n";
- foreach (k, _line; _block_lines) {
- if (k == 1) {
- _codelines ~= format(q"┃ %s
- ┃",
- _line,
- );
- } else {
- _codelines ~= format(q"┃ %s
- ┃",
- _line,
- );
- }
- }
- _codelines ~= " ";
- } else {
- _codelines = " \n";
- _codelines ~= _txt;
- _codelines ~= " ";
- }
- return _codelines;
- }
- if (!(obj.metainfo.identifier.empty)) {
- o = format(q"┃ ┃",
- obj.metainfo.identifier,
- (doc_matters.opt.action.ocn_off) ? "" : ((obj.metainfo.object_number.empty) ? "" : obj.metainfo.identifier),
- obj.metainfo.is_a,
- obj.metainfo.identifier,
- codelines(_txt)
- );
- } else {
- o = format(q"┃ ┃",
- obj.metainfo.is_a,
- codelines(_txt)
- );
- }
- return o;
- }
- }
-}
diff --git a/src/doc_reform/output/xmls_css.d b/src/doc_reform/output/xmls_css.d
deleted file mode 100644
index 553d9da..0000000
--- a/src/doc_reform/output/xmls_css.d
+++ /dev/null
@@ -1,4185 +0,0 @@
-/++
- default css settings
-+/
-module doc_reform.output.xmls_css;
-template spineCss() {
- import std.format;
- auto spineCss(M)(M doc_matters) {
- string _css_indent = format(q"┃
- /* indent */
- p.norm { }
- p.i1 { padding-left : 1em; }
- p.i2 { padding-left : 2em; }
- p.i3 { padding-left : 3em; }
- p.i4 { padding-left : 4em; }
- p.i5 { padding-left : 5em; }
- p.i6 { padding-left : 6em; }
- p.i7 { padding-left : 7em; }
- p.i8 { padding-left : 8em; }
- p.i9 { padding-left : 9em; }
- /* hanging indent */
- p[indent="h0i0"] {
- padding-left : 0em;
- text-indent : 0em;
- }
- p[indent="h0i1"] {
- padding-left : 1em;
- text-indent : -1em;
- }
- p[indent="h0i2"] {
- padding-left : 2em;
- text-indent : -2em;
- }
- p[indent="h0i3"] {
- padding-left : 3em;
- text-indent : -3em;
- }
- p[indent="h0i4"] {
- padding-left : 4em;
- text-indent : -4em;
- }
- p[indent="h0i5"] {
- padding-left : 5em;
- text-indent : -5em;
- }
- p[indent="h0i6"] {
- padding-left : 6em;
- text-indent : -6em;
- }
- p[indent="h0i7"] {
- padding-left : 7em;
- text-indent : -7em;
- }
- p[indent="h0i8"] {
- padding-left : 8em;
- text-indent : -8em;
- }
- p[indent="h0i9"] {
- padding-left : 9em;
- text-indent : -9em;
- }
- p[indent="h1i0"] {
- padding-left : 0em;
- text-indent : 1em;
- }
- p[indent="h1i1"] {
- padding-left : 1em;
- text-indent : 0em;
- }
- p[indent="h1i2"] {
- padding-left : 2em;
- text-indent : -1em;
- }
- p[indent="h1i3"] {
- padding-left : 3em;
- text-indent : -2em;
- }
- p[indent="h1i4"] {
- padding-left : 4em;
- text-indent : -3em;
- }
- p[indent="h1i5"] {
- padding-left : 5em;
- text-indent : -4em;
- }
- p[indent="h1i6"] {
- padding-left : 6em;
- text-indent : -5em;
- }
- p[indent="h1i7"] {
- padding-left : 7em;
- text-indent : -6em;
- }
- p[indent="h1i8"] {
- padding-left : 8em;
- text-indent : -7em;
- }
- p[indent="h1i9"] {
- padding-left : 9em;
- text-indent : -8em;
- }
- p[indent="h2i0"] {
- padding-left : 0em;
- text-indent : 2em;
- }
- p[indent="h2i1"] {
- padding-left : 1em;
- text-indent : 1em;
- }
- p[indent="h2i2"] {
- padding-left : 2em;
- text-indent : 0em;
- }
- p[indent="h2i3"] {
- padding-left : 3em;
- text-indent : -1em;
- }
- p[indent="h2i4"] {
- padding-left : 4em;
- text-indent : -2em;
- }
- p[indent="h2i5"] {
- padding-left : 5em;
- text-indent : -3em;
- }
- p[indent="h2i6"] {
- padding-left : 6em;
- text-indent : -4em;
- }
- p[indent="h2i7"] {
- padding-left : 7em;
- text-indent : -5em;
- }
- p[indent="h2i8"] {
- padding-left : 8em;
- text-indent : -6em;
- }
- p[indent="h2i9"] {
- padding-left : 9em;
- text-indent : -7em;
- }
- p[indent="h3i0"] {
- padding-left : 0em;
- text-indent : 3em;
- }
- p[indent="h3i1"] {
- padding-left : 1em;
- text-indent : 2em;
- }
- p[indent="h3i2"] {
- padding-left : 2em;
- text-indent : 1em;
- }
- p[indent="h3i3"] {
- padding-left : 3em;
- text-indent : 0em;
- }
- p[indent="h3i4"] {
- padding-left : 4em;
- text-indent : -1em;
- }
- p[indent="h3i5"] {
- padding-left : 5em;
- text-indent : -2em;
- }
- p[indent="h3i6"] {
- padding-left : 6em;
- text-indent : -3em;
- }
- p[indent="h3i7"] {
- padding-left : 7em;
- text-indent : -4em;
- }
- p[indent="h3i8"] {
- padding-left : 8em;
- text-indent : -5em;
- }
- p[indent="h3i9"] {
- padding-left : 9em;
- text-indent : -6em;
- }
- p[indent="h4i0"] {
- padding-left : 0em;
- text-indent : 4em;
- }
- p[indent="h4i1"] {
- padding-left : 1em;
- text-indent : 3em;
- }
- p[indent="h4i2"] {
- padding-left : 2em;
- text-indent : 2em;
- }
- p[indent="h4i3"] {
- padding-left : 3em;
- text-indent : 1em;
- }
- p[indent="h4i4"] {
- padding-left : 4em;
- text-indent : 0em;
- }
- p[indent="h4i5"] {
- padding-left : 5em;
- text-indent : -1em;
- }
- p[indent="h4i6"] {
- padding-left : 6em;
- text-indent : -2em;
- }
- p[indent="h4i7"] {
- padding-left : 7em;
- text-indent : -3em;
- }
- p[indent="h4i8"] {
- padding-left : 8em;
- text-indent : -4em;
- }
- p[indent="h4i9"] {
- padding-left : 9em;
- text-indent : -5em;
- }
- p[indent="h5i0"] {
- padding-left : 0em;
- text-indent : 5em;
- }
- p[indent="h5i1"] {
- padding-left : 1em;
- text-indent : 4em;
- }
- p[indent="h5i2"] {
- padding-left : 2em;
- text-indent : 3em;
- }
- p[indent="h5i3"] {
- padding-left : 3em;
- text-indent : 2em;
- }
- p[indent="h5i4"] {
- padding-left : 4em;
- text-indent : 1em;
- }
- p[indent="h5i5"] {
- padding-left : 5em;
- text-indent : 0em;
- }
- p[indent="h5i6"] {
- padding-left : 6em;
- text-indent : -1em;
- }
- p[indent="h5i7"] {
- padding-left : 7em;
- text-indent : -2em;
- }
- p[indent="h5i8"] {
- padding-left : 8em;
- text-indent : -3em;
- }
- p[indent="h5i9"] {
- padding-left : 9em;
- text-indent : -4em;
- }
- p[indent="h6i0"] {
- padding-left : 0em;
- text-indent : 6em;
- }
- p[indent="h6i1"] {
- padding-left : 1em;
- text-indent : 5em;
- }
- p[indent="h6i2"] {
- padding-left : 2em;
- text-indent : 4em;
- }
- p[indent="h6i3"] {
- padding-left : 3em;
- text-indent : 3em;
- }
- p[indent="h6i4"] {
- padding-left : 4em;
- text-indent : 2em;
- }
- p[indent="h6i5"] {
- padding-left : 5em;
- text-indent : 1em;
- }
- p[indent="h6i6"] {
- padding-left : 6em;
- text-indent : 0em;
- }
- p[indent="h6i7"] {
- padding-left : 7em;
- text-indent : -1em;
- }
- p[indent="h6i8"] {
- padding-left : 8em;
- text-indent : -2em;
- }
- p[indent="h6i9"] {
- padding-left : 9em;
- text-indent : -3em;
- }
- p[indent="h7i0"] {
- padding-left : 0em;
- text-indent : 7em;
- }
- p[indent="h7i1"] {
- padding-left : 1em;
- text-indent : 6em;
- }
- p[indent="h7i2"] {
- padding-left : 2em;
- text-indent : 5em;
- }
- p[indent="h7i3"] {
- padding-left : 3em;
- text-indent : 4em;
- }
- p[indent="h7i4"] {
- padding-left : 4em;
- text-indent : 3em;
- }
- p[indent="h7i5"] {
- padding-left : 5em;
- text-indent : 2em;
- }
- p[indent="h7i6"] {
- padding-left : 6em;
- text-indent : 1em;
- }
- p[indent="h7i7"] {
- padding-left : 7em;
- text-indent : 0em;
- }
- p[indent="h7i8"] {
- padding-left : 8em;
- text-indent : -1em;
- }
- p[indent="h7i9"] {
- padding-left : 9em;
- text-indent : -2em;
- }
- p[indent="h8i0"] {
- padding-left : 0em;
- text-indent : 8em;
- }
- p[indent="h8i1"] {
- padding-left : 1em;
- text-indent : 7em;
- }
- p[indent="h8i2"] {
- padding-left : 2em;
- text-indent : 6em;
- }
- p[indent="h8i3"] {
- padding-left : 3em;
- text-indent : 5em;
- }
- p[indent="h8i4"] {
- padding-left : 4em;
- text-indent : 4em;
- }
- p[indent="h8i5"] {
- padding-left : 5em;
- text-indent : 3em;
- }
- p[indent="h8i6"] {
- padding-left : 6em;
- text-indent : 2em;
- }
- p[indent="h8i7"] {
- padding-left : 7em;
- text-indent : 1em;
- }
- p[indent="h8i8"] {
- padding-left : 8em;
- text-indent : 0em;
- }
- p[indent="h8i9"] {
- padding-left : 9em;
- text-indent : -1em;
- }
- p[indent="h9i0"] {
- padding-left : 0em;
- text-indent : 9em;
- }
- p[indent="h9i1"] {
- padding-left : 1em;
- text-indent : 8em;
- }
- p[indent="h9i2"] {
- padding-left : 2em;
- text-indent : 7em;
- }
- p[indent="h9i3"] {
- padding-left : 3em;
- text-indent : 6em;
- }
- p[indent="h9i4"] {
- padding-left : 4em;
- text-indent : 5em;
- }
- p[indent="h9i5"] {
- padding-left : 5em;
- text-indent : 4em;
- }
- p[indent="h9i6"] {
- padding-left : 6em;
- text-indent : 3em;
- }
- p[indent="h9i7"] {
- padding-left : 7em;
- text-indent : 2em;
- }
- p[indent="h9i8"] {
- padding-left : 8em;
- text-indent : 1em;
- }
- p[indent="h9i9"] {
- padding-left : 9em;
- text-indent : 0em;
- }
-┃");
- string _color_ocn_light = (doc_matters.opt.action.ocn_hidden) ? "#FFFFFF" : "#777777";
- string _color_ocn_dark = (doc_matters.opt.action.ocn_hidden) ? "#000000" : "#BBBBBB";
- string _css_light_html_seg = format(q"┃
- *{
- padding : 0px;
- margin : 0px;
- }
- body {
- height : 100vh;
- background-color : #FFFFFF;
- }
- body {
- color : #000000;
- background : #FFFFFF;
- background-color : #FFFFFF;
- }
- a:link {
- color : #003399;
- text-decoration : none;
- }
- a:visited {
- color : #003399;
- text-decoration : none;
- }
- a:hover {
- color : #000000;
- background-color : #F9F9AA;
- }
- a.lnkocn:link {
- color : %s;
- text-decoration : none;
- }
- a.lnkocn:visited {
- color : #32CD32;
- text-decoration : none;
- }
- a.lnkocn:hover {
- color : #777777;
- font-size : 15px;
- }
- a:hover img {
- background-color : #FFFFFF;
- }
- a:active {
- color : #003399;
- text-decoration : underline;
- }
- div {
- margin-left : 0;
- margin-right : 0;
- }
- div.p {
- margin-left : 5%%;
- margin-right : 1%%;
- }
- div.substance {
- width : 100%%;
- background-color : #FFFFFF;
- }
- div.ocn {
- width : 5%%;
- float : right;
- top : 0;
- background-color : #FFFFFF;
- }
- div.endnote {
- width : 95%%;
- background-color : #FFFFFF;
- }
- div.toc {
- position : absolute;
- float : left;
- margin : 0;
- padding : 0;
- padding-top : 0.5em;
- border : 0;
- width : 13em;
- background-color : #EEEEEE;
- margin-right : 1em;
- }
- div.summary {
- margin : 0;
- padding : 0;
- border-left : 13em solid #EEEEEE;
- padding-left : 1em;
- background-color : #EEEEEE;
- }
- div.content, div.main_column {
- margin : 0;
- padding : 0;
- border-left : 13em solid #FFFFFF;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content0, div.main_column0 {
- margin : 0;
- padding : 0;
- border-left : 0%% solid #FFFFFF;
- padding-left : 5%%;
- }
- div.scroll {
- margin : 0;
- padding : 0;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content:after {
- content : ' ';
- clear : both;
- display : block;
- height : 0;
- overflow : hidden;
- }
- div.footer {
- clear : left;
- padding : 0.5em;
- font-size : 80%%;
- margin : 0;
- }
- div.toc ul {
- list-style : none;
- padding : 0;
- margin : 0;
- }
- div.toc li ul a, li ul span.currentlink
- {
- font-weight : normal;
- font-size : 90%%;
- padding-left : 2em;
- background-color : #EEEEEE;
- }
- div.toc a, span.currentlink{
- display : block;
- text-decoration : none;
- padding-left : 0.5em;
- color : #0000aa;
- }
- hr {
- width : 90%%;
- margin-left : 5%%;
- margin-right : 2em;
- margin-top : 1.8em;
- margin-bottom : 1.8em;
- }
- span.currentlink {
- text-decoration : none;
- background-color : #AAAAAA;
- }
- div.toc a:visited {
- color : #0000aa;
- }
- div.toc a:hover {
- color : #000000;
- background-color : #F9F9AA;
- }
- nav#toc ol {
- list-style-type : none;
- }
- .norm, .bold, .verse, .group, .block, .alt {
- line-height : 133%%;
- margin-top : 12px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- }
- p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
- display : block;
- font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- margin-left : 5%%;
- margin-right : 2em;
- }
- p {
- font-size : 100%%;
- font-weight : normal;
- line-height : 133%%;
- text-align : justify;
- text-indent : 0mm;
- margin-top : 0.8em;
- margin-bottom : 0.8em;
- }
- img {
- max-width : 100%%;
- height : auto;
- }
- pre {
- width : auto;
- display : block;
- clear : both;
- color : #555555;
- }
- pre.codeline {
- display : table;
- clear : both;
- table-layout : fixed;
- margin-left : 5%%;
- margin-right : 5%%;
- width : 90%%;
- white-space : pre-wrap;
- border-style : none;
- border-radius : 5px 5px 5px 5px;
- box-shadow : 0 2px 5px #AAAAAA inset;
- margin-bottom : 1em;
- padding : 0.5em 1em;
- page-break-inside : avoid;
- word-wrap : break-word;
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- white-space : pre;
- white-space : pre-wrap;
- white-space : -moz-pre-wrap;
- white-space : -o-pre-wrap;
- background-color : #EEEEEE;
- color : #000000;
- font-size : 95%%;
- line-height : 100%%;
- }
- pre.codeline::before {
- counter-reset : linenum;
- }
- pre.codeline span.tr {
- display : table-row;
- counter-increment : linenum;
- }
- pre.codeline span.th {
- display : table-cell;
- user-select : none;
- -moz-user-select : none;
- -webkit-user-select : none;
- padding : 0.5em 0.5em;
- /* background-color : #666666; */
- }
- pre.codeline span.th::before {
- content : counter(linenum) ".";
- color : #999999;
- text-align : right;
- display : block;
- }
- pre.codeline span.th {
- width : 4em;
- }
- pre.codeline code {
- display : table-cell;
- }
- p.code {
- border-style : none;
- }
- p.spaced { white-space : pre; }
- p.block {
- white-space : pre;
- }
- p.group { }
- p.alt { }
- p.verse {
- white-space : pre;
- margin-bottom : 6px;
- }
- p.caption {
- text-align : left;
- font-size : 80%%;
- display : inline;
- }
- p.endnote {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-right : 15mm;
- }
- p.endnote_indent {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 2em;
- margin-right : 15mm;
- }
- p.center {
- text-align : center;
- }
- p.bold {
- font-weight : bold;
- }
- p.bold_left {
- font-weight : bold;
- text-align : left;
- }
- p.centerbold {
- text-align : center;
- font-weight : bold;
- }
- p.em {
- font-weight : bold;
- font-style : normal;
- background : #FFF3B6;
- }
- p.small {
- font-size : 80%%;
- margin-top : 0px;
- margin-bottom : 0px;
- margin-right : 6px;
- text-align : left;
- }
- .tiny, .tiny_left, .tiny_right, .tiny_center {
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 0px;
- color : #777777;
- margin-right : 6px;
- text-align : left;
- }
- p.tiny { }
- p.tiny_left {
- margin-left : 0px;
- margin-right : 0px;
- text-align : left;
- }
- p.tiny_right {
- margin-right : 1em;
- text-align : right;
- }
- p.tiny_center {
- margin-left : 0px;
- margin-right : 0px;
- text-align : center;
- }
- p.concordance_word {
- line-height : 150%%;
- font-weight : bold;
- display : inline;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.concordance_count {
- font-size : 80%%;
- color : #777777;
- display : inline;
- margin-left : 0em;
- }
- p.concordance_object {
- font-size : 80%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- p.book_index_lev1 {
- line-height : 100%%;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.book_index_lev2 {
- line-height : 100%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- tt {
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- background-color : #EEEEEE;
- color : #000000;
- }
-%s
- note { white-space : pre; }
- label.ocn {
- width : 2%%;
- float : right;
- top : 0;
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 5px;
- margin-right : 5px;
- text-align : right;
- color : %s;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- table {
- display : block;
- margin-left : 5%%;
- margin-right : 2em;
- background-color : inherit;
- }
- tr { }
- th,td {
- vertical-align : top;
- text-align : left;
- }
- th {
- font-weight : bold;
- }
- em {
- font-weight : bold;
- font-style : italic;
- }
- p.left,th.left,td.left {
- text-align : left;
- }
- p.small_left,th.small_left,td.small_left {
- text-align : left;
- font-size : 80%%;
- }
- p.right,th.right,td.right {
- text-align : right;
- }
- ul, li {
- list-style-type : none;
- list-style : none;
- padding-left : 20px;
- font-weight : normal;
- line-height : 150%%;
- text-align : left;
- text-indent : 0mm;
- margin-left : 1em;
- margin-right : 2em;
- margin-top : 3px;
- margin-bottom : 3px;
- }
- li {
- background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
- }
- ul { }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- font-weight : bold;
- line-height : 120%%;
- text-align : left;
- margin-top : 20px;
- margin-bottom : 10px;
- }
- h4.norm, h5.norm, h6.norm, h7.norm {
- margin-top : 10px;
- margin-bottom : 0px;
- }
- h0 { font-size : 125%%; }
- h1 { font-size : 120%%; }
- h2 { font-size : 115%%; }
- h3 { font-size : 110%%; }
- h4 { font-size : 105%%; }
- h5 { font-size : 100%%; }
- h6 { font-size : 100%%; }
- h7 { font-size : 100%%; }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- text-shadow : .2em .2em .3em #808080;
- }
- h1.i { margin-left : 2em; }
- h2.i { margin-left : 3em; }
- h3.i { margin-left : 4em; }
- h4.i { margin-left : 5em; }
- h5.i { margin-left : 6em; }
- h6.i { margin-left : 7em; }
- h7.i { margin-left : 8em; }
- h8.i { margin-left : 9em; }
- h9.i { margin-left : 10em; }
- .toc {
- font-weight : normal;
- margin-top : 6px;
- margin-bottom : 6px;
- }
- h0.toc {
- margin-left : 1em;
- font-size : 120%%;
- line-height : 150%%;
- }
- h1.toc {
- margin-left : 1em;
- font-size : 115%%;
- line-height : 150%%;
- }
- h2.toc {
- margin-left : 2em;
- font-size : 110%%;
- line-height : 140%%;
- }
- h3.toc {
- margin-left : 3em;
- font-size : 105%%;
- line-height : 120%%;
- }
- h4.toc {
- margin-left : 4em;
- font-size : 100%%;
- line-height : 120%%;
- }
- h5.toc {
- margin-left : 5em;
- font-size : 95%%;
- line-height : 110%%;
- }
- h6.toc {
- margin-left : 6em;
- font-size : 90%%;
- line-height : 110%%;
- }
- h7.toc {
- margin-left : 7em;
- font-size : 85%%;
- line-height : 100%%;
- }
- .subtoc {
- margin-right : 34%%;
- font-weight : normal;
- }
- h5.subtoc {
- margin-left : 2em;
- font-size : 80%%;
- margin-top : 2px;
- margin-bottom : 2px;
- }
- h6.subtoc {
- margin-left : 3em;
- font-size : 75%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- h7.subtoc {
- margin-left : 4em;
- font-size : 70%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- .icon-bar {
- width : 100%%;
- overflow : auto;
- margin : 0em 0em 0em;
- }
- .left-bar {
- width : 85%%;
- float : left;
- display : inline;
- overflow : auto;
- }
- .toc-button {
- position : absolute;
- top : 8px;
- width : 2em;
- height : 2em;
- border-radius : 50%%;
- background : #CCCCCC;
- fill : #333333;
- box-shadow : 0 2px 5px #AAAAAA inset;
- }
- .toc-button svg {
- position : relative;
- left : 25%%;
- top : 25%%;
- width : 150%%;
- height : 150%%;
- }
- .toc-button p {
- vertical-align : center;
- font-size : 120%%;
- }
- .prev-next-button {
- position : absolute;
- top : 8px;
- width : 2em;
- height : 2em;
- border-radius : 50%%;
- background : #CCCCCC;
- box-shadow : 0 2px 5px #AAAAAA inset;
- }
- .prev-next-button svg {
- position : relative;
- left : 20%%;
- top : 20%%;
- width : 60%%;
- height : 60%%;
- }
- .menu {
- right : 6em;
- }
- .previous {
- right : 3em;
- }
- .next {
- right : 0em;
- }
- .arrow {
- fill : #333333;
- }
- .minitoc {
- line-height : 100%%;
- font-size : 90%%;
- margin-top : 6px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- /* flex */
- .flex-menu-bar {
- display : -webkit-flex;
- display : flex;
- -webkit-flex-wrap : wrap;
- -webkit-align-items : center;
- align-items : center;
- width : 100%%;
- margin-left : 5%%;
- margin-right : 2%%;
- background-color : #FFFFFF;
- }
- .flex-menu-option {
- background-color : #FFFFFF;
- margin-right : 4px;
- }
- .flex-list {
- display : -webkit-flex;
- display : flex;
- -webkit-align-items : center;
- display : block;
- align-items : center;
- width : 100%%;
- background-color : #FFFFFF;
- }
- .flex-list-item {
- background-color : #FFFFFF;
- margin : 4px;
- }
- /* grid */
- .wrapper {
- display : grid;
- grid-template-columns : 100%%;
- grid-template-areas :
- "headband"
- "doc_header"
- "doc_title"
- "doc_toc"
- "doc_prefix"
- "doc_intro"
- "doc_body"
- "doc_endnotes"
- "doc_glossary"
- "doc_biblio"
- "doc_bookindex"
- "doc_blurb"
- "doc_suffix";
- margin : 0px;
- padding : 0px;
- background-color : #FFFFFF;
- }
- .delimit {
- border-style : none;
- border-color : #FFFFFF;
- padding : 10px;
- }
- .headband {
- grid-area : headband;
- background-color : #FFFFFF;
- }
- .doc_header {
- grid-area : doc_header;
- }
- .doc_title {
- grid-area : doc_title;
- }
- .doc_toc {
- grid-area : doc_toc;
- }
- .doc_prefix {
- grid-area : doc_prefix;
- }
- .doc_intro {
- grid-area : doc_intro;
- }
- .doc_body {
- grid-area : doc_body;
- }
- .doc_endnotes {
- grid-area : doc_endnotes;
- }
- .doc_glossary {
- grid-area : doc_glossary;
- }
- .doc_biblio {
- grid-area : doc_biblio;
- }
- .doc_bookindex {
- grid-area : doc_bookindex;
- }
- .doc_blurb {
- grid-area : doc_blurb;
- }
- .doc_suffix {
- grid-area : doc_suffix;
- }
- .nav-ul {
- list-style : none;
- float : left;
- }
- .nav-li {
- float : left;
- padding-right : 0.7em;
- }
- .nav-li a {
- text-decoration : none;
- color : #FFFFFF;
- }
- footer {
- background-color : #00704E;
- }
-┃",
- _color_ocn_light,
- _css_indent,
- _color_ocn_light,
-);
- string _css_dark_html_seg = format(q"┃
- *{
- padding : 0px;
- margin : 0px;
- }
- body {
- height : 100vh;
- background-color : #000000;
- }
- body {
- color : #CCCCCC;
- background : #000000;
- background-color : #000000;
- }
- a:link {
- color : #FFFFFF;
- text-decoration : none;
- }
- a:visited {
- color : #999999;
- text-decoration : none;
- }
- a:hover {
- color : #000000;
- background-color : #555555;
- }
- a.lnkocn:link {
- color : %s;
- text-decoration : none;
- }
- a.lnkocn:visited {
- color : #9ACD32;
- text-decoration : none;
- }
- a.lnkocn:hover {
- color : #BBBBBB;
- font-size : 15px;
- }
- a:hover img {
- background-color : #000000;
- }
- a:active {
- color : #888888;
- text-decoration : underline;
- }
- div {
- margin-left : 0;
- margin-right : 0;
- }
- div.p {
- margin-left : 5%%;
- margin-right : 1%%;
- }
- div.substance {
- width : 100%%;
- background-color : #000000;
- }
- div.ocn {
- width : 5%%;
- float : right;
- top : 0;
- background-color : #000000;
- }
- div.endnote {
- width : 95%%;
- background-color : #000000;
- }
- div.toc {
- position : absolute;
- float : left;
- margin : 0;
- padding : 0;
- padding-top : 0.5em;
- border : 0;
- width : 13em;
- background-color : #111111;
- margin-right : 1em;
- }
- div.summary {
- margin : 0;
- padding : 0;
- border-left : 13em solid #111111;
- padding-left : 1em;
- background-color : #111111;
- }
- div.content, div.main_column {
- margin : 0;
- padding : 0;
- border-left : 13em solid #000000;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content0, div.main_column0 {
- margin : 0;
- padding : 0;
- border-left : 0%% solid #000000;
- padding-left : 5%%;
- }
- div.scroll {
- margin : 0;
- padding : 0;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content:after {
- content : ' ';
- clear : both;
- display : block;
- height : 0;
- overflow : hidden;
- }
- div.footer {
- clear : left;
- padding : 0.5em;
- font-size : 80%%;
- margin : 0;
- }
- div.toc ul {
- list-style : none;
- padding : 0;
- margin : 0;
- }
- div.toc li ul a, li ul span.currentlink
- {
- font-weight : normal;
- font-size : 90%%;
- padding-left : 2em;
- background-color : #111111;
- }
- div.toc a, span.currentlink{
- display : block;
- text-decoration : none;
- padding-left : 0.5em;
- color : #FF00AA;
- }
- hr {
- width : 90%%;
- margin-left : 5%%;
- margin-right : 2em;
- margin-top : 1.8em;
- margin-bottom : 1.8em;
- }
- span.currentlink {
- text-decoration : none;
- background-color : #AAAAF9;
- }
- div.toc a:visited {
- color : #FF00AA;
- }
- div.toc a:hover {
- color : #CCCCCC;
- background-color : #F9F9AA;
- }
- nav#toc ol {
- list-style-type : none;
- }
- .norm, .bold, .verse, .group, .block, .alt {
- line-height : 133%%;
- margin-top : 12px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- }
- p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
- display : block;
- font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- margin-left : 5%%;
- margin-right : 2em;
- }
- p {
- font-size : 100%%;
- font-weight : normal;
- line-height : 133%%;
- text-align : justify;
- text-indent : 0mm;
- margin-top : 0.8em;
- margin-bottom : 0.8em;
- }
- img {
- max-width : 100%%;
- height : auto;
- }
- pre {
- width : auto;
- display : block;
- clear : both;
- color : #555555;
- }
- pre.codeline {
- display : table;
- clear : both;
- table-layout : fixed;
- margin-left : 5%%;
- margin-right : 5%%;
- width : 90%%;
- white-space : pre-wrap;
- border-style : none;
- border-radius : 5px 5px 5px 5px;
- box-shadow : 0 2px 5px #AAAAAA inset;
- margin-bottom : 1em;
- padding : 0.5em 1em;
- page-break-inside : avoid;
- word-wrap : break-word;
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- white-space : pre;
- white-space : pre-wrap;
- white-space : -moz-pre-wrap;
- white-space : -o-pre-wrap;
- background-color : #555555;
- color : #DDDDDD;
- font-size : 95%%;
- line-height : 100%%;
- }
- pre.codeline::before {
- counter-reset : linenum;
- }
- pre.codeline span.tr {
- display : table-row;
- counter-increment : linenum;
- }
- pre.codeline span.th {
- display : table-cell;
- user-select : none;
- -moz-user-select : none;
- -webkit-user-select : none;
- padding : 0.5em 0.5em;
- }
- pre.codeline span.th::before {
- content : counter(linenum) ".";
- color : #999999;
- text-align : right;
- display : block;
- }
- pre.codeline span.th {
- width : 4em;
- }
- pre.codeline code {
- display : table-cell;
- }
- p.code {
- border-style : none;
- }
- p.spaced { white-space : pre; }
- p.block {
- white-space : pre;
- }
- p.group { }
- p.alt { }
- p.verse {
- white-space : pre;
- margin-bottom : 6px;
- }
- p.caption {
- text-align : left;
- font-size : 80%%;
- display : inline;
- }
- p.endnote {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-right : 15mm;
- }
- p.endnote_indent {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 2em;
- margin-right : 15mm;
- }
- p.center {
- text-align : center;
- }
- p.bold {
- font-weight : bold;
- }
- p.bold_left {
- font-weight : bold;
- text-align : left;
- }
- p.centerbold {
- text-align : center;
- font-weight : bold;
- }
- p.em {
- font-weight : bold;
- font-style : normal;
- background : #FFF3B6;
- }
- p.small {
- font-size : 80%%;
- margin-top : 0px;
- margin-bottom : 0px;
- margin-right : 6px;
- text-align : left;
- }
- .tiny, .tiny_left, .tiny_right, .tiny_center {
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 0px;
- color : #EEEEEE;
- margin-right : 6px;
- text-align : left;
- }
- p.tiny { }
- p.tiny_left {
- margin-left : 0px;
- margin-right : 0px;
- text-align : left;
- }
- p.tiny_right {
- margin-right : 1em;
- text-align : right;
- }
- p.tiny_center {
- margin-left : 0px;
- margin-right : 0px;
- text-align : center;
- }
- p.concordance_word {
- line-height : 150%%;
- font-weight : bold;
- display : inline;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.concordance_count {
- font-size : 80%%;
- color : #555555;
- display : inline;
- margin-left : 0em;
- }
- p.concordance_object {
- font-size : 80%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- p.book_index_lev1 {
- line-height : 100%%;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.book_index_lev2 {
- line-height : 100%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- tt {
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- background-color : #555555;
- color : #DDDDDD;
- }
-%s
- note { white-space : pre; }
- label.ocn {
- width : 2%%;
- float : right;
- top : 0;
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 5px;
- margin-right : 5px;
- text-align : right;
- color : %s;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- table {
- display : block;
- margin-left : 5%%;
- margin-right : 2em;
- background-color : inherit;
- }
- tr { }
- th,td {
- vertical-align : top;
- text-align : left;
- }
- th {
- font-weight : bold;
- }
- em {
- font-weight : bold;
- font-style : italic;
- }
- p.left,th.left,td.left {
- text-align : left;
- }
- p.small_left,th.small_left,td.small_left {
- text-align : left;
- font-size : 80%%;
- }
- p.right,th.right,td.right {
- text-align : right;
- }
- ul, li {
- list-style-type : none;
- list-style : none;
- padding-left : 20px;
- font-weight : normal;
- line-height : 150%%;
- text-align : left;
- text-indent : 0mm;
- margin-left : 1em;
- margin-right : 2em;
- margin-top : 3px;
- margin-bottom : 3px;
- }
- li {
- background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
- }
- ul { }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- font-weight : bold;
- line-height : 120%%;
- text-align : left;
- margin-top : 20px;
- margin-bottom : 10px;
- }
- h4.norm, h5.norm, h6.norm, h7.norm {
- margin-top : 10px;
- margin-bottom : 0px;
- }
- h0 { font-size : 125%%; }
- h1 { font-size : 120%%; }
- h2 { font-size : 115%%; }
- h3 { font-size : 110%%; }
- h4 { font-size : 105%%; }
- h5 { font-size : 100%%; }
- h6 { font-size : 100%%; }
- h7 { font-size : 100%%; }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- text-shadow : .2em .2em .3em #999999;
- }
- h1.i { margin-left : 2em; }
- h2.i { margin-left : 3em; }
- h3.i { margin-left : 4em; }
- h4.i { margin-left : 5em; }
- h5.i { margin-left : 6em; }
- h6.i { margin-left : 7em; }
- h7.i { margin-left : 8em; }
- h8.i { margin-left : 9em; }
- h9.i { margin-left : 10em; }
- .toc {
- font-weight : normal;
- margin-top : 6px;
- margin-bottom : 6px;
- }
- h0.toc {
- margin-left : 1em;
- font-size : 120%%;
- line-height : 150%%;
- }
- h1.toc {
- margin-left : 1em;
- font-size : 115%%;
- line-height : 150%%;
- }
- h2.toc {
- margin-left : 2em;
- font-size : 110%%;
- line-height : 140%%;
- }
- h3.toc {
- margin-left : 3em;
- font-size : 105%%;
- line-height : 120%%;
- }
- h4.toc {
- margin-left : 4em;
- font-size : 100%%;
- line-height : 120%%;
- }
- h5.toc {
- margin-left : 5em;
- font-size : 95%%;
- line-height : 110%%;
- }
- h6.toc {
- margin-left : 6em;
- font-size : 90%%;
- line-height : 110%%;
- }
- h7.toc {
- margin-left : 7em;
- font-size : 85%%;
- line-height : 100%%;
- }
- .subtoc {
- margin-right : 34%%;
- font-weight : normal;
- }
- h5.subtoc {
- margin-left : 2em;
- font-size : 80%%;
- margin-top : 2px;
- margin-bottom : 2px;
- }
- h6.subtoc {
- margin-left : 3em;
- font-size : 75%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- h7.subtoc {
- margin-left : 4em;
- font-size : 70%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- .icon-bar {
- width : 100%%;
- overflow : auto;
- margin : 0em 0em 0em;
- }
- .left-bar {
- width : 85%%;
- float : left;
- display : inline;
- overflow : auto;
- }
- .toc-button {
- position : absolute;
- top : 8px;
- width : 2em;
- height : 2em;
- border-radius : 50%%;
- background : #555555;
- fill : #DDDDDD;
- box-shadow : 0 2px 5px #EEEEEE inset;
- }
- .toc-button svg {
- position : relative;
- left : 25%%;
- top : 25%%;
- width : 150%%;
- height : 150%%;
- }
- .toc-button p {
- vertical-align : center;
- font-size : 120%%;
- }
- .prev-next-button {
- position : absolute;
- top : 8px;
- width : 2em;
- height : 2em;
- border-radius : 50%%;
- background : #555555;
- box-shadow : 0 2px 5px #AAAAAA inset;
- }
- .prev-next-button svg {
- position : relative;
- left : 20%%;
- top : 20%%;
- width : 60%%;
- height : 60%%;
- }
- .menu {
- right : 6em;
- }
- .previous {
- right : 3em;
- }
- .next {
- right : 0em;
- }
- .arrow {
- fill : #DDDDDD;
- }
- .minitoc {
- line-height : 100%%;
- font-size : 90%%;
- margin-top : 6px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- /* flex */
- .flex-menu-bar {
- display : -webkit-flex;
- display : flex;
- -webkit-flex-wrap : wrap;
- -webkit-align-items : center;
- align-items : center;
- width : 100%%;
- margin-left : 5%%;
- margin-right : 2%%;
- background-color : #000000;
- }
- .flex-menu-option {
- background-color : #000000;
- margin-right : 4px;
- }
- .flex-list {
- display : -webkit-flex;
- display : flex;
- -webkit-align-items : center;
- display : block;
- align-items : center;
- width : 100%%;
- background-color : #000000;
- }
- .flex-list-item {
- background-color : #000000;
- margin : 4px;
- }
- /* grid */
- .wrapper {
- display : grid;
- grid-template-columns : 100%%;
- grid-template-areas :
- "headband"
- "doc_header"
- "doc_title"
- "doc_toc"
- "doc_prefix"
- "doc_intro"
- "doc_body"
- "doc_endnotes"
- "doc_glossary"
- "doc_biblio"
- "doc_bookindex"
- "doc_blurb"
- "doc_suffix";
- margin : 0px;
- padding : 0px;
- background-color : #000000;
- }
- .delimit {
- border-style : none;
- border-color : #000000;
- padding : 10px;
- }
- .headband {
- grid-area : headband;
- background-color : #000000;
- }
- .doc_header {
- grid-area : doc_header;
- }
- .doc_title {
- grid-area : doc_title;
- }
- .doc_toc {
- grid-area : doc_toc;
- }
- .doc_prefix {
- grid-area : doc_prefix;
- }
- .doc_intro {
- grid-area : doc_intro;
- }
- .doc_body {
- grid-area : doc_body;
- }
- .doc_endnotes {
- grid-area : doc_endnotes;
- }
- .doc_glossary {
- grid-area : doc_glossary;
- }
- .doc_biblio {
- grid-area : doc_biblio;
- }
- .doc_bookindex {
- grid-area : doc_bookindex;
- }
- .doc_blurb {
- grid-area : doc_blurb;
- }
- .doc_suffix {
- grid-area : doc_suffix;
- }
- .nav-ul {
- list-style : none;
- float : left;
- }
- .nav-li {
- float : left;
- padding-right : 0.7em;
- }
- .nav-li a {
- text-decoration : none;
- color : #000000;
- }
- footer {
- background-color : #FF704E;
- }
-┃",
- _color_ocn_dark,
- _css_indent,
- _color_ocn_dark,
-);
- string _css_light_html_scroll = format(q"┃
- *{
- padding : 0px;
- margin : 0px;
- }
- body {
- height : 100vh;
- background-color : #FFFFFF;
- }
- body {
- color : #000000;
- background : #FFFFFF;
- background-color : #FFFFFF;
- }
- a:link {
- color : #003399;
- text-decoration : none;
- }
- a:visited {
- color : #003399;
- text-decoration : none;
- }
- a:hover {
- color : #000000;
- background-color : #F9F9AA;
- }
- a.lnkocn:link {
- color : %s;
- text-decoration : none;
- }
- a.lnkocn:visited {
- color : #32CD32;
- text-decoration : none;
- }
- a.lnkocn:hover {
- color : #777777;
- font-size : 15px;
- }
- a:hover img {
- background-color : #FFFFFF;
- }
- a:active {
- color : #003399;
- text-decoration : underline;
- }
- div {
- margin-left : 0;
- margin-right : 0;
- }
- div.p {
- margin-left : 5%%;
- margin-right : 1%%;
- }
- div.substance {
- width : 100%%;
- background-color : #FFFFFF;
- }
- div.ocn {
- width : 5%%;
- float : right;
- top : 0;
- background-color : #FFFFFF;
- }
- div.endnote {
- width : 95%%;
- background-color : #FFFFFF;
- }
- div.toc {
- position : absolute;
- float : left;
- margin : 0;
- padding : 0;
- padding-top : 0.5em;
- border : 0;
- width : 13em;
- background-color : #EEEEEE;
- margin-right : 1em;
- }
- div.summary {
- margin : 0;
- padding : 0;
- border-left : 13em solid #EEEEEE;
- padding-left : 1em;
- background-color : #EEEEEE;
- }
- div.content, div.main_column {
- margin : 0;
- padding : 0;
- border-left : 13em solid #FFFFFF;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content0, div.main_column0 {
- margin : 0;
- padding : 0;
- border-left : 0%% solid #FFFFFF;
- padding-left : 5%%;
- }
- div.scroll {
- margin : 0;
- padding : 0;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content:after {
- content : ' ';
- clear : both;
- display : block;
- height : 0;
- overflow : hidden;
- }
- div.footer {
- clear : left;
- padding : 0.5em;
- font-size : 80%%;
- margin : 0;
- }
- div.toc ul {
- list-style : none;
- padding : 0;
- margin : 0;
- }
- div.toc li ul a, li ul span.currentlink
- {
- font-weight : normal;
- font-size : 90%%;
- padding-left : 2em;
- background-color : #EEEEEE;
- }
- div.toc a, span.currentlink{
- display : block;
- text-decoration : none;
- padding-left : 0.5em;
- color : #0000aa;
- }
- hr {
- width : 90%%;
- margin-left : 5%%;
- margin-right : 2em;
- margin-top : 1.8em;
- margin-bottom : 1.8em;
- }
- span.currentlink {
- text-decoration : none;
- background-color : #AAAAAA;
- }
- div.toc a:visited {
- color : #0000aa;
- }
- div.toc a:hover {
- color : #000000;
- background-color : #F9F9AA;
- }
- nav#toc ol {
- list-style-type : none;
- }
- .norm, .bold, .verse, .group, .block, .alt {
- line-height : 133%%;
- margin-top : 12px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- }
- p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
- display : block;
- font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- margin-left : 5%%;
- margin-right : 2em;
- }
- p {
- font-size : 100%%;
- font-weight : normal;
- line-height : 133%%;
- text-align : justify;
- text-indent : 0mm;
- margin-top : 0.8em;
- margin-bottom : 0.8em;
- }
- img {
- max-width : 100%%;
- height : auto;
- }
- pre {
- width : auto;
- display : block;
- clear : both;
- color : #555555;
- }
- pre.codeline {
- display : table;
- clear : both;
- table-layout : fixed;
- margin-left : 5%%;
- margin-right : 5%%;
- width : 90%%;
- white-space : pre-wrap;
- border-style : none;
- border-radius : 5px 5px 5px 5px;
- box-shadow : 0 2px 5px #AAAAAA inset;
- margin-bottom : 1em;
- padding : 0.5em 1em;
- page-break-inside : avoid;
- word-wrap : break-word;
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- white-space : pre;
- white-space : pre-wrap;
- white-space : -moz-pre-wrap;
- white-space : -o-pre-wrap;
- background-color : #EEEEEE;
- color : #000000;
- font-size : 95%%;
- line-height : 100%%;
- }
- pre.codeline::before {
- counter-reset : linenum;
- }
- pre.codeline span.tr {
- display : table-row;
- counter-increment : linenum;
- }
- pre.codeline span.th {
- display : table-cell;
- user-select : none;
- -moz-user-select : none;
- -webkit-user-select : none;
- padding : 0.5em 0.5em;
- /* background-color : #666666; */
- }
- pre.codeline span.th::before {
- content : counter(linenum) ".";
- color : #999999;
- text-align : right;
- display : block;
- }
- pre.codeline span.th {
- width : 4em;
- }
- pre.codeline code {
- display : table-cell;
- }
- p.code {
- border-style : none;
- }
- p.spaced { white-space : pre; }
- p.block {
- white-space : pre;
- }
- p.group { }
- p.alt { }
- p.verse {
- white-space : pre;
- margin-bottom : 6px;
- }
- p.caption {
- text-align : left;
- font-size : 80%%;
- display : inline;
- }
- p.endnote {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-right : 15mm;
- }
- p.endnote_indent {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 2em;
- margin-right : 15mm;
- }
- p.center {
- text-align : center;
- }
- p.bold {
- font-weight : bold;
- }
- p.bold_left {
- font-weight : bold;
- text-align : left;
- }
- p.centerbold {
- text-align : center;
- font-weight : bold;
- }
- p.em {
- font-weight : bold;
- font-style : normal;
- background : #FFF3B6;
- }
- p.small {
- font-size : 80%%;
- margin-top : 0px;
- margin-bottom : 0px;
- margin-right : 6px;
- text-align : left;
- }
- .tiny, .tiny_left, .tiny_right, .tiny_center {
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 0px;
- color : #777777;
- margin-right : 6px;
- text-align : left;
- }
- p.tiny { }
- p.tiny_left {
- margin-left : 0px;
- margin-right : 0px;
- text-align : left;
- }
- p.tiny_right {
- margin-right : 1em;
- text-align : right;
- }
- p.tiny_center {
- margin-left : 0px;
- margin-right : 0px;
- text-align : center;
- }
- p.concordance_word {
- line-height : 150%%;
- font-weight : bold;
- display : inline;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.concordance_count {
- font-size : 80%%;
- color : #777777;
- display : inline;
- margin-left : 0em;
- }
- p.concordance_object {
- font-size : 80%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- p.book_index_lev1 {
- line-height : 100%%;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.book_index_lev2 {
- line-height : 100%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- tt {
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- background-color : #EEEEEE;
- color : #000000;
- }
-%s
- note { white-space : pre; }
- label.ocn {
- width : 2%%;
- float : right;
- top : 0;
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 5px;
- margin-right : 5px;
- text-align : right;
- color : %s;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- table {
- display : block;
- margin-left : 5%%;
- margin-right : 2em;
- background-color : inherit;
- }
- tr { }
- th,td {
- vertical-align : top;
- text-align : left;
- }
- th {
- font-weight : bold;
- }
- em {
- font-weight : bold;
- font-style : italic;
- }
- p.left,th.left,td.left {
- text-align : left;
- }
- p.small_left,th.small_left,td.small_left {
- text-align : left;
- font-size : 80%%;
- }
- p.right,th.right,td.right {
- text-align : right;
- }
- ul, li {
- list-style-type : none;
- list-style : none;
- padding-left : 20px;
- font-weight : normal;
- line-height : 150%%;
- text-align : left;
- text-indent : 0mm;
- margin-left : 1em;
- margin-right : 2em;
- margin-top : 3px;
- margin-bottom : 3px;
- }
- li {
- background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
- }
- ul { }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- font-weight : bold;
- line-height : 120%%;
- text-align : left;
- margin-top : 20px;
- margin-bottom : 10px;
- }
- h4.norm, h5.norm, h6.norm, h7.norm {
- margin-top : 10px;
- margin-bottom : 0px;
- }
- h0 { font-size : 125%%; }
- h1 { font-size : 120%%; }
- h2 { font-size : 115%%; }
- h3 { font-size : 110%%; }
- h4 { font-size : 105%%; }
- h5 { font-size : 100%%; }
- h6 { font-size : 100%%; }
- h7 { font-size : 100%%; }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- text-shadow : .2em .2em .3em #808080;
- }
- h1.i { margin-left : 2em; }
- h2.i { margin-left : 3em; }
- h3.i { margin-left : 4em; }
- h4.i { margin-left : 5em; }
- h5.i { margin-left : 6em; }
- h6.i { margin-left : 7em; }
- h7.i { margin-left : 8em; }
- h8.i { margin-left : 9em; }
- h9.i { margin-left : 10em; }
- .toc {
- font-weight : normal;
- margin-top : 6px;
- margin-bottom : 6px;
- }
- h0.toc {
- margin-left : 1em;
- font-size : 120%%;
- line-height : 150%%;
- }
- h1.toc {
- margin-left : 1em;
- font-size : 115%%;
- line-height : 150%%;
- }
- h2.toc {
- margin-left : 2em;
- font-size : 110%%;
- line-height : 140%%;
- }
- h3.toc {
- margin-left : 3em;
- font-size : 105%%;
- line-height : 120%%;
- }
- h4.toc {
- margin-left : 4em;
- font-size : 100%%;
- line-height : 120%%;
- }
- h5.toc {
- margin-left : 5em;
- font-size : 95%%;
- line-height : 110%%;
- }
- h6.toc {
- margin-left : 6em;
- font-size : 90%%;
- line-height : 110%%;
- }
- h7.toc {
- margin-left : 7em;
- font-size : 85%%;
- line-height : 100%%;
- }
- .subtoc {
- margin-right : 34%%;
- font-weight : normal;
- }
- h5.subtoc {
- margin-left : 2em;
- font-size : 80%%;
- margin-top : 2px;
- margin-bottom : 2px;
- }
- h6.subtoc {
- margin-left : 3em;
- font-size : 75%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- h7.subtoc {
- margin-left : 4em;
- font-size : 70%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- /* flex */
- .flex-menu-bar {
- display : -webkit-flex;
- display : flex;
- -webkit-flex-wrap : wrap;
- -webkit-align-items : center;
- align-items : center;
- width : 100%%;
- margin-left : 5%%;
- margin-right : 2%%;
- background-color : #FFFFFF;
- }
- .flex-menu-option {
- background-color : #FFFFFF;
- margin-right : 4px;
- }
- .flex-list {
- display : -webkit-flex;
- display : flex;
- -webkit-align-items : center;
- display : block;
- align-items : center;
- width : 100%%;
- background-color : #FFFFFF;
- }
- .flex-list-item {
- background-color : #FFFFFF;
- margin : 4px;
- }
- /* grid */
- .wrapper {
- display : grid;
- grid-template-columns : 100%%;
- grid-template-areas :
- "headband"
- "doc_header"
- "doc_title"
- "doc_toc"
- "doc_prefix"
- "doc_intro"
- "doc_body"
- "doc_endnotes"
- "doc_glossary"
- "doc_biblio"
- "doc_bookindex"
- "doc_blurb"
- "doc_suffix";
- margin : 0px;
- padding : 0px;
- background-color : #FFFFFF;
- }
- .delimit {
- border-style : none;
- border-color : #FFFFFF;
- padding : 10px;
- }
- .headband {
- grid-area : headband;
- background-color : #FFFFFF;
- }
- .doc_header {
- grid-area : doc_header;
- }
- .doc_title {
- grid-area : doc_title;
- }
- .doc_toc {
- grid-area : doc_toc;
- }
- .doc_prefix {
- grid-area : doc_prefix;
- }
- .doc_intro {
- grid-area : doc_intro;
- }
- .doc_body {
- grid-area : doc_body;
- }
- .doc_endnotes {
- grid-area : doc_endnotes;
- }
- .doc_glossary {
- grid-area : doc_glossary;
- }
- .doc_biblio {
- grid-area : doc_biblio;
- }
- .doc_bookindex {
- grid-area : doc_bookindex;
- }
- .doc_blurb {
- grid-area : doc_blurb;
- }
- .doc_suffix {
- grid-area : doc_suffix;
- }
- .nav-ul {
- list-style : none;
- float : left;
- }
- .nav-li {
- float : left;
- padding-right : 0.7em;
- }
- .nav-li a {
- text-decoration : none;
- color : #FFFFFF;
- }
- footer {
- background-color : #00704E;
- }
-┃",
- _color_ocn_light,
- _css_indent,
- _color_ocn_light,
-);
- string _css_dark_html_scroll = format(q"┃
- *{
- padding : 0px;
- margin : 0px;
- }
- body {
- height : 100vh;
- background-color : #000000;
- }
- body {
- color : #CCCCCC;
- background : #000000;
- background-color : #000000;
- }
- a:link {
- color : #FFFFFF;
- text-decoration : none;
- }
- a:visited {
- color : #999999;
- text-decoration : none;
- }
- a:hover {
- color : #000000;
- background-color : #555555;
- }
- a.lnkocn:link {
- color : %s;
- text-decoration : none;
- }
- a.lnkocn:visited {
- color : #9ACD32;
- text-decoration : none;
- }
- a.lnkocn:hover {
- color : #BBBBBB;
- font-size : 15px;
- }
- a:hover img {
- background-color : #000000;
- }
- a:active {
- color : #888888;
- text-decoration : underline;
- }
- div {
- margin-left : 0;
- margin-right : 0;
- }
- div.p {
- margin-left : 5%%;
- margin-right : 1%%;
- }
- div.substance {
- width : 100%%;
- background-color : #000000;
- }
- div.ocn {
- width : 5%%;
- float : right;
- top : 0;
- background-color : #000000;
- }
- div.endnote {
- width : 95%%;
- background-color : #000000;
- }
- div.toc {
- position : absolute;
- float : left;
- margin : 0;
- padding : 0;
- padding-top : 0.5em;
- border : 0;
- width : 13em;
- background-color : #111111;
- margin-right : 1em;
- }
- div.summary {
- margin : 0;
- padding : 0;
- border-left : 13em solid #111111;
- padding-left : 1em;
- background-color : #111111;
- }
- div.content, div.main_column {
- margin : 0;
- padding : 0;
- border-left : 13em solid #000000;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content0, div.main_column0 {
- margin : 0;
- padding : 0;
- border-left : 0%% solid #000000;
- padding-left : 5%%;
- }
- div.scroll {
- margin : 0;
- padding : 0;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content:after {
- content : ' ';
- clear : both;
- display : block;
- height : 0;
- overflow : hidden;
- }
- div.footer {
- clear : left;
- padding : 0.5em;
- font-size : 80%%;
- margin : 0;
- }
- div.toc ul {
- list-style : none;
- padding : 0;
- margin : 0;
- }
- div.toc li ul a, li ul span.currentlink
- {
- font-weight : normal;
- font-size : 90%%;
- padding-left : 2em;
- background-color : #111111;
- }
- div.toc a, span.currentlink{
- display : block;
- text-decoration : none;
- padding-left : 0.5em;
- color : #FF00AA;
- }
- hr {
- width : 90%%;
- margin-left : 5%%;
- margin-right : 2em;
- margin-top : 1.8em;
- margin-bottom : 1.8em;
- }
- span.currentlink {
- text-decoration : none;
- background-color : #AAAAF9;
- }
- div.toc a:visited {
- color : #FF00AA;
- }
- div.toc a:hover {
- color : #CCCCCC;
- background-color : #F9F9AA;
- }
- nav#toc ol {
- list-style-type : none;
- }
- .norm, .bold, .verse, .group, .block, .alt {
- line-height : 133%%;
- margin-top : 12px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- }
- p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
- display : block;
- font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- margin-left : 5%%;
- margin-right : 2em;
- }
- p {
- font-size : 100%%;
- font-weight : normal;
- line-height : 133%%;
- text-align : justify;
- text-indent : 0mm;
- margin-top : 0.8em;
- margin-bottom : 0.8em;
- }
- img {
- max-width : 100%%;
- height : auto;
- }
- pre {
- width : auto;
- display : block;
- clear : both;
- color : #555555;
- }
- pre.codeline {
- display : table;
- clear : both;
- table-layout : fixed;
- margin-left : 5%%;
- margin-right : 5%%;
- width : 90%%;
- white-space : pre-wrap;
- border-style : none;
- border-radius : 5px 5px 5px 5px;
- box-shadow : 0 2px 5px #AAAAAA inset;
- margin-bottom : 1em;
- padding : 0.5em 1em;
- page-break-inside : avoid;
- word-wrap : break-word;
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- white-space : pre;
- white-space : pre-wrap;
- white-space : -moz-pre-wrap;
- white-space : -o-pre-wrap;
- background-color : #555555;
- color : #DDDDDD;
- font-size : 95%%;
- line-height : 100%%;
- }
- pre.codeline::before {
- counter-reset : linenum;
- }
- pre.codeline span.tr {
- display : table-row;
- counter-increment : linenum;
- }
- pre.codeline span.th {
- display : table-cell;
- user-select : none;
- -moz-user-select : none;
- -webkit-user-select : none;
- padding : 0.5em 0.5em;
- }
- pre.codeline span.th::before {
- content : counter(linenum) ".";
- color : #999999;
- text-align : right;
- display : block;
- }
- pre.codeline span.th {
- width : 4em;
- }
- pre.codeline code {
- display : table-cell;
- }
- p.code {
- border-style : none;
- }
- p.spaced { white-space : pre; }
- p.block {
- white-space : pre;
- }
- p.group { }
- p.alt { }
- p.verse {
- white-space : pre;
- margin-bottom : 6px;
- }
- p.caption {
- text-align : left;
- font-size : 80%%;
- display : inline;
- }
- p.endnote {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-right : 15mm;
- }
- p.endnote_indent {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 2em;
- margin-right : 15mm;
- }
- p.center {
- text-align : center;
- }
- p.bold {
- font-weight : bold;
- }
- p.bold_left {
- font-weight : bold;
- text-align : left;
- }
- p.centerbold {
- text-align : center;
- font-weight : bold;
- }
- p.em {
- font-weight : bold;
- font-style : normal;
- background : #FFF3B6;
- }
- p.small {
- font-size : 80%%;
- margin-top : 0px;
- margin-bottom : 0px;
- margin-right : 6px;
- text-align : left;
- }
- .tiny, .tiny_left, .tiny_right, .tiny_center {
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 0px;
- color : #EEEEEE;
- margin-right : 6px;
- text-align : left;
- }
- p.tiny { }
- p.tiny_left {
- margin-left : 0px;
- margin-right : 0px;
- text-align : left;
- }
- p.tiny_right {
- margin-right : 1em;
- text-align : right;
- }
- p.tiny_center {
- margin-left : 0px;
- margin-right : 0px;
- text-align : center;
- }
- p.concordance_word {
- line-height : 150%%;
- font-weight : bold;
- display : inline;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.concordance_count {
- font-size : 80%%;
- color : #555555;
- display : inline;
- margin-left : 0em;
- }
- p.concordance_object {
- font-size : 80%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- p.book_index_lev1 {
- line-height : 100%%;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.book_index_lev2 {
- line-height : 100%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- tt {
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- background-color : #555555;
- color : #DDDDDD;
- }
-%s
- note { white-space : pre; }
- label.ocn {
- width : 2%%;
- float : right;
- top : 0;
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 5px;
- margin-right : 5px;
- text-align : right;
- color : %s;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- table {
- display : block;
- margin-left : 5%%;
- margin-right : 2em;
- background-color : inherit;
- }
- tr { }
- th,td {
- vertical-align : top;
- text-align : left;
- }
- th {
- font-weight : bold;
- }
- em {
- font-weight : bold;
- font-style : italic;
- }
- p.left,th.left,td.left {
- text-align : left;
- }
- p.small_left,th.small_left,td.small_left {
- text-align : left;
- font-size : 80%%;
- }
- p.right,th.right,td.right {
- text-align : right;
- }
- ul, li {
- list-style-type : none;
- list-style : none;
- padding-left : 20px;
- font-weight : normal;
- line-height : 150%%;
- text-align : left;
- text-indent : 0mm;
- margin-left : 1em;
- margin-right : 2em;
- margin-top : 3px;
- margin-bottom : 3px;
- }
- li {
- background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
- }
- ul { }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- font-weight : bold;
- line-height : 120%%;
- text-align : left;
- margin-top : 20px;
- margin-bottom : 10px;
- }
- h4.norm, h5.norm, h6.norm, h7.norm {
- margin-top : 10px;
- margin-bottom : 0px;
- }
- h0 { font-size : 125%%; }
- h1 { font-size : 120%%; }
- h2 { font-size : 115%%; }
- h3 { font-size : 110%%; }
- h4 { font-size : 105%%; }
- h5 { font-size : 100%%; }
- h6 { font-size : 100%%; }
- h7 { font-size : 100%%; }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- text-shadow : .2em .2em .3em #999999;
- }
- h1.i { margin-left : 2em; }
- h2.i { margin-left : 3em; }
- h3.i { margin-left : 4em; }
- h4.i { margin-left : 5em; }
- h5.i { margin-left : 6em; }
- h6.i { margin-left : 7em; }
- h7.i { margin-left : 8em; }
- h8.i { margin-left : 9em; }
- h9.i { margin-left : 10em; }
- .toc {
- font-weight : normal;
- margin-top : 6px;
- margin-bottom : 6px;
- }
- h0.toc {
- margin-left : 1em;
- font-size : 120%%;
- line-height : 150%%;
- }
- h1.toc {
- margin-left : 1em;
- font-size : 115%%;
- line-height : 150%%;
- }
- h2.toc {
- margin-left : 2em;
- font-size : 110%%;
- line-height : 140%%;
- }
- h3.toc {
- margin-left : 3em;
- font-size : 105%%;
- line-height : 120%%;
- }
- h4.toc {
- margin-left : 4em;
- font-size : 100%%;
- line-height : 120%%;
- }
- h5.toc {
- margin-left : 5em;
- font-size : 95%%;
- line-height : 110%%;
- }
- h6.toc {
- margin-left : 6em;
- font-size : 90%%;
- line-height : 110%%;
- }
- h7.toc {
- margin-left : 7em;
- font-size : 85%%;
- line-height : 100%%;
- }
- .subtoc {
- margin-right : 34%%;
- font-weight : normal;
- }
- h5.subtoc {
- margin-left : 2em;
- font-size : 80%%;
- margin-top : 2px;
- margin-bottom : 2px;
- }
- h6.subtoc {
- margin-left : 3em;
- font-size : 75%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- h7.subtoc {
- margin-left : 4em;
- font-size : 70%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- /* flex */
- .flex-menu-bar {
- display : -webkit-flex;
- display : flex;
- -webkit-flex-wrap : wrap;
- -webkit-align-items : center;
- align-items : center;
- width : 100%%;
- margin-left : 5%%;
- margin-right : 2%%;
- background-color : #000000;
- }
- .flex-menu-option {
- background-color : #000000;
- margin-right : 4px;
- }
- .flex-list {
- display : -webkit-flex;
- display : flex;
- -webkit-align-items : center;
- display : block;
- align-items : center;
- width : 100%%;
- background-color : #000000;
- }
- .flex-list-item {
- background-color : #000000;
- margin : 4px;
- }
- /* grid */
- .wrapper {
- display : grid;
- grid-template-columns : 100%%;
- grid-template-areas :
- "headband"
- "doc_header"
- "doc_title"
- "doc_toc"
- "doc_prefix"
- "doc_intro"
- "doc_body"
- "doc_endnotes"
- "doc_glossary"
- "doc_biblio"
- "doc_bookindex"
- "doc_blurb"
- "doc_suffix";
- margin : 0px;
- padding : 0px;
- background-color : #000000;
- }
- .delimit {
- border-style : none;
- border-color : #000000;
- padding : 10px;
- }
- .headband {
- grid-area : headband;
- background-color : #000000;
- }
- .doc_header {
- grid-area : doc_header;
- }
- .doc_title {
- grid-area : doc_title;
- }
- .doc_toc {
- grid-area : doc_toc;
- }
- .doc_prefix {
- grid-area : doc_prefix;
- }
- .doc_intro {
- grid-area : doc_intro;
- }
- .doc_body {
- grid-area : doc_body;
- }
- .doc_endnotes {
- grid-area : doc_endnotes;
- }
- .doc_glossary {
- grid-area : doc_glossary;
- }
- .doc_biblio {
- grid-area : doc_biblio;
- }
- .doc_bookindex {
- grid-area : doc_bookindex;
- }
- .doc_blurb {
- grid-area : doc_blurb;
- }
- .doc_suffix {
- grid-area : doc_suffix;
- }
- .nav-ul {
- list-style : none;
- float : left;
- }
- .nav-li {
- float : left;
- padding-right : 0.7em;
- }
- .nav-li a {
- text-decoration : none;
- color : #000000;
- }
- footer {
- background-color : #FF704E;
- }
-┃",
- _color_ocn_dark,
- _css_indent,
- _color_ocn_dark,
-);
- string _css_light_epub = format(q"┃
- *{
- padding : 0px;
- margin : 0px;
- }
- body {
- height : 100vh;
- background-color : #FFFFFF;
- }
- body {
- color : #000000;
- background : #FFFFFF;
- background-color : #FFFFFF;
- }
- a:link {
- color : #003399;
- text-decoration : none;
- }
- a:visited {
- color : #003399;
- text-decoration : none;
- }
- a:hover {
- color : #000000;
- background-color : #F9F9AA;
- }
- a.lnkocn:link {
- color : %s;
- text-decoration : none;
- }
- a.lnkocn:visited {
- color : #32CD32;
- text-decoration : none;
- }
- a.lnkocn:hover {
- color : #777777;
- font-size : 15px;
- }
- a:hover img {
- background-color : #FFFFFF;
- }
- a:active {
- color : #003399;
- text-decoration : underline;
- }
- div {
- margin-left : 0;
- margin-right : 0;
- }
- div.p {
- margin-left : 5%%;
- margin-right : 1%%;
- }
- div.substance {
- width : 100%%;
- background-color : #FFFFFF;
- }
- div.ocn {
- width : 5%%;
- float : right;
- top : 0;
- background-color : #FFFFFF;
- }
- div.endnote {
- width : 95%%;
- background-color : #FFFFFF;
- }
- div.toc {
- position : absolute;
- float : left;
- margin : 0;
- padding : 0;
- padding-top : 0.5em;
- border : 0;
- width : 13em;
- background-color : #EEEEEE;
- margin-right : 1em;
- }
- div.summary {
- margin : 0;
- padding : 0;
- border-left : 13em solid #EEEEEE;
- padding-left : 1em;
- background-color : #EEEEEE;
- }
- div.content, div.main_column {
- margin : 0;
- padding : 0;
- border-left : 13em solid #FFFFFF;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content0, div.main_column0 {
- margin : 0;
- padding : 0;
- border-left : 0%% solid #FFFFFF;
- padding-left : 5%%;
- }
- div.scroll {
- margin : 0;
- padding : 0;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content:after {
- content : ' ';
- clear : both;
- display : block;
- height : 0;
- overflow : hidden;
- }
- div.footer {
- clear : left;
- padding : 0.5em;
- font-size : 80%%;
- margin : 0;
- }
- div.toc ul {
- list-style : none;
- padding : 0;
- margin : 0;
- }
- div.toc li ul a, li ul span.currentlink
- {
- font-weight : normal;
- font-size : 90%%;
- padding-left : 2em;
- background-color : #EEEEEE;
- }
- div.toc a, span.currentlink{
- display : block;
- text-decoration : none;
- padding-left : 0.5em;
- color : #0000aa;
- }
- hr {
- width : 90%%;
- margin-left : 5%%;
- margin-right : 2em;
- margin-top : 1.8em;
- margin-bottom : 1.8em;
- }
- span.currentlink {
- text-decoration : none;
- background-color : #AAAAAA;
- }
- div.toc a:visited {
- color : #0000aa;
- }
- div.toc a:hover {
- color : #000000;
- background-color : #F9F9AA;
- }
- nav#toc ol {
- list-style-type : none;
- }
- .norm, .bold, .verse, .group, .block, .alt {
- line-height : 133%%;
- margin-top : 12px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- }
- p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
- display : block;
- font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- margin-left : 5%%;
- margin-right : 2em;
- }
- p {
- font-size : 100%%;
- font-weight : normal;
- line-height : 133%%;
- text-align : justify;
- text-indent : 0mm;
- margin-top : 0.8em;
- margin-bottom : 0.8em;
- }
- img {
- max-width : 100%%;
- height : auto;
- }
- pre {
- width : auto;
- display : block;
- clear : both;
- color : #555555;
- }
- pre.codeline {
- display : table;
- clear : both;
- table-layout : fixed;
- margin-left : 5%%;
- margin-right : 5%%;
- width : 90%%;
- white-space : pre-wrap;
- border-style : none;
- border-radius : 5px 5px 5px 5px;
- box-shadow : 0 2px 5px #AAAAAA inset;
- margin-bottom : 1em;
- padding : 0.5em 1em;
- page-break-inside : avoid;
- word-wrap : break-word;
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- white-space : pre;
- white-space : pre-wrap;
- white-space : -moz-pre-wrap;
- white-space : -o-pre-wrap;
- background-color : #EEEEEE;
- color : #000000;
- font-size : 95%%;
- line-height : 100%%;
- }
- pre.codeline::before {
- counter-reset : linenum;
- }
- pre.codeline span.tr {
- display : table-row;
- counter-increment : linenum;
- }
- pre.codeline span.th {
- display : table-cell;
- user-select : none;
- -moz-user-select : none;
- -webkit-user-select : none;
- padding : 0.5em 0.5em;
- /* background-color : #666666; */
- }
- pre.codeline span.th::before {
- content : counter(linenum) ".";
- color : #999999;
- text-align : right;
- display : block;
- }
- pre.codeline span.th {
- width : 4em;
- }
- pre.codeline code {
- display : table-cell;
- }
- p.code {
- border-style : none;
- }
- p.spaced { white-space : pre; }
- p.block {
- white-space : pre;
- }
- p.group { }
- p.alt { }
- p.verse {
- white-space : pre;
- margin-bottom : 6px;
- }
- p.caption {
- text-align : left;
- font-size : 80%%;
- display : inline;
- }
- p.endnote {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-right : 15mm;
- }
- p.endnote_indent {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 2em;
- margin-right : 15mm;
- }
- p.center {
- text-align : center;
- }
- p.bold {
- font-weight : bold;
- }
- p.bold_left {
- font-weight : bold;
- text-align : left;
- }
- p.centerbold {
- text-align : center;
- font-weight : bold;
- }
- p.em {
- font-weight : bold;
- font-style : normal;
- background : #FFF3B6;
- }
- p.small {
- font-size : 80%%;
- margin-top : 0px;
- margin-bottom : 0px;
- margin-right : 6px;
- text-align : left;
- }
- .tiny, .tiny_left, .tiny_right, .tiny_center {
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 0px;
- color : #777777;
- margin-right : 6px;
- text-align : left;
- }
- p.tiny { }
- p.tiny_left {
- margin-left : 0px;
- margin-right : 0px;
- text-align : left;
- }
- p.tiny_right {
- margin-right : 1em;
- text-align : right;
- }
- p.tiny_center {
- margin-left : 0px;
- margin-right : 0px;
- text-align : center;
- }
- p.concordance_word {
- line-height : 150%%;
- font-weight : bold;
- display : inline;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.concordance_count {
- font-size : 80%%;
- color : #777777;
- display : inline;
- margin-left : 0em;
- }
- p.concordance_object {
- font-size : 80%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- p.book_index_lev1 {
- line-height : 100%%;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.book_index_lev2 {
- line-height : 100%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- tt {
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- background-color : #EEEEEE;
- color : #000000;
- }
-%s
- note { white-space : pre; }
- label.ocn {
- width : 2%%;
- float : right;
- top : 0;
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 5px;
- margin-right : 5px;
- text-align : right;
- color : %s;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- table {
- display : block;
- margin-left : 5%%;
- margin-right : 2em;
- background-color : inherit;
- }
- tr { }
- th,td {
- vertical-align : top;
- text-align : left;
- }
- th {
- font-weight : bold;
- }
- em {
- font-weight : bold;
- font-style : italic;
- }
- p.left,th.left,td.left {
- text-align : left;
- }
- p.small_left,th.small_left,td.small_left {
- text-align : left;
- font-size : 80%%;
- }
- p.right,th.right,td.right {
- text-align : right;
- }
- ul, li {
- list-style-type : none;
- list-style : none;
- padding-left : 20px;
- font-weight : normal;
- line-height : 150%%;
- text-align : left;
- text-indent : 0mm;
- margin-left : 1em;
- margin-right : 2em;
- margin-top : 3px;
- margin-bottom : 3px;
- }
- li {
- background : url(../image_sys/bullet_09.png) no-repeat 0px 6px;
- }
- ul { }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- font-weight : bold;
- line-height : 120%%;
- text-align : left;
- margin-top : 20px;
- margin-bottom : 10px;
- }
- h4.norm, h5.norm, h6.norm, h7.norm {
- margin-top : 10px;
- margin-bottom : 0px;
- }
- h0 { font-size : 125%%; }
- h1 { font-size : 120%%; }
- h2 { font-size : 115%%; }
- h3 { font-size : 110%%; }
- h4 { font-size : 105%%; }
- h5 { font-size : 100%%; }
- h6 { font-size : 100%%; }
- h7 { font-size : 100%%; }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- text-shadow : .2em .2em .3em #808080;
- }
- h1.i { margin-left : 2em; }
- h2.i { margin-left : 3em; }
- h3.i { margin-left : 4em; }
- h4.i { margin-left : 5em; }
- h5.i { margin-left : 6em; }
- h6.i { margin-left : 7em; }
- h7.i { margin-left : 8em; }
- h8.i { margin-left : 9em; }
- h9.i { margin-left : 10em; }
- .toc {
- font-weight : normal;
- margin-top : 6px;
- margin-bottom : 6px;
- }
- h0.toc {
- margin-left : 1em;
- font-size : 120%%;
- line-height : 150%%;
- }
- h1.toc {
- margin-left : 1em;
- font-size : 115%%;
- line-height : 150%%;
- }
- h2.toc {
- margin-left : 2em;
- font-size : 110%%;
- line-height : 140%%;
- }
- h3.toc {
- margin-left : 3em;
- font-size : 105%%;
- line-height : 120%%;
- }
- h4.toc {
- margin-left : 4em;
- font-size : 100%%;
- line-height : 120%%;
- }
- h5.toc {
- margin-left : 5em;
- font-size : 95%%;
- line-height : 110%%;
- }
- h6.toc {
- margin-left : 6em;
- font-size : 90%%;
- line-height : 110%%;
- }
- h7.toc {
- margin-left : 7em;
- font-size : 85%%;
- line-height : 100%%;
- }
- .subtoc {
- margin-right : 34%%;
- font-weight : normal;
- }
- h5.subtoc {
- margin-left : 2em;
- font-size : 80%%;
- margin-top : 2px;
- margin-bottom : 2px;
- }
- h6.subtoc {
- margin-left : 3em;
- font-size : 75%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- h7.subtoc {
- margin-left : 4em;
- font-size : 70%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
-
-┃",
- _color_ocn_light,
- _css_indent,
- _color_ocn_light,
-);
- string _css_dark_epub = format(q"┃
- *{
- padding : 0px;
- margin : 0px;
- }
- body {
- height : 100vh;
- background-color : #000000;
- }
- body {
- color : #CCCCCC;
- background : #000000;
- background-color : #000000;
- }
- a:link {
- color : #FFFFFF;
- text-decoration : none;
- }
- a:visited {
- color : #999999;
- text-decoration : none;
- }
- a:hover {
- color : #000000;
- background-color : #555555;
- }
- a.lnkocn:link {
- color : %s;
- text-decoration : none;
- }
- a.lnkocn:visited {
- color : #9ACD32;
- text-decoration : none;
- }
- a.lnkocn:hover {
- color : #BBBBBB;
- font-size : 15px;
- }
- a:hover img {
- background-color : #000000;
- }
- a:active {
- color : #888888;
- text-decoration : underline;
- }
- div {
- margin-left : 0;
- margin-right : 0;
- }
- div.p {
- margin-left : 5%%;
- margin-right : 1%%;
- }
- div.substance {
- width : 100%%;
- background-color : #000000;
- }
- div.ocn {
- width : 5%%;
- float : right;
- top : 0;
- background-color : #000000;
- }
- div.endnote {
- width : 95%%;
- background-color : #000000;
- }
- div.toc {
- position : absolute;
- float : left;
- margin : 0;
- padding : 0;
- padding-top : 0.5em;
- border : 0;
- width : 13em;
- background-color : #111111;
- margin-right : 1em;
- }
- div.summary {
- margin : 0;
- padding : 0;
- border-left : 13em solid #111111;
- padding-left : 1em;
- background-color : #111111;
- }
- div.content, div.main_column {
- margin : 0;
- padding : 0;
- border-left : 13em solid #000000;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content0, div.main_column0 {
- margin : 0;
- padding : 0;
- border-left : 0%% solid #000000;
- padding-left : 5%%;
- }
- div.scroll {
- margin : 0;
- padding : 0;
- padding-left : 1em;
- padding-right : 1em;
- }
- div.content:after {
- content : ' ';
- clear : both;
- display : block;
- height : 0;
- overflow : hidden;
- }
- div.footer {
- clear : left;
- padding : 0.5em;
- font-size : 80%%;
- margin : 0;
- }
- div.toc ul {
- list-style : none;
- padding : 0;
- margin : 0;
- }
- div.toc li ul a, li ul span.currentlink
- {
- font-weight : normal;
- font-size : 90%%;
- padding-left : 2em;
- background-color : #111111;
- }
- div.toc a, span.currentlink{
- display : block;
- text-decoration : none;
- padding-left : 0.5em;
- color : #FF00AA;
- }
- hr {
- width : 90%%;
- margin-left : 5%%;
- margin-right : 2em;
- margin-top : 1.8em;
- margin-bottom : 1.8em;
- }
- span.currentlink {
- text-decoration : none;
- background-color : #AAAAF9;
- }
- div.toc a:visited {
- color : #FF00AA;
- }
- div.toc a:hover {
- color : #CCCCCC;
- background-color : #F9F9AA;
- }
- nav#toc ol {
- list-style-type : none;
- }
- .norm, .bold, .verse, .group, .block, .alt {
- line-height : 133%%;
- margin-top : 12px;
- margin-bottom : 0px;
- padding-left : 0em;
- text-indent : 0em;
- }
- p, h0, h1, h2, h3, h4, h5, h6, h7, ul, li {
- display : block;
- font-family : verdana, arial, georgia, tahoma, sans-serif, helvetica, times, roman;
- margin-left : 5%%;
- margin-right : 2em;
- }
- p {
- font-size : 100%%;
- font-weight : normal;
- line-height : 133%%;
- text-align : justify;
- text-indent : 0mm;
- margin-top : 0.8em;
- margin-bottom : 0.8em;
- }
- img {
- max-width : 100%%;
- height : auto;
- }
- pre {
- width : auto;
- display : block;
- clear : both;
- color : #555555;
- }
- pre.codeline {
- display : table;
- clear : both;
- table-layout : fixed;
- margin-left : 5%%;
- margin-right : 5%%;
- width : 90%%;
- white-space : pre-wrap;
- border-style : none;
- border-radius : 5px 5px 5px 5px;
- box-shadow : 0 2px 5px #AAAAAA inset;
- margin-bottom : 1em;
- padding : 0.5em 1em;
- page-break-inside : avoid;
- word-wrap : break-word;
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- white-space : pre;
- white-space : pre-wrap;
- white-space : -moz-pre-wrap;
- white-space : -o-pre-wrap;
- background-color : #555555;
- color : #DDDDDD;
- font-size : 95%%;
- line-height : 100%%;
- }
- pre.codeline::before {
- counter-reset : linenum;
- }
- pre.codeline span.tr {
- display : table-row;
- counter-increment : linenum;
- }
- pre.codeline span.th {
- display : table-cell;
- user-select : none;
- -moz-user-select : none;
- -webkit-user-select : none;
- padding : 0.5em 0.5em;
- }
- pre.codeline span.th::before {
- content : counter(linenum) ".";
- color : #999999;
- text-align : right;
- display : block;
- }
- pre.codeline span.th {
- width : 4em;
- }
- pre.codeline code {
- display : table-cell;
- }
- p.code {
- border-style : none;
- }
- p.spaced { white-space : pre; }
- p.block {
- white-space : pre;
- }
- p.group { }
- p.alt { }
- p.verse {
- white-space : pre;
- margin-bottom : 6px;
- }
- p.caption {
- text-align : left;
- font-size : 80%%;
- display : inline;
- }
- p.endnote {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-right : 15mm;
- }
- p.endnote_indent {
- font-size : 96%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 2em;
- margin-right : 15mm;
- }
- p.center {
- text-align : center;
- }
- p.bold {
- font-weight : bold;
- }
- p.bold_left {
- font-weight : bold;
- text-align : left;
- }
- p.centerbold {
- text-align : center;
- font-weight : bold;
- }
- p.em {
- font-weight : bold;
- font-style : normal;
- background : #FFF3B6;
- }
- p.small {
- font-size : 80%%;
- margin-top : 0px;
- margin-bottom : 0px;
- margin-right : 6px;
- text-align : left;
- }
- .tiny, .tiny_left, .tiny_right, .tiny_center {
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 0px;
- color : #EEEEEE;
- margin-right : 6px;
- text-align : left;
- }
- p.tiny { }
- p.tiny_left {
- margin-left : 0px;
- margin-right : 0px;
- text-align : left;
- }
- p.tiny_right {
- margin-right : 1em;
- text-align : right;
- }
- p.tiny_center {
- margin-left : 0px;
- margin-right : 0px;
- text-align : center;
- }
- p.concordance_word {
- line-height : 150%%;
- font-weight : bold;
- display : inline;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.concordance_count {
- font-size : 80%%;
- color : #555555;
- display : inline;
- margin-left : 0em;
- }
- p.concordance_object {
- font-size : 80%%;
- line-height : 120%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- p.book_index_lev1 {
- line-height : 100%%;
- margin-top : 4px;
- margin-bottom : 1px;
- }
- p.book_index_lev2 {
- line-height : 100%%;
- text-align : left;
- margin-left : 3em;
- margin-top : 1px;
- margin-bottom : 3px;
- }
- tt {
- font-family : inconsolata, "liberation mono", "bitstream vera mono", "dejavu mono", monaco, consolas, "andale mono", "courier new", "courier 10 pitch", courier, monospace;
- background-color : #555555;
- color : #DDDDDD;
- }
-%s
- note { white-space : pre; }
- label.ocn {
- width : 2%%;
- float : right;
- top : 0;
- font-size : 10px;
- margin-top : 0px;
- margin-bottom : 5px;
- margin-right : 5px;
- text-align : right;
- color : %s;
- -khtml-user-select : none;
- -moz-user-select : none;
- -ms-user-select : none;
- -o-user-select : none;
- -webkit-user-select : none;
- user-select : none;
- }
- table {
- display : block;
- margin-left : 5%%;
- margin-right : 2em;
- background-color : inherit;
- }
- tr { }
- th,td {
- vertical-align : top;
- text-align : left;
- }
- th {
- font-weight : bold;
- }
- em {
- font-weight : bold;
- font-style : italic;
- }
- p.left,th.left,td.left {
- text-align : left;
- }
- p.small_left,th.small_left,td.small_left {
- text-align : left;
- font-size : 80%%;
- }
- p.right,th.right,td.right {
- text-align : right;
- }
- ul, li {
- list-style-type : none;
- list-style : none;
- padding-left : 20px;
- font-weight : normal;
- line-height : 150%%;
- text-align : left;
- text-indent : 0mm;
- margin-left : 1em;
- margin-right : 2em;
- margin-top : 3px;
- margin-bottom : 3px;
- }
- li {
- background : (../image_sys/bullet_09.png) no-repeat 0px 6px;
- }
- ul { }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- font-weight : bold;
- line-height : 120%%;
- text-align : left;
- margin-top : 20px;
- margin-bottom : 10px;
- }
- h4.norm, h5.norm, h6.norm, h7.norm {
- margin-top : 10px;
- margin-bottom : 0px;
- }
- h0 { font-size : 125%%; }
- h1 { font-size : 120%%; }
- h2 { font-size : 115%%; }
- h3 { font-size : 110%%; }
- h4 { font-size : 105%%; }
- h5 { font-size : 100%%; }
- h6 { font-size : 100%%; }
- h7 { font-size : 100%%; }
- h0, h1, h2, h3, h4, h5, h6, h7 {
- text-shadow : .2em .2em .3em #999999;
- }
- h1.i { margin-left : 2em; }
- h2.i { margin-left : 3em; }
- h3.i { margin-left : 4em; }
- h4.i { margin-left : 5em; }
- h5.i { margin-left : 6em; }
- h6.i { margin-left : 7em; }
- h7.i { margin-left : 8em; }
- h8.i { margin-left : 9em; }
- h9.i { margin-left : 10em; }
- .toc {
- font-weight : normal;
- margin-top : 6px;
- margin-bottom : 6px;
- }
- h0.toc {
- margin-left : 1em;
- font-size : 120%%;
- line-height : 150%%;
- }
- h1.toc {
- margin-left : 1em;
- font-size : 115%%;
- line-height : 150%%;
- }
- h2.toc {
- margin-left : 2em;
- font-size : 110%%;
- line-height : 140%%;
- }
- h3.toc {
- margin-left : 3em;
- font-size : 105%%;
- line-height : 120%%;
- }
- h4.toc {
- margin-left : 4em;
- font-size : 100%%;
- line-height : 120%%;
- }
- h5.toc {
- margin-left : 5em;
- font-size : 95%%;
- line-height : 110%%;
- }
- h6.toc {
- margin-left : 6em;
- font-size : 90%%;
- line-height : 110%%;
- }
- h7.toc {
- margin-left : 7em;
- font-size : 85%%;
- line-height : 100%%;
- }
- .subtoc {
- margin-right : 34%%;
- font-weight : normal;
- }
- h5.subtoc {
- margin-left : 2em;
- font-size : 80%%;
- margin-top : 2px;
- margin-bottom : 2px;
- }
- h6.subtoc {
- margin-left : 3em;
- font-size : 75%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
- h7.subtoc {
- margin-left : 4em;
- font-size : 70%%;
- margin-top : 0px;
- margin-bottom : 0px;
- }
-
-┃",
- _color_ocn_dark,
- _css_indent,
- _color_ocn_dark,
-);
- auto css_() {
- struct _CSS {
- string html_seg = "/* spine css html seg stylesheet */\n";
- string html_scroll = "/* spine css html scroll stylesheet */\n";
- string epub = "/* spine css epub stylesheet */\n";
- }
- return _CSS();
- }
- auto css = css_();
- if (doc_matters.opt.action.css_theme_default) {
- css.html_seg ~= _css_light_html_seg;
- css.html_scroll ~= _css_light_html_scroll;
- css.epub ~= _css_light_epub;
- } else {
- css.html_seg ~= _css_dark_html_seg;
- css.html_scroll ~= _css_dark_html_scroll;
- css.epub ~= _css_dark_epub;
- }
- return css;
- }
-}
diff --git a/src/doc_reform/source/paths_source.d b/src/doc_reform/source/paths_source.d
deleted file mode 100644
index ef1e6d0..0000000
--- a/src/doc_reform/source/paths_source.d
+++ /dev/null
@@ -1,842 +0,0 @@
-/++
- read configuration files
- - read config files
- meta_config_files.d
-+/
-module doc_reform.source.paths_source;
-import std.array,
- std.file,
- std.path,
- std.regex,
- std.stdio,
- std.conv : to;
-import
- doc_reform.meta.defaults,
- doc_reform.meta.rgx;
-template PodManifest() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto PodManifest(P)(
- P _pth=""
- ) {
- struct ManifestFile_ {
- string pod_manifest_filename() {
- return "pod.manifest";
- }
- string pod_manifest_path() {
- string _manifest_path;
- if ((isValidPath(_pth) && exists(_pth)!=0 && _pth.isDir)
- && (exists(_pth.chainPath(pod_manifest_filename).array)!=0
- && (_pth.chainPath(pod_manifest_filename).array).isFile)) {
- _manifest_path = _pth;
- } else if (_pth.match(rgx.src_pth_contents)
- && exists(_pth)!=0 && _pth.isFile) {
- _manifest_path = _pth.dirName;
- } else if (_pth.match(rgx.src_pth_pod_sst_or_ssm)
- && exists(_pth)!=0 && (_pth.isFile)) {
- if (auto m = _pth.match(rgx.src_pth_pod_sst_or_ssm)) {
- _manifest_path = m.captures["podpath"];
- }
- } else {
- writeln("WARNING, issue with manifest_path: ", _pth);
- _manifest_path = null; // _manifest_path = "";
- }
- return _manifest_path;
- }
- string pods_collection_root_path() {
- return (pod_manifest_path.length > 0) ? ((chainPath(pod_manifest_path, "..")).asNormalizedPath).array.to!string : "";
- }
- string pod_manifest_file_with_path() {
- string _k;
- if (exists(pod_manifest_path.chainPath(pod_manifest_filename).array)!=0) {
- _k = pod_manifest_path.chainPath(pod_manifest_filename).array;
- } else if (exists(pod_manifest_path)!=0) {
- _k = pod_manifest_path;
- }
- if (exists(_k)==0) {
- writeln("ERROR >> Processing Skipped! Manifest not found: ", _k);
- _k = null;
- }
- return _k;
- }
- }
- return ManifestFile_();
- }
-}
-template PathMatters() {
- mixin spineRgxInit;
- mixin InternalMarkup;
- static auto rgx = Rgx();
- static auto mkup = InlineMarkup();
- auto PathMatters(O,E)(
- O _opt_actions,
- E _env,
- string _pth,
- string _fns = "",
- char[][] _manifest_fn_list = [[]],
- ) {
- auto _manifested = PodManifest!()(_pth);
- struct ManifestMatters_ {
- auto env() {
- auto _env = _env;
- struct Env_ {
- auto pwd() {
- return _env["pwd"];
- }
- auto home() {
- return _env["home"];
- }
- }
- return Env_();
- }
- auto opt() {
- struct Opt_ {
- auto action() {
- return _opt_actions;
- }
- }
- return Opt_();
- }
- bool src_is_pod() {
- return (_manifested.pod_manifest_path.length > 0) ? true : false;
- }
- auto pod() {
- struct Pod_ {
- bool src_is_pod() {
- return (_manifested.pod_manifest_path.length > 0) ? true : false;
- }
- string collection_root() {
- return _manifested.pods_collection_root_path;
- }
- string manifest_filename() {
- return _manifested.pod_manifest_filename;
- }
- string manifest_path() {
- return _manifested.pod_manifest_path;
- }
- string pod_name_with_path() {
- return _manifested.pod_manifest_path.baseName;
- }
- string manifest_file_with_path() {
- return _manifested.pod_manifest_file_with_path;
- }
- string[] config_dr_document_make_dirs() {
- string[] _config_dirs;
- return _config_dirs;
- }
- string[] config_local_site_dirs() {
- string[] _config_dirs;
- return _config_dirs;
- }
- string[] image_dirs() {
- string[] _image_dirs;
- return _image_dirs;
- }
- auto manifest_list_of_filenames() {
- return _manifest_fn_list;
- }
- string[] manifest_list_of_languages() {
- string[] _lngs;
- foreach (filename_; manifest_list_of_filenames) {
- string _k = "en";
- if (auto m = (filename_).match(rgx.language_code_and_filename)) {
- _k = m.captures[1].to!string;
- }
- _lngs ~= _k; // all the languages from the manifest list of filenames with paths
- }
- return _lngs;
- }
- }
- return Pod_();
- }
- auto src() {
- string _fns = _fns; // required here by dmd & not by ldc (for D:2078)
- auto _opt_actions = _opt_actions;
- auto _env = _env;
- struct SRC_ {
- bool is_pod() {
- return (_manifested.pod_manifest_path.length > 0) ? true : false;
- }
- string path_and_fn() {
- return _fns;
- }
- string pod_name_with_path() {
- return (is_pod) ? _manifested.pod_manifest_path : "";
- }
- string pods_collection_root_path() {
- return (is_pod) ? _manifested.pods_collection_root_path : "";
- }
- string pod_name() {
- return pod_name_with_path.baseName;
- }
- string filename() {
- return path_and_fn.baseName;
- }
- string filename_base() {
- return filename.stripExtension;
- }
- string filename_extension() {
- return filename.match(rgx.src_pth_sst_or_ssm).captures["extension"];
- }
- string lng() {
- string _k;
- if (auto m = path_and_fn.match(rgx.language_code_and_filename)) {
- _k = m.captures[1];
- } else {_k = "en"; }
- return _k;
- }
- string doc_uid() {
- string _uid;
- if (is_pod && !(pod_name_with_path.empty)) {
- if (pod_name_with_path.baseName == filename_base) {
- _uid = filename_base ~ "." ~ filename_extension ~ mkup.sep ~ lng;
- } else {
- _uid = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ "." ~ filename_extension ~ mkup.sep ~ lng;
- }
- } else {
- _uid = mkup.sep ~ filename_base ~ "." ~ filename_extension ~ mkup.sep ~ lng;
- }
- return _uid;
- }
- string doc_uid_out() {
- string _uid;
- if (is_pod && !(pod_name_with_path.empty)) {
- if (pod_name_with_path.baseName == filename_base) {
- _uid = filename_base ~ "." ~ lng;
- } else {
- _uid = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ "." ~ lng;
- }
- } else {
- _uid = "_" ~ filename_base ~ "." ~ lng;
- }
- return _uid;
- }
- string docname_composite_unique_per_src_doc() {
- string _fn;
- if (pod_name_with_path.baseName == filename_base) {
- _fn = filename_base ~ mkup.sep ~ filename_extension ~ mkup.sep ~ lng;
- } else if (!(pod_name_with_path.empty)) {
- _fn = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension ~ mkup.sep ~ lng;
- } else {
- _fn = "_" ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension ~ mkup.sep ~ lng;
- }
- return _fn;
- }
- string docname_composite_unique_per_src_pod() {
- /+
- z pod name if any + src filename (without lng code)
- filename ~ mkup.sep ~ lng
- * unique per src pod
- used by
- - pod (multilingual collection)
- - sqlite discrete index (multilingual collection)
- +/
- string _fn;
- if (pod_name_with_path.baseName == filename_base) {
- _fn = filename_base ~ mkup.sep ~ filename_extension;
- } else if (!(pod_name_with_path.empty)) {
- _fn = pod_name_with_path.baseName ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension;
- } else {
- _fn = "_" ~ mkup.sep ~ filename_base ~ mkup.sep ~ filename_extension;
- }
- return _fn;
- }
- string language() {
- return lng();
- }
- string file_with_absolute_path() {
- return _env["pwd"].chainPath(path_and_fn).array;
- }
- string absolute_path_to_src() {
- return (_env["pwd"].chainPath(path_and_fn)).dirName.array;
- }
- string path_to_doc_root_path_to_lang_and_filename() {
- return _env["pwd"].chainPath(path_and_fn).array;
- }
- string base_dir() {
- string _dir;
- if (
- auto m = (absolute_path_to_src)
- .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
- ) {
- _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array;
- assert(_dir == m.captures["dir"]);
- } else {
- _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array;
- assert(_dir == absolute_path_to_src
- .match(rgx.src_base_parent_dir_name).captures["dir"]);
- }
- if (_opt_actions.debug_do) {
- writeln("--> (base_dir) ", _dir);
- }
- return _dir;
- }
- string base_parent_dir_path() {
- string _dir;
- if (
- auto m = (absolute_path_to_src)
- .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
- ) {
- _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array;
- } else {
- _dir = ((path_and_fn.chainPath("../../../")).asNormalizedPath).array;
- }
- return _dir;
- }
- string base_dir_path() {
- string _dir;
- if (
- auto m = (absolute_path_to_src)
- .match(rgx.src_formalised_file_path_parts)
- ) {
- _dir = ((m.captures["pth"]).asNormalizedPath).array;
- } else if (
- auto m = (absolute_path_to_src)
- .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
- ) {
- _dir = ((path_and_fn.chainPath("../")).asNormalizedPath).array;
- } else {
- _dir = ((path_and_fn.chainPath("../../")).asNormalizedPath).array;
- }
- if (_opt_actions.debug_do) {
- writeln("--> (base_dir_path) ", _dir);
- }
- return _dir;
- }
- string media_dir_path() {
- string _dir = ((base_dir_path.chainPath("media")).asNormalizedPath).array;
- return _dir;
- }
- string image_dir_path() {
- string _paths;
- string[] _possible_img_pths = [ "./image", "../image", "../../image" ];
- string _img_pth_found = "";
- if (is_pod) {
- _img_pth_found = ((file_with_absolute_path.dirName ~ "/../../image").asNormalizedPath).array;
- } else {
- string _img_pth(string _possible_img_pth) {
- return ((file_with_absolute_path.dirName ~ "/" ~ _possible_img_pth).asNormalizedPath).array;
- }
- foreach(_possible_img_pth; _possible_img_pths) {
- if (exists(_img_pth(_possible_img_pth))) {
- _img_pth_found = _img_pth(_possible_img_pth);
- break;
- } else {
- _paths ~= " " ~ _img_pth(_possible_img_pth);
- }
- }
- }
- if (_img_pth_found.empty) {
- writeln("WARNING not image path found, searched: ", _paths);
- }
- return _img_pth_found;
- }
- auto conf_dir_path() {
- return ((base_dir_path.chainPath("conf")).asNormalizedPath).array;
- }
- auto base_parent_dir() {
- string _dir;
- if (
- auto m = (absolute_path_to_src)
- .match(regex(r"[/](?P(?:[a-zA-Z0-9._-]+))/pod/" ~ filename.stripExtension))
- ) {
- _dir = m.captures["dir"];
- } else {
- _dir = (absolute_path_to_src).match(rgx.src_base_parent_dir_name).captures["dir"];
- }
- if (_opt_actions.debug_do) {
- writeln("--> (base_parent_dir) ", _dir);
- }
- return _dir;
- }
- string[] config_dirs() {
- string[] _config_dirs;
- if (is_pod) {
- } else {}
- return _config_dirs;
- }
- string[] image_dirs() {
- string[] _image_dirs;
- if (is_pod) {
- } else {}
- return _image_dirs;
- }
- }
- return SRC_();
- }
- auto output() {
- /+
- - command line if output path set
- - config file if found and set set
- - search for and if exists read config
- - default paths to config related to:
- - source markup path;
- - current dir;
- - home dir
- - get output path if set
- - (program) default within current directory?
- +/
- auto _env = _env;
- struct Out_ {
- auto path() {
- auto _output_path = _env["pwd"];
- if ((_opt_actions.output_dir_set.length > 0)
- && isValidPath(_opt_actions.output_dir_set)
- ) {
- _output_path = ((_opt_actions.output_dir_set).asNormalizedPath).array;
- if (!exists(_output_path)) {
- try {
- _output_path.mkdirRecurse;
- // } catch (ErrnoException ex) {
- } catch (Exception ex) {
- // Handle error
- }
- }
- assert(_output_path.isDir,
- "not a directory: " ~ _output_path);
- // TODO always test that is a directory and it is writable
- }
- return _output_path;
- }
- }
- return Out_();
- }
- }
- return ManifestMatters_();
- }
-}
-template ConfigFilePaths() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto ConfigFilePaths(M,E)(
- M _manifested,
- E _env,
- string _cli_config_path_set = ""
- ) {
- struct ConfFilePaths {
- string config_filename_document() {
- return "dr_document_make";
- }
- string config_filename_site() {
- return "config_local_site";
- }
- auto possible_config_path_locations() {
- struct _ConfFilePaths {
- string[] dr_document_make() {
- /+ FIX clean up conf paths ↓ +/
- /+ config local site (file system only, not in pod) +/
- /+ return paths +/
- string[] _possible_config_path_locations;
- if (_cli_config_path_set.empty) {
- if (_manifested.src.is_pod) {
- /+ config document in pod +/
- string _dr_doc_conf_pod;
- string _dr_doc_conf_pod_text;
- _dr_doc_conf_pod = asNormalizedPath(chainPath(
- to!string(_env["pwd"]),
- _manifested.pod.manifest_path ~ "/conf"
- )).array;
- _dr_doc_conf_pod_text = asNormalizedPath(chainPath(
- to!string(_env["pwd"]),
- _manifested.pod.manifest_path ~ "/media/text/" ~ _manifested.src.lng ~ "/conf"
- )).array;
- /+ return paths +/
- _possible_config_path_locations = [
- _dr_doc_conf_pod_text,
- _dr_doc_conf_pod,
- ];
- } else {
- /+ config document (& or local site) on filesystem +/
- string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array; // think about
- string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
- /+ return paths +/
- _possible_config_path_locations = [
- _dr_doc_conf_pwd,
- _dr_doc_conf_pwd_a,
- _dr_doc_conf_pwd_b,
- _dr_doc_conf_pwd_c,
- _dr_doc_conf_pwd_d,
- ];
- }
- } else {
- _possible_config_path_locations = [
- _cli_config_path_set
- ];
- }
- /+ FIX clean up conf paths ↑
- (compare pwd to doc path location, and build config path)
- +/
- return _possible_config_path_locations;
- }
- string[] config_local_site() {
- /+ FIX clean up conf paths ↓ +/
- /+ config local site (file system only, not in pod) +/
- string[] _possible_config_path_locations;
- if (_cli_config_path_set.empty) {
- string _dot_pwd = ((chainPath(to!string(_env["pwd"]), ".dr")).asNormalizedPath).array;
- string _underscore_pwd = ((chainPath(to!string(_env["pwd"]), "_dr")).asNormalizedPath).array;
- string _dot_home = ((chainPath(to!string(_env["home"]), ".dr")).asNormalizedPath).array;
- /+ return paths +/
- if (_manifested.src.is_pod) {
- string _collection_root_a = ((chainPath(to!string(_manifested.pod.collection_root.to!string), ".dr")).asNormalizedPath).array;
- string _collection_root_b = ((chainPath(to!string(_manifested.pod.collection_root.to!string), "_dr")).asNormalizedPath).array;
- _possible_config_path_locations = [
- _dot_pwd,
- _underscore_pwd,
- _dot_home,
- "/etc/dr",
- _collection_root_a, // set priority higher?
- _collection_root_b // set priority higher?
- ];
- } else {
- /+ config document (& or local site) on filesystem +/
- string _dr_doc_conf_pwd = ((chainPath(to!string(_env["pwd"]), "dr_doc/conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_a = ((chainPath(to!string(_env["pwd"]), "conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_b = ((chainPath(to!string(_env["pwd"]), "../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_c = ((chainPath(to!string(_env["pwd"]), "../../conf")).asNormalizedPath).array;
- string _dr_doc_conf_pwd_d = ((chainPath(to!string(_env["pwd"]), "../../../conf")).asNormalizedPath).array;
- _possible_config_path_locations = [
- _dr_doc_conf_pwd,
- _dr_doc_conf_pwd_a,
- _dr_doc_conf_pwd_b,
- _dr_doc_conf_pwd_c,
- _dr_doc_conf_pwd_d,
- _dot_pwd,
- _underscore_pwd,
- _dot_home,
- "/etc/dr"
- ];
- }
- } else {
- _possible_config_path_locations = [
- _cli_config_path_set
- ];
- }
- /+ FIX clean up conf paths ↑
- (compare pwd to doc path location, and build config path)
- +/
- return _possible_config_path_locations;
- }
- }
- return _ConfFilePaths();
- }
- }
- return ConfFilePaths();
- }
-}
-template spinePathsSRC() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- auto spinePathsSRC(D,Fn)(
- D _pwd,
- Fn _fn_src_and_path,
- ) {
- struct drSrcPaths {
- auto pwd() {
- return _pwd;
- }
- string language() {
- // use command line info as well?
- string _k;
- if (auto m = _fn_src_and_path.match(rgx.language_code_and_filename)) {
- _k = m.captures[1];
- } else { /+ unknown until doc_meta read, (could provide & use command line info?) +/
- _k = "xx"; // original default was "en" but is not known
- }
- return _k;
- }
- string doc_root() {
- return "dr_doc";
- }
- auto media_root() {
- return ((doc_root.chainPath("media")).asNormalizedPath).array;
- }
- auto conf_root() {
- return ((doc_root.chainPath("conf")).asNormalizedPath).array;
- }
- auto text_root() {
- return ((media_root.chainPath("text")).asNormalizedPath).array;
- }
- auto image_root() {
- return ((media_root.chainPath("image")).asNormalizedPath).array;
- }
- auto doc_src_fn_with_path_for_text_root_and_lng() {
- return ((text_root.chainPath(language)).asNormalizedPath).array;
- }
- auto doc_src_fn() {
- return ((_fn_src_and_path.baseName).asNormalizedPath).array;
- }
- auto doc_src_with_path() {
- return ((pwd.chainPath(_fn_src_and_path)).asNormalizedPath).array;
- }
- }
- return drSrcPaths();
- }
-}
-
-
-template spinePathsPods() {
- mixin spineRgxInit;
- static auto rgx = Rgx();
- string _suffix = ".zip";
- auto spinePathsPods(M)(M doc_matters) {
- string _base_dir_pod = (doc_matters.output_path.length > 0)
- ? doc_matters.output_path ~ "/pod"
- : "/pod";
- string _base_dir_doc = "dr_doc";
- struct _PodPaths {
- string base_filename_(string fn_src) {
- auto pth = fn_src.baseName.stripExtension;
- return pth;
- }
- string pod_dir_() {
- auto pth = _base_dir_pod;
- return pth;
- }
- string dr_doc_dir_() {
- auto pth = _base_dir_doc;
- return pth;
- }
- string pod_filename_(string fn_src) {
- string pth = _base_dir_pod.chainPath(base_filename_(fn_src) ~ _suffix).array;
- return pth;
- }
- string base_filesystem_(string fn_src) {
- string pth = _base_dir_pod.chainPath(base_filename_(fn_src)).array;
- assert(pth == _base_dir_pod ~ "/" ~ base_filename_(fn_src),
- pth ~ " == " ~ _base_dir_pod ~ "/" ~ base_filename_(fn_src) ~ "?");
- return pth;
- }
- string output_pod_manifest_file(string fn_src) {
- string pth = base_filesystem_(fn_src).chainPath("pod.manifest").array;
- return pth;
- }
- string base_pod_(string fn_src) {
- string pth = _base_dir_pod.chainPath(base_filename_(fn_src)).array; // change this
- return pth;
- }
- auto base_filename(string fn_src) {
- auto pth_1_ = base_filename_(fn_src);
- auto pth_2_ = base_filename_(fn_src);
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- return pth_2_;
- }
- }
- return _pods();
- }
- auto pod_filename(string fn_src) {
- auto pth_1_ = pod_filename_(fn_src);
- auto pth_2_ = pod_filename_(fn_src);
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- return pth_2_;
- }
- }
- return _pods();
- }
- auto base(string fn_src) {
- auto pth_1_ = "";
- auto pth_2_ = base_filesystem_(fn_src);
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- return pth_2_;
- }
- }
- return _pods();
- }
- auto pod_root(string fn_src) {
- auto pth_1_ = "pod";
- auto pth_2_ = ((base(fn_src).filesystem_open_zpod.chainPath("")).asNormalizedPath).array; // "dr_doc"
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- return pth_2_;
- }
- }
- return _pods();
- }
- auto conf_root(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = "conf";
- auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("conf")).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto css(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((conf_root(fn_src).zpod.chainPath("css")).asNormalizedPath).array;
- auto pth_2_ = ((conf_root(fn_src).filesystem_open_zpod.chainPath("css")).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto pod_manifest(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((pod_root(fn_src).zpod.chainPath("pod.manifest")).asNormalizedPath).array;
- auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("pod.manifest")).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto media_root(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((pod_root(fn_src).zpod.chainPath("media")).asNormalizedPath).array;
- auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath("media")).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto text_root(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((media_root(fn_src).zpod.chainPath("text")).asNormalizedPath).array;
- auto pth_2_ = ((media_root(fn_src).filesystem_open_zpod.chainPath("text")).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto doc(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = text_root(fn_src).zpod;
- auto pth_2_ = text_root(fn_src).filesystem_open_zpod;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto doc_lng(string fn_src, string lng) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((text_root(fn_src).zpod.chainPath(lng)).asNormalizedPath).array;
- auto pth_2_ = ((text_root(fn_src).filesystem_open_zpod.chainPath(lng)).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto image_root(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((media_root(fn_src).zpod.chainPath("image")).asNormalizedPath).array;
- auto pth_2_ = ((media_root(fn_src).filesystem_open_zpod.chainPath("image")).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto fn_pod_filelist(string fn_src) {
- auto pod_root_ = pod_root(fn_src);
- auto _manifested = PodManifest!()(fn_src).pod_manifest_filename;
- auto pth_1_ = _manifested;
- auto pth_2_ = ((pod_root(fn_src).filesystem_open_zpod.chainPath(_manifested)).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto fn_doc(string fn_src, string lng) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((doc_lng(fn_src, lng).zpod.chainPath(fn_src.baseName)).asNormalizedPath).array;
- auto pth_2_ = ((doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_src.baseName)).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- auto fn_doc_insert(string fn_src, string fn_insert, string lng) {
- auto pod_root_ = pod_root(fn_src);
- auto pth_1_ = ((doc_lng(fn_src, lng).zpod.chainPath(fn_insert.baseName)).asNormalizedPath).array;
- auto pth_2_ = ((doc_lng(fn_src, lng).filesystem_open_zpod.chainPath(fn_insert.baseName)).asNormalizedPath).array;
- struct _pods {
- auto zpod() {
- return pth_1_;
- }
- auto filesystem_open_zpod() {
- assert(pod_root_.filesystem_open_zpod.chainPath(zpod).array == pth_2_);
- return pth_2_;
- }
- }
- return _pods();
- }
- }
- return _PodPaths();
- }
-}
diff --git a/src/doc_reform/source/read_config_files.d b/src/doc_reform/source/read_config_files.d
deleted file mode 100644
index f522c29..0000000
--- a/src/doc_reform/source/read_config_files.d
+++ /dev/null
@@ -1,155 +0,0 @@
-/++
- read configuration files
- - read config files
- meta_config_files.d
-+/
-module doc_reform.source.read_config_files;
-
-static template readConfigSite() {
- import
- doc_reform.meta.rgx;
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- mixin spineRgxInit;
- final auto readConfigSite(M,E)(
- M _manifested,
- E _env,
- string _cli_config_path_set = ""
- ) {
- static auto rgx = Rgx();
- string config_file_str;
- string conf_filename = "NONE";
- auto _conf_file_details = ConfigFilePaths!()(_manifested, _env, _cli_config_path_set);
- string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.config_local_site;
- foreach(conf_fn; [_conf_file_details.config_filename_site]) {
- foreach(pth; possible_config_path_locations) {
- char[] conf_file;
- conf_filename = conf_fn;
- if (exists(pth)) {
- auto f_attrib = pth.getLinkAttributes;
- if (
- possible_config_path_locations.length == 1
- && f_attrib.attrIsFile
- ) {
- conf_file = pth.to!(char[]);
- conf_filename = pth.baseName;
- } else if (f_attrib.attrIsDir) {
- conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array;
- conf_filename = conf_fn;
- }
- try {
- if (exists(conf_file)) {
- if (conf_file.getLinkAttributes.attrIsFile) {
- config_file_str = conf_file.readText;
- break;
- }
- }
- } catch (ErrnoException ex) {
- } catch (FileException ex) {
- }
- }
- }
- if (config_file_str.length > 0) { break; }
- }
- struct _ConfContent {
- string filename() {
- return conf_filename;
- }
- string filetype() {
- string _ft = "";
- if (content.match(rgx.yaml_config)) {
- _ft = "yaml";
- }
- return _ft;
- }
- string content() {
- return config_file_str;
- }
- }
- return _ConfContent();
- }
-}
-static template readConfigDoc() {
- import
- doc_reform.meta.rgx;
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- mixin spineRgxInit;
- final auto readConfigDoc(M,E)(M _manifested, E _env) {
- static auto rgx = Rgx();
- string config_file_str;
- string conf_filename = "NONE";
- auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
- string[] possible_config_path_locations = _conf_file_details.possible_config_path_locations.dr_document_make;
- foreach(conf_fn; [_conf_file_details.config_filename_document]) {
- foreach(pth; possible_config_path_locations) {
- auto conf_file = ((chainPath(pth.to!string, conf_fn)).asNormalizedPath).array;
- conf_filename = conf_fn;
- if (config_file_str.length > 0) {
- break;
- }
- try {
- if (exists(conf_file)) {
- if (conf_file.getLinkAttributes.attrIsFile) {
- config_file_str = conf_file.readText;
- break;
- }
- }
- } catch (ErrnoException ex) {
- } catch (FileException ex) {
- }
- }
- if (config_file_str.length > 0) { break; }
- }
- struct _ConfContent {
- string filename() {
- return conf_filename;
- }
- string content() {
- return config_file_str;
- }
- string filetype() {
- string _ft = "";
- if (content.match(rgx.yaml_config)) {
- _ft = "yaml";
- }
- return _ft;
- }
- }
- return _ConfContent();
- }
-}
-static template configReadSiteYAML() {
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- final YAMLDocument configReadSiteYAML(M,E)(M _manifested, E _env) {
- string _configuration = configReadInSiteYAML!()(_manifested, _env);
- auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
- string _conf_yaml_fn = _conf_file_details.config_filename_site;
- YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml_fn);
- return _yaml_conf;
- }
-}
-static template configReadDocYAML() {
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- final YAMLDocument configReadDocYAML(M,E)(M _manifested, E _env) {
- string _configuration = configReadInDocYAML!()(_manifested, _env);
- auto _conf_file_details = ConfigFilePaths!()(_manifested, _env);
- string _conf_yaml_fn = _conf_file_details.config_filename_document;
- YAMLDocument _yaml_conf = configYAML!()(_configuration, _conf_yaml_fn);
- return _yaml_conf;
- }
-}
diff --git a/src/doc_reform/source/read_source_files.d b/src/doc_reform/source/read_source_files.d
deleted file mode 100644
index 7626a89..0000000
--- a/src/doc_reform/source/read_source_files.d
+++ /dev/null
@@ -1,348 +0,0 @@
-/++
- module source_read_source_files;
- - open markup files
- - if master file scan for addional files to import/insert
-+/
-module doc_reform.source.read_source_files;
-static template spineRawMarkupContent() {
- import
- doc_reform.meta.rgx;
- import
- doc_reform.meta,
- doc_reform.source.paths_source,
- std.file,
- std.path;
- mixin spineRgxInit;
- static auto rgx = Rgx();
- string[] _images=[];
- auto _extract_images(S)(S content_block) {
- string[] images_;
- string _content_block = content_block.to!string;
- if (auto m = _content_block.matchAll(rgx.image)) {
- images_ ~= m.captures[1].to!string;
- }
- return images_;
- }
- auto rawsrc = RawMarkupContent();
- auto spineRawMarkupContent(O,Fn)(O _opt_action, Fn fn_src) {
- auto _0_header_1_body_content_2_insert_filelist_tuple
- = rawsrc.sourceContentSplitIntoHeaderAndBody(_opt_action, rawsrc.sourceContent(fn_src), fn_src);
- return _0_header_1_body_content_2_insert_filelist_tuple;
- }
- struct RawMarkupContent {
- final sourceContent(in string fn_src) {
- auto raw = MarkupRawUnit();
- auto source_txt_str
- = raw.markupSourceReadIn(fn_src);
- return source_txt_str;
- }
- final auto sourceContentSplitIntoHeaderAndBody(O)(O _opt_action, in string source_txt_str, in string fn_src="") {
- auto raw = MarkupRawUnit();
- string[] insert_file_list;
- string[] images_list;
- auto t
- = raw.markupSourceHeaderContentRawLineTupleArray(source_txt_str);
- auto header_raw = t[0];
- auto sourcefile_body_content = t[1];
- if (fn_src.match(rgx.src_fn_master)) { // filename with path needed if master file (.ssm) not otherwise
- auto ins = Inserts();
- auto tu
- = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src);
- static assert(!isTypeTuple!(tu));
- sourcefile_body_content = tu[0];
- insert_file_list = tu[1].dup;
- images_list = tu[2].dup;
- } else if (_opt_action.source || _opt_action.pod) {
- auto ins = Inserts();
- auto tu
- = ins.scan_master_src_for_insert_files_and_import_content(_opt_action, sourcefile_body_content, fn_src);
- static assert(!isTypeTuple!(tu));
- images_list = tu[2].dup;
- }
- string header_type = "";
- if (header_raw.match(rgx.yaml_config)) {
- header_type = "yaml";
- }
- t = tuple(
- header_raw,
- sourcefile_body_content,
- header_type,
- insert_file_list,
- images_list
- );
- static assert(t.length==5);
- return t;
- }
- }
- struct MarkupRawUnit {
- import std.file;
- final private string readInMarkupSource(in char[] fn_src) {
- enforce(
- exists(fn_src)!=0,
- "file not found: «" ~
- fn_src ~ "»"
- );
- string source_txt_str;
- try {
- if (exists(fn_src)) {
- if (fn_src.getLinkAttributes.attrIsFile) {
- source_txt_str = fn_src.readText;
- } else {
- }
- }
- } catch (ErrnoException ex) {
- } catch (UTFException ex) {
- // Handle validation errors
- } catch (FileException ex) {
- // Handle errors
- }
- std.utf.validate(source_txt_str);
- return source_txt_str;
- }
- final private char[][] header0Content1(in string src_text) {
- /+ split string on _first_ match of "^:?A~\s" into [header, content] array/tuple +/
- char[][] header_and_content;
- auto m = (cast(char[]) src_text).matchFirst(rgx.heading_a);
- header_and_content ~= m.pre;
- header_and_content ~= m.hit ~ m.post;
- assert(header_and_content.length == 2,
- "document markup is broken, header body split == "
- ~ header_and_content.length.to!string
- ~ "; (header / body array split should == 2 (split is on level A~))"
- );
- return header_and_content;
- }
- final private char[][] markupSourceLineArray(in char[] src_text) {
- char[][] source_line_arr
- = (cast(char[]) src_text).split(rgx.newline_eol_strip_preceding);
- return source_line_arr;
- }
- auto markupSourceReadIn(in string fn_src) {
- static auto rgx = Rgx();
- enforce(
- fn_src.match(rgx.src_pth_sst_or_ssm),
- "not a dr markup filename: «" ~
- fn_src ~ "»"
- );
- auto source_txt_str = readInMarkupSource(fn_src);
- return source_txt_str;
- }
- auto markupSourceHeaderContentRawLineTupleArray(in string source_txt_str) {
- string[] file_insert_list = [];
- string[] images_list = [];
- char[][] hc = header0Content1(source_txt_str);
- char[] header = hc[0];
- char[] source_txt = hc[1];
- auto source_line_arr = markupSourceLineArray(source_txt);
- string header_type = "";
- if (header.match(rgx.yaml_config)) {
- header_type = "yaml";
- }
- auto t = tuple(
- header,
- source_line_arr,
- header_type,
- file_insert_list,
- images_list
- );
- return t;
- }
- final char[][] getInsertMarkupSourceContentRawLineArray(
- in char[] fn_src_insert,
- Regex!(char) rgx_file
- ) {
- enforce(
- fn_src_insert.match(rgx_file),
- "not a dr markup filename: «" ~
- fn_src_insert ~ "»"
- );
- auto source_txt_str = readInMarkupSource(fn_src_insert);
- auto source_line_arr = markupSourceLineArray(source_txt_str);
- return source_line_arr;
- }
- }
- struct Inserts {
- auto scan_subdoc_source(O)(
- O _opt_action,
- char[][] markup_sourcefile_insert_content,
- string fn_src
- ) {
- mixin spineRgxInitFlags;
- char[][] contents_insert;
- int[string] type1 = flags_type_init;
- auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm);
- auto markup_src_file_path = fn_pth_full.captures[1];
- foreach (line; markup_sourcefile_insert_content) {
- if (type1["curly_code"] == 1) {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
- if (line.matchFirst(rgx.block_curly_code_close)) {
- type1["curly_code"] = 0;
- }
- contents_insert ~= line;
- } else if (line.matchFirst(rgx.block_curly_code_open)) {
- type1["curly_code"] = 1;
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
- contents_insert ~= line;
- } else if (type1["tic_code"] == 1) {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
- if (line.matchFirst(rgx.block_tic_close)) {
- type1["tic_code"] = 0;
- }
- contents_insert ~= line;
- } else if (line.matchFirst(rgx.block_tic_code_open)) {
- type1["tic_code"] = 1;
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
- contents_insert ~= line;
- } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
- auto insert_fn = m.captures[2];
- auto insert_sub_pth = m.captures[1];
- auto fn_src_insert
- = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array;
- auto raw = MarkupRawUnit();
- auto markup_sourcesubfile_insert_content
- = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts);
- debug(insert_file) {
- writeln(line);
- writeln(fn_src_insert);
- writeln(
- " length contents insert array: ",
- markup_sourcesubfile_insert_content.length
- );
- }
- if (_opt_action.source || _opt_action.pod) {
- _images ~= _extract_images(markup_sourcesubfile_insert_content);
- }
- auto ins = Inserts();
- /+
- - 1. load file
- - 2. read lines
- - 3. scan lines
- - a. if filename insert, and insert filename
- - repeat 1
- - b. else
- - add line to new array;
- - build image list, search for any image files to add to image list
- +/
- } else {
- type1["header_make"] = 0;
- type1["header_meta"] = 0;
- contents_insert ~= line; // images to extract for image list?
- if (_opt_action.source || _opt_action.pod) {
- auto _image_linelist = _extract_images(line);
- if (_image_linelist.length > 0) {
- _images ~= _image_linelist;
- }
- }
- }
- } // end src subdoc (inserts) loop
- auto t = tuple(
- contents_insert,
- _images
- );
- return t;
- }
- auto scan_master_src_for_insert_files_and_import_content(O)(
- O _opt_action,
- char[][] sourcefile_body_content,
- string fn_src
- ) {
- import std.algorithm;
- mixin spineRgxInitFlags;
- char[][] contents;
- int[string] type = flags_type_init;
- auto fn_pth_full = fn_src.match(rgx.src_pth_sst_or_ssm);
- auto markup_src_file_path = fn_pth_full.captures[1];
- char[][] contents_insert;
- string[] _images =[];
- string[] insert_file_list =[];
- foreach (line; sourcefile_body_content) {
- if (type["curly_code"] == 1) {
- if (line.matchFirst(rgx.block_curly_code_close)) {
- type["curly_code"] = 0;
- }
- contents ~= line;
- } else if (line.matchFirst(rgx.block_curly_code_open)) {
- type["curly_code"] = 1;
- contents ~= line;
- } else if (type["tic_code"] == 1) {
- if (line.matchFirst(rgx.block_tic_close)) {
- type["tic_code"] = 0;
- }
- contents ~= line;
- } else if (line.matchFirst(rgx.block_tic_code_open)) {
- type["tic_code"] = 1;
- contents ~= line;
- } else if (auto m = line.match(rgx.insert_src_fn_ssi_or_sst)) {
- auto insert_fn = m.captures[2];
- auto insert_sub_pth = m.captures[1];
- auto fn_src_insert
- = chainPath(markup_src_file_path, insert_sub_pth ~ insert_fn).array;
- insert_file_list ~= fn_src_insert.to!string;
- auto raw = MarkupRawUnit();
- /+ TODO +/
- auto markup_sourcefile_insert_content
- = raw.getInsertMarkupSourceContentRawLineArray(fn_src_insert, rgx.src_fn_find_inserts);
- debug(insert_file) {
- writeln(line);
- writeln(fn_src_insert);
- writeln(
- " length contents insert array: ",
- markup_sourcefile_insert_content.length
- );
- }
- auto ins = Inserts();
- auto contents_insert_tu = ins.scan_subdoc_source(
- _opt_action,
- markup_sourcefile_insert_content,
- fn_src_insert.to!string
- );
- contents ~= contents_insert_tu[0]; // images to extract for image list?
- if (_opt_action.source || _opt_action.pod) {
- auto _image_linelist = _extract_images(contents_insert_tu[0]);
- if (_image_linelist.length > 0) {
- _images ~= _image_linelist;
- }
- }
- /+
- - 1. load file
- - 2. read lines
- - 3. scan lines
- - a. if filename insert, and insert filename
- - repeat 1
- - b. else
- - add line to new array;
- - build image list, search for any image files to add to image list
- +/
- } else {
- contents ~= line;
- if (_opt_action.source || _opt_action.pod) {
- auto _image_linelist = _extract_images(line);
- if (_image_linelist.length > 0) {
- _images ~= _image_linelist;
- }
- }
- }
- } // end src doc loop
- string[] images = [];
- foreach(i; uniq(_images.sort())) {
- images ~= i;
- }
- debug(insert_file) {
- writeln(__LINE__);
- writeln(contents.length);
- }
- auto t = tuple(
- contents,
- insert_file_list,
- images
- );
- return t;
- }
- }
-}
diff --git a/src/doc_reform/spine.d b/src/doc_reform/spine.d
index c70b87c..51e571d 100755
--- a/src/doc_reform/spine.d
+++ b/src/doc_reform/spine.d
@@ -71,10 +71,10 @@ import
doc_reform.meta.defaults,
doc_reform.meta.doc_debugs,
doc_reform.meta.rgx,
- doc_reform.source.paths_source,
- doc_reform.source.read_config_files,
- doc_reform.source.read_source_files,
- doc_reform.output.hub;
+ doc_reform.io_in.paths_source,
+ doc_reform.io_in.read_config_files,
+ doc_reform.io_in.read_source_files,
+ doc_reform.io_out.hub;
import std.algorithm;
import std.parallelism;
mixin(import("version.txt"));
@@ -942,7 +942,7 @@ void main(string[] args) {
spineMetaDocHarvestsAuthors!()(hvst.harvests, _make_and_meta_struct, _opt_action);
}
if (!(_opt_action.quiet)) {
- import doc_reform.output.paths_output;
+ import doc_reform.io_out.paths_output;
auto out_pth = spinePathsHTML!()(_make_and_meta_struct.conf.output_path, "");
if (_opt_action.harvest_authors) {
writeln("- ", out_pth.harvest("authors.html"));
--
cgit v1.2.3