Add title export option
see https://orgmode.org/manual/Export-Settings.html
This commit is contained in:
parent
9ffcaa8e1c
commit
5e50794af0
2 changed files with 3 additions and 2 deletions
|
@ -86,7 +86,7 @@ func New() *Configuration {
|
||||||
DefaultSettings: map[string]string{
|
DefaultSettings: map[string]string{
|
||||||
"TODO": "TODO | DONE",
|
"TODO": "TODO | DONE",
|
||||||
"EXCLUDE_TAGS": "noexport",
|
"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),
|
Log: log.New(os.Stderr, "go-org: ", 0),
|
||||||
ReadFile: ioutil.ReadFile,
|
ReadFile: ioutil.ReadFile,
|
||||||
|
@ -174,6 +174,7 @@ func (d *Document) Get(key string) string {
|
||||||
// - < (export timestamps)
|
// - < (export timestamps)
|
||||||
// - e (export org entities)
|
// - e (export org entities)
|
||||||
// - f (export footnotes)
|
// - f (export footnotes)
|
||||||
|
// - title (export title)
|
||||||
// - toc (export table of content. an int limits the included org headline lvl)
|
// - toc (export table of content. an int limits the included org headline lvl)
|
||||||
// - todo (export headline todo status)
|
// - todo (export headline todo status)
|
||||||
// - pri (export headline priority)
|
// - pri (export headline priority)
|
||||||
|
|
|
@ -92,7 +92,7 @@ func (w *HTMLWriter) WriterWithExtensions() Writer {
|
||||||
func (w *HTMLWriter) Before(d *Document) {
|
func (w *HTMLWriter) Before(d *Document) {
|
||||||
w.document = d
|
w.document = d
|
||||||
w.log = d.Log
|
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)
|
titleDocument := d.Parse(strings.NewReader(title), d.Path)
|
||||||
if titleDocument.Error == nil {
|
if titleDocument.Error == nil {
|
||||||
title = w.WriteNodesAsString(titleDocument.Nodes...)
|
title = w.WriteNodesAsString(titleDocument.Nodes...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue