diff options
Diffstat (limited to 'org/spine.org')
| -rw-r--r-- | org/spine.org | 58 |
1 files changed, 56 insertions, 2 deletions
diff --git a/org/spine.org b/org/spine.org index 49ef331..a0f0570 100644 --- a/org/spine.org +++ b/org/spine.org @@ -75,6 +75,12 @@ string program_name = "spine"; +/ 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; @@ -294,6 +300,19 @@ string program_name = "spine"; 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 @@ -348,6 +367,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; @@ -830,8 +850,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 @@ -2384,6 +2407,23 @@ if (doc.matters.opt.action.ocda_db) { } 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; } + } +} #+END_SRC ***** align ocn non-synchronized (serial processing) @@ -2401,6 +2441,20 @@ if (doc.matters.opt.action.ocda_db) { } _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; + } +} #+END_SRC ***** abstraction curate :abstraction:curate: |
