shithub: hugo

Download patch

ref: 78c99463fdd45c91af9933528d12d36a86dc6482
parent: abc54080ec8c43e8989c081d934b59f0c9570c0b
author: gllera <[email protected]>
date: Thu Aug 16 22:17:27 EDT 2018

hugolib: Fix shortcode output wrapped in p

Fixes #1642

--- a/hugolib/shortcode.go
+++ b/hugolib/shortcode.go
@@ -670,7 +670,6 @@
 		return source, nil
 	}
 
-	sourceLen := len(source)
 	start := 0
 
 	pre := []byte("HAHA" + prefix)
@@ -694,7 +693,7 @@
 
 		// Issue #1148: Check for wrapping p-tags <p>
 		if j >= 3 && bytes.Equal(source[j-3:j], pStart) {
-			if (k+4) < sourceLen && bytes.Equal(source[end:end+4], pEnd) {
+			if (k+4) < len(source) && bytes.Equal(source[end:end+4], pEnd) {
 				j -= 3
 				end += 4
 			}