parser/pageparser: Add front matter etc. support

See #5324
This commit is contained in:
Bjørn Erik Pedersen
2018-10-17 13:48:55 +02:00
parent f6863e1ef7
commit 2fdc4a24d5
4 changed files with 345 additions and 68 deletions

View File

@@ -73,10 +73,10 @@ func (i Item) String() string {
return i.Val
case i.typ > tKeywordMarker:
return fmt.Sprintf("<%s>", i.Val)
case len(i.Val) > 20:
return fmt.Sprintf("%.20q...", i.Val)
case len(i.Val) > 50:
return fmt.Sprintf("%v:%.20q...", i.typ, i.Val)
}
return fmt.Sprintf("[%s]", i.Val)
return fmt.Sprintf("%v:[%s]", i.typ, i.Val)
}
type itemType int
@@ -85,6 +85,15 @@ const (
tError itemType = iota
tEOF
// page items
tHTMLLead // <
tSummaryDivider // <!--more-->
tSummaryDividerOrg // # more
tFrontMatterYAML
tFrontMatterTOML
tFrontMatterJSON
tFrontMatterORG
// shortcode items
tLeftDelimScNoMarkup
tRightDelimScNoMarkup
@@ -95,8 +104,7 @@ const (
tScParam
tScParamVal
//itemIdentifier
tText // plain text, used for everything outside the shortcodes
tText // plain text
// preserved for later - keywords come after this
tKeywordMarker