Blocks

문서개요

This document has a header that specifies the Blocks.
This document is about the blocks.

Structural containers in AsciiDoc
Type Description Minimum delimiter Example

Comment

출력에 표시되지 않는 개인 메모

////

////
This is a comment.
////

Example

예시 내용을 지정하거나 훈계 블록을 정의합니다.

====

====
This is an example.
====

Listing

소스 코드 또는 키보드 입력이 입력된 대로 표시됩니다.

----

----
This is a listing.
----

Literal

출력 텍스트는 입력한 대로 정확하게 표시됩니다.

…​.

…​.
This is a literal.
…​.

Open

통과 또는 테이블 블록을 제외한 모든 블록으로 작동할 수 있는 익명 블록

--

--
This is an open.
--

Sidebar

문서의 흐름 외부에 표시되는 텍스트와 콘텐츠

****

****
This is a sidebar.
****

Table

표 형식 콘텐츠를 표시합니다.

|===
,===
:===
!===

|===
|This is a table.
|===

Pass

출력으로 직접 전송되는 처리되지 않은 콘텐츠

++++

++++
This is a pass.
++++

quote

선택적 저작자 표시가 있는 견적

____

____
This is a quote.
____

1. Comment

1.1. 한 줄 주석 (//)

// A single-line comment.

1.2. 두 목록 구분

. first list

//

. second list
  1. first list

  1. second list

1.3. 블록 주석 (////)

////
A comment block.

Notice it's a delimited block.
////

1.4. 목록 항목에 포함된 주석

. first item
+
////
A comment block in a list.

Notice it's attached to the preceding list item.
////

. second item
  1. first item

  2. second item

1.5. 테이블 내 주석

|===
a|
cell text

////
A comment block in a table.

Notice the cell has the "a" (AsciiDoc) style.
////
|===

cell text

2. Example

  • 예제 블록은 개념을 설명하거나 작업 결과를 표시하는 콘텐츠를 시각적으로 묘사하는 데 유용합니다.

  • 예제에는 모든 유형의 콘텐츠와 AsciiDoc 구문이 포함될 수 있습니다.

2.1. 예제 블록 (====)

.예제 제목
====
The book hit the floor with a *thud*.

He could hear doves *cooing* in the pine trees`' branches.
====
  • 결과

    Example 1. 예제 제목

    The book hit the floor with a thud.

    He could hear doves cooing in the pine trees’ branches.

2.2. 축소 ([%collapsible])

[%collapsible]
====
This content is only revealed when the user clicks the block title.
====
  • 결과

    Details

    This content is only revealed when the user clicks the block title.

3. Listing

  • 서식이 지정된 블록과 단락은 소스에 표시된 대로 렌더링된 내용을 정확하게 표시합니다.

  • 목록 콘텐츠는 미리 서식이 지정된 텍스트로 변환됩니다.

  • 콘텐츠는 고정 너비 글꼴로 표시되며 개행은 유지됩니다.

  • 문서가 변환될 때 특수 문자와 설명선만 바뀝니다.

3.1. 기본 블록 (----)

----
This is a _delimited listing block_.

The content inside is displayed as <pre> text.
----
  • 결과

    This is a _delimited listing block_.
    
    The content inside is displayed as <pre> text.
    • HTML 요소는 이스케이프됩니다, 즉 해석되지 않고 그대로 표시됩니다.

    • 밑줄 서식(_) 표시가 있음에도 불구하고 기울임꼴로 표시되지 않습니다.

3.2. 소스 코드 블록 ([source])

[source]
----
#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}
----

[source,console]
$ asciidoctor -v

[source,c]
----
#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}
----
  • 결과

    #include <stdio.h>
    int main() {
        printf("Hello, World!");
        return 0;
    }
    $ asciidoctor -v
    #include <stdio.h>
    int main() {
        printf("Hello, World!");
        return 0;
    }

3.3. 축소 ([%collapsible])

.Show stacktrace
[%collapsible]
====
[source]
----
Error: Content repository not found (url: https://git.example.org/repo.git)
    at transformGitCloneError
    at git.clone.then.then.catch
Caused by: HttpError: HTTP Error: 401 HTTP Basic: Access Denied
    at GitCredentialManagerStore.rejected
    at fill.then
----
====
  • 결과

    Show stacktrace
    Error: Content repository not found (url: https://git.example.org/repo.git)
        at transformGitCloneError
        at git.clone.then.then.catch
    Caused by: HttpError: HTTP Error: 401 HTTP Basic: Access Denied
        at GitCredentialManagerStore.rejected
        at fill.then

3.4. 설명선

3.4.1. 기본 (<n>)

[source,ruby]
----
require 'sinatra' <1>

get '/hi' do <2> <3>
  "Hello World!"
end
----
<1> Library import
<2> URL mapping
<3> Response block
  • 결과

    require 'sinatra' (1)
    
    get '/hi' do (2) (3)
      "Hello World!"
    end
    1 Library import
    2 URL mapping
    3 Response block

3.4.2. 주석 뒤

[source]
----
line of code // <1>
line of code # <2>
line of code ;; <3>
line of code <!--4-->
----
<1> A callout behind a line comment for C-style languages.
<2> A callout behind a line comment for Ruby, Python, Perl, etc.
<3> A callout behind a line comment for Clojure.
<4> A callout behind a line comment for XML or SGML languages like HTML.
  • 결과

    line of code (1)
    line of code (2)
    line of code (3)
    line of code (4)
    1 A callout behind a line comment for C-style languages.
    2 A callout behind a line comment for Ruby, Python, Perl, etc.
    3 A callout behind a line comment for Clojure.
    4 A callout behind a line comment for XML or SGML languages like HTML.

3.4.3. 사용자 지정 ([line-comment=])

[source,erlang,line-comment=%]
----
-module(hello_world).
-compile(export_all).

hello() ->
    io:format("hello world~n"). % <1>
----
<1> A callout behind a custom line comment prefix.
  • 결과

    -module(hello_world).
    -compile(export_all).
    
    hello() ->
        io:format("hello world~n"). (1)
    1 A callout behind a custom line comment prefix.

3.4.4. 줄 주석

[source,asciidoc,line-comment=]
----
-- <1>
A paragraph in an open block.
--
----
<1> An open block delimiter.
  • 결과

    -- (1)
    A paragraph in an open block.
    --
    1 An open block delimiter.

3.5. 추가 속성

3.5.1. 라인 번호 추가 ([linenums])

[source,ruby,linenums]
----
ORDERED_LIST_KEYWORDS = {
  'loweralpha' => 'a',
  'lowerroman' => 'i',
  'upperalpha' => 'A',
  'upperroman' => 'I'
   #'lowergreek' => 'a'
   #'arabic'     => '1'
   #'decimal'    => '1'
}
----
  • 결과

    ORDERED_LIST_KEYWORDS = {
      'loweralpha' => 'a',
      'lowerroman' => 'i',
      'upperalpha' => 'A',
      'upperroman' => 'I'
       #'lowergreek' => 'a'
       #'arabic'     => '1'
       #'decimal'    => '1'
    }

3.5.2. 특정 라인 강조 ([highlight=""])

[source,shell,highlight="3,4"]
----
#!/bin/sh

fail () {
    echo
    echo "$*"
    echo
    exit 1
} >&2

JAVACMD=java
which java >/dev/null 2>&1 || fail "ERROR: no 'java' command could be found in your PATH."

exec "$JAVACMD" "$@"
----
  • 결과

    #!/bin/sh
    
    fail () {
        echo
        echo "$*"
        echo
        exit 1
    } >&2
    
    JAVACMD=java
    which java >/dev/null 2>&1 || fail "ERROR: no 'java' command could be found in your PATH."
    
    exec "$JAVACMD" "$@"

4. Literal

  • 리터럴 블록(…​.)은 소스에서 보는 그대로 작성한 텍스트를 표시합니다.

  • 리터럴 텍스트는 서식이 미리 지정된 텍스트로 처리됩니다.

  • 텍스트는 고정 너비 글꼴로 표시되며 개행은 유지됩니다.

  • 문서가 변환될 때 특수 문자와 설명선만 바뀝니다.

....
Kismet: Where is the *defensive operations manual*?

Computer: Calculating ...
Can not locate object.
You are not authorized to know it exists.

Kismet: Did the werewolves tell you to say that?

Computer: Calculating ...
....
  • 결과

    Kismet: Where is the *defensive operations manual*?
    
    Computer: Calculating ...
    Can not locate object.
    You are not authorized to know it exists.
    
    Kismet: Did the werewolves tell you to say that?
    
    Computer: Calculating ...
    • 출력에서 굵은 텍스트(*) 서식이 텍스트에 적용되지 않았습니다.

    • 세 개의 연속된 마침표가 줄임표 유니코드 문자로 대체되지 않습니다.

5. Open

  • 열린 블록(--)은 콘텐츠를 묶기 위한 일반적인 구조적 컨테이너를 제공합니다.

  • 열린 블록이 다른 열린 블록 안에 중첩될 수 없다.

** The header in AsciiDoc must start with a document title.
+
--
Here's an example of a document title:

====
= Document Title
====

NOTE: The header is optional.
--
  • 결과

    • The header in AsciiDoc must start with a document title.

      Here’s an example of a document title:

      = Document Title

      The header is optional.

6. Sidebar

  • 사이드바(****)에는 인용문, 방정식 및 이미지와 같은 모든 유형의 콘텐츠가 포함될 수 있습니다.

.Optional Title
****
Sidebars are used to visually separate auxiliary bits of content that supplement the main text.

TIP: They can contain any type of content.

.Source code block in a sidebar
[source,js]
----
const { expect, expectCalledWith, heredoc } = require('../test/test-utils')
----

////
+ 개별 제목은 섹션 제목과 유사한 방식으로 선언되고 스타일 지정됨
  - 섹션 계층 구조의 일부가 아닙니다.
  - 다른 블록에 중첩 될 수 있습니다.
  - 자식 블록을 가질 수 없습니다.
  - 목차에 포함되어 있지 않습니다.
////
[discrete]
== Discrete Heading
Discrete headings are useful for making headings inside of other blocks, like this sidebar.
Discrete headings can be used where sections are not permitted.
****
  • 결과

    Optional Title

    Sidebars are used to visually separate auxiliary bits of content that supplement the main text.

    They can contain any type of content.
    Source code block in a sidebar
    const { expect, expectCalledWith, heredoc } = require('../test/test-utils')

    Discrete Heading

    Discrete headings are useful for making headings inside of other blocks, like this sidebar.
    Discrete headings can be used where sections are not permitted.

7. Pass

  • 패스 블록(++++)은 AsciiDoc이 아닌 콘텐츠를 출력에 직접 전달하는 것입니다.

  • 예를 들어, 패스 블록을 사용하여 원시 HTML을 HTML 출력으로 전달할 수 있습니다.

7.1. 패스 블록 (++++)

++++
image:tiger.png[]
link:Tables_sample.adoc#tables_sample[Table]
++++
  • 결과

    image:tiger.png[] link:Tables_sample.adoc#tables_sample[Table]

    • AsciiDoc에는 이미지와 링크 매크로가 있으나 변환되지 않습니다.

    • 패스 블록의 내용은 단락에 줄 바꿈되지 않습니다.

7.2. 인라인 (pass:[ ])

Content passed directly to the output followed by normal content.
"/resources/pass:[**]"
  • 결과

    Content passed directly to the output followed by normal content.
    "/resources/**"