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

[Bug 990816] HTML5 Validation For Questions #2407

Closed
wants to merge 8 commits into from

Conversation

NeonArray
Copy link

Since every single template file would need validated, I feel that it is beyond the scope of a single bug. That being said, I fixed all the errors I found except for one, which was out of my control since it is dynamically created in:
line 199 questions/templates/questions/includes/aaq_macros.html
The {{ url }} outputs two anchor links separated by a comma which the validator doesn't appreciate very much. I created the pull request since I corrected the errors listed initially with the bug report.

<time itemprop="dateCreated" datetime="{{ question.created }}">{{ datetimeformat(question.created) }}</time>
<span itemprop="dateCreated">
{{ datetimeformat(question.created) }}
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

You're using tabs for indentation here. They should be spaces instead.

Copy link
Author

Choose a reason for hiding this comment

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

Ok, fixed and pushed the changes.

<time itemprop="dateCreated" datetime="{{ question.created }}">{{ datetimeformat(question.created) }}</time>
<span itemprop="dateCreated">
{{ datetimeformat(question.created) }}
</span>
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this change will do what we want, though I'm not sure. The itemprop attribute is used as part of a microdata schema. I think you may need to modify datetimeformat to add extra parameters like itemprop.

@rehandalal You implemented the microdata stuff, right? Will it be fine to have the itemprop attribute on a surrounding <span> instead of on the <time> element that datetimeformat generates?

Copy link
Contributor

Choose a reason for hiding this comment

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

no we specifically want this in a <time> element. it is also a valid html5 tag.

Copy link
Author

Choose a reason for hiding this comment

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

A time element is still being created via datetimeformat(question.created), I only removed the outer time element. The parser looks for what is nested inside of the element that contains itemprop as well. It validates correctly using https://developers.google.com/structured-data/testing-tool/ , I obviously defer judgement to you guys, but that is the reasoning behind my changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah sorry my bad, i see that now. basically we need that itemprop attribute to be on the <time>. so perhaps datetimeformat will need to be updated. i need some time to dig around and figure out what should happen here.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rehandalal Any update here?

@rehandalal
Copy link
Contributor

Sorry about the delay responding to this...

I think we need to update datetimeformat in sumo/helpers.py to be something like:

def datetimeformat(context, value, format='shortdatetime', attrs=None):
   # attrs is a dict of attributes to be added to the <time> element.

Then we would use something like datetimeformat(question.created, attrs={'itemprop': 'dateCreated'}).

Does that make sense?

@willkg
Copy link
Member

willkg commented May 18, 2015

This PR is pretty old and there's no way it can get merged in now.

I think if we want to let it go forward, it should get rebased against master and the issues need to be resolved. Otherwise we should close it out and a new PR with updated changes should get created.

@mythmon mythmon closed this May 18, 2015
@mythmon
Copy link
Contributor

mythmon commented May 18, 2015

Please file a new PR with an updated version of this change, or parts of it. If we leave out the bit about the microdata, the rest of this could probably land easily.

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

Successfully merging this pull request may close these issues.

None yet

4 participants