Edgewall Software

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#10667 closed enhancement (fixed)

Better HTML tag metadata in page output

Reported by: chad@… Owned by: chad@…
Priority: normal Milestone: 1.0
Component: ticket system Version: 0.12.2
Severity: minor Keywords:
Cc: ethan.jucovy@… Branch:
Release Notes:
API Changes:

trac-field-<fieldname> classes added to field changes in the ticket change history [11112]

Internal Changes:


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)

ticket_change.add_attributes.patch (997 bytes ) - added by chad@… 9 years ago.
adds class attributes to li and strong tags in change history

Download all attachments as: .zip

Change History (12)

comment:1 by Christian Boos, 9 years ago

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)

comment:2 by chad@…, 9 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 Christian Boos, 9 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 anonymous, 9 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 chad@…, 9 years ago

adds class attributes to li and strong tags in change history

comment:5 by Ethan Jucovy <ethan.jucovy@…>, 9 years ago

Cc: ethan.jucovy@… added

comment:6 by Remy Blank, 9 years ago

Milestone: 1.01.0-triage

Preparing for 1.0.

comment:7 by Christian Boos, 9 years ago

Milestone: next-stable-1.0.x1.0
Owner: set to Christian Boos

Patch looks good, should be OK for 1.0.

comment:8 by Remy Blank, 9 years ago

Resolution: fixed
Status: newclosed

Slightly simpler patch applied in [11112], with class attributes trac-field-* to avoid clashing with e.g. the trac-conflict class.

comment:9 by Remy Blank, 9 years ago

Owner: changed from Christian Boos to chad@…

in reply to:  9 comment:10 by Christian Boos, 9 years ago

API Changes: modified (diff)
Severity: normalminor

comment:11 by Christian Boos, 9 years ago

Component: renderingticket system

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain chad@….
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from chad@… to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.