标签: asciidoctor

如何通过位于不同文件夹中的许多 .adoc 文件正确引用图像

我正在使用 Atom Editor + 两个有关 asciidoctor 的插件/包。

  • asciidoc-预览
  • 语言asciidoc

一切都按预期工作。但我有以下情况:

我有以下目录结构:

xml
  figures
     findOneXml.adoc
     findOneXml.png
  urls
     findOne.adoc
Run Code Online (Sandbox Code Playgroud)

哪里findOneXml.adoc(在数字文件夹内)有

[[findOneXml]]
image::findOneXml.png[caption="Figure - " title="findOneXml"]
Run Code Online (Sandbox Code Playgroud)

通过实时预览,我可以看到图像及其各自的描述

现在 with findOne.adoc(在url文件夹中)包含以下行:

include::../figures/findOneXml.adoc[]
Run Code Online (Sandbox Code Playgroud)

我认为路径参考没问题。如果我使用其他,实时预览会显示一条关于无效或错误路径的错误消息。

但是通过实时预览,我看到图像损坏了,但我可以看到描述。

在此处输入图片说明

有什么问题或遗漏了什么?

即使include::./../figures/findOneXml.adoc[]失败

注意:在子/子文档中,我需要添加其他数据如何注释、提示(警告),该子文档将被其他父母多次重复使用。所以我只不需要参考图像。

谢谢

asciidoc asciidoctor atom-editor

4
推荐指数
1
解决办法
3159
查看次数

从 gradle 中找不到 Asciidoctor 'snippets' 属性

我正在遵循 Spring Rest Docs 参考文档中关于构建配置的说明。但是当我尝试做时,“片段”属性似乎没有暴露给 Asciidoctor

include::{snippets}/....
Run Code Online (Sandbox Code Playgroud)

但我得到一个 asciidoctor“警告:删除包含对缺失属性的引用的行:片段”

如果我去掉属性引用,直接放在路径中,就会出现包含文件的内容。

这是包含 Rest Docs/Asciidoctor 信息的 build.gradle 文件:

buildscript {
    ext {
        springBootVersion = '1.3.0.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

plugins {
    id "org.asciidoctor.convert" version "1.5.3"
}


allprojects {
    apply plugin: 'groovy'
    apply plugin: 'idea'

    sourceCompatibility = 1.8
    targetCompatibility = 1.8
    group = 'com....'

    ext {
        si = [version: '4.1.7.RELEASE']
        groovy = [version: '2.4.5']
        newRelic = [version: '3.13.0']
        jackson = [version: '2.6.2']
    }

    repositories {
        mavenCentral()
        maven …
Run Code Online (Sandbox Code Playgroud)

asciidoctor spring-restdocs

4
推荐指数
1
解决办法
2408
查看次数

目录不紧接在标题页之后

使用asciidoc,我想将目录放在第三页上。最多只能放在第2页;在扉页之后。

我的期望是这样的事情应该有效:

= My book
A book to enjoy

== Preface
Enjoy my book

== Table of contents
:toc:

== Chapter One
It was the best of times ...
Run Code Online (Sandbox Code Playgroud)

...但目录仍然位于第 2 页。

是否可以选择放置目录的位置?

编辑:

我希望目录位于不同页面上的原因是因为我正在复制一个模板,该模板在目录之前有一个部分。

asciidoc asciidoctor

4
推荐指数
1
解决办法
1830
查看次数

链接到 asciidoc 中同一页面的部分

我正在编写一些将转换为 HTML 的文本,作为一个长页面。

无法弄清楚如何像在 HTML 中一样使用 链接到部分#some-id,以便用户在单击它时会向上或向下浏览网页

<h2 id="some-id">Section A</h2>
<p>Lot's of lines</p>
<a href="#some-id">Go to section</a>
Run Code Online (Sandbox Code Playgroud)

asciidoc asciidoctor

4
推荐指数
2
解决办法
2789
查看次数

如何在Asciidoctor Asciidoc中转义双加号“++”?

例如,如果我写:

Notepad++ is *great*, I like Notepad++
Run Code Online (Sandbox Code Playgroud)

它被视为++something++转义结构,忽略粗体*并产生:

<p>Notepad is *great*, I like Notepad</p>
Run Code Online (Sandbox Code Playgroud)

而不是所需的:

<p>Notepad++ is <strong>great</strong>, I like Notepad++</p>
Run Code Online (Sandbox Code Playgroud)

上游讨论:https://github.com/asciidoctor/asciidoctor/issues/1864

在 Asciidoctor 2.0.10 上测试。

asciidoc asciidoctor

4
推荐指数
1
解决办法
688
查看次数

如何更改 asciidoc 语法中单词的文本颜色?

我的任务是将一些文档转换为 asciidoc 格式。

我只有 asciidoctor 标准工具 - 我无法访问 asciidoctor 用于渲染输出的任何 css 表。

我需要改变单词中间的颜色。

假设这个词是 RedNectar

我希望前三个字母呈现为红色,后五个字母呈现为黄色

如果我拆分这个词并使用[red]#Red# [yellow]#Nectar#

我得到了正确的颜色,但它们之间有一个空格

在此输入图像描述

但如果我删除空间,[red]#Red#[yellow]#Nectar#它会呈现为:

在此输入图像描述

[黄色突出显示只是表示有问题的预览]

那么我需要施展什么魔法才能让这两个半字连接起来呢?在很多情况下,当我在单词之间使用 {nbsp} (不间断空格)时,我在单词之间遇到与 wee 相同的问题 - 现在它完全被视为空格,并且我遇到了与您所看到的相同类型的问题这里 - 我在 Red 和 Nectar 之间有一个空格 - 它只是一个 {nbsp} - 并且仍然无法正确渲染。

在此输入图像描述

asciidoc asciidoctor

4
推荐指数
1
解决办法
4840
查看次数

Asciidoctor render_file缺少CSS

从CLI运行AsciiDoctor会创建一个带有嵌入式样式表的HTML文档:

$ asciidoctor mysample.adoc

....
<title>My First Experience with the Dangers of Documentation</title>
<style>
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; }
...
Run Code Online (Sandbox Code Playgroud)

但是,在Ruby文件中运行Asciidoctor不会:

r.rb:

#!/usr/bin/env ruby

require 'asciidoctor'
Asciidoctor.render_file('mysample.adoc', :in_place => true)

$ ./r.rb

...
<title>My First Experience with the Dangers of Documentation</title>
<link rel="stylesheet" href="./asciidoctor.css">
...
Run Code Online (Sandbox Code Playgroud)

文件并不表示应该有任何区别.我错过了什么?

细节:

  • Asciidoctor 0.1.4
  • ruby 2.0.0p247

css ruby ruby-2.0 asciidoctor

3
推荐指数
1
解决办法
485
查看次数

Asciidoctor属性替换代码块

在我目前的Asciidoctor文档中,我有一个我想在代码块中使用的属性.有没有办法在代码块中进行字符串插值?

标题中的属性..

:api_version: 1.0
Run Code Online (Sandbox Code Playgroud)

代码块

{
    "api_version" : "{api_version}",
}
Run Code Online (Sandbox Code Playgroud)

我似乎无法进行字符串替换,任何提示或提示在代码块中进行字符串替换?

asciidoc asciidoctor

3
推荐指数
1
解决办法
454
查看次数

asciidoctorj 库不适用于 Spring Boot 2 可执行引导 jar

我试图在 Spring Boot 2.0.3 中使用 asciidoctorj,当我从 IntelliJ IDEA 运行项目时一切正常,但是当我创建一个引导 jar 时,我开始看到以下错误:

Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- asciidoctor
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:956) ~[jruby-complete-9.1.16.0.jar!/:na]
    at RUBY.require(uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:55) ~[na:na]
    at RUBY.<main>(<script>:15) ~[na:na]
Run Code Online (Sandbox Code Playgroud)

这是来自 build.gradle 的片段

buildscript {
    ext {
        springBootVersion = '2.0.3.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

... committed few lines

springBoot {
    buildInfo()
}

bootJar {
    launchScript()
    mainClassName = "com.example.demo.DemoApplication"
    requiresUnpack 'org.jruby:jruby-complete', 'org.asciidoctor:asciidoctorj'
}

dependencies {
    compile('org.springframework.boot:spring-boot-starter-web')
    compile('org.asciidoctor:asciidoctorj:1.5.7')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}
Run Code Online (Sandbox Code Playgroud)

我的项目托管在,如果有人想看看它

https://github.com/cancerian0684/spring-boot2-asciidoctorj

用于使用 Spring Boot …

spring-boot asciidoctor gradle-plugin

3
推荐指数
1
解决办法
541
查看次数

使用 AsciiDoctor,如何在源代码块和示例块中传递变量?

有谁知道如何在 Asciidoc 中将变量传递{var}[source]块和示例块(带有====)?

我已经尝试了以下

:country: France
:city: Shanghai

[source]
----
print("{country} is a country")
print("{city} is a city")
----

.Example
====
{country} is a country +
{city} is a city
====

.Example with better alignment
====
    {country} is a country
    {city} is a city
====
Run Code Online (Sandbox Code Playgroud)

但这就是我得到的:

结果

实际上,第一个“示例”正在运行,但它不是理想的解决方案,因为:

  • 它不像其他示例那样有灰色区域
  • 我需要+在每一行的末尾添加一个

期待您的投入。提前致谢!

asciidoc asciidoctor

3
推荐指数
1
解决办法
1048
查看次数