aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJohn MacFarlane <[email protected]>2025-06-02 23:29:47 -0700
committerJohn MacFarlane <[email protected]>2025-06-02 23:29:47 -0700
commitadd83e81698a3468b4fde02f3af3c42d5c56f790 (patch)
treece1e2df3839f74b43db968ad83867b98ceb701e2 /test
parent0f79a1f627f7aad9cfa1cb5857f6fbf7d5f8dfb5 (diff)
Markdown reader: make definition lists behave like other lists.
If the `four_space_rule` extension is not enabled, figure out the indentation needed for child blocks dynamically, by looking at the first nonspace content after the `:` marker. Previously the four-space rule was always obeyed. Remove the old `compact_definition_lists` extension. This was neded to preserve backwards compatibility after pandoc 1.12 was released, but at this point we can get rid of it. T.P.Extensions: remove `Ext_compact_definition_lists` constructor for `Extension` [API change]. Fix tight/loose detection for definition lists, to conform to the documentation. Closes #10889.
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Readers/Markdown.hs22
-rw-r--r--test/command/10889.md16
-rw-r--r--test/command/lists-inside-definition.md1
3 files changed, 22 insertions, 17 deletions
diff --git a/test/Tests/Readers/Markdown.hs b/test/Tests/Readers/Markdown.hs
index ed0d59843..20ab99e48 100644
--- a/test/Tests/Readers/Markdown.hs
+++ b/test/Tests/Readers/Markdown.hs
@@ -29,10 +29,6 @@ markdownSmart :: Text -> Pandoc
markdownSmart = purely $ readMarkdown def { readerExtensions =
enableExtension Ext_smart pandocExtensions }
-markdownCDL :: Text -> Pandoc
-markdownCDL = purely $ readMarkdown def { readerExtensions = enableExtension
- Ext_compact_definition_lists pandocExtensions }
-
markdownGH :: Text -> Pandoc
markdownGH = purely $ readMarkdown def {readerExtensions = enableExtension
Ext_wikilinks_title_before_pipe githubMarkdownExtensions }
@@ -461,14 +457,14 @@ tests = [ testGroup "inline code"
, "blank space before first def" =:
"foo1\n\n : bar\n\nfoo2\n\n : bar2\n : bar3\n" =?>
definitionList [ (text "foo1", [para (text "bar")])
- , (text "foo2", [para (text "bar2"),
- plain (text "bar3")])
+ , (text "foo2", [plain (text "bar2"),
+ para (text "bar3")])
]
, "blank space before second def" =:
"foo1\n : bar\n\nfoo2\n : bar2\n\n : bar3\n" =?>
definitionList [ (text "foo1", [plain (text "bar")])
, (text "foo2", [plain (text "bar2"),
- para (text "bar3")])
+ plain (text "bar3")])
]
, "laziness" =:
"foo1\n : bar\nbaz\n : bar2\n" =?>
@@ -478,8 +474,8 @@ tests = [ testGroup "inline code"
]
, "no blank space before first of two paragraphs" =:
"foo1\n : bar\n\n baz\n" =?>
- definitionList [ (text "foo1", [para (text "bar") <>
- para (text "baz")])
+ definitionList [ (text "foo1", [plain (text "bar") <>
+ plain (text "baz")])
]
, "first line not indented" =:
"foo\n: bar\n" =?>
@@ -492,14 +488,6 @@ tests = [ testGroup "inline code"
divWith nullAttr (definitionList
[ (text "foo", [bulletList [plain (text "bar")]]) ])
]
- , testGroup "+compact_definition_lists"
- [ test markdownCDL "basic compact list" $
- "foo1\n: bar\n baz\nfoo2\n: bar2\n" =?>
- definitionList [ (text "foo1", [plain (text "bar" <> softbreak <>
- text "baz")])
- , (text "foo2", [plain (text "bar2")])
- ]
- ]
, testGroup "lists"
[ "issue #1154" =:
" - <div>\n first div breaks\n </div>\n\n <button>if this button exists</button>\n\n <div>\n with this div too.\n </div>\n"
diff --git a/test/command/10889.md b/test/command/10889.md
new file mode 100644
index 000000000..8f99685ce
--- /dev/null
+++ b/test/command/10889.md
@@ -0,0 +1,16 @@
+```
+% pandoc
+apple
+
+: pomaceous
+
+ fruit
+^D
+<dl>
+<dt>apple</dt>
+<dd>
+<p>pomaceous</p>
+<p>fruit</p>
+</dd>
+</dl>
+```
diff --git a/test/command/lists-inside-definition.md b/test/command/lists-inside-definition.md
index 731cd10d3..de2c72c94 100644
--- a/test/command/lists-inside-definition.md
+++ b/test/command/lists-inside-definition.md
@@ -33,6 +33,7 @@ Definition
2. list
^D
\begin{description}
+\tightlist
\item[Definition]
Foo