Closed Bug 788063 Opened 12 years ago Closed 11 years ago

[socorro-crashstats] html5-tidy template files

Categories

(Socorro :: Webapp, task)

task
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: rhelmer, Assigned: espressive)

References

Details

(Whiteboard: [qa-])

Our HTML templates are a mess; let's run html5-tidy on them.

Warnings are ok, but malformed/badly formatted HTML just makes our life harder.
I already have this done, but it's disruptive so I'd like to land outstanding PRs before we do this.
Blocks: 788082
I still don't get this. We can't run tidy on the templates because they're not HTML. They're jinja. And we can't run it on the output because the output doesn't really exist. We'd have to have a middleware that's run last that tidies up the HTML output and that would be terribly slow.
(In reply to Peter Bengtsson [:peterbe] from comment #2)
> I still don't get this. We can't run tidy on the templates because they're
> not HTML. They're jinja. And we can't run it on the output because the
> output doesn't really exist. We'd have to have a middleware that's run last
> that tidies up the HTML output and that would be terribly slow.

My plan is to run html5-tidy on the template files, first manually changing {{ }} and {% %} to <%= %> <% %> respectively (html5-tidy's parser already supports template languages like PHP and JSP, I looked into adding jinja support but the parser makes a lot of assumptions about angle brackets so it'd be non-trivial)

Then I will go over the files by hand and remove the header/footer and reformat the jinja tags as appropriate (since it doesn't do much to format inside there)

As I said, this is definitely a one-time thing.. we'll want to get linters up running middleware on jenkins to keep it from backsliding, and not have to do this again.
Sounds risky. Mind you the {# comments #} too. 

Best of luck. I suspect you'll catch a couple of things at least. 

I'm not convinced about a middleware that only runs on jenkins. We can talk about that later.
(In reply to Peter Bengtsson [:peterbe] from comment #4)
> Sounds risky. Mind you the {# comments #} too. 
> 
> Best of luck. I suspect you'll catch a couple of things at least. 

The thing is, the templates are so small I could do this all by hand if I had to, I think it's worth letting the tool help a bit. I expect to just run through all the templates and make sure it looks kosher, so it just will save the tedium of doing this all by hand.

> I'm not convinced about a middleware that only runs on jenkins. We can talk
> about that later.

Yep that is for bug 788082 (not blocking staging)
Whiteboard: [qa-]
Blocks: 749359
No longer blocks: 788003
No longer blocks: 749359, 788082
Depends on: 749359
Not actively working on this
Assignee: rhelmer → nobody
Assignee: nobody → schalk.neethling.bugs
Commit pushed to master at https://github.com/mozilla/socorro

https://github.com/mozilla/socorro/commit/43e97e1f83a069f6da9f129234dc582182024f32
Merge pull request #1433 from ossreleasefeed/bug788063-ensure-templates-use-valid-html

Fix Bug 778063, ensure all pages validates against w3c validator
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 57
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.