djot 0.1.2.1 → 0.1.2.2
raw patch · 5 files changed
+64/−10 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +6/−0
- djot.cabal +1/−1
- src/Djot/Blocks.hs +11/−9
- test/regression.test +26/−0
- test/tables.test +20/−0
CHANGELOG.md view
@@ -1,5 +1,11 @@ # Revision history for djot +## 0.1.2.2 -- 2024-10-04++* Allow list items with blank lines between divs (#10).++* Fix parsing of indented tables (#8).+ ## 0.1.2.1 -- 2024-06-24 * Djot writer: include separator line in table when the table has
djot.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: djot-version: 0.1.2.1+version: 0.1.2.2 synopsis: Parser and renderer for djot light markup syntax. description: Djot (<https://djot.net>) is a light markup language. This package provides a data structure to represent
src/Djot/Blocks.hs view
@@ -118,6 +118,7 @@ case blockName (containerSpec tip) of "Para" -> void pListStart _ -> pure ())+ <|> True <$ followedByBlankLine <|> pure False , blockContainsBlock = Just Normal , blockContainsLines = False@@ -455,18 +456,19 @@ lookahead pRawTableRow ind <- sourceColumn addContainer tableSpec ind (TableData mempty)- , blockContinue = \container ->+ , blockContinue = \container -> do+ skipMany spaceOrTab -- TODO: this is inefficient; we parse the inline contents -- twice. Find a better way.- (True <$- -- if we just parsed a blank or caption line,- -- we don't allow more table rows:- case Seq.viewr (containerText container) of- _ Seq.:> c | not (B8.any (=='|') (chunkBytes c)) -> mzero- _ -> lookahead pRawTableRow)+ let parsedBlankOrCaption =+ case Seq.viewr (containerText container) of+ _ Seq.:> c -> not (B8.any (=='|') (chunkBytes c))+ Seq.EmptyR -> False+ (True <$ -- if we just parsed a blank or caption line, no more table rows+ (guard (not parsedBlankOrCaption) <* lookahead pRawTableRow)) <|> (True <$ followedByBlankLine)- <|> (True <$ lookahead- (skipMany spaceOrTab *> asciiChar '^' *> spaceOrTab))+ <|> (True <$+ (skipMany spaceOrTab *> lookahead (asciiChar '^' *> spaceOrTab))) <|> (True <$ guard (not (null (containerChildren container)))) , blockContainsBlock = Just CaptionBlock , blockContainsLines = True
test/regression.test view
@@ -164,3 +164,29 @@ </tr> </table> ```++Issue jgm/djoths#10:++```+1. Hello++ ::: hi+ inside list?+ :::++ ::: hi+ inside list?+ :::+.+<ol>+<li>+<p>Hello</p>+<div class="hi">+<p>inside list?</p>+</div>+<div class="hi">+<p>inside list?</p>+</div>+</li>+</ol>+```
test/tables.test view
@@ -123,3 +123,23 @@ </tr> </table> ```++Indented table:++```+ | a | b |+ |---|---|+ | 1 | 2 |+.+<table>+<tr>+<th>a</th>+<th>b</th>+</tr>+<tr>+<td>1</td>+<td>2</td>+</tr>+</table>+```+