Commit d9500467 authored by Vincent Massol's avatar Vincent Massol
Browse files

XRENDERING-623: Remove quote macro that was left by error

parent 045a2008
......@@ -117,7 +117,6 @@
<module>xwiki-rendering-macro-html</module>
<module>xwiki-rendering-macro-id</module>
<module>xwiki-rendering-macro-message</module>
<module>xwiki-rendering-macro-quote</module>
<module>xwiki-rendering-macro-raw</module>
<module>xwiki-rendering-macro-toc</module>
</modules>
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.xwiki.rendering</groupId>
<artifactId>xwiki-rendering-macros</artifactId>
<version>14.0-SNAPSHOT</version>
</parent>
<artifactId>xwiki-rendering-macro-quote</artifactId>
<name>XWiki Rendering - Macro - Quote</name>
<description>Displays inline text with special quote formatting</description>
<properties>
<xwiki.jacoco.instructionRatio>0.96</xwiki.jacoco.instructionRatio>
<!-- Name to display by the Extension Manager -->
<xwiki.extension.name>Quote Macro</xwiki.extension.name>
</properties>
</project>
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.rendering.internal.macro.quote;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import org.xwiki.component.annotation.Component;
import org.xwiki.component.manager.ComponentManager;
import org.xwiki.rendering.block.Block;
import org.xwiki.rendering.block.QuotationBlock;
import org.xwiki.rendering.block.QuotationLineBlock;
import org.xwiki.rendering.block.VerbatimBlock;
import org.xwiki.rendering.macro.AbstractNoParameterMacro;
import org.xwiki.rendering.macro.MacroContentParser;
import org.xwiki.rendering.macro.MacroExecutionException;
import org.xwiki.rendering.macro.descriptor.DefaultContentDescriptor;
import org.xwiki.rendering.transformation.MacroTransformationContext;
/**
* Displays passed text as inline text, with one quote per line in the content (spearated by new line characters).
*
* @version $Id$
* @since 7.3M1
*/
@Component
@Named("quote")
@Singleton
public class QuoteMacro extends AbstractNoParameterMacro
{
/**
* The description of the macro.
*/
private static final String DESCRIPTION = "Displays inline text with special quote formatting.";
/**
* The description of the macro content.
*/
private static final String CONTENT_DESCRIPTION = "Content to quote";
/**
* Used to parse the macro content.
*/
@Inject
private MacroContentParser macroContentParser;
/**
* Used to find the Parser corresponding to the user-specified syntax for the Macro.
*/
@Inject
private ComponentManager componentManager;
/**
* Create and initialize the descriptor of the macro.
*/
public QuoteMacro()
{
super("Quote", DESCRIPTION, new DefaultContentDescriptor(CONTENT_DESCRIPTION));
setDefaultCategory(DEFAULT_CATEGORY_FORMATTING);
}
@Override
public boolean supportsInlineMode()
{
return false;
}
@Override
public List<Block> execute(Object parameters, String content, MacroTransformationContext context)
throws MacroExecutionException
{
List<Block> quoteBlocks = new ArrayList<>();
for (String line : content.split("\\r?\\n")) {
List<Block> lineContentBlocks = Collections.<Block>singletonList(new VerbatimBlock(line, true));
quoteBlocks.add(new QuotationLineBlock(lineContentBlocks));
}
return Collections.<Block>singletonList(new QuotationBlock(quoteBlocks));
}
}
/*
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.xwiki.rendering.macro.quote;
import org.xwiki.rendering.test.integration.junit5.RenderingTests;
/**
* Run all tests found in {@code *.test} files located in the classpath. These {@code *.test} files must follow the
* conventions described in {@link org.xwiki.rendering.test.integration.TestDataParser}.
*
* @version $Id$
* @since 7.3M1
*/
public class IntegrationTests implements RenderingTests
{
}
.runTransformations
.#-----------------------------------------------------
.input|xwiki/2.0
.#-----------------------------------------------------
{{quote}}
quote **line** 1
quote line 2
{{/quote}}
.#-----------------------------------------------------
.expect|event/1.0
.#-----------------------------------------------------
beginDocument
beginMacroMarkerStandalone [quote] [] [quote **line** 1
quote line 2]
beginQuotation
beginQuotationLine
onVerbatim [quote **line** 1] [true]
endQuotationLine
beginQuotationLine
onVerbatim [] [true]
endQuotationLine
beginQuotationLine
onVerbatim [quote line 2] [true]
endQuotationLine
endQuotation
endMacroMarkerStandalone [quote] [] [quote **line** 1
quote line 2]
endDocument
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment