diff options
| author | 2026-03-29 18:55:20 +0700 | |
|---|---|---|
| committer | 2026-03-29 18:55:20 +0700 | |
| commit | 52fbb4a4eb781dd4ba66fae0e1ceaec6721758f5 (patch) | |
| tree | 3be8adf291fecb7611adce3d5ed610f8ac832ca2 /internal/glightbox/parser.go | |
| parent | 0a9de353b2456505b0b8214fab4a7c844d31735c (diff) | |
| download | web-52fbb4a4eb781dd4ba66fae0e1ceaec6721758f5.tar.gz web-52fbb4a4eb781dd4ba66fae0e1ceaec6721758f5.zip | |
feat: add namespace parameter for gallery
refactor: replace sprintf for galleryid with simple replaceall in gallery rendering
Diffstat (limited to 'internal/glightbox/parser.go')
| -rw-r--r-- | internal/glightbox/parser.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/internal/glightbox/parser.go b/internal/glightbox/parser.go index 6780090..b376034 100644 --- a/internal/glightbox/parser.go +++ b/internal/glightbox/parser.go @@ -29,7 +29,7 @@ func (p *GLightboxParser) Open(parent ast.Node, reader text.Reader, pc parser.Co return nil, parser.NoChildren } - r := regexp.MustCompile(`^\{Gallery:([A-Za-z0-9\+\-/]+)\}$`) + r := regexp.MustCompile(`^\{Gallery:([A-Za-z0-9\+\-/]+)(:([A-Za-z0-9\+\-/]+))?\}$`) trimmed := bytes.TrimSpace(line) parts := r.FindSubmatch(trimmed) @@ -44,7 +44,12 @@ func (p *GLightboxParser) Open(parent ast.Node, reader text.Reader, pc parser.Co return nil, parser.NoChildren } - return &GLightboxBlock{Location: loc}, parser.NoChildren + ns := "" + if len(parts) >= 4 { + ns = string(parts[3]) + } + + return &GLightboxBlock{Location: loc, Namespace: ns}, parser.NoChildren } func (p *GLightboxParser) Continue(node ast.Node, reader text.Reader, pc parser.Context) parser.State { |