URI: 
       hugolib: Fix inline shortcode regression - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit 5509954c7e8b0ce8d5ea903b0ab639ea14b69acb
   DIR parent 6b59b64f02341c67a3606d2bbb3b9934d6276a74
  HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
       Date:   Sat, 28 Dec 2019 12:07:23 +0100
       
       hugolib: Fix inline shortcode regression
       
       Fixes #6677
       
       Diffstat:
         M hugolib/shortcode.go                |      13 +++++++++++--
         M hugolib/shortcode_test.go           |       4 ++++
       
       2 files changed, 15 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go
       @@ -196,7 +196,16 @@ type shortcode struct {
        }
        
        func (s shortcode) insertPlaceholder() bool {
       -        return !s.doMarkup || s.info.ParseInfo().Config.Version == 1
       +        return !s.doMarkup || s.configVersion() == 1
       +}
       +
       +func (s shortcode) configVersion() int {
       +        if s.info == nil {
       +                // Not set for inline shortcodes.
       +                return 2
       +        }
       +
       +        return s.info.ParseInfo().Config.Version
        }
        
        func (s shortcode) innerString() string {
       @@ -347,7 +356,7 @@ func renderShortcode(
        
                        // Pre Hugo 0.55 this was the behaviour even for the outer-most
                        // shortcode.
       -                if sc.doMarkup && (level > 0 || sc.info.ParseInfo().Config.Version == 1) {
       +                if sc.doMarkup && (level > 0 || sc.configVersion() == 1) {
                                var err error
                                b, err := p.pageOutput.cp.renderContent([]byte(inner), false)
        
   DIR diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go
       @@ -1101,6 +1101,7 @@ SECOND:{{< myshort.inline "second" />}}:END
        NEW INLINE:  {{< n1.inline "5" >}}W1: {{ seq (.Get 0) }}{{< /n1.inline >}}:END:
        INLINE IN INNER: {{< outer >}}{{< n2.inline >}}W2: {{ seq 4 }}{{< /n2.inline >}}{{< /outer >}}:END:
        REUSED INLINE IN INNER: {{< outer >}}{{< n1.inline "3" />}}{{< /outer >}}:END:
       +## MARKDOWN DELIMITER: {{% mymarkdown.inline %}}**Hugo Rocks!**{{% /mymarkdown.inline %}}
        `
        
                                        b.WithContent("page-md-shortcode.md", `---
       @@ -1116,10 +1117,12 @@ title: "Hugo Home"
        
                                        b.WithTemplatesAdded("layouts/_default/single.html", `
        CONTENT:{{ .Content }}
       +TOC: {{ .TableOfContents }}
        `)
        
                                        b.WithTemplatesAdded("layouts/index.html", `
        CONTENT:{{ .Content }}
       +TOC: {{ .TableOfContents }}
        `)
        
                                        b.WithTemplatesAdded("layouts/shortcodes/outer.html", `Inner: {{ .Inner }}`)
       @@ -1133,6 +1136,7 @@ CONTENT:{{ .Content }}
                                                "NEW INLINE:  W1: [1 2 3 4 5]",
                                                "INLINE IN INNER: Inner: W2: [1 2 3 4]",
                                                "REUSED INLINE IN INNER: Inner: W1: [1 2 3]",
       +                                        `<li><a href="#markdown-delimiter-hugo-rocks">MARKDOWN DELIMITER: Hugo Rocks!</a></li>`,
                                        }
        
                                        if enableInlineShortcodes {