-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
asciidoc writer, checklists fix #7832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
In general this looks very good. Some questions: I checked the asciidoc documentation for task lists, and found this:
I might be wrong in one of these impressions -- in which case correct me. |
Yes, you are right, review fix please |
src/Text/Pandoc/Extensions.hs
Outdated
| getDefaultExtensions "opml" = pandocExtensions -- affects notes | ||
| getDefaultExtensions "markua" = extensionsFromList | ||
| [] | ||
| getDefaultExtensions "asciidoc" = extensionsFromList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be formatted like the others, so the = lines up.
test/Tests/Writers/AsciiDoc.hs
Outdated
| , test (asciidocWithOpts def) "bullet without task_lists" $ | ||
| bulletList [plain "☐ a", plain "☒ b"] =?> unlines | ||
| [ "* ☐ a" | ||
| , "* ☒ b" | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we leave task_lists as an extension that can be disabled, then it makes sense to test what happens when it is disabled. But I'm still not sure why we should make task list rendering something you can disable with an extension.
So, I'd favor
- removing
task_listfrom the available extensions for asciidoc. - changing the code to do the task list transformation if asciidoctorVariant is set in WriterState, otherwise not. (A cursory glance through the original asciidoc user guide https://asciidoc-py.github.io/userguide.html doesn't show anything about checklists, so it seems to be an asciidoctor-only feature.)
With these changes, task list syntax will be used automatically with -t asciidoctor but not with -t asciidoc, which I think is what we want. Extensions should be used only when it makes sense to disable them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, review please
src/Text/Pandoc/Shared.hs
Outdated
| handleTaskListItemNoExtsCheck :: ([Inline] -> [Inline]) -> [Block] -> [Block] | ||
| handleTaskListItemNoExtsCheck handleInlines bls = | ||
| handleItem bls | ||
| where | ||
| handleItem (Plain is : bs) = Plain (handleInlines is) : bs | ||
| handleItem (Para is : bs) = Para (handleInlines is) : bs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to avoid the API change this would require.
Why not just call handleTaskListItem, and add Ext_task_lists to the extensions parameter when calling it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
341abf8 to
41d131e
Compare
|
Great, thanks! |
Requesting a code review. See issue #7798