maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Charles Salmon (JIRA)" <j...@codehaus.org>
Subject [jira] (DOXIA-488) Support optional langage for syntax highlighting
Date Thu, 11 Apr 2013 02:34:52 GMT

    [ https://jira.codehaus.org/browse/DOXIA-488?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=323508#comment-323508
] 

Charles Salmon edited comment on DOXIA-488 at 4/10/13 9:33 PM:
---------------------------------------------------------------

Dont know how to edit the issue, so here the code of what should be changed:
{code:java}
    /**
     * {@inheritDoc}
     */
	@Override
	public void visit(VerbatimNode node) {
		printer.println().print("<div class=\"source\"><pre");
		if (!StringUtils.isEmpty(node.getType())) {
			printAttribute("class", node.getType());
		}
		printer.print(">");
		String text = node.getText();
		// print HTML breaks for all initial newlines
		while (text.charAt(0) == '\n') {
			printer.print("<br/>");
			text = text.substring(1);
		}
		printer.printEncoded(text);
		printer.print("</pre></div>");
	}

	private void printAttribute(String name, String value) {
		printer.print(' ').print(name).print('=').print('"').print(value)
				.print('"');
	}
{code}

THE CODE HAS BEEN TESTED ON 1.3 version with the patch DOXIA-484 APPLIED.
The fix is safe, would be great to have it for 1.4.

Thanks !
                
      was (Author: charless):
    Dont know how to edit the issue, so here the code of what should be changed:
{code:java}
    /**
     * {@inheritDoc}
     */
	@Override
	public void visit(VerbatimNode node) {
		printer.println().print("<div class=\"source\"><pre>");
		if (!StringUtils.isEmpty(node.getType())) {
			printAttribute("class", node.getType());
		}
		printer.print(">");
		String text = node.getText();
		// print HTML breaks for all initial newlines
		while (text.charAt(0) == '\n') {
			printer.print("<br/>");
			text = text.substring(1);
		}
		printer.printEncoded(text);
		printer.print("</pre></div>");
	}

	private void printAttribute(String name, String value) {
		printer.print(' ').print(name).print('=').print('"').print(value)
				.print('"');
	}
{code}

THE CODE HAS BEEN TESTED ON 1.3 version with the patch DOXIA-484 APPLIED.
The fix is safe, would be great to have it for 1.4.

Thanks !
                  
> Support optional langage for syntax highlighting
> ------------------------------------------------
>
>                 Key: DOXIA-488
>                 URL: https://jira.codehaus.org/browse/DOXIA-488
>             Project: Maven Doxia
>          Issue Type: Bug
>          Components: Module - Markdown
>    Affects Versions: 1.3
>            Reporter: Charles Salmon
>            Priority: Trivial
>
> pegdown supports the way to specify the langage for a code block:
> ~~~langage
> code
> ~~~
> Following the resolution of DOXIA-484 (pegdown dependency update), we should make sure
the overrided {code:java}public void visit( VerbatimNode node ) {code} of the {code:java}MarkdownToDoxiaHtmlSerializer{code}
includes the support of langage option, ie:
> {code:java}
>      /**
>       * {@inheritDoc}
>       */
>      @Override
>      public void visit( VerbatimNode node )
>      {
>         printer.println().print("<div class=\"source\"><pre>");
>         if (!StringUtils.isEmpty(node.getType())) {
>             printAttribute("class", node.getType());
>         }
>         printer.print(">");
>         ...
>      }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message