Edgewall Software

Ticket #2645 (new defect)

Opened 3 years ago

Last modified 10 months ago

Report custom formatting: font styles not honored

Reported by: kilian.cavalotti@… Owned by: daniel
Priority: lowest Milestone: 2.0
Component: report system Version: 0.9.3
Severity: normal Keywords: style report font
Cc: whueskes@…

Description

I have a problem with reports custom formatting: when using style to change font properties, the specified style is not applied. The following example, given in TracReports, illustrates the problem :

SELECT p.value AS __color__,
     t.milestone AS __group__,
     (CASE owner WHEN '$USER' THEN 'font-weight: bold; background: red;' ELSE 
'' END) AS __style__,
       t.id AS ticket, summary
  FROM ticket t,enum p
  WHERE t.status IN ('new', 'assigned', 'reopened') 
    AND p.name=t.priority AND p.type='priority'
  ORDER BY t.milestone, p.value, t.severity, t.time

Using this report, I correctly see my tickets with a red background, but the font weight is normal. I assume that's because the style="font-weight:bold" attribute is passed to the <tr> tag, when it should probably be passed to each <td> element.

With

(CASE owner WHEN '$USER' THEN 'font-weight: bold;' ELSE '' END) AS __style__,

the generated HTML looks like below:

<tr class="color2-odd" style="font-weight: bold;">
    <td class="ticket">
        <a title="View ticket" href="/trac/ticket/52"> #52 </a>
    </td>
    <td class="component"> trac </td>
    <td class="status"> new </td>
    <td class="type"> task </td>
    <td class="priority"> high </td>
    <td class="severity"> normal </td>
    <td class="owner"> kilian </td>
    <td class="date"> 01/17/06 </td>
</tr>

Attachments

Change History

Changed 3 years ago by whueskes@…

  • cc whueskes@… added

Workaround: change in htdocs/css/trac.css

body, th, td {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
} 

into:

body, th {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
} 

Changed 3 years ago by whueskes@…>

or even better:

body, th, tr {
 font: normal 13px verdana,arial,'Bitstream Vera Sans',helvetica,sans-serif;
} 

Changed 21 months ago by cboos

  • priority changed from normal to lowest
  • milestone set to 2.0

Perhaps related to #633?

Changed 21 months ago by whueskes@…

the (second) workaround is working fine for me.

Here is a test case: http://www.hosted-projects.com/trac/TracDemo/Demo/report/14
The background color is applied, but the font is not made bold.
When I edit the css using https://addons.mozilla.org/firefox/60/, I see no other visual change except that line becoming bold, but I am no css expert, so there might be situations or browsers where it does change something.

Changing the DOCTYPE might also solve the problem: (google groups)

Changed 15 months ago by cboos

  • summary changed from Repoort custom formatting: font styles not honored to Report custom formatting: font styles not honored

Changed 10 months ago by osimons

#5128 closed as a duplicate. It contains some related discussion, and identification of a code change that solved it using 0.10.4.

Add/Change #2645 (Report custom formatting: font styles not honored)

Author



Change Properties
<Author field>
Action
as new
as The resolution will be set. Next status will be 'closed'
to The owner will change from daniel. Next status will be 'new'
The owner will change from daniel to anonymous. Next status will be 'assigned'
 
Note: See TracTickets for help on using tickets.