aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-03-05 12:17:54 +0100
committerPřemysl Eric Janouch <p@janouch.name>2025-11-30 19:01:47 +0100
commitf95a5cab6a0aa423d2ec88573fabdb18abd47f72 (patch)
treeb9be27762232cc2792a7572294814e1035d20532
parentb1293a002a4019f1e7683bed58aef2979db8036e (diff)
downloadhaven-f95a5cab6a0aa423d2ec88573fabdb18abd47f72.tar.gz
haven-f95a5cab6a0aa423d2ec88573fabdb18abd47f72.tar.xz
haven-f95a5cab6a0aa423d2ec88573fabdb18abd47f72.zip
WIP: hswg: enable preprocessing
WIP: Shouldn't allow it in pass-through mode, at minimum.
-rw-r--r--hswg/main.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/hswg/main.go b/hswg/main.go
index 3c7582e..6afbbd3 100644
--- a/hswg/main.go
+++ b/hswg/main.go
@@ -81,7 +81,12 @@ func Render(r io.Reader, config *configuration.Configuration) (
// return
var doc *types.Document
- if doc, err = parser.ParseDocument(pr, config); err == nil {
+ var preprocessed string
+ // TODO(p): Ensure that this doesn't pose a security risk.
+ if preprocessed, err = parser.Preprocess(pr, config); err != nil {
+ // Render it raw below.
+ } else if doc, err = parser.ParseDocument(
+ strings.NewReader(preprocessed), config); err == nil {
doctype := config.Attributes.GetAsStringWithDefault(
types.AttrDocType, "article")
problems, verr := validator.Validate(doc, doctype)