= Blocks Sample
Gildong Hong <email1@bwg.com>
:description: The document's description. This document is about the blocks sample.
include::../attributes/common_attrs.adoc[]
include::../attributes/dir_attrs.adoc[]
include::../attributes/common_css.adoc[]
:source-highlighter: pygments
:pygments-style: material
:pygments-linenums-mode: inline

[abstract]
.문서개요
--
This document has a header that specifies the {doctitle}.
This document is about the blocks.
--

.Structural containers in AsciiDoc
[cols="15,32,18,35"]
|===
|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>>
|문서의 흐름 외부에 표시되는 텍스트와 콘텐츠
|pass:[****]
|pass:[****]
 This is a sidebar.
 pass:[****]

|xref:./tables.adoc[Table]
|표 형식 콘텐츠를 표시합니다.
|\|===
 ,===
 :===
 !===
|\|===
 \|This is a table.
 \|===

|<<_pass>>
|출력으로 직접 전송되는 처리되지 않은 콘텐츠
|pass:[++++]
|pass:[++++]
 This is a pass.
 pass:[++++]

|quote
|선택적 저작자 표시가 있는 견적
|pass:[____]
|pass:[____]
 This is a quote.
 pass:[____]
|===

== Comment
=== 한 줄 주석 (//)
----
// A single-line comment.
----
====
// A single-line comment.
====

=== 두 목록 구분
----
. first list

//

. second list
----
====
. first list

//

. second list
====

=== 블록 주석 (////)
----
////
A comment block.

Notice it's a delimited block.
////
----
====
////
A comment block.

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

=== 목록 항목에 포함된 주석
----
. first item
+
////
A comment block in a list.

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

. second item
----
====
. first item
+
////
A comment block in a list.

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

. second item
====

=== 테이블 내 주석
----
|===
a|
cell text

////
A comment block in a table.

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

////
A comment block in a table.

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

== Example
* 예제 블록은 개념을 설명하거나 작업 결과를 표시하는 콘텐츠를 시각적으로 묘사하는 데 유용합니다.
* 예제에는 모든 유형의 콘텐츠와 AsciiDoc 구문이 포함될 수 있습니다. 

=== 예제 블록 (pass:[====])
----
.예제 제목
====
The book hit the floor with a *thud*.

He could hear doves *cooing* in the pine trees`' branches.
====
----

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

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

=== 축소 ([%collapsible])
----
[%collapsible]
====
This content is only revealed when the user clicks the block title.
====
----

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

== Listing 
* 서식이 지정된 블록과 단락은 소스에 표시된 대로 렌더링된 내용을 정확하게 표시합니다.
* 목록 콘텐츠는 미리 서식이 지정된 텍스트로 변환됩니다. 
* 콘텐츠는 고정 너비 글꼴로 표시되며 개행은 유지됩니다.
* 문서가 변환될 때 특수 문자와 설명선만 바뀝니다.

=== 기본 블록 (pass:[----])
....
----
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 요소는 이스케이프됩니다, 즉 해석되지 않고 그대로 표시됩니다.
** 밑줄 서식(_) 표시가 있음에도 불구하고 기울임꼴로 표시되지 않습니다.

=== 소스 코드 블록 ([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;
}
----
....

* 결과
+
[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;
}
----

=== 축소 ([%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
[%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
----
====

=== 설명선
==== 기본 (<n>)
....
[source,ruby]
----
require 'sinatra' \<1>

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

* 결과
+
[source,ruby]
----
require 'sinatra' <1>

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

==== 주석 뒤
....
[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.
....

* 결과
+
[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-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.
....

* 결과
+
[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.

==== 줄 주석
....
[source,asciidoc,line-comment=]
----
-- \<1>
A paragraph in an open block.
--
----
<1> An open block delimiter.
....

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

=== 추가 속성
==== 라인 번호 추가 ([linenums])
....
[%linenums,ruby]
----
ORDERED_LIST_KEYWORDS = {
  'loweralpha' => 'a',
  'lowerroman' => 'i',
  'upperalpha' => 'A',
  'upperroman' => 'I'
   #'lowergreek' => 'a'
   #'arabic'     => '1'
   #'decimal'    => '1'
}
----
....

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

==== 특정 라인 강조 ([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" "$@"
----
....

* 결과
+
[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" "$@"
----

== 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 ...
....
** 출력에서 굵은 텍스트(*) 서식이 텍스트에 적용되지 않았습니다.
** 세 개의 연속된 마침표가 줄임표 유니코드 문자로 대체되지 않습니다.

== 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
====

NOTE: The header is optional.
--

== Sidebar
* 사이드바(pass:[****])에는 인용문, 방정식 및 이미지와 같은 모든 유형의 콘텐츠가 포함될 수 있습니다.
....
.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.

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.
****

== Pass
* 패스 블록(pass:[++++])은 AsciiDoc이 아닌 콘텐츠를 출력에 직접 전달하는 것입니다.
* 예를 들어, 패스 블록을 사용하여 원시 HTML을 HTML 출력으로 전달할 수 있습니다.

=== 패스 블록 (pass:[++++])
....
++++
image:tiger.png[] 
link:Tables_sample.adoc#tables_sample[Table]
++++
....

* 결과
+
++++
image:tiger.png[] 
link:Tables_sample.adoc#tables_sample[Table]
++++
{blank}
** AsciiDoc에는 이미지와 링크 매크로가 있으나 변환되지 않습니다.
** 패스 블록의 내용은 단락에 줄 바꿈되지 않습니다.

=== 인라인 (pass:[pass:[ ]])
....
Content passed directly to the output followed by normal content.
"/resources/pass:[**]" 
....

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