blocks.adoc 11.9 KB
Newer Older
heywon.choi's avatar
heywon.choi committed
1
= Blocks
heywon.choi's avatar
heywon.choi committed
2 3
Gildong Hong <email1@bwg.com>
:description: The document's description. This document is about the blocks sample.
4
include::ROOT:common_attrs.adoc[]
heywon.choi's avatar
heywon.choi committed
5 6 7 8 9 10 11 12 13

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

.Structural containers in AsciiDoc
heywon.choi's avatar
heywon.choi committed
14
[cols="15,32,18,35"]
heywon.choi's avatar
heywon.choi committed
15 16
|===
|Type |Description |Minimum delimiter |Example
heywon.choi's avatar
heywon.choi committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

|<<_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:[****]

heywon.choi's avatar
heywon.choi committed
60
|xref:./tables.adoc[Table]
heywon.choi's avatar
heywon.choi committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|표 형식 콘텐츠를 표시합니다.
|\|===
 ,===
 :===
 !===
|\|===
 \|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
====

=== 블록 주석 (////)
----
heywon.choi's avatar
heywon.choi committed
112
////
heywon.choi's avatar
heywon.choi committed
113 114 115
A comment block.

Notice it's a delimited block.
heywon.choi's avatar
heywon.choi committed
116
////
heywon.choi's avatar
heywon.choi committed
117
----
heywon.choi's avatar
heywon.choi committed
118
====
heywon.choi's avatar
heywon.choi committed
119 120 121 122 123
////
A comment block.

Notice it's a delimited block.
////
heywon.choi's avatar
heywon.choi committed
124 125
====

heywon.choi's avatar
heywon.choi committed
126
=== 목록 항목에 포함된 주석
heywon.choi's avatar
heywon.choi committed
127
----
heywon.choi's avatar
heywon.choi committed
128 129 130 131 132 133 134 135 136
. first item
+
////
A comment block in a list.

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

. second item
heywon.choi's avatar
heywon.choi committed
137
----
heywon.choi's avatar
heywon.choi committed
138 139 140 141 142
====
. first item
+
////
A comment block in a list.
heywon.choi's avatar
heywon.choi committed
143

heywon.choi's avatar
heywon.choi committed
144 145 146 147 148
Notice it's attached to the preceding list item.
////

. second item
====
heywon.choi's avatar
heywon.choi committed
149

heywon.choi's avatar
heywon.choi committed
150 151
=== 테이블 내 주석
----
heywon.choi's avatar
heywon.choi committed
152
|===
heywon.choi's avatar
heywon.choi committed
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
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.
////
|===
====
heywon.choi's avatar
heywon.choi committed
175 176

== Example
heywon.choi's avatar
heywon.choi committed
177 178 179 180 181 182 183 184 185 186 187 188 189 190
* 예제 블록은 개념을 설명하거나 작업 결과를 표시하는 콘텐츠를 시각적으로 묘사하는 데 유용합니다.
* 예제에는 모든 유형의 콘텐츠와 AsciiDoc 구문이 포함될 수 있습니다. 

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

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

* 결과
heywon.choi's avatar
heywon.choi committed
191 192 193 194 195 196 197 198
+
.예제 제목
====
The book hit the floor with a *thud*.

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

heywon.choi's avatar
heywon.choi committed
199 200 201 202 203 204 205 206 207
=== 축소 ([%collapsible])
----
[%collapsible]
====
This content is only revealed when the user clicks the block title.
====
----

* 결과
heywon.choi's avatar
heywon.choi committed
208 209 210 211 212 213 214
+
[%collapsible]
====
This content is only revealed when the user clicks the block title.
====

== Listing 
heywon.choi's avatar
heywon.choi committed
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241
* 서식이 지정된 블록과 단락은 소스에 표시된 대로 렌더링된 내용을 정확하게 표시합니다.
* 목록 콘텐츠는 미리 서식이 지정된 텍스트로 변환됩니다. 
* 콘텐츠는 고정 너비 글꼴로 표시되며 개행은 유지됩니다.
* 문서가 변환될 때 특수 문자와 설명선만 바뀝니다.

=== 기본 블록 (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]
heywon.choi's avatar
heywon.choi committed
242 243 244 245 246 247 248 249
----
#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}
----

heywon.choi's avatar
heywon.choi committed
250 251 252 253
[source,console]
$ asciidoctor -v

[source,c]
heywon.choi's avatar
heywon.choi committed
254 255 256 257 258 259 260
----
#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}
----
heywon.choi's avatar
heywon.choi committed
261
....
heywon.choi's avatar
heywon.choi committed
262

heywon.choi's avatar
heywon.choi committed
263 264 265 266 267 268 269 270 271 272 273
* 결과
+
[source]
----
#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}
----
+
heywon.choi's avatar
heywon.choi committed
274 275
[source,console]
$ asciidoctor -v
heywon.choi's avatar
heywon.choi committed
276
+
heywon.choi's avatar
heywon.choi committed
277 278 279 280 281 282 283 284 285
[source,c]
----
#include <stdio.h>
int main() {
    printf("Hello, World!");
    return 0;
}
----

heywon.choi's avatar
heywon.choi committed
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
=== 축소 ([%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
----
====
....

* 결과
heywon.choi's avatar
heywon.choi committed
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318
+
.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
----
====

heywon.choi's avatar
heywon.choi committed
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335
=== 설명선
==== 기본 (<n>)
....
[source,ruby]
----
require 'sinatra' \<1>

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

* 결과
heywon.choi's avatar
heywon.choi committed
336 337 338 339 340 341 342 343 344 345 346 347 348
+
[source,ruby]
----
require 'sinatra' <1>

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

heywon.choi's avatar
heywon.choi committed
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364
==== 주석 뒤
....
[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.
....

* 결과
heywon.choi's avatar
heywon.choi committed
365 366 367 368 369 370 371 372 373 374 375 376 377
+
[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.

heywon.choi's avatar
heywon.choi committed
378 379 380 381 382 383 384 385 386 387 388 389 390 391
==== 사용자 지정 ([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.
....

* 결과
heywon.choi's avatar
heywon.choi committed
392 393 394 395 396 397 398 399 400 401 402
+
[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.

heywon.choi's avatar
heywon.choi committed
403 404 405 406 407 408 409 410 411 412 413 414
==== 줄 주석
....
[source,asciidoc,line-comment=]
----
-- \<1>
A paragraph in an open block.
--
----
<1> An open block delimiter.
....

* 결과
heywon.choi's avatar
heywon.choi committed
415 416 417 418 419 420 421 422 423
+
[source,asciidoc,line-comment=]
----
-- <1>
A paragraph in an open block.
--
----
<1> An open block delimiter.

heywon.choi's avatar
heywon.choi committed
424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441
=== 추가 속성
==== 라인 번호 추가 ([linenums])
....
[source,ruby,linenums]
----
ORDERED_LIST_KEYWORDS = {
  'loweralpha' => 'a',
  'lowerroman' => 'i',
  'upperalpha' => 'A',
  'upperroman' => 'I'
   #'lowergreek' => 'a'
   #'arabic'     => '1'
   #'decimal'    => '1'
}
----
....

* 결과
heywon.choi's avatar
heywon.choi committed
442 443 444 445 446 447 448 449 450 451 452 453 454 455
+
[source,ruby,linenums]
----
ORDERED_LIST_KEYWORDS = {
  'loweralpha' => 'a',
  'lowerroman' => 'i',
  'upperalpha' => 'A',
  'upperroman' => 'I'
   #'lowergreek' => 'a'
   #'arabic'     => '1'
   #'decimal'    => '1'
}
----

heywon.choi's avatar
heywon.choi committed
456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476
==== 특정 라인 강조 ([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" "$@"
----
....

* 결과
heywon.choi's avatar
heywon.choi committed
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494
+
[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" "$@"
----

heywon.choi's avatar
heywon.choi committed
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529
== 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 ...
....
** 출력에서 굵은 텍스트(*) 서식이 텍스트에 적용되지 않았습니다.
** 세 개의 연속된 마침표가 줄임표 유니코드 문자로 대체되지 않습니다.

heywon.choi's avatar
heywon.choi committed
530
== Open
heywon.choi's avatar
heywon.choi committed
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550
* 열린 블록(--)은 콘텐츠를 묶기 위한 일반적인 구조적 컨테이너를 제공합니다.
* 열린 블록이 다른 열린 블록 안에 중첩될 수 없다.

....
** 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.
heywon.choi's avatar
heywon.choi committed
551 552 553 554 555 556 557 558 559 560 561 562
+
--
Here's an example of a document title:

====
= Document Title
====

NOTE: The header is optional.
--

== Sidebar
heywon.choi's avatar
heywon.choi committed
563 564 565 566 567 568 569 570 571 572 573 574 575
* 사이드바(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')
----
heywon.choi's avatar
heywon.choi committed
576

heywon.choi's avatar
heywon.choi committed
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592
////
+ 개별 제목은 섹션 제목과 유사한 방식으로 선언되고 스타일 지정됨
  - 섹션 계층 구조의 일부가 아닙니다.
  - 다른 블록에 중첩 될 수 있습니다.
  - 자식 블록을 가질 수 없습니다.
  - 목차에 포함되어 있지 않습니다.
////
[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.
****
....

* 결과
+
heywon.choi's avatar
heywon.choi committed
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618
.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
heywon.choi's avatar
heywon.choi committed
619 620 621 622 623 624 625 626 627 628 629 630 631
* 패스 블록(pass:[++++])은 AsciiDoc이 아닌 콘텐츠를 출력에 직접 전달하는 것입니다.
* 예를 들어, 패스 블록을 사용하여 원시 HTML을 HTML 출력으로 전달할 수 있습니다.

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

* 결과
+
heywon.choi's avatar
heywon.choi committed
632 633 634 635
++++
image:tiger.png[] 
link:Tables_sample.adoc#tables_sample[Table]
++++
heywon.choi's avatar
heywon.choi committed
636 637 638 639 640 641 642 643 644
{blank}
** AsciiDoc에는 이미지와 링크 매크로가 있으나 변환되지 않습니다.
** 패스 블록의 내용은 단락에 줄 바꿈되지 않습니다.

=== 인라인 (pass:[pass:[ ]])
....
Content passed directly to the output followed by normal content.
"/resources/pass:[**]" 
....
heywon.choi's avatar
heywon.choi committed
645

heywon.choi's avatar
heywon.choi committed
646
* 결과
heywon.choi's avatar
heywon.choi committed
647 648
+
Content passed directly to the output followed by normal content.
heywon.choi's avatar
heywon.choi committed
649
"/resources/pass:[**]"