Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unneeded trailing slash of void elements #840

Merged
merged 1 commit into from
Dec 26, 2022

Conversation

ann0see
Copy link
Member

@ann0see ann0see commented Oct 7, 2022

Short description of changes

HTML void elements should not use trailing slashes: https://github.com/validator/validator/wiki/Markup-%C2%BB-Void-elements#trailing-slashes

This removes (hopefully) all of them
Context: Fixes an issue? Related issues
Makes w3c validator happy

Status of this Pull Request
Ready for review.

What is missing until this pull request can be merged?
Review

Does this need translation?

No.

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I'm sure that this Pull Request goes to the correct branch

@ann0see
Copy link
Member Author

ann0see commented Oct 7, 2022

Po4a doesn't seem to like removing "/"? Checks fail.

@ann0see ann0see marked this pull request as draft October 7, 2022 20:06
@pljones
Copy link
Contributor

pljones commented Oct 7, 2022

@ann0see
Copy link
Member Author

ann0see commented Oct 8, 2022

I thought we're using HTML5?

@pljones
Copy link
Contributor

pljones commented Oct 8, 2022

I thought we're using HTML5?

At a guess, do files declare that with a doctype? If we're leaving parsers to guess, it's easy to guess wrongly.

@ann0see
Copy link
Member Author

ann0see commented Oct 8, 2022

We do have a doctype html tag, so it should be interpreted as html5.

@pljones
Copy link
Contributor

pljones commented Oct 8, 2022

In Update .po files I can see:

../wiki/en/misc/1-index.html:48: (po4a::xml)
Unexpected closing tag </p> found. The main document may be wrong.

when updating the language files. Does that mean po4a thinks it's using xml style tags? That's also reported in Create translated docs and stats. I'd check for an extra </p> where one isn't needed based on the error report.


It looks like that then has a knock on effect as, later, in Build the site in the jekyll/builder container:

Installing jekyll-minifier 0.1.10
Bundle complete! 4 Gemfile dependencies, 37 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x86_64-linux-musl]
Configuration file: /srv/jekyll/_config.yml
            Source: /srv/jekyll
       Destination: /srv/jekyll/_site
 Incremental build: disabled. Enable with --incremental
      Generating... 
/usr/gem/gems/jekyll-4.2.2/lib/jekyll/utils.rb:141:in `initialize': No such file or directory @ rb_sysopen - /srv/jekyll/1-nl-index.html (Errno::ENOENT/usr/gem/gems/jekyll-4.2.2/lib/jekyll/utils.rb:141:in `initialize': No such file or directory @ rb_sysopen - /srv/jekyll/1-nl-index.html (Errno::ENOENT)
	from /usr/gem/gems/jekyll-4.2.2/lib/jekyll/utils.rb:141:in `open'Installing jekyll-minifier 0.1.10
Bundle complete! 4 Gemfile dependencies, 37 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
...

and then fails.

Then, Zip Website reports

  zip -r /home/runner/work/jamuluswebsite/jamuluswebsite/website.zip _site/*
  shell: /usr/bin/bash -e {0}
	zip warning: name not matched: _site/*

zip error: Nothing to do! (try: zip -r /home/runner/work/jamuluswebsite/jamuluswebsite/website.zip . -i _site/*)
Error: Process completed with exit code 12.

@ann0see
Copy link
Member Author

ann0see commented Oct 8, 2022

Does that mean po4a thinks it's using xml style tags?

Yes, that's what I suspect.

@pljones
Copy link
Contributor

pljones commented Oct 8, 2022

Mm. Nothing obvious like unbalanced tags... The document itelf doesn't have a <doctype> as it's a fragment. Does po4a have a config that's fed in?

@ann0see
Copy link
Member Author

ann0see commented Oct 8, 2022

I searched for it but didn't find anything.

@ignotus666 ?

@ignotus666
Copy link
Contributor

ignotus666 commented Oct 8, 2022

I can't really look into it properly yet until Monday but yes, html docs are processed as xml by po4a. I think the checks for tag "errors" can be disabled or left at just a warning (without aborting the file processing), as it seems to default to aborting. There's info about this in the official po4a documentation. It should be a matter of adding a config parameter to the scripts.

@pljones
Copy link
Contributor

pljones commented Oct 9, 2022

I'd really like to leave the config until we identify what's changed to cause it to start breaking.

@ignotus666
Copy link
Contributor

ignotus666 commented Oct 9, 2022

Here's the relevant page in the po4a docs - scroll down to "ontagerror". It seems that po4a interprets that <br> tag as an opening tag and doesn't like that the next closing tag doesn't match it. Turns out the update I was preparing for #817 would "fix" this by just printing a warning (and not exiting). I don't know if that's an acceptable solution though.

On closer inspection, I was using "ontagerror", but maybe "optionalclosingtag" would be a better choice?

@pljones
Copy link
Contributor

pljones commented Oct 9, 2022

Does HTML5 allow

<p>paragraph one
<p>paragraph two without a previous closing &lt;/p&gt;</p>

? Do we want to allow that? It sounds like "ontagerror" would cause the error - but also errors on <br> rather than <br/> and "optionalclosingtag" would allow the "missing" </p> whilst allowing <br>.

@ignotus666
Copy link
Contributor

Another option is to use the "Xhtml" instead of "xml" module in po4a. It correctly deals with those tags without adding options but segments the paragraphs in a completely different way, meaning translators would have to re-translate "1-Index.html", though it seems a re-write is in the works so maybe not such a big deal.

Here's an issue raised about the same problem that arose with the Xhtml module, but which seems to have been solved since.

@ann0see ann0see changed the base branch from release to next-release December 22, 2022 11:45
@ann0see ann0see marked this pull request as ready for review December 25, 2022 19:46
HTML void elements should not use trailing slashes:
https://github.com/validator/validator/wiki/Markup-%C2%BB-Void-elements#trailing-slashes

This removes (hopefully) all of them
Note: SVG images do need them.
Copy link
Member Author

@ann0see ann0see left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all is ok now after the update by ignotus.

@ann0see ann0see added this to the Release 3.10.0 milestone Dec 25, 2022
@ann0see ann0see requested a review from ignotus666 December 25, 2022 21:11
@ignotus666
Copy link
Contributor

There's something wrong - all the file updates with po4a fail, but the script doesn't exit and the check looks like it passed when it didn't. Apparentlylibs-parse-keyword-perl needs to be installed. I'm going to add it to the cache script, and change the key back to "po4a" to force a new cache to be created. Then re-run this action to see if it's fixed.

@ignotus666
Copy link
Contributor

Ok, fixed now.

@ann0see ann0see merged commit 7d11c14 into jamulussoftware:next-release Dec 26, 2022
@ann0see ann0see deleted the fixHTML branch December 26, 2022 09:23
@ignotus666
Copy link
Contributor

ignotus666 commented Dec 26, 2022

Aargh, this has caused Weblate to lock due to a whole load of conflicts...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants