Package ru.org.linux.util.formatter

Examples of ru.org.linux.util.formatter.ToHtmlFormatter


    } else if(rootNode.isTopicMinimized()) { // топик со свернутым cut, вместо содержимого ссылка
      URI uri = rootNode.getCutURI();
      try {
        uri.setFragment("cut"+Integer.toString(rootNode.getCutCount()));
        if (!node.getParameter().isEmpty()) {
          ToHtmlFormatter formatter = rootNode.getToHtmlFormatter();
          String parameter;
          if(formatter != null) {
            parameter = rootNode.getToHtmlFormatter().simpleFormat(node.getParameter().replaceAll("\"", ""));
          } else {
             parameter = Parser.escape(node.getParameter().replaceAll("\"", ""));
View Full Code Here


    return text;
  }

  @Override
  public String renderXHtml() {
    ToHtmlFormatter toHtmlFormatter = state.getRootNode().getToHtmlFormatter();
    if(toHtmlFormatter != null) {
      if (TagNode.class.isInstance(parent)) {
        TagNode tagNode = (TagNode) parent;
        if (parserParameters.getAutoLinkTags().contains(tagNode.bbtag.getName())) {
          return toHtmlFormatter.format(
              text,
              state.getRootNode().isSecure(),
              state.getRootNode().isNofollow(),
              state.getTypoChanger()
              );
        } else {
          return toHtmlFormatter.simpleFormat(state.getTypoChanger().format(text));
        }
      }
    }
    return Parser.escape(text);
  }
View Full Code Here

      linkText = url;
    }
    String escapedUrl = URLUtil.fixURL(url);
    TagNode tagNode = (TagNode)node;
    RootNode rootNode = tagNode.getRootNode();
    ToHtmlFormatter formatter = rootNode.getToHtmlFormatter();

   if(formatter != null) {
      StringBuilder out = new StringBuilder();

      try {
        formatter.processUrl(
                rootNode.isSecure(),
                rootNode.isNofollow(),
                out,
                escapedUrl,
                linkText
View Full Code Here

    }
    TextNode txtNode = (TextNode) node.getChildren().iterator().next();
    String memberName = Parser.escape(txtNode.getText()).trim();
    TagNode tagNode = (TagNode)node;
    RootNode rootNode = tagNode.getRootNode();
    ToHtmlFormatter toHtmlFormatter = rootNode.getToHtmlFormatter();
    boolean secure = rootNode.isSecure();
    UserDao userDao = rootNode.getUserDao();
    String result;
    try {
      if(userDao != null && toHtmlFormatter != null){
        User user = rootNode.getUserDao().getUser(memberName);
        if (!user.isBlocked()) {
          result = String.format(" <span style=\"white-space: nowrap\"><img src=\"/img/tuxlor.png\"><a style=\"text-decoration: none\" href=\"%s\">%s</a></span>",
              toHtmlFormatter.memberURL(user, secure), Parser.escape(memberName));
          rootNode.addReplier(user);
        } else {
          result = String.format(" <span style=\"white-space: nowrap\"><img src=\"/img/tuxlor.png\"><s><a style=\"text-decoration: none\" href=\"%s\">%s</a></s></span>",
              toHtmlFormatter.memberURL(user, secure), Parser.escape(memberName));
        }
      }else{
        result = Parser.escape(memberName);
      }
    } catch (Exception ex) {
View Full Code Here

    TagNode tagNode = (TagNode)node;
    RootNode rootNode = tagNode.getRootNode();

    boolean rss = rootNode.isRss();
    ToHtmlFormatter formatter = rootNode.getToHtmlFormatter();

    if (!node.getParameter().isEmpty()) {
      if(rss) {
        ret.append(citeHeaderRSS);
      } else {
        ret.append(citeHeader);
      }
      ret.append("<p><cite>");
      if(formatter != null) {
        ret.append(formatter.simpleFormat(node.getParameter().replaceAll("\"", "")));
      } else {
        ret.append(Parser.escape(node.getParameter().replaceAll("\"", "")));
      }
      ret.append("</cite></p>");
      ret.append(node.renderChildrenXHtml());
View Full Code Here

    URI mainURI = new URI(mainUrl, true, "UTF-8");
    SiteConfig siteConfig = mock(SiteConfig.class);
    when(siteConfig.getMainURI()).thenReturn(mainURI);
    when(siteConfig.getMainUrl()).thenReturn(mainUrl);

    toHtmlFormatter = new ToHtmlFormatter();
    toHtmlFormatter.setSiteConfig(siteConfig);


    lorCodeService = new LorCodeService();
    lorCodeService.setUserDao(mock(UserDao.class));
View Full Code Here

    SiteConfig siteConfig = mock(SiteConfig.class);
    when(siteConfig.getMainURI()).thenReturn(mainURI);
    when(siteConfig.getMainUrl()).thenReturn(mainUrl);


    ToHtmlFormatter toHtmlFormatter = new ToHtmlFormatter();
    toHtmlFormatter.setSiteConfig(siteConfig);

    lorCodeService = new LorCodeService();
    lorCodeService.setUserDao(userDao);
    lorCodeService.setSiteConfig(siteConfig);
    lorCodeService.setToHtmlFormatter(toHtmlFormatter);
View Full Code Here

    URI mainURI = new URI(mainUrl, true, "UTF-8");
    SiteConfig siteConfig = mock(SiteConfig.class);
    when(siteConfig.getMainURI()).thenReturn(mainURI);
    when(siteConfig.getMainUrl()).thenReturn(mainUrl);

    ToHtmlFormatter toHtmlFormatter = new ToHtmlFormatter();
    toHtmlFormatter.setSiteConfig(siteConfig);


    lorCodeService = new LorCodeService();
    lorCodeService.setUserDao(userDao);
    lorCodeService.setSiteConfig(siteConfig);
View Full Code Here

    SiteConfig siteConfig = mock(SiteConfig.class);
    when(siteConfig.getMainURI()).thenReturn(mainURI);
    when(siteConfig.getMainUrl()).thenReturn(mainUrl);

    ToHtmlFormatter toHtmlFormatter = new ToHtmlFormatter();
    toHtmlFormatter.setSiteConfig(siteConfig);

    lorCodeService = new LorCodeService();
    lorCodeService.setUserDao(mock(UserDao.class));
    lorCodeService.setSiteConfig(siteConfig);
    lorCodeService.setToHtmlFormatter(toHtmlFormatter);
View Full Code Here

    SiteConfig siteConfig = mock(SiteConfig.class);

    when(siteConfig.getMainURI()).thenReturn(mainURI);

    toHtmlFormatter = new ToHtmlFormatter();
    toHtmlFormatter.setSiteConfig(siteConfig);
    toHtmlFormatter.setMessageDao(messageDao);
    toHtmlFormatter.setCommentService(commentService);

    toHtmlFormatter20 = new ToHtmlFormatter();
    toHtmlFormatter20.setSiteConfig(siteConfig);
    toHtmlFormatter20.setMessageDao(messageDao);
    toHtmlFormatter20.setMaxLength(20);
    toHtmlFormatter20.setCommentService(commentService);
View Full Code Here

TOP

Related Classes of ru.org.linux.util.formatter.ToHtmlFormatter

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.