Using lyxhtml_validity.py
Kornel Benko
kornel at lyx.org
Sat Jan 7 09:40:53 UTC 2023
Am Sat, 7 Jan 2023 03:59:54 +0100
schrieb Thibaut Cuvelier <dourouc05 at gmail.com>:
> On Sat, 31 Dec 2022 at 10:37, Kornel Benko <kornel at lyx.org> wrote:
>
> > Hi Thibaut,
> > I started to integrate (a modified) version of lyxhtml_validity.py.
> > But I am getting errors like in the attached.
> >
>
> Hi Kornel,
>
> It may very well be the latest patches I got for XHTML that trigger
> different code paths for the validator (I haven't run it yet since the
> switch to XHTML 5): some errors and warnings are related to the conversion
> to XHTML5, others just didn't trigger before.
>
> Error: Bad value "en_US" for attribute "lang" on element "html": The
> language subtag "en_us" is not a valid language subtag.
> This problem should be fixed by switching lib/languages' LangCode to BCP47,
> as suggested as a TODO in the comments. I implemented a quick fix in
> 26e6b1c2. As these are the only two places in LyX where the conversion is
> needed, I believe it is sufficient for now.
>
> Error: Bad value "Content-type" for attribute "http-equiv" on element
> "meta".
> The value must be in lower case, i.e. "content-type" (
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta). This is
> fixed at cabb12ba.
>
> Error: A document must not include both a "meta" element with an
> "http-equiv" attribute whose value is "content-type", and a "meta" element
> with a "charset" attribute.
> I removed one occurrence (the charset, because it is the newest and has the
> worst support among ancient browsers, pre-2010 roughly, and I had to pick
> one).
>
> Error: CSS: "font-weight": "medium" is not a "font-weight" value.
> That one is more tricky, it's a problem when defining a style. That's fixed
> as of 4c1f9d11.
>
> Warning: The "type" attribute for the "style" element is not needed and
> should be omitted.
> Not an error per se, but removing the deprecated argument shouldn't be a
> problem even for ancient browsers (only CSS was ever implemented, after
> all). https://developer.mozilla.org/en-US/docs/Web/HTML/Element/style Fixed
> at fb4a2657.
>
> Warning: Section lacks heading. Consider using "h2"-"h6" elements to add
> identifying headings to all sections.
> Not a serious error, but semantically the XHTML code could be much better
> (that could help with accessibility, for instance). Here is an excerpt for
> the Tufte example you are using:
> <section>
> <div class='chapter' id='magicparlabel-21'>The Features of the
> Tufte-book Class</div>
> This <div> really should be a <hSOMETHING>. I'm implementing a change in
> the layouts themselves for this (051c5f27). The other possibility would be
> to change Layout::htmltag() to return hX instead of div for sectioning
> elements, based on toclevel; the problem is that we would need to convert
> toclevel to an integer between 1 and 6. I remember seeing horrible values
> (including -1000, but also -1 for Beamer parts and other layouts), making
> me wary: is it possible to write simple code that works automagically for
> every interesting case?
>
> In any case, the script works as expected :)!
After your recent changes, the number of errors decreased :)
I got now (for Tufte_Book.xhtml)
Error: Bad value "content-type" for attribute "http-equiv" on element "meta".
From line 5, column 1 to line 5, column 68 in resource
file:/usr9/BUILD/Mint21/BuildLyxGitQt5.15.3local-gcc12.1.0/autotests/out-home/AbC_wGZLha/examples/es/Books/Tufte_Book.xhtml
Document checking completed.
> Found 3 validation errors!
Kornel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: Digitale Signatur von OpenPGP
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20230107/60ca94b9/attachment.asc>
More information about the lyx-devel
mailing list