Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
X
xwiki-platform
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
XWiki
xwiki-platform
Commits
cbdd31a8
Commit
cbdd31a8
authored
7 years ago
by
Thomas Mortagne
Browse files
Options
Downloads
Patches
Plain Diff
[misc] Bulletproofing
parent
3d204784
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xwiki-platform-core/xwiki-platform-annotations/xwiki-platform-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/PlainTextNormalizingChainingRenderer.java
+17
-14
17 additions, 14 deletions
...ternal/renderer/PlainTextNormalizingChainingRenderer.java
with
17 additions
and
14 deletions
xwiki-platform-core/xwiki-platform-annotations/xwiki-platform-annotation-core/src/main/java/org/xwiki/annotation/internal/renderer/PlainTextNormalizingChainingRenderer.java
+
17
−
14
View file @
cbdd31a8
...
...
@@ -21,6 +21,7 @@
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.xwiki.annotation.content.AlteredContent
;
import
org.xwiki.annotation.content.ContentAlterer
;
import
org.xwiki.rendering.listener.HeaderLevel
;
...
...
@@ -100,20 +101,22 @@ public void onVerbatim(String content, boolean inline, Map<String, String> param
@Override
public
void
onRawText
(
String
text
,
Syntax
syntax
)
{
// Similar approach to verbatim FTM. In the future, syntax specific cleaner could be used for various syntaxes
// (which would do the great job for HTML, for example)
// normalize the protected string before adding it to the plain text version
if
(
Character
.
isWhitespace
(
text
.
charAt
(
0
)))
{
// if there is a space right at the beginning of the raw text, we need to print a space
printSpace
();
}
AlteredContent
cleanedContent
=
textCleaner
.
alter
(
text
);
printText
(
cleanedContent
.
getContent
().
toString
());
if
(
Character
.
isWhitespace
(
text
.
charAt
(
text
.
length
()
-
1
)))
{
// if there is a space right at the end of the text, we need to print a space
printSpace
();
if
(
StringUtils
.
isNotEmpty
(
text
))
{
// Similar approach to verbatim FTM. In the future, syntax specific cleaner could be used for various
// syntaxes (which would do the great job for HTML, for example) normalize the protected string before
// adding it to the plain text version
if
(
Character
.
isWhitespace
(
text
.
charAt
(
0
)))
{
// if there is a space right at the beginning of the raw text, we need to print a space
printSpace
();
}
AlteredContent
cleanedContent
=
textCleaner
.
alter
(
text
);
printText
(
cleanedContent
.
getContent
().
toString
());
if
(
Character
.
isWhitespace
(
text
.
charAt
(
text
.
length
()
-
1
)))
{
// if there is a space right at the end of the text, we need to print a space
printSpace
();
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment