Package com.uwyn.jhighlight.renderer

Examples of com.uwyn.jhighlight.renderer.Renderer


        }
        int lastDot = source.lastIndexOf('.');
        if (lastDot != -1)
        {
          String type = source.substring(lastDot + 1);
          Renderer renderer = XhtmlRendererFactory.getRenderer(type);
          if (renderer != null)
          {
            return renderer.highlight(source, sb.toString(), "UTF-8", true);
          }
        }
        return Strings.escapeMarkup(sb.toString(), false, true)
          .toString()
          .replaceAll("\n", "<br />");
View Full Code Here


  }
 
  public Renderer getRenderer(String type) {
   
    // Look first for our own renderer, followed by the richfaces renderer
    Renderer renderer = null;
    Object object = classNames.get(type.toLowerCase());
    if (object != null) {
      String className = object.toString();
     
      try {
View Full Code Here

        }
        int lastDot = name.lastIndexOf('.');
        if (lastDot != -1)
        {
          String type = name.substring(lastDot + 1);
          Renderer renderer = XhtmlRendererFactory.getRenderer(type);
          if (renderer != null)
          {
            return renderer.highlight(name, sb.toString(), "UTF-8", true);
          }
        }
        return Strings.escapeMarkup(sb.toString(), false, true).toString().replaceAll("\n",
          "<br />");
      }
View Full Code Here

      response instanceof HttpServletResponse)
    {
      HttpServletRequest  http_request = (HttpServletRequest)request;
      HttpServletResponse http_response = (HttpServletResponse)response;
     
      Renderer renderer = null;
      String uri = http_request.getRequestURI();
      String extension = FileUtils.getExtension(uri);
      if (extension != null &&
        extension.endsWith("s"))
      {
        renderer = XhtmlRendererFactory.getRenderer(extension.substring(0, extension.length()-1));
      }
     
      if (renderer != null)
      {
        SourceRequestWrapper    request_wrapper = new SourceRequestWrapper(http_request);
        CharResponseWrapper     response_wrapper = new CharResponseWrapper(http_response);
       
        chain.doFilter(request_wrapper, response_wrapper);
       
        OutputStream out = response.getOutputStream();
        try
        {
          if (HttpServletResponse.SC_OK == response_wrapper.getStatus())
          {
            InputStream is = new ByteArrayInputStream(response_wrapper.getWrappedOutputStream().toByteArray());
            ByteArrayOutputStream os = new ByteArrayOutputStream();
           
            String encoding = request.getCharacterEncoding();
            if (null == encoding)
            {
              encoding = "UTF-8";
            }
           
            renderer.highlight(http_request.getServletPath().substring(1), is, os, encoding, false);
           
            String highlighted = os.toString("ISO-8859-1");
           
            response.setContentType("text/html");
            response.setContentLength(highlighted.length());
View Full Code Here

        int lastDot = source.lastIndexOf('.');
        if (lastDot != -1)
        {
          String type = source.substring(lastDot + 1);
          Renderer renderer = XhtmlRendererFactory.getRenderer(type);
          if (renderer != null)
          {
            ByteArrayOutputStream output = new ByteArrayOutputStream();
            renderer.highlight(source, resourceAsStream, output, "UTF-8", true);
            return output.toString("UTF-8");
          }
        }

        CharSequence escaped = Strings.escapeMarkup(IOUtils.toString(resourceAsStream),
View Full Code Here

        }
        int lastDot = name.lastIndexOf('.');
        if (lastDot != -1)
        {
          String type = name.substring(lastDot + 1);
          Renderer renderer = XhtmlRendererFactory.getRenderer(type);
          if (renderer != null)
          {
            return renderer.highlight(name, sb.toString(), "UTF-8", true);
          }
        }
        return Strings.escapeMarkup(sb.toString(), false, true).toString().replaceAll("\n", "<br />");
      }
      catch (IOException e)
View Full Code Here

              metadata.add(TikaCoreProperties.CREATOR, author);
            }
            nbLines ++;
        }
        metadata.set("LoC", String.valueOf(nbLines));
        Renderer renderer = getRenderer(type.toString());
       
        String codeAsHtml = renderer.highlight(name, out.toString(), charset.name(), false);
       
        Schema schema = context.get(Schema.class, HTML_SCHEMA);

        org.ccil.cowan.tagsoup.Parser parser = new org.ccil.cowan.tagsoup.Parser();
        parser.setProperty(org.ccil.cowan.tagsoup.Parser.schemaProperty, schema);
View Full Code Here

TOP

Related Classes of com.uwyn.jhighlight.renderer.Renderer

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.