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

XRENDERING-667: New lines added when parsing and re-rendering groups in xwiki/2.1 #289

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.#-------------------------------------------------------------------
.inputexpect|xwiki/2.0
.# Verify that newlines in a group stay unchanged
.#-------------------------------------------------------------------
(((


)))
.#-----------------------------------------------------
.expect|event/1.0
.#-----------------------------------------------------
beginDocument
beginGroup
onEmptyLines [2]
endGroup
endDocument
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ endDocument
.#-----------------------------------------------------
(% id="idname1" %)
(((

)))

before{{id name="idname2"/}}after
before{{id name="idname2"/}}after
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,14 @@ public void endDocument(MetaData metadata)
@Override
public void endGroup(Map<String, String> parameters)
{
print("\n");
// Flush the internal buffer to ensure we have the correct newline state. Note that the following print()
// would flush the buffer, anyway.
getXWikiPrinter().flush();

// Don't print a new line if the last element of the group is a new line.
if (!getXWikiPrinter().getEscapeHandler().isOnNewLine()) {
print("\n");
}
print(")))");

// Restore previous listeners that were stacked
Expand Down Expand Up @@ -958,4 +965,4 @@ protected void popPrinter()

super.popPrinter();
}
}
}