Add title export option

see https://orgmode.org/manual/Export-Settings.html
This commit is contained in:
Niklas Fasching 2020-06-26 12:23:29 +02:00
parent 9ffcaa8e1c
commit 5e50794af0
2 changed files with 3 additions and 2 deletions

View file

@ -86,7 +86,7 @@ func New() *Configuration {
DefaultSettings: map[string]string{
"TODO": "TODO | DONE",
"EXCLUDE_TAGS": "noexport",
"OPTIONS": "toc:t <:t e:t f:t pri:t todo:t tags:t",
"OPTIONS": "toc:t <:t e:t f:t pri:t todo:t tags:t title:t",
},
Log: log.New(os.Stderr, "go-org: ", 0),
ReadFile: ioutil.ReadFile,
@ -174,6 +174,7 @@ func (d *Document) Get(key string) string {
// - < (export timestamps)
// - e (export org entities)
// - f (export footnotes)
// - title (export title)
// - toc (export table of content. an int limits the included org headline lvl)
// - todo (export headline todo status)
// - pri (export headline priority)

View file

@ -92,7 +92,7 @@ func (w *HTMLWriter) WriterWithExtensions() Writer {
func (w *HTMLWriter) Before(d *Document) {
w.document = d
w.log = d.Log
if title := d.Get("TITLE"); title != "" {
if title := d.Get("TITLE"); title != "" && w.document.GetOption("title") != "nil" {
titleDocument := d.Parse(strings.NewReader(title), d.Path)
if titleDocument.Error == nil {
title = w.WriteNodesAsString(titleDocument.Nodes...)