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
After publishToConfluence: Java-Code Formatting lost #281
Comments
hm. this is not how it should be. docToolchain takes the generated HTML and publishes it to confluence. |
I think its a problem of LF/CLRF. I'm a linux user, so my default editor setting is LF. I'll check this immediately and will inform you... |
This could be the problem. My last published code block looks fine, but I used windows and it could be that git converted my line endings: https://arc42-template.atlassian.net/wiki/spaces/dttest/pages/579665949/Included+Section |
This is the code before publishing: and this after: I have no clue why. The XML file works fine. Where is the difference. I've tried 1000 things, nothing works for me. Please, can you try to publish the file under windows? |
yes, I will give it a try tomorrow. |
I've tried all format options (coderay, highlightjs, prettify, and pygments). The stripping of all the spans from the codeblock seems to work correctly. I suppose sth. unexpected happens here: I'm not a groovy expert, but we can try to investigate what goes in and what comes out there. org.jsoup.nodes.Document? I have no further settings, my adoc file is shown here: |
you example (the one with the inline source) renders fine for me: No matter if I use WSL (linux) or windows. Can you please check which line endings you use? My editor reports me that I use |
my html source looks the same as yours. The confluence storage format looks like this:
so, something is different with your setup... |
as I can see, the confluence version we both use is also the same... |
could you please overwrite your
This should shed some light at least on where the problem lies. |
Thank your for your efforts. I found a method to reproduce the error today by random:
src/docs/test.adoc
Config.groovy (to modify):
Publish it and everything works. Set
and you see the unformatted code in the sect2 sections set it to false and everything is ok again... Hope this helps to find the error. This is under Linux, I'll check it under windows asap. If the behavior is different, I'll debug the rewriteCodeblocks as you have proposed above... Greetings Tom |
wrong button clicked... |
absolutly the same behavior as described above with windows 10... |
hm. I have currently no clue what could be different. which shell do you use? |
I'm usting bash(Linux) or gitbash (windows) but ...anyway. Chekcout the code at https://github.com/duschata/reproduceCodeFormattingFailure.git and modify your server and space settings. After that publish and play with the createSubpages = false/true option. If set to false, sect2 code formatting will fail... Greetings Tom |
Thanx! Now I can reproduce it: so, it is because of the subpages... |
this is the line:
https://github.com/docToolchain/docToolchain/blob/master/scripts/asciidoc2confluence.groovy#L248 now let's see why it behaves different when executed the second time.... |
hm. at least, this line removes the rest of the line breaks, but some are already removed before... |
pageBody has type Elements, body (in the confluenceCreateSubpages section) is a (single) Element type. So the rewriteCodeblocks get different inputs while processing the page.body. If you have an idea to quickfix it let me know. I suggest to change the sect2 selector or modify the rewriteCodeblocks section (don't know what is better, what do you think?) |
good question. JSoup was always some kind of magic to me. I am always happy when it just works. So, how would you modify it? |
I' spent hours and hours with this bug..
line. You will get a null pointer exception in a plain java jsoup test, if you try to work on referenced Elements, which you have removed from the dom. The behavior of Groovy seems to be different there, but not 100% predictable. You write a view lines to debug this
after the remove() the LF disappeared. Comment the remove() line and both outputs are identical. |
ok, you can checkout this project |
I've forgotten to set in the java-example above:
after this, everything works as expected (in java). But why fails this in the doctools groovy script? |
thanx for spending some much time trying to fix this issue! |
ok, I had the same idea on Friday and started a fresh groovy project. I would like to reduce the "bug" to a minimum of lines. What we have so far:
Have a look to my java code, it seems to work. Where are the differences? Are there side effects in the gradleScript which I've overlooked? |
https://github.com/duschata/minimalPublishError.git |
finally it's a bug (or a strange behavior) in jsoup! |
very cool that you managed to find the root cause! Kudos to you! |
Hello All,
have a look at this URL(and it's subpages):
https://asciidoc.atlassian.net/wiki/spaces/DOCSASCODE/pages/589861/Showcase
I've pushed some asiidocs which contain java code. The code-formatting for java has completely vanished (I've tried this with/without the java keyword in [code]).
Maybe this has to do sth. with
any ideas?
Greetings Tom
The text was updated successfully, but these errors were encountered: