-
-
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
docx writer does not support tracked deletions anymore #4303
Comments
We discussed this yesterday in issue #4301. The If you want to put track changes information into a docx file, you have to use the output of |
Sorry -- I misunderstood the issue. Let me check this and get back to you. |
Confirmed -- this is indeed an issue. Note, though, that |
Okay -- fixed. Sorry again about the misunderstanding, and thanks for reporting the issue! |
Okay, thanks for the fix. What about adding a test case for it. |
our test framework for the docx writer is a bit lacking at the moment. There's been some discussion about how to fix that. @jgm -- this would certainly be a good argument for adding golden tests to docx, after the fashion of the pptx writer. I think this issue was introduced in 5441e11b06 (almost a year ago) and no one noticed it till now. Should I work on abstracting those tests to Test.Writers.OOXML? |
The reason for that is not obvious to me. Since you closed #4301, is it worth to discuss this anywhere else, i. e. at pandoc-discuss? BTW: I'm willing to support pandoc and I would like to spend time on pandoc itself rather than on lua filters, if it makes sense. As track changes were introduced some years ago and are supported by a number of formats (docx, odt, html, and even criticmarkup, even if it is not supported here) and are partialy implemented in pandoc (docx, for html see i.e. #1273 (comment)) I think it is worth to support it pandoc for these formats and support accept/reject for all the other formats (IMHO). |
I closed #4301 because the issue there focused heavily on the documentation, which was accurate. This would probably be a better topic for pandoc-discuss, since that is not a bug (as this was), but rather a choice (that might or might not have been the right choice). The reason that this currently requires more of an open discussion, I think, is that the current spans and divs output by It seems that before we talk about officially having all writer write track-changes info, we'd have to decide what form we want that to take in pandoc. It's not an issue to be fixed, so much as a question of how to proceed in the future. So I think pandoc-discuss is more appropriate. |
That was not my general aim with #4301. I just wanted that the track-changes info is removed per default in all writers, which is possible with the roundtrip md -> docx -md with |
+++ Jesse Rosenthal [Jan 25 18 07:52 ]:
***@***.*** -- this would certainly be a good argument for adding golden
tests to docx, after the fashion of the pptx writer. I think this issue
was introduced in [2]5441e11 (almost a year ago) and no one noticed it
till now. Should I work on abstracting those tests to
Test.Writers.OOXML?
That would be great!
|
John MacFarlane <notifications@github.com> writes:
+++ Jesse Rosenthal [Jan 25 18 07:52 ]:
> Should I work on abstracting those tests to
> Test.Writers.OOXML?
That would be great!
Okay -- just merged it as Tests.Writers.OOXML. `pptxTest` in
Tests.Writers.Powerpoint is now just `ooxmlTest writePowerpoint`. As far
as the docx tests go, I guess we can just use the natives in the reader
test directory, though we'll want to define different names for the
golden tests so we don't get them mixed up with ms-generated docx files
the reader tests:
~~~
...
, docxTest
"Inline formatting"
def
"docx/inline_formatting.native"
"docx/golden/inline_formatting.docx"
...
~~~
One more issue that will have to be dealt with. It looks like the docx
writer uses uniqueIds. That will make the outcome non-deterministic,
which will make comparing harder. I'll take a look to see if there's any
way to make it more deterministic (keeping a state list of ids) -- I
didn't have to do it in pptx, but I'm not sure if that's down to a
format difference. If there isn't we'll either have to look for some
safe ways to give the comparison a pass, as we do with the time values
in the docprops, or think about an option for passing ersatz values.
Then we can just run it, and someone (who probably won't be me for the
next week or so) will just have to go through the golden files one by
one in office to ensure that they (a) are not corrupt, and (b) exhibit
the correct behavior.
|
@jgm, yeah we can actually take care of that problem by just keeping something in state as say, getUniqueId :: (PandocMonad m) => m String
getUniqueId = do
n <- gets stateCurId
modify $ \st -> st{stateCurId = stateCurId + 1}
return n At the moment you avoid collisions by adding 20 to the output of P.uniqueHash, so we could just start this by initializing |
Oh, there's also a random in |
OK, see #4308 |
+++ Jesse Rosenthal [Jan 25 18 12:46 ]:
One more issue that will have to be dealt with. It looks like the docx
writer uses uniqueIds. That will make the outcome non-deterministic,
which will make comparing harder. I'll take a look to see if there's
any
way to make it more deterministic (keeping a state list of ids) -- I
didn't have to do it in pptx, but I'm not sure if that's down to a
format difference. If there isn't we'll either have to look for some
safe ways to give the comparison a pass, as we do with the time values
in the docprops, or think about an option for passing ersatz values.
Running the writer in PandocPure would be one way to go, I
suppose, though itt requires some setup.
|
If I use the provided test files (track_changes_deletion_all.native or track_changes_deletion.docx in case of round-tripping) like with
pandoc -s -t docx --track-changes=all track_changes_deletion_all.native -o track_changes_deletion_test.docx
, the output docx contains the deletion as it was rejected and it is not marked as a tracked change anymore.Insertions and comments were converted sucessfully.
pandoc version is 2.1.1
Maybe the test files should be added to the tests in
https://github.com/jgm/pandoc/blob/master/test/Tests
?The text was updated successfully, but these errors were encountered: