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>2022-03-20 23:28:53 +0100
commit9e90deae955fafceaecf36b9197c771543447b14 (patch)
tree57c44530ace30a01254f700ad5bf03e6b0940121
parent85152b9d71b51f7601e0cd3325f01d5f53cb77ee (diff)
downloadhaven-9e90deae955fafceaecf36b9197c771543447b14.tar.gz
haven-9e90deae955fafceaecf36b9197c771543447b14.tar.xz
haven-9e90deae955fafceaecf36b9197c771543447b14.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 458fe87..a1610fc 100644
--- a/hswg/main.go
+++ b/hswg/main.go
@@ -82,7 +82,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)