fix: trying to fix error in matching code
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package template
|
||||
|
||||
import "fmt"
|
||||
|
||||
// CompileTemplate scans once, emitting:
|
||||
// - data blocks: inner content between a line that's exactly "{" and a line that's exactly "}"
|
||||
// - matching blocks: gaps between data blocks (excluding the brace lines themselves)
|
||||
@@ -33,6 +35,7 @@ func CompileTemplate(templateSource string) ([]Block, error) {
|
||||
|
||||
if curlyIndex == 0 && nextCurlyIndex == 1 {
|
||||
if i > start {
|
||||
fmt.Printf("BLockContent 1: %q\n", template.Slice(start, i).String())
|
||||
block, err := ParseTemplateBlock(template.Slice(start, i), blockType)
|
||||
if err != nil {
|
||||
return nil, NewErrorf("cannot parse block @pos -> %w", err).WithPosition(start, i)
|
||||
@@ -42,6 +45,7 @@ func CompileTemplate(templateSource string) ([]Block, error) {
|
||||
start = i
|
||||
blockType = DataBlock
|
||||
} else if curlyIndex == 1 && nextCurlyIndex == 0 {
|
||||
fmt.Printf("BLockContent 2: %q\n", template.Slice(start, i).String())
|
||||
if i > start {
|
||||
block, err := ParseTemplateBlock(template.Slice(start, i), blockType)
|
||||
if err != nil {
|
||||
|
Reference in New Issue
Block a user