コード例 #1
0
 private AttributesBuilder getAttributes(ConfigSection cfg, String revision) {
   AttributesBuilder ab =
       AttributesBuilder.attributes()
           .tableOfContents(cfg.getBoolean(KEY_INCLUDE_TOC, true))
           .sourceHighlighter("prettify");
   for (String name : attributes.stringPropertyNames()) {
     ab.attribute(name, attributes.getProperty(name));
   }
   ab.attribute("last-update-label!");
   ab.attribute("revnumber", revision);
   return ab;
 }
コード例 #2
0
  @Override
  public String format(
      String projectName,
      String path,
      String revision,
      String abbrRev,
      ConfigSection globalCfg,
      String raw)
      throws IOException {
    if (!globalCfg.getBoolean(KEY_ALLOW_HTML, false)) {
      raw = suppressHtml(raw);
    }

    ConfigSection projectCfg = formatters.getFormatterConfig(NAME, projectName);
    String html =
        Asciidoctor.Factory.create(AsciidoctorFormatter.class.getClassLoader())
            .convert(raw, createOptions(projectCfg, abbrRev));
    return util.applyCss(html, NAME, projectName);
  }