-
-
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
Add Option for Lossyness Reports #3392
Comments
The new architecture we have in the |
Of course comments welcome on the proposed system. What I have now is a logging mechanism with ERROR, WARNING, INFO, and DEBUG levels. The user will be able to select the level of verbosity. I also have a flag to treat warnings as errors; perhaps it would be worth while having another option to treat info messages as errors? Or perhaps lossiness indications should be warnings? (There will likely be many of them.) |
The ideal is to have a system that could please both humans and scripts: the former with readability in mind, the latter intended for parsable output. Exit CodesAt its very basic, an exit error level
Similar information is what the user might be looking for at the highest level, eg: if pandoc reports a So really, the difference between what is a warning or an error might be subjective according to usage context and expectations. But generally, I’d say that deletion of contents are more critical than style changes or removals. Custom Reader/WritersFrom the upcoming 2.0 changes you’ve mentioned, I then assume that also custom readers and writers will be able to employ this system. I’ve worked on a markdown to BBCode custom writer, and implement a manual warning sytem along these lines: table are lost completely, inline code is converted to bold, headers become bold text with different sizes, and so on. So, if this system is to be extended to custom reader and writers then it would need to consider all possible descriptors for lossyness cases. Reports in JSON + Human Readable FormatAs for the verbose report on the details of losses, JSON would be a good format for a scripted automation pipeline, and the same JSON structure could be printed out in human-readable markdown-formatted reported on request. The JSON report could group losses according to loss-types, and for each loss provide a reference to the line in the original source, the original element, an maybe a string with the starting text that is affected (this is intended only for the human-readable version). Eg: requesting human-readable report:
… just a speculative example, but it might represent the convience of having some standard to handle both JSON representation and a human readable mardkwon report (that should be easy to read also in terminal, as raw txt). |
+++ Tristano Ajmone [Jan 29 17 02:52 ]:
At its very basic, an exit error level 0=lossless, >=1=lossy should
satisfy both humans and scripts.
No, because it's standard in unix for 0 to mean "exited
without errors"; warnings shouldn't cause non-0 exit codes
unless a special flag is used, as I suggested.
to check the presence of the above type of losses. Maybe in a given
context any losses that don’t imply deletion of elements are ok and the
conversion should go ahead.
The way compilers usually handle this fine-grained
discrimination is by allowing each type of warning to be
selectively enabled or disabled by a command-line flag.
From the upcoming 2.0 changes you’ve mentioned, I then assume that also
custom readers and writers will be able to employ this system. I’ve
I haven't really thought about how to do this, but yes, I
think it should be possible to expose these functions to lua.
|
This now contains the Verbosity definition previously in Options, as well as a new LogMessage datatype that will eventually be used instead of raw strings for warnings. This will enable us, among other things, to provide machine-readable warnings if desired. See #3392.
This gives us the possibility of both machine-readable and human-readable output for log messages. See #3392.
I've added the framework for this (much better warnings about omitted content + machine-readable warnings + an option to generate an error status code if there are warnings). I've also added more warnings to readers and writers, so one now gets much fuller information (especially with Eventually we should add warnings to all writers for raw blocks/inlines that are not rendered (because the formats don't match). Currently we've got this for the following writers: To add to the other writers, we need to do a bit of replumbing so that the writers are in PandocMonad. |
TODO: Convert these writers to use PandocMonad:
Also:
|
Hi! I hope this is related enough. I'm currently working on an open source book and it has a build script in it's directory, so users don't have to directly type in the pandoc commands. But the source code is structured like this: Every chapter has it's own markdown file and they get converted to one big markdown file with pandoc in this build script. However, the footnotes in every chapter start at 1 and not at the number from the chapter before + 1. I don't want to change this, that way it's just easier to work with. So when someone executes the build script, pandoc throws a bunch of warnings about duplicate footnotes. The actual output is fine, because pandoc is that smart to fix these footnotes. But the warnings are still here. They could confuse users and I don't see an option to disable warnings, but in my opinion this is an important feature. At least for me. :D So yeah, it would be cool, if you could add this feature to your todo-list. :) |
My guess is that the output is not fine; you'll be
getting footnotes, but not the right footnotes, since
pandoc will use only one of the footnotes labeled "1".
Have you checked carefully?
You could try using --file-scope (see the manual).
+++ Nano Miratus [Jun 16 17 15:59 ]:
… Hi! I hope this is related enough.
I'm currently working on an open source book and it has a build script
in it's directory, so users don't have to directly type in the pandoc
commands. But the source code is structured like this: Every chapter
has it's own markdown file and they get converted to one big markdown
file with pandoc in this build script. However, the footnotes in every
chapter start at 1 and not at the number from the chapter before + 1. I
don't want to change this, that way it's just easier to work with. So
when someone executes the build script, pandoc throws a bunch of
warnings about duplicate footnotes. The actual output is fine, because
pandoc is that smart to fix these footnotes.
But the warnings are still here. They could confuse users and I don't
see an option to disable warnings, but in my opinion this is an
important feature. At least for me. :D
So yeah, it would be cool, if you could add this feature to your
todo-list. :)
—
You are receiving this because you commented.
Reply to this email directly, [1]view it on GitHub, or [2]mute the
thread.
References
1. #3392 (comment)
2. https://github.com/notifications/unsubscribe-auth/AAAL5KqJveo3mtGxy_D5196CopV8kJ5Zks5sEwjCgaJpZM4LwveC
|
I have checked carefully, the output is totally fine. And all three chapters have identical footnotes. See, it works perfectly, just the warnings could confuse people. https://github.com/nnmrts/dafern/tree/master/src - these are the source markdown files The script is spaghetti code, I know. :D But the command is basically:
The only relevant settings are And this already works. The footnotes are correct and then I just convert the book.md to html and pdf and I'm done. |
@nnmrts As I see it, the footnotes are not fine. I checked the PDF version and clicked on the 1st footnote in of 1st chapter at
and was sent to the footnote of chapter 3
Maybe you should check this again. (Übrigens: Spannende Unternehmung, Dein Buch) |
If you just want to turn off warnings, you can use
`--quiet`.
|
@Wolf-at-SO Also ist anscheinend nur das PDF kaputt. Okay, danke, das ist mir tatsächlich nicht aufgefallen, weil ich kaum auf die Fußnoten draufgeklickt hatte. translation: @jgm Thank you very much, this will probably help me in the future. But as it seems, I need the warnings now even more than before, until I get my build script to work. :D So yeah, sorry, I should have checked the other files more carefully. Thanks for the help anyway! :) EDIT: So, locally my files are great, on github they are all not fine, not even the markdown file. The markdown file I have locally is working, but I haven't changed it since my last commit, so... |
So I fixed it now, using a version-like notation, like Thank you two again! 💓 |
Well, there are still lots more things we could warn about. |
Currently there is no way to know if a given pandoc conversion is lossy or not. It would be nice to have an option to perform a dry-run conversion and display a report on elements loss, either:
STDERR
); orSTDERR
), and (optionally) a resume of the lost elements and their context (onSTDOUT
).This option could be helpful to test formats before proceding with the actual conversion. Sometimes we simply get confused about the multiple formats, and might forget that a given element won't render in another format. The lossyness warning would be a better solution than manually checking if every element is present in the final output.
This would also be useful in big projects (especially if script-automated, like API documentation, etc), it would allow users to check (and control) wether elements are lost during the pipeline, and take counter measures if there are --- eg: a pre-conversion check might block a specific release if a lossyness warning is raised by pandoc, allowing maintainers to edit the source docs so that only elements that can make it through the conversion line are used.
The text was updated successfully, but these errors were encountered: