添加“上次编辑时间”跟踪 wiki 页面

发布于 2024-10-06 22:23:30 字数 258 浏览 2 评论 0原文

我的组织有一个庞大的 wiki,但并没有很好地保持最新状态。为了减少新人阅读页面而没有意识到它有多过时的危险,我想修改页面标题,以便顶部的内容不再是

页面名称

,而是类似

>页面名称 - 最后由 Joe 于 2010 年 5 月 8 日修改

我看到 Trac 允许页面模板,但如果我们以前没有使用过这些模板,是否有一个“空白”模板我可以更改以更改所有现有页面?

My organization has a sprawling wiki that isn't kept up to date very well. To reduce the danger of new people reading a page and not realizing how outdated it is, I'd like to modify the page header so that instead of

Page Name

at the top, it says something like

Page Name - last modified 5/8/10 by Joe

I see that Trac allows page templates, but if we haven't used those before, is there a 'blank' template I could alter to change all existing pages?

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

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

发布评论

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

评论(3

埖埖迣鎅 2024-10-13 22:23:30

除非您更改了某些内容,否则 Trac wiki 页面应该在每个页面的右上角有一个“上次修改”条目。将鼠标悬停在文本的不同部分上将显示更多详细信息,例如最后编辑页面的用户名以及上次编辑时间的详细时间戳。这与您所询问的功能有什么不同吗?

Unless you have changed something, Trac wiki pages should have a "Last Modified" entry in the top right-hand corner of each page. Hovering the mouse over different parts of the text will show you more details, like the user name of the last person to edit the page and a detailed timestamp of when the last edit was made. Is this different from the functionality that you are asking about?

盛夏已如深秋| 2024-10-13 22:23:30

您可以将以下内容放在项目目录的 templates 目录中的 site.html 中:

    <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/"
      py:strip="">
  <!--!
    This file allows customizing the appearance of the Trac installation.
    Add your customizations here and rename the file to site.html. Note that
    it will take precedence over a global site.html placed in the directory
    specified by [inherit] templates_dir.

    More information about site appearance customization can be found here:

      http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance
  -->

  <div py:match="div[@id='wikipage']" py:attrs="select('@*')" once="true">
    <h1>Last modified ${format_date(page.time)} by ${authorinfo(page.author)}</h1>
    ${select('*|text()|comment()')}
  </div>
</html>

它不会将最后修改的信息添加到标题中,而是在渲染之前显示它页面的其余部分。我认为您无法在不更改 wiki 格式呈现方式的代码的情况下将其添加到标题中。

You can put the following in site.html in the templates directory of your project directory:

    <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/"
      py:strip="">
  <!--!
    This file allows customizing the appearance of the Trac installation.
    Add your customizations here and rename the file to site.html. Note that
    it will take precedence over a global site.html placed in the directory
    specified by [inherit] templates_dir.

    More information about site appearance customization can be found here:

      http://trac.edgewall.org/wiki/TracInterfaceCustomization#SiteAppearance
  -->

  <div py:match="div[@id='wikipage']" py:attrs="select('@*')" once="true">
    <h1>Last modified ${format_date(page.time)} by ${authorinfo(page.author)}</h1>
    ${select('*|text()|comment()')}
  </div>
</html>

It doesn't add the last modified info into the title, but displays it before rendering the rest of the page. I don't think you can add it to the title without changing the code of how wiki formatting is rendered.

灼痛 2024-10-13 22:23:30

如果您希望上次修改日期更加明显,可以使用 LastModifiedMacro。我相当确定您可以使用一个简单的脚本将其插入到所有现有页面中,该脚本读取/写入数据库中的 wiki 表,但我自己从未做过类似的事情。看一下数据库架构,但请记住可能有更好的通过 Trac API 来完成此操作。

If you want the last modified date to be more visible, you can use the LastModifiedMacro. I'm fairly sure you could insert it into all existing pages with a simple script that read/writes to wiki table in the database, but I've never done anything like that myself. Take a look at the Database Schema, though keep in mind there may be a better way to do this through the Trac API.

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