在 Trac 中,是否可以添加“text-decoration: line-through”作为自定义 __style__?

发布于 2024-10-15 20:20:45 字数 1225 浏览 1 评论 0原文

我第一次设置 Trac 0.12.1,并编写了一些自定义报告查询。

但是,我很难获取自定义 __style__ 宏(在文档 此处)以显示 text-decoration: line-through; 样式。它根本不显示。

我的查询大致如下:

SELECT p.value AS __color__,
   (CASE status WHEN 'closed' THEN 'text-decoration: line-through' END)
      AS __style__,
   id AS ticket, priority, summary, version
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  ORDER BY version DESC, id DESC

这不会显示带有直通的关闭票证。我可以在渲染的页面源代码中看到它,它在 style="" 属性标记中的格式正确,如下所示:

  </tr>
  <tr class="color1-even" style="text-decoration: line-through;">
        <td class="ticket">

但是,将上面查询中的第 2 行更改为:

   (CASE status WHEN 'closed' THEN 'color: #666; background: #ccc' END)

它实际上确实显示了行颜色和背景更改为中灰色,因此该样式绝对有效。

有没有人足够熟悉 Trac 来解释为什么这可能不起作用,并提供解决方法?删除线确实有助于区分已关闭/无效的票证。

text-decoration:line-through 可能无法跨 tr 标签工作;如果是这种情况,是否有办法仅将 Trac __style__ 应用于一列(仅将其应用于 summary 就可以了。)

提前谢谢您。

I'm getting Trac 0.12.1 set up for the first time, and have written a few custom report queries.

However, I am having difficulty getting the custom __style__ macro thingy (described in the docs here) to display a text-decoration: line-through; style. It doesn't show up at all.

My query is roughly the following:

SELECT p.value AS __color__,
   (CASE status WHEN 'closed' THEN 'text-decoration: line-through' END)
      AS __style__,
   id AS ticket, priority, summary, version
  FROM ticket t
  LEFT JOIN enum p ON p.name = t.priority AND p.type = 'priority'
  ORDER BY version DESC, id DESC

This does not display closed tickets with line-through. I can see it in the rendered page source, it is correctly formatted in the style="" attribute tag, as such:

  </tr>
  <tr class="color1-even" style="text-decoration: line-through;">
        <td class="ticket">

However, changing line 2 in the query above to read:

   (CASE status WHEN 'closed' THEN 'color: #666; background: #ccc' END)

It actually does show the row color and background as changing to a medium-gray color, so the style is definitely working.

Is anyone familiar enough with Trac to say why this may not be working, and provide a workaround? Strike-through really helps to distinguish closed/invalid tickets.

It may be that text-decoration:line-through doesn't work across tr tags; if that is the case, is there a way to apply the Trac __style__ only on one column (having it only on the summary would be fine.)

Thank you in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沦落红尘 2024-10-22 20:20:45

我测试了以下最小 HTML 文档:

<html><body>
<table border=1>
<tr><th>Col 1</th><th>Col 2</th></tr>
<tr><td>Data 1</td><td>Data 2</td></tr>
<tr style="text-decoration: line-through;"><td>Data 3</td><td>Data 4</td></tr>
</table>
</body></html>

结果符合预期(在 Firefox 和 IE 中)。最后一行的文本有一条线贯穿其中。我不认为在 元素中包含 text-decoration: line-through; 是你的问题。

确保任何样式表中没有任何内容可能会覆盖内联 CSS。尝试使用 text-decoration: line-through !important 覆盖可能存在的任何其他样式。如果这改变了行为,那么您的问题是由样式表之一中的定义冲突引起的。

I tested out the following minimal HTML document:

<html><body>
<table border=1>
<tr><th>Col 1</th><th>Col 2</th></tr>
<tr><td>Data 1</td><td>Data 2</td></tr>
<tr style="text-decoration: line-through;"><td>Data 3</td><td>Data 4</td></tr>
</table>
</body></html>

The results were as expected (in both Firefox and IE). The text in the last row had a line running through it. I don't think having text-decoration: line-through; inside a <tr> element is your problem here.

Make sure that there isn't anything in any of your style sheets that might be overriding your inline CSS. Try using text-decoration: line-through !important to override any other styles that may be present. If this changes the behavior, then your problem is being caused by a conflicting definition in one of the style sheets.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文