summaryrefslogtreecommitdiff
path: root/internal/lightgallery/parser.go
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lightgallery/parser.go')
-rw-r--r--internal/lightgallery/parser.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/internal/lightgallery/parser.go b/internal/lightgallery/parser.go
index 2c10c01..0ce209c 100644
--- a/internal/lightgallery/parser.go
+++ b/internal/lightgallery/parser.go
@@ -2,9 +2,7 @@ package lightgallery
import (
"bytes"
- "regexp"
"strings"
- "time"
"github.com/yuin/goldmark/ast"
"github.com/yuin/goldmark/parser"
@@ -24,24 +22,16 @@ func (p *LightGalleryParser) Trigger() []byte {
func (p *LightGalleryParser) Open(parent ast.Node, reader text.Reader, pc parser.Context) (ast.Node, parser.State) {
line, _ := reader.PeekLine()
- if !bytes.HasPrefix(line, []byte("{Gallery")) {
+ if !bytes.HasPrefix(line, []byte("{Gallery}")) {
return nil, parser.NoChildren
}
- r := regexp.MustCompile(`^\{Gallery:([A-Za-z0-9\+\-/]+)\}$`)
-
trimmed := bytes.TrimSpace(line)
- parts := r.FindSubmatch(trimmed)
- if len(parts) < 2 {
- return nil, parser.NoChildren
- }
-
- loc, err := time.LoadLocation(string(parts[1]))
- if err != nil {
+ if !bytes.Equal(trimmed, []byte("{Gallery}")) {
return nil, parser.NoChildren
}
- return &LightGalleryBlock{Location: loc}, parser.NoChildren
+ return &LightGalleryBlock{}, parser.NoChildren
}
func (p *LightGalleryParser) Continue(node ast.Node, reader text.Reader, pc parser.Context) parser.State {