2012-03-16 101 views
6

我正在創建一個採用組織模式的網站,並希望將後導格式設置爲格式,因此只顯示創建日期和頁面底部的創建者,位於中心,並且是水平的。如何使用組織模式將HTML導出中的後導碼格式化?

在我的.emacs我有

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

,並在我的index.org的頂部(和所有其他網頁)我有

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

後同步進行格式化這樣目前:

日期:2012年3月16日

版組織與03年7月8日版本的Emacs 24

驗證XHTML 1.0

垂直排列的,我不很喜歡。

+0

你能寫/添加一個明顯的例子,你如何破解後同步? – Dror 2012-10-22 10:38:45

+0

(setq org-export-html-postamble-format '((「en」「最後更新%d。由Emacs中的Org-Mode創建,可能是Force with you。」))) – Zach 2012-12-21 18:37:23

回答

9

它不接受你自己的後置碼的原因是因爲你必須使用#+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; }得到定心工作。

+0

圍繞同時你回答。到底我做了什麼。謝謝! – Zach 2012-03-16 21:27:50

+1

你可以爲'BIND'部分添加一個明確的代碼嗎?有一些參考?謝謝 – Dror 2012-10-19 13:11:36

+0

這些天來,這個變量好像被重命名爲'org-html-postamble-format'。 – 2016-01-05 13:44:38

3

你需要最簡單的配置是:

 
(setq org-html-postamble "Your postamble here") 

這直接設置過帳。

要看看你有哪些選擇你的後同步,類型:

 
C-h v org-html-postamble-format 

你會看到它列出:

 
%t stands for the title. 
%a stands for the author's name. 
%e stands for the author's email. 
%d stands for the date. 
%c will be replaced by `org-html-creator-string'. 
%v will be replaced by `org-html-validation-link'. 
%T will be replaced by the export time. 
%C will be replaced by the last modification time. 
相關問題