From commits-return-77313-archive-asf-public=cust-asf.ponee.io@maven.apache.org Thu Nov 22 13:06:45 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 71EDD180675 for ; Thu, 22 Nov 2018 13:06:44 +0100 (CET) Received: (qmail 62016 invoked by uid 500); 22 Nov 2018 12:06:43 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 62007 invoked by uid 99); 22 Nov 2018 12:06:43 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Nov 2018 12:06:43 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id D5E88851CA; Thu, 22 Nov 2018 12:06:42 +0000 (UTC) Date: Thu, 22 Nov 2018 12:06:43 +0000 To: "commits@maven.apache.org" Subject: [maven-doxia] 01/03: [DOXIA-577] Handle whitespace in tables properly in ConfluenceSink. Line breaks within a table are removed. Any whitespace-only content is trimmed. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit From: dennisl@apache.org In-Reply-To: <154288840280.27313.1856227131914924080@gitbox.apache.org> References: <154288840280.27313.1856227131914924080@gitbox.apache.org> X-Git-Host: gitbox.apache.org X-Git-Repo: maven-doxia X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Rev: 41ad6cd454dcd6fed8d61e1ed712bdb23cc42286 X-Git-NotificationType: diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated Message-Id: <20181122120642.D5E88851CA@gitbox.apache.org> This is an automated email from the ASF dual-hosted git repository. dennisl pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-doxia.git commit 41ad6cd454dcd6fed8d61e1ed712bdb23cc42286 Author: Dennis Lundberg AuthorDate: Thu Nov 22 12:47:08 2018 +0100 [DOXIA-577] Handle whitespace in tables properly in ConfluenceSink. Line breaks within a table are removed. Any whitespace-only content is trimmed. --- .../doxia/module/confluence/ConfluenceSink.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSink.java b/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSink.java index 17e6000..6516dbc 100644 --- a/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSink.java +++ b/doxia-modules/doxia-module-confluence/src/main/java/org/apache/maven/doxia/module/confluence/ConfluenceSink.java @@ -61,6 +61,9 @@ public class ConfluenceSink /** An indication on if we're in verbatim box mode. */ private boolean verbatimBoxedFlag; + /** An indication on if we're in table mode. */ + private boolean tableFlag; + /** An indication on if we're in table header mode. */ private boolean tableHeaderFlag; @@ -819,6 +822,7 @@ public class ConfluenceSink public void table() { // nop + tableFlag = true; writeEOL( true ); writeEOL(); } @@ -832,6 +836,7 @@ public class ConfluenceSink /** {@inheritDoc} */ public void table_() { + tableFlag = false; writeEOL( true ); writeEOL(); } @@ -964,7 +969,21 @@ public class ConfluenceSink write( LINK_START_MARKUP ); } - content( text ); + if ( tableFlag ) + { + // Remove line breaks, because it interferes with the table syntax + String strippedText = StringUtils.replace( text, "\n", "" ); + // Trim if only whitespace, to handle ignorable whitespace from xdoc documents + if ( StringUtils.isWhitespace( strippedText ) ) + { + strippedText = StringUtils.trim( strippedText ); + } + content( strippedText ); + } + else + { + content( text ); + } if ( linkName != null ) {