属性的声明及使用
:homepage: http://asciidoctor.org
:docslink: http://asciidoctor.org/docs[Asciidoctor's Docs]
:summary: Asciidoctor is a mature, plain-text document format for \
writing notes, articles, documentation, books, and more. \
It's also a text processor & toolchain for translating \
documents into various output formats (i.e., backends), \
including HTML, DocBook, PDF and ePub.
:checkedbox: pass:normal[{startsb}✔{endsb}]
Check out {homepage}[Asciidoctor]!
{summary}
Check out {docslink} too!
{checkedbox} That's done!
Asciidoctor is a mature, plain-text document format for writing notes, articles, documentation, books, and more. It’s also a text processor & toolchain for translating documents into various output formats (i.e., backends), including HTML, DocBook, PDF and ePub.
[✔] That’s done!
属性赋值优先级(从高到低)
传递给 API 或者 命令行且不以 @ 结尾的属性
在文档中定义的属性
传递给 API 或者 命令行且以 @ 结尾的属性
内置属性值(默认值)
为了使传递给 API 或者 命令行的属性有一个比文档中定义的属性有更低的优先级,则可以在属性值的末尾追加一个 @ 符号。
Predefined attributes for character replacements [1][2][3]
Attribute name
Replacement text
Appearance
blank
nothing
empty
nothing
sp
single space
nbsp
zwsp[4]
wj[5]
apos
'
'
quot
"
"
lsquo
‘
‘
rsquo
’
’
ldquo
“
“
rdquo
”
”
deg
°
°
plus
+
+
brvbar
¦
¦
vbar
|
|
amp
&
&
lt
<
<
gt
>
>
startsb
[
[
endsb
]
]
caret
^
^
asterisk
*
*
tilde
~
~
backslash
\
\
backtick
`
`
two-colons
::
::
two-semicolons
;;
;;
cpp
C++
C++
[1] Some replacements are Unicode characters, whereas others are numeric character references.
The character references (e.g., ") are used whenever the use of the Unicode character could interfere with the AsciiDoc syntax or confuse the renderer (i.e., the browser).
It’s up to the converter to transform the reference into something the renderer understands (something both the manpage and PDF converter handle).
[2] Asciidoctor does not prevent you from reassigning predefined attributes.
However, it’s best to treat them as read-only unless the output format requires the use of a different encoding scheme.
These attributes are an effective tool for decoupling content and presentation.
[3] Asciidoctor allows you to use any of the named character references (aka named entities) defined in HTML (e.g., € resolves to €).
However, using named character references can cause problems when generating non-HTML output such as PDF because the lookup table needed to resolve these names may not be defined.
Our recommendation is avoid using named character references—with the exception of those defined in XML (i.e., lt, gt, amp, quot and apos).
Instead, use numeric character references (e.g., €).
[4] The Zero Width Space (ZWSP) is a code point in Unicode that shows where a long word can be split if necessary.
[5] The word joiner (WJ) is a code point in Unicode prevents a line break at its position.
Environment attributes
Attribute
Description
Example Value
asciidoctor
Set if the current processor is Asciidoctor.
asciidoctor-version
Asciidoctor version.
1.5.4
backend
Backend used to create the output file.
html5
basebackend
The backend value minus any trailing numbers.
For example, if the backend is docbook5, the basebackend is docbook.
html
docdate
Last modified date of the source document.[1,2]
2015-01-04
docdatetime
Last modified date and time of the source document.[1,2]
2015-01-04 19:26:06 GMT+0000
docdir
Full path of the directory that contains the source document.
/home/user/docs
docfile
Full path of the source document.
/home/user/docs/userguide.adoc
docname
Root name of the source document (no leading path or file extension).
userguide
doctime
Last modified time of the source document.[1,2]
19:26:06 GMT+0000
doctype
Document type (article, book or manpage).
article
embedded
Set if content is being converted to an embeddable document (body only).
filetype
File extension of the output file name (without leading period).
html
htmlsyntax
Syntax used when generating the HTML output (html or xhtml).
html
localdate
Date when converted.[2]
2016-02-17
localdatetime
Date and time when converted.[2]
2016-02-17 19:31:05 GMT+0000
localtime
Time when converted.[2]
19:31:05 GMT+0000
outdir
Full path of the output directory.
/home/user/docs/dist
outfile
Full path of the output file.
/home/user/docs/dist/userguide.html
outfilesuffix
Default file extension of output file (not the file extension of the specified output file).
Value depends on backend (.html for html, .xml for docbook, etc).
Safe to modify.
.html
safe-mode-level
Numeric value of the safe mode setting.
(UNSAFE=0, SAFE=10, SERVER=10, SECURE=20).
20
safe-mode-name
Textual value of the safe mode setting.
SERVER
safe-mode-unsafe
Set if the safe mode is UNSAFE.
safe-mode-safe
Set if the safe mode is SAFE.
safe-mode-server
Set if the safe mode is SERVER.
safe-mode-secure
Set if the safe mode is SECURE.
user-home
Home directory of the current user.
Resolves to . if the safe mode is SERVER or greater.
/home/user
Named substitutions
none
Disables substitutions
normal
Performs all substitutions except for callouts
verbatim
Replaces special characters and processes callouts
specialchars, specialcharacters
Replaces , and & with their corresponding entities
quotes
Applies text formatting
attributes
Replaces attribute references
replacements
Substitutes textual and character reference replacements
macros
Processes macros
post_replacements
Replaces the line break character (+)
Counter attributes
[caption=""]
.Parts{counter2:index:0}
|===
|Part Id |Description
|PX-{counter:index}
|Description of PX-{index}
|PX-{counter:index}
|Description of PX-{index}
|===
Parts
Part Id
Description
PX-1
Description of PX-1
PX-2
Description of PX-2