org.asciidoctor.Attributes.setDocType()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.0k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.asciidoctor.Attributes.setDocType()方法的一些代码示例,展示了Attributes.setDocType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Attributes.setDocType()方法的具体详情如下:
包路径:org.asciidoctor.Attributes
类名称:Attributes
方法名:setDocType

Attributes.setDocType介绍

[英]Sets the document type, which defines how a document and what parts are rendered. Possible values are:

  • article
  • book
  • inline
  • manpage
    [中]设置文档类型,该类型定义如何呈现文档以及呈现哪些部分。可能的值为:
    *文章
    *书
    *内联
    *手册页

代码示例

代码示例来源:origin: asciidoctor/asciidoctorj

/**
 * Sets doc type attribute.
 * 
 * @param docType
 *            value.
 * @return this instance.
 */
public AttributesBuilder docType(String docType) {
  this.attributes.setDocType(docType);
  return this;
}

代码示例来源:origin: org.asciidoctor/asciidoctor-java-integration

/**
 * Sets doc type attribute.
 * 
 * @param docType
 *            value.
 * @return this instance.
 */
public AttributesBuilder docType(String docType) {
  this.attributes.setDocType(docType);
  return this;
}

代码示例来源:origin: org.asciidoctor/asciidoctorj-api

/**
 * Sets doc type attribute.
 * 
 * @param docType
 *            value.
 * @return this instance.
 */
public AttributesBuilder docType(String docType) {
  this.attributes.setDocType(docType);
  return this;
}

代码示例来源:origin: pietermartin/sqlg

private void createDocs() {
  String version = "2.0.0-SNAPSHOT";
  Asciidoctor asciidoctor = create();
  try {
    File file = new File("sqlg-doc/docs/" + version + "/sqlg.adoc");
    File html = new File("sqlg-doc/docs/" + version + "/index.html");
    Attributes attributes = new Attributes();
    attributes.setBackend("html5");
    attributes.setStyleSheetName("asciidoctor-default.css");
    attributes.setDocType("book");
    attributes.setSourceHighlighter("highlightjs");
    Map<String, Object> options =  OptionsBuilder.options()
        .attributes(attributes)
        .toFile(new File(html.getPath()))
        .headerFooter(true)
        .safe(SafeMode.SERVER)
        .asMap();
    options.put("location", ":footer");
    Docinfo docinfo = new Docinfo(options);
    asciidoctor.javaExtensionRegistry().docinfoProcessor(docinfo);
    asciidoctor.convertFile(
        file,
        options
    );
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
}

相关文章

微信公众号

最新文章

更多