【问题标题】:How do I format the postamble in HTML-export with Org-mode?如何使用 Org 模式格式化 HTML 导出中的 postamble?
【发布时间】:2012-03-16 18:45:30
【问题描述】:

我正在使用 org-mode 创建一个网站,并希望格式化 postamble,使其仅在页面底部、中心和水平位置显示创建日期和创建者。

在我的 .emacs 中有

(setq org-export-html-postamble-format "Last Updated %d. Created by %c")

在我的 index.org(和所有其他页面)的顶部,我有

# -*- org-export-html-postamble:t; -*-

postamble 目前的格式如下:

日期:2012 年 3 月 16 日

Org 版本 7.8.03 和 Emacs 版本 24

验证 XHTML 1.0

垂直排列,我不太喜欢。

【问题讨论】:

  • 你能写/添加一个明确的例子吗?
  • (setq org-export-html-postamble-format '(("en" "Last Updated %d. Created by Org-Mode in Emacs. May the Force be with you.")))

标签: html org-mode


【解决方案1】:

它不接受您自己的后置码的原因是您必须对变量使用#+BIND: 语法,以便在导出时使用它。 (见Export Options

更改该设置后,我还必须稍微调整格式以适应所需的语法。 org-export-html-postamble-format 的默认值为:

(("en" "<p class=\"author\">Author: %a (%e)</p>
<p class=\"date\">Date: %d</p>
<p class=\"creator\">Generated by %c</p>
<p class=\"xhtml-validation\">%v</p>
"))

因此,您必须执行以下操作才能将其包含在内(尽可能与该格式匹配):

(setq org-export-html-postamble-format 
      '(("en" "<p class=\"postamble\">Last Updated %d. Created by %c</p>")))

然而,这不会使您的文本居中,它会按如下方式导出:

<div id="postamble">
<p class="postamble">Last Updated 2012-03-16 16:22:03 Eastern Daylight Time. Created by Org version 7.8.03 with Emacs version 24
</div>

我相信您必须使用 p.postamble { text-align: center; } 设置自定义样式表才能使居中工作。

【讨论】:

  • 大约在您回复的同时想通了。正是我所做的。谢谢!
  • 您可以为BIND 部分添加显式代码吗?一些参考?谢谢
  • 这些天变量似乎重命名为org-html-postamble-format
  • 现在org-html-postamble-format 将不起作用。它变成org-html-postamble
  • 谢谢@JordanHe - 我认为应该为此更新答案
【解决方案2】:

您需要的最简单的配置是:

(setq org-html-postamble “你的postamble在这里”)

这直接设置postable。

要查看您对后置码有哪些选项,请输入:

C-h v org-html-postamble-format

你会看到它列出:

%t 代表标题。 %a 代表作者姓名。 %e 代表作者的电子邮件。 %d 代表日期。 %c 将被替换为“org-html-creator-string”。 %v 将被 `org-html-validation-link' 取代。 %T 将替换为导出时间。 %C 将替换为最后修改时间。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-09
    • 2012-10-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多