oop html block got parsed correct and then didn't do correct whitespace
This commit is contained in:
parent
8f31672b0f
commit
2a87e61a05
2 changed files with 10 additions and 6 deletions
10
TODO.md
10
TODO.md
|
|
@ -10,14 +10,16 @@
|
|||
- Borsh
|
||||
- https://crates.io/crates/tree-sitter-highlight
|
||||
- Or potentially https://docs.rs/arborium/latest/arborium/
|
||||
- [ ] Refactor template handling so templates include other templates via lambda rather than implicitly https://hackage-content.haskell.org/package/mustache-2.4.3.1/docs/Text-Mustache.html#v:overText
|
||||
- [ ] Make a function which takes IR and spits out some kind of table of contents
|
||||
- [ ] swap from using `draft` to using `date` for determing draft status, lack of date = draft
|
||||
- [ ] setup font subsetting (font file minimization)
|
||||
- `pyftsubset` (`fonttools subset`) is an external tool I can and probably should use
|
||||
for this
|
||||
- [ ] Refactor template handling so templates include other templates via lambda rather than implicitly https://hackage-content.haskell.org/package/mustache-2.4.3.1/docs/Text-Mustache.html#v:overText
|
||||
- [ ] Fix time via timestamps potentially meaning something (via preshim?) and use local offset instead of absolute time https://www.rfc-editor.org/rfc/rfc3339#section-4.2
|
||||
- [ ] Add rst or org support and convert markdown handling to custom parser instead of pandoc
|
||||
- [ ] Add in functionality for footnotes
|
||||
- There should be a per footnote template as well and also either the default or post template should have an attribute which handles footnotes
|
||||
- [ ] swap from using `draft` to using `date` for determing draft status, lack of date = draft
|
||||
- [ ] Fix time via timestamps potentially meaning something (via preshim?) and use local offset instead of absolute time https://www.rfc-editor.org/rfc/rfc3339#section-4.2
|
||||
- [ ] setup font subsetting (font file minimization)
|
||||
- [ ] dev server setup (with live reloading)
|
||||
- https://hackage-content.haskell.org/package/warp-3.4.10
|
||||
- https://hackage.haskell.org/package/file-embed
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ module Markdown (document, metadata) where
|
|||
import Control.Applicative (many, optional, some, (<|>))
|
||||
import Control.Monad (guard, void)
|
||||
import Data.Functor.Identity (Identity)
|
||||
import Data.List (intercalate)
|
||||
import Data.Maybe (fromMaybe, maybeToList)
|
||||
import Data.Proxy (Proxy (Proxy))
|
||||
import Data.String (IsString)
|
||||
|
|
@ -188,15 +189,16 @@ htmlBlock = do
|
|||
attrs <-
|
||||
if not hasEnded
|
||||
then
|
||||
Just . toText . mconcat <$> htmlAttrs
|
||||
Just . toText . intercalate " " <$> htmlAttrs
|
||||
else pure Nothing
|
||||
|
||||
-- technically not standard markdown but I don't want to write a full HTML parser in my
|
||||
inside <- many (notFollowedBy ((chunk $ "</" <> tagName <> ">") <|> chunk "</>") *> anySingle)
|
||||
end <- toText <$> ((chunk $ "</" <> tagName <> ">") <|> chunk "</>")
|
||||
-- if a blockEnding after some whitespace isn't next when we should parse this as inline text/paragraph
|
||||
many ((notFollowedBy lineEnding) *> spaceChar)
|
||||
lookAhead blockEnding
|
||||
pure $ HTML $ HTMLTag $ T.concat ["<", toText tagName, fromMaybe "" attrs, ">", T.pack inside, if end == "</>" then "" else end]
|
||||
pure $ HTML $ HTMLTag $ T.concat ["<", toText tagName, " ", fromMaybe "" attrs, ">", T.pack inside, if end == "</>" then "" else end]
|
||||
where
|
||||
tagNameEnd = (lookAhead spaceChar <* space) <|> char '>'
|
||||
htmlAttrs = ((notFollowedBy $ char '>') *> htmlAttr) `sepBy` space
|
||||
|
|
|
|||
Loading…
Reference in a new issue