Skip to content
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

Html2mark - missing newline when paragraph followed by div #328

Closed
dmitrymurashenkov opened this issue Mar 26, 2019 · 4 comments
Closed

Comments

@dmitrymurashenkov
Copy link

If paragraph ends on div tag then newline is missing:

<p>Paragraph 1</p>
<div>Paragraph 2</div>

Expected:

Paragraph 1

Paragraph 2

Actual:

Paragraph 1
Paragraph 2

Similar case, but possibly another problem:

<div>Paragraph 1</div>
<div>
    Text
    <div>Paragraph 2</div>
</div>

Expected:

Paragraph 1

Text

Paragraph 2

Actual:

Paragraph 1

Text
Paragraph 2

Options used:

MutableDataSet options = new MutableDataSet();
options.set(FlexmarkHtmlParser.OUTPUT_ATTRIBUTES_ID, false);
options.set(FlexmarkHtmlParser.THEMATIC_BREAK, "-------------------");
options.set(FlexmarkHtmlParser.SETEXT_HEADINGS, false);
options.set(FlexmarkHtmlParser.BR_AS_EXTRA_BLANK_LINES, false);
options.set(FlexmarkHtmlParser.BR_AS_PARA_BREAKS, false);
options.set(FlexmarkHtmlParser.DIV_AS_PARAGRAPH, true);
options.set(TableFormatOptions.FORMAT_TABLE_CAPTION, TableCaptionHandling.REMOVE);
@vsch
Copy link
Owner

vsch commented Mar 26, 2019

@dmitrymurashenkov, thank you for these cases. I will add the fix and test cases for these.

@vsch vsch added the 🪲 bug label Mar 26, 2019
@vsch vsch added this to the V 0.40.28 milestone Mar 26, 2019
@vsch vsch modified the milestones: V 0.40.28, V 0.40.34 Apr 4, 2019
@vsch
Copy link
Owner

vsch commented Apr 4, 2019

@dmitrymurashenkov, this is a bug of not honouring DIV_AS_PARAGRAPH in all cases.

I will make a release shortly with the fix.

@vsch
Copy link
Owner

vsch commented Apr 4, 2019

Paragraph 1  
Paragraph 2
.
<p>Paragraph 1</p>
<div>Paragraph 2</div>

DIV_AS_PARAGRAPH true

Paragraph 1

Paragraph 2

.
<p>Paragraph 1</p>
<div>Paragraph 2</div>
Paragraph 1  
Text  
Paragraph 2
.
<div>Paragraph 1</div>
<div>
    Text
    <div>Paragraph 2</div>
</div>

DIV_AS_PARAGRAPH true

Paragraph 1

Text

Paragraph 2

.
<div>Paragraph 1</div>
<div>
    Text
    <div>Paragraph 2</div>
</div>

@vsch
Copy link
Owner

vsch commented Apr 4, 2019

Fix for this is available. Repo updated, maven updated but may take a while to show up in maven central.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants