From 9e90deae955fafceaecf36b9197c771543447b14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sat, 5 Mar 2022 12:17:54 +0100 Subject: WIP: hswg: enable preprocessing WIP: Shouldn't allow it in pass-through mode, at minimum. --- hswg/main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) -- cgit v1.2.3