diff options
| author | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-20 23:43:35 -0400 |
|---|---|---|
| committer | Ralph Amissah <ralph.amissah@gmail.com> | 2026-09-22 12:50:31 -0400 |
| commit | cd93d2d8b5062493650673ecdd13139d6f0e5171 (patch) | |
| tree | 23ab13665da3bc5aca4913ca8f8dc33eb5219bff /src/sisudoc/ocda | |
| parent | pod digests: multilingual document digests sorted (diff) | |
xml: markup language attributes take a bcp 47 tag
Spine names a language as the directory under media/text/ is
named, which for a region is the posix form with an underscore,
pt_BR. A lang, xml:lang or dc:language value is a BCP 47 (RFC
3066) tag and wants a hyphen, pt-BR. Spine put its own code
there unchanged, so a document in a region language produced an
invalid attribute in every one of its xhtml files: 138 epubcheck
errors for a document of ten segments and a navigation file.
src.language_tag is the same language as a tag. The attributes
and the dc metadata now read it. Output paths keep src.language,
since a path is named after the directory, not after the tag.
(assisted by Claude-Code)
Diffstat (limited to 'src/sisudoc/ocda')
| -rw-r--r-- | src/sisudoc/ocda/io_in/paths_source.d | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/sisudoc/ocda/io_in/paths_source.d b/src/sisudoc/ocda/io_in/paths_source.d index 9cacdf0..f32b89e 100644 --- a/src/sisudoc/ocda/io_in/paths_source.d +++ b/src/sisudoc/ocda/io_in/paths_source.d @@ -298,6 +298,21 @@ template PathMatters() { string language() { return lng(); } + /+ ↓ the same language, as a language tag rather than as spine's + own code. Spine names a language the way a directory under + media/text/ is named, which for a region is the posix form + with an underscore, pt_BR. A lang, xml:lang or dc:language + value is a BCP 47 (RFC 3066) tag and wants a hyphen, pt-BR; + an underscore there is invalid and every xhtml file in the + document carrying it is an epubcheck error. Every other code + spine knows (from the document sample set) is two letters, + where the two forms are equal, which is why only a region + code shows this up. + +/ + string language_tag() { + import std.array : replace; + return lng().replace("_", "-"); + } string file_with_absolute_path() { return _env["pwd"].chainPath(path_and_fn).array; } |
