mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
parent
272484f8bf
commit
c4a530f104
4 changed files with 20 additions and 31 deletions
|
@ -631,7 +631,6 @@ func (p *pageState) wrapError(err error) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return herrors.NewFileErrorFromFile(err, filename, p.s.SourceSpec.Fs.Source, lineMatcher)
|
return herrors.NewFileErrorFromFile(err, filename, p.s.SourceSpec.Fs.Source, lineMatcher)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pageState) getContentConverter() converter.Converter {
|
func (p *pageState) getContentConverter() converter.Converter {
|
||||||
|
@ -674,7 +673,6 @@ func (p *pageState) mapContentForResult(
|
||||||
markup string,
|
markup string,
|
||||||
withFrontMatter func(map[string]any) error,
|
withFrontMatter func(map[string]any) error,
|
||||||
) error {
|
) error {
|
||||||
|
|
||||||
iter := result.Iterator()
|
iter := result.Iterator()
|
||||||
|
|
||||||
fail := func(err error, i pageparser.Item) error {
|
fail := func(err error, i pageparser.Item) error {
|
||||||
|
@ -792,9 +790,6 @@ Loop:
|
||||||
s.shortcodes = append(s.shortcodes, currShortcode)
|
s.shortcodes = append(s.shortcodes, currShortcode)
|
||||||
|
|
||||||
rn.AddShortcode(currShortcode)
|
rn.AddShortcode(currShortcode)
|
||||||
|
|
||||||
case it.Type == pageparser.TypeEmoji:
|
|
||||||
rn.AddBytes(it)
|
|
||||||
case it.IsEOF():
|
case it.IsEOF():
|
||||||
break Loop
|
break Loop
|
||||||
case it.IsError():
|
case it.IsError():
|
||||||
|
|
|
@ -16,6 +16,7 @@ package hugolib
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"html/template"
|
"html/template"
|
||||||
"path"
|
"path"
|
||||||
|
@ -26,8 +27,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"errors"
|
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/common/herrors"
|
"github.com/gohugoio/hugo/common/herrors"
|
||||||
|
|
||||||
"github.com/gohugoio/hugo/parser/pageparser"
|
"github.com/gohugoio/hugo/parser/pageparser"
|
||||||
|
@ -312,8 +311,8 @@ func prepareShortcode(
|
||||||
tplVariants tpl.TemplateVariants,
|
tplVariants tpl.TemplateVariants,
|
||||||
sc *shortcode,
|
sc *shortcode,
|
||||||
parent *ShortcodeWithPage,
|
parent *ShortcodeWithPage,
|
||||||
p *pageState) (shortcodeRenderer, error) {
|
p *pageState,
|
||||||
|
) (shortcodeRenderer, error) {
|
||||||
toParseErr := func(err error) error {
|
toParseErr := func(err error) error {
|
||||||
return p.parseError(fmt.Errorf("failed to render shortcode %q: %w", sc.name, err), p.source.parsed.Input(), sc.pos)
|
return p.parseError(fmt.Errorf("failed to render shortcode %q: %w", sc.name, err), p.source.parsed.Input(), sc.pos)
|
||||||
}
|
}
|
||||||
|
@ -332,7 +331,6 @@ func prepareShortcode(
|
||||||
}
|
}
|
||||||
|
|
||||||
return fn, nil
|
return fn, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func doRenderShortcode(
|
func doRenderShortcode(
|
||||||
|
@ -342,7 +340,8 @@ func doRenderShortcode(
|
||||||
tplVariants tpl.TemplateVariants,
|
tplVariants tpl.TemplateVariants,
|
||||||
sc *shortcode,
|
sc *shortcode,
|
||||||
parent *ShortcodeWithPage,
|
parent *ShortcodeWithPage,
|
||||||
p *pageState) (shortcodeRenderer, error) {
|
p *pageState,
|
||||||
|
) (shortcodeRenderer, error) {
|
||||||
var tmpl tpl.Template
|
var tmpl tpl.Template
|
||||||
|
|
||||||
// Tracks whether this shortcode or any of its children has template variations
|
// Tracks whether this shortcode or any of its children has template variations
|
||||||
|
@ -501,7 +500,6 @@ func (s *shortcodeHandler) transferNames(in *shortcodeHandler) {
|
||||||
for k := range in.nameSet {
|
for k := range in.nameSet {
|
||||||
s.nameSet[k] = true
|
s.nameSet[k] = true
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *shortcodeHandler) hasName(name string) bool {
|
func (s *shortcodeHandler) hasName(name string) bool {
|
||||||
|
@ -629,8 +627,6 @@ Loop:
|
||||||
return sc, nil
|
return sc, nil
|
||||||
case currItem.IsText():
|
case currItem.IsText():
|
||||||
sc.inner = append(sc.inner, currItem.ValStr(source))
|
sc.inner = append(sc.inner, currItem.ValStr(source))
|
||||||
case currItem.Type == pageparser.TypeEmoji:
|
|
||||||
sc.inner = append(sc.inner, currItem.ValStr(source))
|
|
||||||
case currItem.IsShortcodeName():
|
case currItem.IsShortcodeName():
|
||||||
|
|
||||||
sc.name = currItem.ValStr(source)
|
sc.name = currItem.ValStr(source)
|
||||||
|
|
|
@ -192,7 +192,6 @@ const (
|
||||||
TypeFrontMatterTOML
|
TypeFrontMatterTOML
|
||||||
TypeFrontMatterJSON
|
TypeFrontMatterJSON
|
||||||
TypeFrontMatterORG
|
TypeFrontMatterORG
|
||||||
TypeEmoji
|
|
||||||
TypeIgnore // // The BOM Unicode byte order marker and possibly others
|
TypeIgnore // // The BOM Unicode byte order marker and possibly others
|
||||||
|
|
||||||
// shortcode items
|
// shortcode items
|
||||||
|
|
|
@ -15,25 +15,24 @@ func _() {
|
||||||
_ = x[TypeFrontMatterTOML-4]
|
_ = x[TypeFrontMatterTOML-4]
|
||||||
_ = x[TypeFrontMatterJSON-5]
|
_ = x[TypeFrontMatterJSON-5]
|
||||||
_ = x[TypeFrontMatterORG-6]
|
_ = x[TypeFrontMatterORG-6]
|
||||||
_ = x[TypeEmoji-7]
|
_ = x[TypeIgnore-7]
|
||||||
_ = x[TypeIgnore-8]
|
_ = x[tLeftDelimScNoMarkup-8]
|
||||||
_ = x[tLeftDelimScNoMarkup-9]
|
_ = x[tRightDelimScNoMarkup-9]
|
||||||
_ = x[tRightDelimScNoMarkup-10]
|
_ = x[tLeftDelimScWithMarkup-10]
|
||||||
_ = x[tLeftDelimScWithMarkup-11]
|
_ = x[tRightDelimScWithMarkup-11]
|
||||||
_ = x[tRightDelimScWithMarkup-12]
|
_ = x[tScClose-12]
|
||||||
_ = x[tScClose-13]
|
_ = x[tScName-13]
|
||||||
_ = x[tScName-14]
|
_ = x[tScNameInline-14]
|
||||||
_ = x[tScNameInline-15]
|
_ = x[tScParam-15]
|
||||||
_ = x[tScParam-16]
|
_ = x[tScParamVal-16]
|
||||||
_ = x[tScParamVal-17]
|
_ = x[tIndentation-17]
|
||||||
_ = x[tIndentation-18]
|
_ = x[tText-18]
|
||||||
_ = x[tText-19]
|
_ = x[tKeywordMarker-19]
|
||||||
_ = x[tKeywordMarker-20]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const _ItemType_name = "tErrortEOFTypeLeadSummaryDividerTypeFrontMatterYAMLTypeFrontMatterTOMLTypeFrontMatterJSONTypeFrontMatterORGTypeEmojiTypeIgnoretLeftDelimScNoMarkuptRightDelimScNoMarkuptLeftDelimScWithMarkuptRightDelimScWithMarkuptScClosetScNametScNameInlinetScParamtScParamValtIndentationtTexttKeywordMarker"
|
const _ItemType_name = "tErrortEOFTypeLeadSummaryDividerTypeFrontMatterYAMLTypeFrontMatterTOMLTypeFrontMatterJSONTypeFrontMatterORGTypeIgnoretLeftDelimScNoMarkuptRightDelimScNoMarkuptLeftDelimScWithMarkuptRightDelimScWithMarkuptScClosetScNametScNameInlinetScParamtScParamValtIndentationtTexttKeywordMarker"
|
||||||
|
|
||||||
var _ItemType_index = [...]uint16{0, 6, 10, 32, 51, 70, 89, 107, 116, 126, 146, 167, 189, 212, 220, 227, 240, 248, 259, 271, 276, 290}
|
var _ItemType_index = [...]uint16{0, 6, 10, 32, 51, 70, 89, 107, 117, 137, 158, 180, 203, 211, 218, 231, 239, 250, 262, 267, 281}
|
||||||
|
|
||||||
func (i ItemType) String() string {
|
func (i ItemType) String() string {
|
||||||
if i < 0 || i >= ItemType(len(_ItemType_index)-1) {
|
if i < 0 || i >= ItemType(len(_ItemType_index)-1) {
|
||||||
|
|
Loading…
Reference in a new issue