mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-27 14:10:31 +03:00
Improve markup determination logic
Sets Page.markup earlier (as early as possible, when the page is loaded). Sets it once and only once, removing many redundant calls to determineMarkupType(). This kills a sleeping bug that was avoided by the parts of the code depending on this value making those redundant calls.
This commit is contained in:
parent
00e36a4164
commit
2fb9af59c1
2 changed files with 12 additions and 16 deletions
|
@ -314,7 +314,8 @@ func renderShortcode(
|
|||
|
||||
if sc.doMarkup {
|
||||
newInner := p.s.ContentSpec.RenderBytes(&helpers.RenderingContext{
|
||||
Content: []byte(inner), PageFmt: p.determineMarkupType(),
|
||||
Content: []byte(inner),
|
||||
PageFmt: p.Markup,
|
||||
Cfg: p.Language(),
|
||||
DocumentID: p.UniqueID(),
|
||||
DocumentName: p.Path(),
|
||||
|
@ -333,7 +334,7 @@ func renderShortcode(
|
|||
// substitutions in <div>HUGOSHORTCODE-1</div> which prevents the
|
||||
// generation, but means that you can’t use shortcodes inside of
|
||||
// markdown structures itself (e.g., `[foo]({{% ref foo.md %}})`).
|
||||
switch p.determineMarkupType() {
|
||||
switch p.Markup {
|
||||
case "unknown", "markdown":
|
||||
if match, _ := regexp.MatchString(innerNewlineRegexp, inner); !match {
|
||||
cleaner, err := regexp.Compile(innerCleanupRegexp)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue