From 2fdc4a24d5450a98cf38a4456e8e0e8e97a3343d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 17 Oct 2018 13:48:55 +0200 Subject: parser/pageparser: Add front matter etc. support See #5324 --- parser/pageparser/item.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'parser/pageparser/item.go') diff --git a/parser/pageparser/item.go b/parser/pageparser/item.go index ae2f6cbc9..f7495c90e 100644 --- a/parser/pageparser/item.go +++ b/parser/pageparser/item.go @@ -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 // + 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 -- cgit v1.2.3