From afc1bcda2b18b30fcdc1dcb4286fa918bc83c63c Mon Sep 17 00:00:00 2001 From: crc Date: Sat, 14 Jul 2018 14:56:35 +0000 Subject: [PATCH] bug fixes in html output for glossary FossilOrigin-Name: 75f3f037e53d34be6d3be83095d235199926361a047bab61e8d966f6f80c32c2 --- RELEASE_NOTES.md | 2 ++ glossary.forth | 15 +++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4a5df12..4e7cb8d 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -23,6 +23,8 @@ Major Changes: Bug fixes: - use CELL instead of int in the VM +- glossary.forth now renders < > and & when serving the index as + HTML Build: diff --git a/glossary.forth b/glossary.forth index 5435738..5116f3c 100755 --- a/glossary.forth +++ b/glossary.forth @@ -88,7 +88,7 @@ Note to self: This is horribly messy and should be rewritten. :s:put (s-) s:format s:put ; :display-result - field:name s:put nl nl + field:name s:put nl nl field:dstack '__Data:__%s\n s:put field:astack '__Addr:__%s\n s:put field:fstack '__Float:_%s\n s:put nl @@ -439,8 +439,15 @@ the HTML for each line, and an `http:list-words` which uses this to build an index. ~~~ +:sanitize (s-s) + here buffer:set + [ $< [ '< [ buffer:add ] s:for-each ] case + $> [ '> [ buffer:add ] s:for-each ] case + $& [ '& [ buffer:add ] s:for-each ] case + buffer:add ] s:for-each buffer:start s:temp ; + :display-entry (n-n) - field:name over '%s
s:format s:put ; + field:name sanitize over '%s
s:format s:put ; :http:list-words (-) #0 'words.tsv [ s:keep !SourceLine display-entry n:inc ] file:for-each-line drop ; @@ -469,13 +476,13 @@ And then the actual top level server. #1024 allot :css (-) - ' s:put nl ; :http:display (-) - #0 'words.tsv [ s:keep !SourceLine dup-pair eq? [ '
 s:put display-result '
s:put ] if n:inc ] file:for-each-line drop-pair ; + #0 'words.tsv [ s:keep !SourceLine dup-pair eq? [ ' s:put display-result ' s:put ] if n:inc ] file:for-each-line drop-pair ; :handle-http css