-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Endnotes #4042
base: main
Are you sure you want to change the base?
Endnotes #4042
Conversation
Don't have time to look at it right now, but the most likely explanation is that you'll have to edit the |
@tarleb Thanks, trying to fix it. |
Fixed, all tests pass. Now going to add endnotes to Docx and ODT. |
Reporting progress: |
3d91574
to
effc480
Compare
All done, need review. Especially for Docx writer. Documents it produces can be loaded by LibreOffice, that is all I have tested. Code is mostly a copy of footnotes, I think it can be hlinted and pruned after merge. I don't understand the reason for Also, I will have to switch from my repo back to official one, for that we need a new version of pandoc-types, right? So first jgm/pandoc-types#34 is to be merged and a new version assigned, then I can fix first commit in this PR. |
c8abaff
to
f7913d7
Compare
Added support for Muse ( @jgm How do I proceed to get this PR merged? I think it is ready. |
src/Text/Pandoc/Writers/Custom.hs
Outdated
@@ -232,7 +232,9 @@ inlineToCustom (Link attr txt (src,tit)) = | |||
inlineToCustom (Image attr alt (src,tit)) = | |||
callFunc "Image" (Stringify alt) src tit (attrToMap attr) | |||
|
|||
inlineToCustom (Note contents) = callFunc "Note" (Stringify contents) | |||
inlineToCustom (Note FootNote contents) = callFunc "FootNote" (Stringify contents) |
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 approach will break existing custom writers that use Note.
A better approach would be callFunc "Note" "footnote"
and callFunc "Note" "endnote"
, I think.
This would allow current writers to work without being changed. @tarleb, any thoughts?
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.
That seems like a nice solution. We'd get full backwards compatibility if we pass the note type after the content:
inlineToCustom (Note noteType contents) = callFunc "Note" (Stringify contents) noteType
Lua won't mind the extra parameter if the function just expects contents. This would pass the node type as "FootNote" and "EndNote*.
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
35930b9
to
8c38331
Compare
8380f26
to
5b50995
Compare
Rebased it once again on top of refactored Muse reader. @jkr How do I update binary Docx files with the new test framework? All binary tests are failing mostly due to added endnote style. Manual testing shows produced files with endnotes are ok. |
1c9175b
to
917f3df
Compare
@labdsf Thanks, LGTM. I'm only wondering why it is |
Not sure, most likely because I looked at On the other hand, "footnote", "endnote" and "sidenote" are single words in English, while "doublequote" and "inlinemath" are not. I still prefer the CamelCase style, because it allows to add something like "PopupNote", "MarginNote" etc. |
I still prefer Footnote and Endnote, because these are single words;
the CamelCase looks wrong here, though I see your thinking.
|
I have replaced FootNote and EndNote with Footnote and Endnote. Had to replace Run constructors Footnote and Endnote with RunFootnote and RunEndnote in Docx to avoid conflicts. |
23a6e2b
to
3cd5979
Compare
This is a massive PR, so it's difficult to examine thoroughly. Can you clarify which readers and writers actually support the distinction between endnotes and footnotes? (I assume that the other readers and writers just treat all notes as footnotes?) |
@jgm Endnotes are supported in both readers and writers for ODT, Docx and Muse (with Amusewiki syntax: "{1}", "{2}" instead of "[1]" and "[2]" for footnotes), besides Native. All the other readers and writers simply ignore the type and treat them as footnotes. Later it would be nice to add support for LaTeX, at least for the writer, but that requires using additional packages, so I have left it out for now. HTML/EPUB can get support once #4213 is resolved. |
13214d4
to
f0790f5
Compare
@jgm |
c7fc26c
to
4fbfda6
Compare
b4e25e6
to
882def3
Compare
I'm wondering if this PR is still being worked on? It would be great to be able to specify whether notes are endnotes and footnotes, especially for |
This is for issue #4041 and depends on jgm/pandoc-types#34
So far I did some straightforward changes, trying to relpace
Note
withNote FootNote
where possible. For some reason Lua tests fail.Reproduce with:
stack test -j 1 --test-arguments '-p Lua' 2>&1 | less
Can someone familiar with lua (@tarleb ?) help with fixing this? Looks like something should be done about
function Note
, for example replacing it withfunction FootNote
andfunction EndNote
like it is done withMath
.