summaryrefslogtreecommitdiff
path: root/internal/glightbox/parser.go
diff options
from:
to:
context:
space:
mode:
authorGravatar Saya Andy <145215889+SayaAndy@users.noreply.github.com> 2026-03-30 02:13:49 +0700
committerGravatar GitHub <noreply@github.com> 2026-03-30 02:13:49 +0700
commit8d0385546b0a5f4f3b0832fce1b4c0a10fa0a927 (patch)
tree3be8adf291fecb7611adce3d5ed610f8ac832ca2 /internal/glightbox/parser.go
parent56d333f3501cfc8e5725784e29ea917d347f37d8 (diff)
parent52fbb4a4eb781dd4ba66fae0e1ceaec6721758f5 (diff)
downloadweb-0.12.3.tar.gz
web-0.12.3.zip
v0.12.3 (#24)v0.12.3
* [feat: add meta for embeds & search engines](https://github.com/SayaAndy/saya-today-web/commit/610341bc9d59f9724e8e71f663b28df1904cb038) * feat: link marker fill saturation and brightness in the global map to the publication date * [feat: add namespace parameter for gallery](https://github.com/SayaAndy/saya-today-web/commit/52fbb4a4eb781dd4ba66fae0e1ceaec6721758f5) * refactor: replace sprintf for galleryid with simple replaceall in gallery rendering
Diffstat (limited to 'internal/glightbox/parser.go')
-rw-r--r--internal/glightbox/parser.go9
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 {