-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix generated_html failure when the meta line doesn't have a "content" attribute #4628
Conversation
This reverts commit 84428d3b9ef746ea94046ad65781ac4245d5f629.
This reverts commit fc0da0388afc18e70baf9de328e0b6e9468276bb.
469594a
to
b34ed98
Compare
I literally just commented about this on
I checked your branch out locally: $ cd /tmp && git clone --depth=10 --single-branch --branch lildude/fix-gen_html-error -- git@github.com:github/linguist.git ... which revealed some disconcerting metadata. 😕 Note the
|
Sorted and they have absolutely nothing to do with the 500 errors. You can see it in real life at https://github.com/tj/git-extras/pull/769/files I was pinged on those 500 errors. |
I've also corrected the author info and force-pushed to this branch. Problem persists. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly speaking, <meta />
elements don't have a value=
attribute, and I assume this error was propagated due to the common pairing of name
and value
when naming stuff that represents a key/value pair.
Valid or not, it's still in our interests to support it. The DOM purist in me couldn't approve this PR without pointing this out, however. 😉
(Then again, I wouldn't expect accurate markup from Ronn of all things... 😜)
Gonna test on staging before merging this, just in case it's not a complete fix. |
Confirmed this does the trick in staging. Merging and will now make a new release. |
Description
It has come to light that the changes in
generated_html()
added in #4574 don't correctly handle meta lines that containname="generated"
attribute, but not acontent="?"
attribute, for example:... from https://github.com/tj/git-extras/blob/a56e14488e5cd713ad27370ec432fdd510353f53/man/git-alias.html#L5
This results in a 500 error (try clicking the first commit in this PR 😉) on GitHub.com with the following failure stack:
... as can be seen in the test failure I deliberately forced. See https://github.com/github/linguist/runs/206726836#step:5:68
This PR updates
generated_html()
to better handle the case wherecontent
doesn't exist, and also adds support for thevalue
attribute and additionally marks those generated by Ronn as generated too.Now the catch: I can't include the two sample files I want to include in this PR as doing so causes a 500 error when attempting to create this pull request.
I can add them back now the PR has been created, but then the files can't be viewed in the "Files Changed" tab as we hit the same 500 error. You can't view the individual commits containing those files either. All of these are caused by the issue I'm trying to fix here.
So for the moment, I'm going to leave out the tests and fixture files and add them once this PR has been merged and a new release made and pushed to GitHub.com.
The fix can be verified locally as follows:
test/fixtures/HTML/no-content.html
using another fixture as the source:sed -e 's/content/value/' test/fixtures/HTML/unknown.html > test/fixtures/HTML/no-content.html
generated_fixture_loading_data("HTML/no-content.html", true)
to the list of tests intest_generated.rb
bundle exec rake test TEST=test/test_generated.rb
- all test should pass.Similar changes can be made to test the
value="Ronn/....
support.Template removed as it's not relevant.