aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sisudoc/spine.d
diff options
context:
space:
mode:
Diffstat (limited to 'src/sisudoc/spine.d')
-rw-r--r--src/sisudoc/spine.d58
1 files changed, 56 insertions, 2 deletions
diff --git a/src/sisudoc/spine.d b/src/sisudoc/spine.d
index 18beda2..c1a3f63 100644
--- a/src/sisudoc/spine.d
+++ b/src/sisudoc/spine.d
@@ -72,6 +72,7 @@ import sisudoc.ocda.meta.conf_make_meta_json;
import sisudoc.ocda.meta.defaults;
import sisudoc.ocda.meta.doc_debugs;
import sisudoc.ocda.meta.ocn_align;
+import sisudoc.ocda.meta.reserved_names;
import sisudoc.ocda.meta.rgx;
import sisudoc.ocda.meta.rgx_yaml;
import sisudoc.ocda.meta.rgx_files;
@@ -438,8 +439,11 @@ Verifying:
check is otherwise automatic and runs before
anything is written.
- --strict document checks that warn become failures, ocn
- alignment between languages among them.
+ --strict document checks that warn become failures: ocn
+ alignment between languages, and a heading that
+ claims a segment name spine keeps for a section of
+ its own (toc, endnotes, glossary, bibliography,
+ bookindex, blurb).
┃");
/+ ↓ --help is a question answered on stdout, not a run: the
scope(success) banner would be the last line of the answer
@@ -1681,6 +1685,12 @@ Verifying:
+/
mixin spineOcnAlign _ocna;
_ocna.ST_OcnProfile[] _ocn_profiles;
+ /+ ↓ headings that claimed a name spine keeps for a generated section.
+ Reported as each document goes by, where the document can be named, and
+ remembered here only so that --strict has something to fail on.
+ +/
+ mixin spineReservedNames _rsvd;
+ bool _reserved_name_used = false;
/+ ↓ what verify found, gathered as the documents go by +/
size_t _verify_checked = 0;
size_t _verify_failed = 0;
@@ -1854,6 +1864,23 @@ Verifying:
}
synchronized { _ocn_profiles ~= _ocn_p; }
}
+ /+ ↓ a heading of this document that asked for a name spine uses for a section
+ of its own. Said here, where the document can be named, and per language:
+ the markup is per language and so is the answer.
+ +/
+ {
+ auto _rsvd_uses = _rsvd.reservedNameHeadings(doc);
+ if (_rsvd_uses.length > 0) {
+ foreach (_line; _rsvd.reservedNameReportLines(
+ doc.matters.src.doc_uid_out_no_lang,
+ doc.matters.src.language,
+ _rsvd_uses,
+ )) {
+ stderr.writeln(_line);
+ }
+ synchronized { _reserved_name_used = true; }
+ }
+ }
if (doc.matters.opt.action.curate) {
auto _hvst = spineMetaDocCurate!()(doc.matters, hvst);
if (
@@ -2058,6 +2085,20 @@ Verifying:
}
_ocn_profiles ~= _ocn_p;
}
+ /+ ↓ reserved segment names, as above +/
+ {
+ auto _rsvd_uses = _rsvd.reservedNameHeadings(doc);
+ if (_rsvd_uses.length > 0) {
+ foreach (_line; _rsvd.reservedNameReportLines(
+ doc.matters.src.doc_uid_out_no_lang,
+ doc.matters.src.language,
+ _rsvd_uses,
+ )) {
+ stderr.writeln(_line);
+ }
+ _reserved_name_used = true;
+ }
+ }
if (doc.matters.opt.action.curate) {
auto _hvst = spineMetaDocCurate!()(doc.matters, hvst);
if (
@@ -2288,6 +2329,19 @@ Verifying:
import core.stdc.stdlib : exit;
exit(1);
}
+ /+ ↓ --strict and a heading that claimed a name spine keeps for itself.
+ The same shape as the check above: the warning has already named the
+ document and the heading, the output of the run is complete and can be
+ looked at, and this is the exit status. A publishable run should not
+ contain a heading called something other than what its author wrote.
+ +/
+ if (_reserved_name_used && _opt_action.strict) {
+ stderr.writeln(
+ "~ run FAILED ~ --strict: a heading claims a reserved segment name"
+ );
+ import core.stdc.stdlib : exit;
+ exit(1);
+ }
/+ ↓ a verification that failed is a failed run, whatever else went well.
--no-verify has already said its piece per document and does not reach
here: it turns the failure into a warning and the output is produced