Fix shortcode vs pygments

This is the nth attempt to fix an issue by changing the placeholder token pattern, but
now we actually have tests for all the historic trouble cases.

Fixes #2223
This commit is contained in:
Bjørn Erik Pedersen
2016-09-08 21:23:01 +02:00
committed by GitHub
parent ccb3040ad4
commit 76bf2dcdd2
3 changed files with 48 additions and 41 deletions

View File

@@ -204,7 +204,7 @@ func isInnerShortcode(t *template.Template) (bool, error) {
}
func createShortcodePlaceholder(id int) string {
return fmt.Sprintf("{-{-%s-%d-}-}", shortcodePlaceholderPrefix, id)
return fmt.Sprintf("HAHA%s-%dHBHB", shortcodePlaceholderPrefix, id)
}
const innerNewlineRegexp = "\n"
@@ -528,8 +528,8 @@ func replaceShortcodeTokens(source []byte, prefix string, replacements map[strin
sourceLen := len(source)
start := 0
pre := []byte("{-{-" + prefix)
post := []byte("-}-}")
pre := []byte("HAHA" + prefix)
post := []byte("HBHB")
pStart := []byte("<p>")
pEnd := []byte("</p>")