Package br.com.caelum.tubaina.parser.html.desktop

Examples of br.com.caelum.tubaina.parser.html.desktop.SyntaxHighlighter


  }

  @Test
  public void plainJavaCode() throws Exception {
    String options = "java";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(code, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(code), eq(options), eq(false), eq(emptyList), Mockito.anyString());
  }
View Full Code Here


  }

  @Test
  public void javaCodeWithNumberedLines() throws Exception {
    String options = "java #";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(code, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(code), eq("java"), eq(true), eq(emptyList), Mockito.anyString());
  }
View Full Code Here

  @Test
  public void plainRubyCode() throws Exception {
    String options = "ruby";
    String rubyCode = "@name = \"Gabriel\"\n" + "puts \"Hello, \" + name";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(rubyCode, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(rubyCode), eq("ruby"), eq(false), eq(emptyList), Mockito.anyString());
  }
View Full Code Here

  @Test
  public void noLanguageDefinedIsTreatedAsText() throws Exception {
    String options = "";
    String noParticularLanguage = "Some text explaining some new bizarre\n" + "syntax in a very code alike way";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(noParticularLanguage, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(noParticularLanguage), eq("text"), eq(false), eq(emptyList), Mockito.anyString());
  }
View Full Code Here

  @Test
  public void noLanguageDefinedIsTreatedAsTextEvenWhenItIsNumbered() throws Exception {
    String options = "#";
    String noParticularLanguage = "Some text explaining some new bizarre\n" + "syntax in a very code alike way";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(noParticularLanguage, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(noParticularLanguage), eq("text"), eq(true), eq(emptyList), Mockito.anyString());
  }
View Full Code Here

  @Test
  public void shouldNotConsiderLabelAsLanguage() throws Exception {
    String options = "label=world";
    String noParticularLanguage = "Some code";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(noParticularLanguage, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(noParticularLanguage), eq("text"), eq(false), eq(emptyList), Mockito.anyString());
  }
View Full Code Here

  @Test
  public void shouldConsiderLineHighlightOption() throws Exception {
    String options = "h=1,2";
    String noParticularLanguage = "Some code";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(noParticularLanguage, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(noParticularLanguage), eq("text"), eq(false), eq(Arrays.asList(1, 2)), Mockito.anyString());
  }
View Full Code Here

 
  @Test
  public void shouldConsiderPygmentsOptions() throws Exception {
    String options = "label=somelabel options=\'startinline=true\'";
    String noParticularLanguage = "Some code";
    SyntaxHighlighter htmlCodeHighlighter = mock(SyntaxHighlighter.class);
    HtmlAndKindleCodeTag codeTag = new HtmlAndKindleCodeTag(htmlCodeHighlighter);
    CodeChunk chunk = new CodeChunk(noParticularLanguage, options);
    codeTag.parse(chunk);
    verify(htmlCodeHighlighter).highlight(eq(noParticularLanguage), eq("text"), eq(false), eq(emptyList), eq("startinline=true"));
  }
View Full Code Here

    private CodeTag code;
    private GistResultRetriever retriever;

    public GistTag(Indentator i, GistResultRetriever retriever) {
        this.code = new CodeTag(i, new SyntaxHighlighter(new SimpleCommandExecutor(), CodeOutputType.LATEX, new CodeCache(CodeOutputType.LATEX)));
        this.retriever = retriever;
    }
View Full Code Here

TOP

Related Classes of br.com.caelum.tubaina.parser.html.desktop.SyntaxHighlighter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.