#10667 closed enhancement (fixed)
Better HTML tag metadata in page output
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | 1.0 |
Component: | ticket system | Version: | 0.12.2 |
Severity: | minor | Keywords: | |
Cc: | ethan.jucovy@… | Branch: | |
Release Notes: | |||
API Changes: |
|
||
Internal Changes: |
Description
Over at http://genshi.edgewall.org/ticket/521 I documented some of the hell that is using Genshi/XPath for interface customizations. While I like that the approach offers a way to do customizations that survive upgrades, it falls down a little in practice because the page output does not have enough tag metadata.
The example from that link above is customizing some of the labels in ticket change history. I didn't want to use the term 'Reporter'. In most other places in the interface, I was able to fairly easily change it out via a simple XPath selector. But in the change history it's just sitting inside a strong tag with no attributes. Hours later, I had finally figured out the proper XPath mojo that actually worked in Genshi to select those strong tags based on if they contained the text 'Reporter'.
The point is that if those tags had been properly classed, it would have taken me two minutes instead of hours, and the selector would be more accurate and consistent. Outside of adding a bit more data that has to come across the wire, I see no downside in being more verbose with tag attributes in the page output.
So my specific request is to please consider a more thorough treatment of the HTML document structure, to include tag metadata in a consistent manner that allows all aspects of the interface to be easily customized.
Attachments (1)
Change History (12)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
i'm afraid i don't know the trac codebase at all, and don't have the volunteer man hours to burn learning enough to generate quality patches. hopefully someone else will be able to step in and help out here.
comment:3 by , 13 years ago
Ah, but it won't involve digging into the codebase, just take the html page you need to modify as the base, modify a few of the rows the way you would like them to be, and make a diff. This would help to make clear what you really need.
comment:4 by , 13 years ago
Here's a start fixing just the problem area in my example. It's generated against 0.12.2, hope that works. This is really all I have time for, good luck!
by , 13 years ago
Attachment: | ticket_change.add_attributes.patch added |
---|
adds class attributes to li and strong tags in change history
comment:5 by , 13 years ago
Cc: | added |
---|
comment:7 by , 12 years ago
Milestone: | next-stable-1.0.x → 1.0 |
---|---|
Owner: | set to |
Patch looks good, should be OK for 1.0.
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Slightly simpler patch applied in [11112], with class attributes trac-field-*
to avoid clashing with e.g. the trac-conflict
class.
follow-up: 10 comment:9 by , 12 years ago
Owner: | changed from | to
---|
comment:10 by , 12 years ago
API Changes: | modified (diff) |
---|---|
Severity: | normal → minor |
comment:11 by , 12 years ago
Component: | rendering → ticket system |
---|
Sure, I was going to suggest something along those lines in a reply to your mail on Trac-dev.
In general, we do try to add appropriate semantic markup, but there can be places where it's missing. Can you please provide us with a patch for that specific issue, so that at least this one can be fixed? (using
trac-
prefixes for ids and classes, this is also a convention not yet enforced everywhere but that we try to apply for new code)