| | ... |
| 10 | 10 | .syntax-sample { border-color:#373731; } |
| 11 | 11 | .syntax-caption { color:#aaa59c; } |
| 12 | 12 | } |
| 13 | .help-theme-demo { padding:8px; border:1px solid #888; color:#17324d; background:#e3f2fd; } |
| 14 | @grove-dark-mode { |
| 15 | .help-theme-demo { color:#def; background:#19344a; } |
| 16 | } |
| 13 | 17 | }}} |
| 14 | 18 | |
| 15 | 19 | [include(틀:투비위키)] |
| | ... |
| 198 | 202 | |
| 199 | 203 | {{{.help-syntax-example}}} 앞의 점은 클래스 선택자입니다. {{{class}}} 값에는 점 없이 이름만 적습니다. 작성한 스타일은 해당 문서의 본문에 적용됩니다. |
| 200 | 204 | |
| 205 | === 다크 모드의 공용 스타일 === |
| 206 | {{{#!style}}} 안에서 {{{@grove-dark-mode}}}로 감싼 규칙은 어두운 테마에만 적용합니다. 기존 {{{@theseed-dark-mode}}} 표기도 호환됩니다. 한 블록의 {{{dark-style}}}과 여러 클래스의 다크 규칙을 나누어 쓸 수 있습니다. |
| 207 | |
| 208 | {{{#!wiki class="syntax-pair" |
| 209 | {{{#!wiki class="syntax-pane syntax-input" |
| 210 | {{{#!wiki class="syntax-caption" |
| 211 | 입력 |
| 212 | }}}{{{#!wiki class="syntax-example-body" |
| 213 | {{{#!html <pre class="syntax-code"><code>{{{#!style |
| 214 | .help-theme-demo { padding:8px; border:1px solid #888; color:#17324d; background:#e3f2fd; } |
| 215 | @grove-dark-mode { |
| 216 | .help-theme-demo { color:#def; background:#19344a; } |
| 217 | } |
| 218 | }}} |
| 219 | {{{#!wiki class="help-theme-demo" |
| 220 | 테마를 바꾸면 글자색과 배경색이 바뀝니다. |
| 221 | }}}</code></pre>}}} |
| 222 | }}} |
| 223 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 224 | {{{#!wiki class="syntax-caption" |
| 225 | 결과 |
| 226 | }}}{{{#!wiki class="syntax-example-body" |
| 227 | {{{#!wiki class="help-theme-demo" |
| 228 | 테마를 바꾸면 글자색과 배경색이 바뀝니다. |
| 229 | }}} |
| 230 | }}} |
| 231 | }}} |
| 232 | }}} |
| 233 | |
| 234 | === 선택자와 적용 범위 === |
| 235 | 클래스는 {{{class="이름"}}}으로 붙이며, CSS에서는 {{{.이름}}}으로 선택합니다. 클래스에 걸린 요소를 기준으로 자식과 형제 요소까지 선택할 수 있습니다. |
| 236 | |
| 237 | ||<thead><rowbgcolor=#eee,#2d2f34> 선택자 || 선택하는 대상 || |
| 238 | || {{{.예시}}} ||<(> 해당 클래스가 있는 요소 || |
| 239 | || {{{.예시.강조}}} ||<(> 두 클래스를 모두 가진 요소 || |
| 240 | || {{{.예시 .항목}}} ||<(> 예시 안에 있는 항목 || |
| 241 | || {{{.예시 > div}}} ||<(> 예시의 바로 아래 div || |
| 242 | || {{{.예시 + .다음}}} ||<(> 예시 바로 다음의 형제 요소 || |
| 243 | || {{{.첫째, .둘째}}} ||<(> 두 선택자에 같은 규칙 적용 || |
| 244 | || {{{.예시:hover}}}, {{{.예시:focus-within}}} ||<(> 마우스를 올렸거나 내부에 키보드 포커스가 있는 상태 || |
| 245 | || {{{.예시:first-child}}}, {{{.예시:nth-child(2n+1)}}} ||<(> 자식의 위치에 따라 선택 || |
| 246 | |
| 247 | 지원하는 위치 가상 클래스는 {{{first-child}}}, {{{last-child}}}, {{{only-child}}}, {{{first-of-type}}}, {{{last-of-type}}}, {{{only-of-type}}}, {{{empty}}}, {{{nth-child()}}}, {{{nth-of-type()}}}, {{{nth-last-child()}}}, {{{nth-last-of-type()}}}입니다. 상태는 {{{hover}}}, {{{focus}}}, {{{focus-within}}}을 지원합니다. |
| 248 | |
| 249 | 요소 이름은 {{{a}}}, {{{div}}}, {{{table}}}, {{{thead}}}, {{{tbody}}}, {{{tfoot}}}, {{{tr}}}, {{{th}}}, {{{td}}}를 사용할 수 있습니다. 선택자에는 문서에서 붙인 클래스가 포함되어야 합니다. {{{body}}} 같은 사이트 전역 선택자, ID·속성 선택자와 {{{::before}}}·{{{::after}}}는 지원하지 않습니다. |
| 250 | |
| 251 | 스타일은 문서 본문 안에만 적용됩니다. 틀에서 정의한 클래스는 그 틀의 포함 범위에서 구분되므로 같은 클래스 이름을 썼다고 다른 틀의 스타일이 되지는 않습니다. 같은 범위에서는 선택자의 구체성, {{{!important}}}, 작성 순서에 따라 적용되며, {{{#!wiki}}}의 {{{style}}}은 해당 요소의 직접 스타일처럼 취급됩니다. |
| 252 | |
| 253 | === 배치 예시 === |
| 254 | 가로로 나란히 놓되 좁은 화면에서는 줄을 바꾸려면 {{{display:flex}}}와 {{{flex-wrap:wrap}}}을 함께 사용합니다. CSS Grid는 지원하지 않습니다. |
| 255 | |
| 256 | {{{#!wiki class="syntax-pair" |
| 257 | {{{#!wiki class="syntax-pane syntax-input" |
| 258 | {{{#!wiki class="syntax-caption" |
| 259 | 입력 |
| 260 | }}}{{{#!wiki class="syntax-example-body" |
| 261 | {{{#!html <pre class="syntax-code"><code>{{{#!wiki style="display:flex;flex-wrap:wrap;gap:8px" |
| 262 | {{{#!wiki style="flex-grow:1;flex-basis:12em;min-width:0;border:1px solid #888;padding:8px" |
| 263 | 첫 번째 영역 |
| 264 | }}} |
| 265 | {{{#!wiki style="flex-grow:1;flex-basis:12em;min-width:0;border:1px solid #888;padding:8px" |
| 266 | 두 번째 영역 |
| 267 | }}} |
| 268 | }}}</code></pre>}}} |
| 269 | }}} |
| 270 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 271 | {{{#!wiki class="syntax-caption" |
| 272 | 결과 |
| 273 | }}}{{{#!wiki class="syntax-example-body" |
| 274 | {{{#!wiki style="display:flex;flex-wrap:wrap;gap:8px" |
| 275 | {{{#!wiki style="flex-grow:1;flex-basis:12em;min-width:0;border:1px solid #888;padding:8px" |
| 276 | 첫 번째 영역 |
| 277 | }}} |
| 278 | {{{#!wiki style="flex-grow:1;flex-basis:12em;min-width:0;border:1px solid #888;padding:8px" |
| 279 | 두 번째 영역 |
| 280 | }}} |
| 281 | }}} |
| 282 | }}} |
| 283 | }}} |
| 284 | }}} |
| 285 | |
| 286 | === 허용 CSS 속성 === |
| 287 | 다음 목록의 속성도 값의 형식과 범위를 검사합니다. 허용하지 않은 속성이나 값은 적용하지 않습니다. 크기는 {{{px}}}, {{{em}}}, {{{rem}}}, {{{pt}}}, {{{%}}}, {{{lh}}} 등을 사용하며, 속성에 따라 {{{auto}}}·내용 기반 크기·안전한 계산식을 사용할 수 있습니다. |
| 288 | |
| 289 | ||<thead><rowbgcolor=#eee,#2d2f34> 속성 || 값의 예시 || |
| 290 | || {{{color}}}, {{{background-color}}}, {{{border-top-color}}}, {{{border-right-color}}}, {{{border-bottom-color}}}, {{{border-left-color}}} ||<(> #aa7700, red, rgba(10,20,30,0.5) || |
| 291 | || {{{border-color}}} ||<(> #888, #888 #aaa || |
| 292 | || {{{background}}}, {{{background-image}}} ||<(> #eee, linear-gradient(#eee, #ccc) || |
| 293 | || {{{background-attachment}}} ||<(> scroll, fixed, local || |
| 294 | || {{{background-origin}}} ||<(> border-box, padding-box, content-box || |
| 295 | || {{{background-position}}} ||<(> center, left top, 50% 50% || |
| 296 | || {{{background-repeat}}} ||<(> repeat, repeat-x, repeat-y, no-repeat, space, round || |
| 297 | || {{{background-size}}} ||<(> cover, contain, 100% auto || |
| 298 | || {{{text-align}}} ||<(> left, center, right, justify || |
| 299 | || {{{word-break}}} ||<(> normal, keep-all, break-all || |
| 300 | || {{{overflow-wrap}}} ||<(> normal, break-word, anywhere || |
| 301 | || {{{white-space}}} ||<(> normal, nowrap, pre, pre-wrap, pre-line || |
| 302 | || {{{display}}} ||<(> block, inline, inline-block, list-item, table, inline-table, table-caption, table-column, table-column-group, table-header-group, table-footer-group, table-row-group, table-row, table-cell, flex, inline-flex, none || |
| 303 | || {{{float}}} ||<(> none, left, right || |
| 304 | || {{{clear}}} ||<(> none, left, right, both || |
| 305 | || {{{overflow}}}, {{{overflow-x}}}, {{{overflow-y}}} ||<(> visible, hidden, clip, auto, scroll || |
| 306 | || {{{image-rendering}}} ||<(> auto, smooth, high-quality, crisp-edges, pixelated || |
| 307 | || {{{object-fit}}} ||<(> fill, contain, cover, none, scale-down || |
| 308 | || {{{font-style}}} ||<(> normal, italic, oblique || |
| 309 | || {{{font-weight}}} ||<(> normal, bold, 1~1000 || |
| 310 | || {{{font-family}}} ||<(> sans-serif, serif, monospace || |
| 311 | || {{{font}}} ||<(> bold 16px sans-serif || |
| 312 | || {{{font-size}}}, {{{line-height}}}, {{{width}}}, {{{height}}}, {{{min-width}}}, {{{max-width}}}, {{{min-height}}}, {{{max-height}}} ||<(> 16px, 1.2em, 100% || |
| 313 | || {{{aspect-ratio}}} ||<(> 16 / 9, auto || |
| 314 | || {{{letter-spacing}}} ||<(> 1px, normal || |
| 315 | || {{{word-spacing}}}, {{{text-indent}}} ||<(> 2px, 1em || |
| 316 | || {{{text-transform}}} ||<(> none, capitalize, uppercase, lowercase, full-width || |
| 317 | || {{{text-decoration-color}}} ||<(> #888, red || |
| 318 | || {{{text-decoration-line}}} ||<(> none, underline, overline, line-through || |
| 319 | || {{{text-decoration-style}}} ||<(> solid, double, dotted, dashed, wavy || |
| 320 | || {{{text-decoration}}} ||<(> underline dotted #888 || |
| 321 | || {{{margin}}} ||<(> 0, 8px, 4px 8px || |
| 322 | || {{{padding}}} ||<(> 0, 8px, 4px 8px || |
| 323 | || {{{border-radius}}} ||<(> 8px, 50%, 8px / 4px || |
| 324 | || {{{border-top-left-radius}}}, {{{border-top-right-radius}}}, {{{border-bottom-left-radius}}}, {{{border-bottom-right-radius}}} ||<(> 8px, 50% || |
| 325 | || {{{gap}}} ||<(> 8px, 4px 12px || |
| 326 | || {{{margin-top}}}, {{{margin-right}}}, {{{margin-bottom}}}, {{{margin-left}}} ||<(> 0, 8px, -4px, auto || |
| 327 | || {{{padding-top}}}, {{{padding-right}}}, {{{padding-bottom}}}, {{{padding-left}}} ||<(> 0, 8px || |
| 328 | || {{{border}}}, {{{border-top}}}, {{{border-right}}}, {{{border-bottom}}}, {{{border-left}}} ||<(> 1px solid #888 || |
| 329 | || {{{border-style}}} ||<(> none, solid, dashed, dotted, double || |
| 330 | || {{{border-top-style}}}, {{{border-right-style}}}, {{{border-bottom-style}}}, {{{border-left-style}}} ||<(> none, solid, dashed, dotted, double || |
| 331 | || {{{border-width}}} ||<(> 1px, 1px 2px || |
| 332 | || {{{border-top-width}}}, {{{border-right-width}}}, {{{border-bottom-width}}}, {{{border-left-width}}} ||<(> 1px, thin, medium, thick || |
| 333 | || {{{border-collapse}}} ||<(> separate, collapse || |
| 334 | || {{{border-spacing}}} ||<(> 0, 4px, 4px 8px || |
| 335 | || {{{box-decoration-break}}} ||<(> slice, clone || |
| 336 | || {{{text-shadow}}}, {{{box-shadow}}} ||<(> none, 1px 1px 2px #888 || |
| 337 | || {{{opacity}}} ||<(> 0~1 || |
| 338 | || {{{vertical-align}}} ||<(> baseline, top, middle, bottom, text-top, text-bottom, sub, super || |
| 339 | || {{{justify-content}}} ||<(> normal, start, end, flex-start, flex-end, left, right, center, space-between, space-around, space-evenly, stretch || |
| 340 | || {{{align-items}}} ||<(> normal, stretch, start, end, flex-start, flex-end, self-start, self-end, center, baseline, first baseline, last baseline || |
| 341 | || {{{align-content}}} ||<(> normal, stretch, start, end, flex-start, flex-end, center, space-between, space-around, space-evenly || |
| 342 | || {{{justify-items}}}, {{{justify-self}}} ||<(> auto, normal, stretch, start, end, center || |
| 343 | || {{{flex-wrap}}} ||<(> nowrap, wrap, wrap-reverse || |
| 344 | || {{{flex-direction}}} ||<(> row, row-reverse, column, column-reverse || |
| 345 | || {{{flex-grow}}}, {{{flex-shrink}}} ||<(> 0~1000 || |
| 346 | || {{{flex-basis}}} ||<(> 12em, 50%, auto, content || |
| 347 | || {{{align-self}}} ||<(> auto, normal, stretch, start, end, center, baseline || |
| 348 | || {{{order}}} ||<(> -1000~1000 || |
| 349 | || {{{cursor}}} ||<(> auto, default, pointer, text, help || |
| 350 | || {{{background-clip}}}, {{{-webkit-background-clip}}} ||<(> border-box, padding-box, content-box, text || |
| 351 | || {{{box-sizing}}} ||<(> content-box, border-box || |
| 352 | || {{{visibility}}} ||<(> visible, hidden, collapse || |
| 353 | || {{{list-style-position}}} ||<(> inside, outside || |
| 354 | || {{{list-style-type}}} ||<(> disc, circle, square, decimal, lower-alpha, upper-roman || |
| 355 | || {{{text-align-last}}} ||<(> auto, start, end, left, right, center, justify || |
| 356 | || {{{text-overflow}}} ||<(> clip, ellipsis || |
| 357 | || {{{text-wrap}}} ||<(> wrap, nowrap, balance, pretty, stable || |
| 358 | || {{{word-wrap}}} ||<(> normal, break-word, anywhere || |
| 359 | || {{{writing-mode}}} ||<(> horizontal-tb, vertical-rl, vertical-lr || |
| 360 | || {{{text-orientation}}} ||<(> mixed, upright, sideways || |
| 361 | || {{{text-combine-upright}}} ||<(> none, all || |
| 362 | || {{{text-underline-position}}} ||<(> auto, under, from-font || |
| 363 | || {{{text-emphasis-color}}} ||<(> #888, red || |
| 364 | || {{{text-emphasis-position}}} ||<(> over, under, left, right || |
| 365 | || {{{text-emphasis-style}}} ||<(> none, dot, circle, triangle, sesame || |
| 366 | |
| 367 | {{{display}}}는 {{{block}}}, {{{inline}}}, {{{inline-block}}}, {{{list-item}}}, 표 배치 값, {{{flex}}}, {{{inline-flex}}}, {{{none}}}을 지원합니다. {{{position}}}, {{{z-index}}}, {{{transform}}}, {{{animation}}}, {{{transition}}}과 외부 파일을 읽는 {{{url()}}}·{{{@import}}}는 지원하지 않습니다. CSS 변수는 {{{var(--link-color)}}}와 {{{var(--article-background-color)}}}를 읽을 수 있습니다. 임의 변수를 선언하는 {{{--이름:값}}}은 지원하지 않습니다. |
| 368 | |
| 369 | 요소의 너비에 여백과 테두리를 포함시키려면 {{{box-sizing:border-box}}}를 사용합니다. 긴 내용이 들어가는 가로 배치에는 {{{min-width:0}}}을 함께 지정하면 화면을 밀어내는 것을 줄일 수 있습니다. |
| 370 | |
| 201 | 371 | == 조건식 == |
| 202 | | {{{#!if}}} 뒤의 조건이 참이면 안쪽 내용을 표시하고, 거짓이면 표시하지 않습니다. |
| 372 | {{{#!if 조건}}}의 조건이 참이면 본문을 표시합니다. 거짓이거나 식을 계산할 수 없으면 그 블록의 본문을 표시하지 않습니다. 조건식에는 틀의 입력값, 숫자와 문자열, 배열과 객체를 사용할 수 있습니다. |
| 203 | 373 | |
| 204 | 374 | {{{#!wiki class="syntax-pair" |
| 205 | 375 | {{{#!wiki class="syntax-pane syntax-input" |
| 206 | 376 | {{{#!wiki class="syntax-caption" |
| 207 | 377 | 입력 |
| 208 | 378 | }}}{{{#!wiki class="syntax-example-body" |
| 209 | | {{{#!html <pre class="syntax-code"><code>{{{#!if 2 > 1 |
| 379 | {{{#!html <pre class="syntax-code"><code>{{{#!if 2 > 1 |
| 210 | 380 | 2는 1보다 큽니다. |
| 211 | | }}}
|
| 212 | | {{{#!if 2 < 1
|
| 381 | }}} |
| 382 | {{{#!if 2 < 1 |
| 213 | 383 | 이 문장은 표시되지 않습니다. |
| 214 | | }}}</code></pre>}}}
|
| 384 | }}}</code></pre>}}} |
| 215 | 385 | }}} |
| 216 | 386 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 217 | 387 | {{{#!wiki class="syntax-caption" |
| | ... |
| 227 | 397 | }}} |
| 228 | 398 | }}} |
| 229 | 399 | |
| 230 | | 위 예시에서는 첫 번째 블록만 표시됩니다. 조건식은 문서에 표시할 내용을 선택하기 위한 문법이며 브라우저에서 JavaScript를 실행하는 기능은 아닙니다.
|
| 400 | === 값과 자료형 === |
| 401 | ||<thead><rowbgcolor=#eee,#2d2f34> 종류 || 입력 예시 || 설명 || |
| 402 | || 숫자 || {{{42}}}, {{{-3}}}, {{{1.5}}}, {{{0xff}}} ||<(> 정수와 실수. 계산과 비교에 사용합니다. || |
| 403 | || 문자열 || {{{'stone'}}}, {{{"문자열"}}} ||<(> 작은따옴표나 큰따옴표로 감쌉니다. || |
| 404 | || 참과 거짓 || {{{true}}}, {{{false}}} ||<(> 조건의 참과 거짓. || |
| 405 | || 없는 값 || {{{null}}}, {{{undefined}}} ||<(> 둘 다 값이 없는 상태로 취급합니다. 전달하지 않은 입력값도 해당합니다. || |
| 406 | || 배열 || {{{[10, 20, 30]}}} ||<(> 여러 값을 순서대로 저장합니다. || |
| 407 | || 객체 || {{{{name:'돌', count:64}}}} ||<(> 이름을 붙여 여러 값을 저장합니다. || |
| 408 | || 특수한 숫자 || {{{NaN}}}, {{{Infinity}}} ||<(> 숫자로 계산할 수 없는 값과 무한대. || |
| 231 | 409 | |
| 232 | | === 기본 연산자 ===
|
| 410 | {{{false}}}, {{{0}}}, {{{NaN}}}, {{{null}}}, 빈 문자열 {{{''}}}은 조건에서 거짓입니다. 빈 배열과 빈 객체는 참이며, 문자열 {{{'0'}}}도 글자가 있으므로 참입니다. |
| 411 | |
| 412 | === 연산자 === |
| 233 | 413 | ||<thead><rowbgcolor=#eee,#2d2f34> 종류 || 연산자 || 예시 || |
| 234 | | || 비교 || {{{==}}}, {{{!=}}}, {{{>}}}, {{{<}}}, {{{>=}}}, {{{<=}}} || {{{2 > 1}}} || |
| 235 | | || 논리 || {{{&&}}}, {{{||}}}, {{{!}}} || {{{2 > 1 && 3 > 2}}} || |
| 236 | | || 계산 || {{{+}}}, {{{-}}}, {{{*}}}, {{{/}}}, {{{%}}} || {{{3 * 4 == 12}}} || |
| 414 | || 비교 || {{{==}}}, {{{!=}}}, {{{>}}}, {{{<}}}, {{{>=}}}, {{{<=}}} || {{{수량 >= 64}}} || |
| 415 | || 논리 || {{{&&}}}, {{{||}}}, {{{!}}} || {{{수량 > 0 && 이름 != null}}} || |
| 416 | || 없는 값 대체 || {{{??}}} || {{{이름 ?? '이름 없음'}}} || |
| 417 | || 계산 || {{{+}}}, {{{-}}}, {{{*}}}, {{{/}}}, {{{%}}}, {{{**}}} || {{{2 ** 3 == 8}}} || |
| 418 | || 조건 선택 || {{{조건 ? 참일 때 : 거짓일 때}}} || {{{수량 > 0 ? 수량 : 0}}} || |
| 419 | || 대입 || {{{=}}} || {{{수량 = 64}}} || |
| 420 | || 복합 대입 || {{{+=}}}, {{{-=}}}, {{{*=}}}, {{{/=}}}, {{{%=}}}, {{{**=}}} || {{{수량 += 1}}} || |
| 421 | || 논리 대입 || {{{&&=}}}, {{{||=}}}, {{{??=}}} || {{{이름 ??= '돌'}}} || |
| 422 | || 증감 || {{{++}}}, {{{--}}} || {{{++수량}}}, {{{수량--}}} || |
| 423 | || 비트 연산 || {{{&}}}, {{{|}}}, {{{^}}}, {{{~}}}, {{{<<}}}, {{{>>}}} || {{{(5 & 3) == 1}}} || |
| 424 | || 비트 대입 || {{{&=}}}, {{{|=}}}, {{{^=}}}, {{{<<=}}}, {{{>>=}}} || {{{값 <<= 1}}} || |
| 425 | || 식 이어 쓰기 || {{{,}}}, {{{;}}} || {{{수량=1, 수량+=2, 수량==3}}} || |
| 237 | 426 | |
| 238 | | 문자열은 {{{'문자열'}}}처럼 따옴표로 감쌉니다. {{{true}}}는 참, {{{false}}}는 거짓이며, {{{null}}}은 값이 없는 경우를 나타냅니다.
|
| 427 | 같은 조건식에서 계산을 여러 번 이어 쓰면 마지막 식의 값으로 본문 표시 여부를 정합니다. 대입한 값은 같은 문맥의 뒤쪽 조건식에서도 사용할 수 있습니다. 대입은 변수 이름에 하며, 배열 요소나 객체 속성을 직접 고치는 문법은 지원하지 않습니다. |
| 239 | 428 | |
| 240 | | === 틀의 입력값으로 조건 나누기 ===
|
| 241 | | 조건식에서는 입력값 이름을 따옴표나 {{{#!html <code>@</code>}}} 없이 씁니다. 본문에서 입력값을 출력할 때에는 {{{#!html <code>@이름@</code>}}}을 사용합니다.
|
| 429 | {{{#!wiki class="syntax-pair" |
| 430 | {{{#!wiki class="syntax-pane syntax-input" |
| 431 | {{{#!wiki class="syntax-caption" |
| 432 | 입력 |
| 433 | }}}{{{#!wiki class="syntax-example-body" |
| 434 | {{{#!html <pre class="syntax-code"><code>{{{#!if 도움말수량=1, 도움말수량+=2, 도움말수량==3 |
| 435 | 수량은 3입니다. |
| 436 | }}} |
| 437 | {{{#!if 도움말수량 > 2 |
| 438 | 앞에서 정한 수량이 이어집니다. |
| 439 | }}}</code></pre>}}} |
| 440 | }}} |
| 441 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 442 | {{{#!wiki class="syntax-caption" |
| 443 | 결과 |
| 444 | }}}{{{#!wiki class="syntax-example-body" |
| 445 | {{{#!if 도움말수량=1, 도움말수량+=2, 도움말수량==3 |
| 446 | 수량은 3입니다. |
| 447 | }}} |
| 448 | {{{#!if 도움말수량 > 2 |
| 449 | 앞에서 정한 수량이 이어집니다. |
| 450 | }}} |
| 451 | }}} |
| 452 | }}} |
| 453 | }}} |
| 242 | 454 | |
| 243 | | {{{#!html <pre><code>{{{#!if 이름 != null |
| 455 | 앞에 적은 {{{++값}}}은 증가시킨 값을, 뒤에 적은 {{{값++}}}은 증가시키기 전의 값을 식에 사용합니다. {{{--}}}도 같은 방식입니다. |
| 456 | |
| 457 | === 우선순위와 조건 선택 === |
| 458 | 이항 연산자의 우선순위는 아래에서 위쪽일수록 높습니다. 같은 줄의 연산자는 같은 단계입니다. |
| 459 | |
| 460 | ||<thead><rowbgcolor=#eee,#2d2f34> 순서 || 연산자 || |
| 461 | || 1 || {{{**}}} || |
| 462 | || 2 || {{{*}}}, {{{/}}}, {{{%}}} || |
| 463 | || 3 || {{{+}}}, {{{-}}} || |
| 464 | || 4 || {{{<<}}}, {{{>>}}} || |
| 465 | || 5 || {{{<}}}, {{{<=}}}, {{{>}}}, {{{>=}}} || |
| 466 | || 6 || {{{==}}}, {{{!=}}} || |
| 467 | || 7 || {{{&}}} || |
| 468 | || 8 || {{{^}}} || |
| 469 | || 9 || {{{|}}} || |
| 470 | || 10 || {{{&&}}} || |
| 471 | || 11 || {{{||}}} || |
| 472 | || 12 || {{{??}}} || |
| 473 | |
| 474 | 괄호로 묶으면 그 안의 식을 먼저 계산합니다. 예를 들어 {{{(5 & 3) == 1}}}과 {{{5 & (3 == 1)}}}은 서로 다른 식입니다. 조건 선택은 {{{조건 ? 참일 때의 값 : 거짓일 때의 값}}}으로 쓰며, 선택된 쪽의 식만 계산합니다. |
| 475 | |
| 476 | {{{#!wiki class="syntax-pair" |
| 477 | {{{#!wiki class="syntax-pane syntax-input" |
| 478 | {{{#!wiki class="syntax-caption" |
| 479 | 입력 |
| 480 | }}}{{{#!wiki class="syntax-example-body" |
| 481 | {{{#!html <pre class="syntax-code"><code>{{{#!if (64 > 32 ? '많음' : '적음') == '많음' |
| 482 | 수량이 32개보다 많습니다. |
| 483 | }}}</code></pre>}}} |
| 484 | }}} |
| 485 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 486 | {{{#!wiki class="syntax-caption" |
| 487 | 결과 |
| 488 | }}}{{{#!wiki class="syntax-example-body" |
| 489 | {{{#!if (64 > 32 ? '많음' : '적음') == '많음' |
| 490 | 수량이 32개보다 많습니다. |
| 491 | }}} |
| 492 | }}} |
| 493 | }}} |
| 494 | }}} |
| 495 | |
| 496 | {{{&&}}}는 왼쪽이 거짓이면 오른쪽을 계산하지 않고, {{{??}}}는 왼쪽 값이 {{{null}}}일 때만 오른쪽을 계산합니다. {{{||}}}는 양쪽을 계산한 뒤 값을 선택합니다. {{{&&=}}}, {{{??=}}}, {{{||=}}}도 각각 같은 규칙을 따르므로 오른쪽에 증감이나 대입을 넣을 때에는 이 차이를 고려합니다. |
| 497 | |
| 498 | === 틀의 입력값 === |
| 499 | 조건식에서는 입력값 이름을 따옴표나 {{{#!html <code>@</code>}}} 없이 씁니다. 본문에 값을 표시할 때에는 {{{#!html <code>@이름@</code>}}}을 사용합니다. |
| 500 | {{{#!html <pre class="syntax-code"><code>{{{#!if 이름 != null && 이름 != '' |
| 244 | 501 | 이름: @이름@ |
| 245 | | }}}
|
| 246 | | {{{#!if 이름 == null
|
| 502 | }}} |
| 503 | {{{#!if 이름 == null |
| 247 | 504 | 이름을 입력하지 않았습니다. |
| 248 | | }}}</code></pre>}}}
|
| 249 | | {{{이름=값}}}을 전달하면 첫 번째 블록을, 입력값을 생략하면 두 번째 블록을 표시합니다. |
| 505 | }}}</code></pre>}}} |
| 506 | 입력값을 생략한 {{{null}}}과 명시적으로 전달한 빈 문자열은 서로 다릅니다. 빈 문자열은 {{{이름=,}}}처럼 등호 뒤에 구분 쉼표를 남겨 전달하며, 마지막에 {{{이름=}}}만 쓰면 전달하지 않은 것으로 처리합니다. {{{this['입력값 이름']}}}이나 {{{this.이름}}}으로도 전달된 입력값을 읽을 수 있습니다. 공백·하이픈이 들어간 이름은 {{{this['표시 이름']}}}처럼 접근합니다. |
| 250 | 507 | |
| 251 | | 빈 문자열을 구분할 때에는 {{{이름 == ''}}}처럼 비교합니다. 값이 없는 {{{null}}}과 값을 비워 전달한 {{{''}}}는 서로 다릅니다.
|
| 508 | 틀의 입력값은 문자열로 전달됩니다. {{{'1.5'}}}를 숫자로 강제변환한 {{{+'1.5'}}}는 소수 1.5가 아니라 앞의 정수 부분인 1입니다. 숫자로 시작하지 않는 문자열은 이 변환에서 0이 되며, 숫자 리터럴 {{{1.5}}}와 구분합니다. |
| 252 | 509 | |
| 253 | | === 문자열 === |
| 254 | | 문자열에는 {{{length}}} 같은 속성과 일부 문자열 함수를 사용할 수 있습니다.
|
| 510 | === 배열과 객체 === |
| 511 | 배열의 첫 요소는 0번입니다. 객체는 점 뒤에 속성 이름을 쓰거나 대괄호 안에 문자열 키를 넣어 읽습니다. |
| 255 | 512 | |
| 256 | | ||<thead><rowbgcolor=#eee,#2d2f34> 식 || 결과 ||
|
| 257 | | || {{{'stone'.length}}} || 5 ||
|
| 258 | | || {{{'stone'.includes('one')}}} || true ||
|
| 259 | | || {{{'stone'.substring(0, 3)}}} || sto ||
|
| 260 | | || {{{'stone'.indexOf('o')}}} || 2 ||
|
| 513 | {{{#!wiki class="syntax-pair" |
| 514 | {{{#!wiki class="syntax-pane syntax-input" |
| 515 | {{{#!wiki class="syntax-caption" |
| 516 | 입력 |
| 517 | }}}{{{#!wiki class="syntax-example-body" |
| 518 | {{{#!html <pre class="syntax-code"><code>{{{#!if [16, 32, 64][1] == 32 |
| 519 | 배열의 두 번째 값은 32입니다. |
| 520 | }}} |
| 521 | {{{#!if ({name:'돌', count:64}).count == 64 |
| 522 | 객체의 count는 64입니다. |
| 523 | }}}</code></pre>}}} |
| 524 | }}} |
| 525 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 526 | {{{#!wiki class="syntax-caption" |
| 527 | 결과 |
| 528 | }}}{{{#!wiki class="syntax-example-body" |
| 529 | {{{#!if [16, 32, 64][1] == 32 |
| 530 | 배열의 두 번째 값은 32입니다. |
| 531 | }}} |
| 532 | {{{#!if ({name:'돌', count:64}).count == 64 |
| 533 | 객체의 count는 64입니다. |
| 534 | }}} |
| 535 | }}} |
| 536 | }}} |
| 537 | }}} |
| 261 | 538 | |
| 262 | | 위치 번호는 0부터 시작합니다. 예를 들어 {{{substring(0, 3)}}}은 0번부터 3번 직전까지의 글자를 가져옵니다.
|
| 539 | {{{?.}}}를 사용하면 대상이 {{{null}}}인 경우에도 속성 접근 오류 없이 없는 값을 얻습니다. 이어서 {{{??}}}로 대체 값을 지정할 수 있습니다. |
| 263 | 540 | |
| 541 | {{{#!wiki class="syntax-pair" |
| 542 | {{{#!wiki class="syntax-pane syntax-input" |
| 543 | {{{#!wiki class="syntax-caption" |
| 544 | 입력 |
| 545 | }}}{{{#!wiki class="syntax-example-body" |
| 546 | {{{#!html <pre class="syntax-code"><code>{{{#!if (없는입력?.이름 ?? '미정') == '미정' |
| 547 | 이름이 없으므로 ‘미정’을 사용합니다. |
| 548 | }}}</code></pre>}}} |
| 549 | }}} |
| 550 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 551 | {{{#!wiki class="syntax-caption" |
| 552 | 결과 |
| 553 | }}}{{{#!wiki class="syntax-example-body" |
| 554 | {{{#!if (없는입력?.이름 ?? '미정') == '미정' |
| 555 | 이름이 없으므로 ‘미정’을 사용합니다. |
| 556 | }}} |
| 557 | }}} |
| 558 | }}} |
| 559 | }}} |
| 560 | |
| 561 | 배열과 객체의 {{{==}}}는 내용이 같은지가 아니라 같은 값을 가리키는지를 비교합니다. {{{[1] == [1]}}}은 거짓이고, {{{a=[1], b=a, a==b}}}는 참입니다. 배열을 문자열로 바꿔도 요소 목록으로 펼쳐지지 않고 {{{[object Object]}}}가 됩니다. 배열의 {{{length}}} 속성은 지원하지 않습니다. |
| 562 | |
| 563 | === 문자열과 내장 함수 === |
| 564 | 문자열의 {{{length}}}는 글자 수입니다. 위치는 0부터 시작하고, {{{indexOf}}}·{{{lastIndexOf}}}는 찾지 못하면 -1을 반환합니다. |
| 565 | |
| 566 | ||<thead><rowbgcolor=#eee,#2d2f34> 식 || 결과 || 설명 || |
| 567 | || {{{'stone'.length}}} || 5 ||<(> 글자 수 || |
| 568 | || {{{' stone '.trim()}}} || stone ||<(> 양끝의 공백 제거 || |
| 569 | || {{{'stone'.startsWith('st')}}} || true ||<(> 지정한 글자로 시작하는지 검사 || |
| 570 | || {{{'stone'.endsWith('ne')}}} || true ||<(> 지정한 글자로 끝나는지 검사 || |
| 571 | || {{{'stone'.indexOf('one')}}} || 2 ||<(> 앞에서부터 찾은 위치 || |
| 572 | || {{{'banana'.lastIndexOf('a')}}} || 5 ||<(> 뒤에서부터 찾은 위치 || |
| 573 | || {{{'stone'.substring(0, 3)}}} || sto ||<(> 시작 위치부터 끝 위치 직전까지 || |
| 574 | || {{{'stone'.substr(1, 3)}}} || ton ||<(> 시작 위치부터 지정한 글자 수만큼 || |
| 575 | || {{{(64).toString()}}} || 64 ||<(> 값을 문자열로 변환 || |
| 576 | || {{{parseInt('ff', 16)}}} || 255 ||<(> 문자열을 정수로 변환 || |
| 577 | || {{{time()}}} || 현재 Unix 시간 ||<(> 1970년 1월 1일 UTC부터 지난 초 || |
| 578 | |
| 579 | 문자열을 포함하는지는 {{{indexOf('찾을 글자') >= 0}}}으로 검사합니다. {{{includes()}}}, {{{replace()}}}, {{{split()}}} 같은 다른 문자열 함수는 지원하지 않습니다. |
| 580 | |
| 581 | {{{#!wiki class="syntax-pair" |
| 582 | {{{#!wiki class="syntax-pane syntax-input" |
| 583 | {{{#!wiki class="syntax-caption" |
| 584 | 입력 |
| 585 | }}}{{{#!wiki class="syntax-example-body" |
| 586 | {{{#!html <pre class="syntax-code"><code>{{{#!if 'stone'.indexOf('one') >= 0 |
| 587 | stone에는 one이 들어 있습니다. |
| 588 | }}}</code></pre>}}} |
| 589 | }}} |
| 590 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 591 | {{{#!wiki class="syntax-caption" |
| 592 | 결과 |
| 593 | }}}{{{#!wiki class="syntax-example-body" |
| 594 | {{{#!if 'stone'.indexOf('one') >= 0 |
| 595 | stone에는 one이 들어 있습니다. |
| 596 | }}} |
| 597 | }}} |
| 598 | }}} |
| 599 | }}} |
| 600 | |
| 601 | {{{substring(시작, 끝)}}}과 {{{substr(시작, 길이)}}}의 두 번째 인자는 의미가 다릅니다. {{{startsWith(글자, 시작)}}}, {{{endsWith(글자, 끝)}}}, {{{indexOf(글자, 시작)}}}, {{{lastIndexOf(글자, 위치)}}}는 선택적인 위치 인자도 받습니다. |
| 602 | |
| 603 | {{{parseInt(문자열)}}}은 십진수를 읽습니다. 두 번째 인자로 2·8·16을 넣으면 해당 진법을 사용하고, 다른 값은 십진수로 처리합니다. 숫자를 읽을 수 없으면 {{{NaN}}}입니다. 전역 {{{toString()}}}은 전달한 인자를 변환하는 함수가 아니므로 {{{값.toString()}}} 형식을 사용합니다. |
| 604 | |
| 264 | 605 | === 표의 행 표시 조건 === |
| 265 | | 표의 행에는 {{{<rowif=조건>}}}을 사용할 수 있습니다. 조건이 거짓인 행은 표시하지 않습니다.
|
| 606 | {{{<rowif=조건>}}}을 행의 앞에 넣으면 같은 조건식 규칙으로 행을 표시하거나 숨깁니다. 거짓인 행은 빈 행을 남기지 않습니다. |
| 266 | 607 | |
| 267 | 608 | {{{#!wiki class="syntax-pair" |
| 268 | 609 | {{{#!wiki class="syntax-pane syntax-input" |
| | ... |
| 270 | 611 | 입력 |
| 271 | 612 | }}}{{{#!wiki class="syntax-example-body" |
| 272 | 613 | {{{#!html <pre class="syntax-code"><code>||<thead> 항목 || 내용 || |
| 273 | | ||<rowif=true> 보이는 행 || 표시됨 || |
| 274 | | ||<rowif=false> 숨기는 행 || 표시되지 않음 ||</code></pre>}}} |
| 614 | ||<rowif=32 <= 64> 돌 || 표시되는 행 || |
| 615 | ||<rowif=false> 흙 || 표시되지 않는 행 ||</code></pre>}}} |
| 275 | 616 | }}} |
| 276 | 617 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 277 | 618 | {{{#!wiki class="syntax-caption" |
| 278 | 619 | 결과 |
| 279 | 620 | }}}{{{#!wiki class="syntax-example-body" |
| 280 | 621 | ||<thead> 항목 || 내용 || |
| 281 | | ||<rowif=true> 보이는 행 || 표시됨 || |
| 282 | | ||<rowif=false> 숨기는 행 || 표시되지 않음 || |
| 622 | ||<rowif=32 <= 64> 돌 || 표시되는 행 || |
| 623 | ||<rowif=false> 흙 || 표시되지 않는 행 || |
| 283 | 624 | }}} |
| 284 | 625 | }}} |
| 285 | 626 | }}} |
| 286 | 627 | |
| 628 | {{{>}}}는 옵션을 닫는 기호이므로, 크기 비교는 {{{32 <= 64}}}처럼 {{{<}}} 방향으로 작성합니다. 틀의 입력값과 비교할 때에는 {{{<rowif=이름 != null>}}}처럼 쓸 수 있습니다. |
| 287 | 629 | |
| 630 | === 지원하지 않는 구문과 오류 === |
| 631 | 조건식은 JavaScript 프로그램을 실행하는 기능이 아닙니다. {{{===}}}, {{{!==}}}, {{{let}}}, {{{const}}}, 반복문, 함수 선언, {{{window}}}·{{{document}}} 같은 브라우저 객체는 지원하지 않습니다. |
| 632 | |
| 633 | 문법 오류는 식 전체를 계산하지 않습니다. 없는 함수를 호출하는 등의 실행 오류가 나면 그 식의 후속 실행을 멈춥니다. 같은 식에서 오류 전에 끝난 대입은 남을 수 있으므로 복잡한 계산은 여러 조건식으로 나누어 확인합니다. 조건식의 참·거짓을 확인할 때에는 위 예시처럼 본문에 문장을 넣고 미리보기로 결과를 확인할 수 있습니다. |
| 634 | |
| 288 | 635 | == 코드 강조 == |
| 289 | 636 | {{{#!syntax}}} 뒤에 지원 언어 이름을 쓰면 해당 언어의 문법에 맞춰 코드를 강조합니다. 코드에 적은 프로그램을 실행하지는 않습니다. |
| 290 | 637 | |
| | ... |
| 342 | 689 | |
| 343 | 690 | |
| 344 | 691 | == 수식 == |
| 345 | | {{{[math(수식)]}}} 안에서는 TeX 문법을 사용합니다. |
| 692 | 문장 안에는 {{{[math(수식)]}}}, 별도의 여러 줄 수식에는 {{{#!latex}}} 블록을 사용합니다. 수식 본문은 TeX로 읽으며, 위키 링크나 틀 문법으로 해석하지 않습니다. |
| 346 | 693 | |
| 694 | === 기본 기호와 첨자 === |
| 347 | 695 | ||<thead><rowbgcolor=#eee,#2d2f34> 입력 || 표시 || |
| 348 | | || {{{[math(x^2+y^2=z^2)]}}} || [math(x^2+y^2=z^2)] || |
| 349 | | || {{{[math(\frac{a}{b})]}}} || [math(\frac{a}{b})] || |
| 350 | | || {{{[math(\sqrt{x})]}}} || [math(\sqrt{x})] || |
| 351 | | || {{{[math(a_n)]}}} || [math(a_n)] || |
| 696 | || {{{[math(x^{n+1}+a_i)]}}} || [math(x^{n+1}+a_i)] || |
| 697 | || {{{[math(\frac{a+b}{c})]}}} || [math(\frac{a+b}{c})] || |
| 698 | || {{{[math(\sqrt[3]{x})]}}} || [math(\sqrt[3]{x})] || |
| 699 | || {{{[math(\alpha+\beta\leq\gamma)]}}} || [math(\alpha+\beta\leq\gamma)] || |
| 352 | 700 | || {{{[math(\sum_{i=1}^{n}i)]}}} || [math(\sum_{i=1}^{n}i)] || |
| 353 | | || {{{[math(\alpha+\beta)]}}} || [math(\alpha+\beta)] || |
| 701 | || {{{[math(\int_0^1 x^2\,dx)]}}} || [math(\int_0^1 x^2\,dx)] || |
| 354 | 702 | |
| 355 | | {{{^}}}는 위 첨자, {{{_}}}는 아래 첨자입니다. 첨자에 여러 글자를 넣을 때에는 {{{x^{n+1}}}}처럼 중괄호로 묶습니다. {{{\frac{분자}{분모}}}}는 분수, {{{\sqrt{내용}}}}는 제곱근입니다. |
| 703 | {{{^}}}는 위 첨자, {{{_}}}는 아래 첨자입니다. 여러 글자를 한 첨자로 묶을 때에는 {{{x^{n+1}}}}처럼 중괄호를 사용합니다. {{{\frac{분자}{분모}}}}는 분수, {{{\sqrt{내용}}}}는 제곱근, {{{\sqrt[차수]{내용}}}}는 거듭제곱근입니다. |
| 356 | 704 | |
| 357 | | {{{<math>수식</math>}}} 형식도 사용할 수 있습니다. 수식에 쓰는 괄호와 중괄호는 짝을 맞춥니다.
|
| 705 | === 표시 수식과 여러 줄 정렬 === |
| 706 | {{{#!latex}}} 다음 줄부터 수식을 씁니다. {{{aligned}}} 환경에서 {{{&}}}는 정렬 기준, {{{\\}}}는 다음 줄입니다. |
| 358 | 707 | |
| 708 | {{{#!wiki class="syntax-pair" |
| 709 | {{{#!wiki class="syntax-pane syntax-input" |
| 710 | {{{#!wiki class="syntax-caption" |
| 711 | 입력 |
| 712 | }}}{{{#!wiki class="syntax-example-body" |
| 713 | {{{#!html <pre class="syntax-code"><code>{{{#!latex |
| 714 | \begin{aligned} |
| 715 | (a+b)^2 &= a^2+2ab+b^2 \\ |
| 716 | (a-b)^2 &= a^2-2ab+b^2 |
| 717 | \end{aligned} |
| 718 | }}}</code></pre>}}} |
| 719 | }}} |
| 720 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 721 | {{{#!wiki class="syntax-caption" |
| 722 | 결과 |
| 723 | }}}{{{#!wiki class="syntax-example-body" |
| 724 | {{{#!latex |
| 725 | \begin{aligned} |
| 726 | (a+b)^2 &= a^2+2ab+b^2 \\ |
| 727 | (a-b)^2 &= a^2-2ab+b^2 |
| 728 | \end{aligned} |
| 729 | }}} |
| 730 | }}} |
| 731 | }}} |
| 732 | }}} |
| 733 | |
| 734 | === 행렬과 경우 나누기 === |
| 735 | 행렬의 열은 {{{&}}}, 행은 {{{\\}}}로 나눕니다. {{{matrix}}}는 괄호 없이, {{{pmatrix}}}는 소괄호, {{{bmatrix}}}는 대괄호를 붙여 표시합니다. |
| 736 | |
| 737 | {{{#!wiki class="syntax-pair" |
| 738 | {{{#!wiki class="syntax-pane syntax-input" |
| 739 | {{{#!wiki class="syntax-caption" |
| 740 | 입력 |
| 741 | }}}{{{#!wiki class="syntax-example-body" |
| 742 | {{{#!html <pre class="syntax-code"><code>{{{#!latex |
| 743 | A=\begin{pmatrix} |
| 744 | 1 & 2 \\ |
| 745 | 3 & 4 |
| 746 | \end{pmatrix} |
| 747 | }}}</code></pre>}}} |
| 748 | }}} |
| 749 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 750 | {{{#!wiki class="syntax-caption" |
| 751 | 결과 |
| 752 | }}}{{{#!wiki class="syntax-example-body" |
| 753 | {{{#!latex |
| 754 | A=\begin{pmatrix} |
| 755 | 1 & 2 \\ |
| 756 | 3 & 4 |
| 757 | \end{pmatrix} |
| 758 | }}} |
| 759 | }}} |
| 760 | }}} |
| 761 | }}} |
| 762 | |
| 763 | 조건에 따라 다른 값을 쓰는 함수는 {{{cases}}}로 나타낼 수 있습니다. 수식 안의 설명 문장은 {{{\text{설명}}}}으로 감쌉니다. |
| 764 | |
| 765 | {{{#!wiki class="syntax-pair" |
| 766 | {{{#!wiki class="syntax-pane syntax-input" |
| 767 | {{{#!wiki class="syntax-caption" |
| 768 | 입력 |
| 769 | }}}{{{#!wiki class="syntax-example-body" |
| 770 | {{{#!html <pre class="syntax-code"><code>{{{#!latex |
| 771 | f(x)=\begin{cases} |
| 772 | x^2 & \text{if } x\geq 0 \\ |
| 773 | -x & \text{if } x<0 |
| 774 | \end{cases} |
| 775 | }}}</code></pre>}}} |
| 776 | }}} |
| 777 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 778 | {{{#!wiki class="syntax-caption" |
| 779 | 결과 |
| 780 | }}}{{{#!wiki class="syntax-example-body" |
| 781 | {{{#!latex |
| 782 | f(x)=\begin{cases} |
| 783 | x^2 & \text{if } x\geq 0 \\ |
| 784 | -x & \text{if } x<0 |
| 785 | \end{cases} |
| 786 | }}} |
| 787 | }}} |
| 788 | }}} |
| 789 | }}} |
| 790 | |
| 791 | === 괄호, 글꼴과 간격 === |
| 792 | ||<thead><rowbgcolor=#eee,#2d2f34> 용도 || 입력 || 표시 || |
| 793 | || 내용에 맞는 괄호 || {{{[math(\left(\frac{a}{b}\right))]}}} || [math(\left(\frac{a}{b}\right))] || |
| 794 | || 벡터 || {{{[math(\vec{v})]}}} || [math(\vec{v})] || |
| 795 | || 굵은 글자 || {{{[math(\mathbf{A})]}}} || [math(\mathbf{A})] || |
| 796 | || 집합 기호 || {{{[math(\mathbb{R})]}}} || [math(\mathbb{R})] || |
| 797 | || 일반 문장 || {{{[math(\text{거리}=v\times t)]}}} || [math(\text{거리}=v\times t)] || |
| 798 | || 간격 || {{{[math(a\,b\quad c\qquad d)]}}} || [math(a\,b\quad c\qquad d)] || |
| 799 | |
| 800 | {{{\left}}}와 {{{\right}}}는 짝을 맞춥니다. 한쪽 괄호를 생략할 때에는 {{{\left.}}}나 {{{\right.}}}를 쓸 수 있습니다. 수식에서는 일반 공백 대신 {{{\,}}}, {{{\quad}}}, {{{\qquad}}} 등으로 간격을 지정합니다. |
| 801 | |
| 802 | {{{<math>수식</math>}}}도 호환 문법으로 사용할 수 있습니다. TeX 문서 전체를 넣는 {{{\documentclass}}}·{{{\usepackage}}} 형식은 사용하지 않습니다. 수식 변환은 Temml을 사용하므로 모든 LaTeX 패키지와 명령을 사용할 수 있는 것은 아닙니다. 지원하지 않는 명령이나 짝이 맞지 않는 환경은 원문으로 남습니다. |
| 803 | |
| 359 | 804 | == 앵커 == |
| 360 | 805 | 문단 제목과 별개로 이름 있는 이동 지점을 만들 때에는 {{{[anchor(이름)]}}}을 사용합니다. |
| 361 | 806 | |
| | ... |
| 380 | 825 | 다른 문서에서는 {{{[[투비위키:문법 도움말/심화#도움말예시위치|예시 위치로 이동]]}}}처럼 문서 이름을 함께 적습니다. 앵커의 이름은 같은 문서 안에서 겹치지 않게 정합니다. |
| 381 | 826 | |
| 382 | 827 | == HTML == |
| 383 | | {{{#!html}}} 블록에는 HTML 태그로 작성한 내용을 넣을 수 있습니다. 이 안에서는 일반 위키 문법 대신 HTML 문법을 사용합니다. |
| 828 | {{{#!html}}} 블록 안에서는 위키 문법 대신 HTML을 사용합니다. 글자 서식뿐 아니라 목록, 표와 접기도 작성할 수 있습니다. |
| 384 | 829 | |
| 385 | 830 | {{{#!wiki class="syntax-pair" |
| 386 | 831 | {{{#!wiki class="syntax-pane syntax-input" |
| 387 | 832 | {{{#!wiki class="syntax-caption" |
| 388 | 833 | 입력 |
| 389 | 834 | }}}{{{#!wiki class="syntax-example-body" |
| 390 | | {{{#!html <pre class="syntax-code"><code>{{{#!html |
| 391 | | <strong>굵은 글자</strong><br><em>기울인 글자</em> |
| 392 | | }}}</code></pre>}}} |
| 835 | {{{#!html <pre class="syntax-code"><code>{{{#!html |
| 836 | <details> |
| 837 | <summary>서버 접속 정보</summary> |
| 838 | <p>서버 주소: <code>example.org</code></p> |
| 839 | <ul><li>Java Edition</li><li>Bedrock Edition</li></ul> |
| 840 | </details> |
| 841 | }}}</code></pre>}}} |
| 393 | 842 | }}} |
| 394 | 843 | }}}{{{#!wiki class="syntax-pane syntax-output" |
| 395 | 844 | {{{#!wiki class="syntax-caption" |
| 396 | 845 | 결과 |
| 397 | 846 | }}}{{{#!wiki class="syntax-example-body" |
| 398 | 847 | {{{#!html |
| 399 | | <strong>굵은 글자</strong><br><em>기울인 글자</em> |
| 848 | <details> |
| 849 | <summary>서버 접속 정보</summary> |
| 850 | <p>서버 주소: <code>example.org</code></p> |
| 851 | <ul><li>Java Edition</li><li>Bedrock Edition</li></ul> |
| 852 | </details> |
| 400 | 853 | }}} |
| 401 | 854 | }}} |
| 402 | 855 | }}} |
| 403 | 856 | }}} |
| 404 | 857 | |
| 405 | | 스크립트, 이벤트 속성과 허용되지 않은 외부 자원은 적용되지 않습니다. 위키 문법으로 작성할 내용은 {{{#!wiki}}}, HTML로 작성할 내용은 {{{#!html}}}에 넣습니다.
|
| 858 | === 허용 태그 === |
| 859 | ||<thead><rowbgcolor=#eee,#2d2f34> 용도 || 태그 || |
| 860 | || 문장과 글자 || {{{p}}}, {{{br}}}, {{{span}}}, {{{b}}}, {{{strong}}}, {{{i}}}, {{{em}}}, {{{u}}}, {{{s}}}, {{{strike}}}, {{{del}}}, {{{ins}}}, {{{small}}}, {{{sub}}}, {{{sup}}}, {{{abbr}}} || |
| 861 | || 제목과 구역 || {{{h1}}}~{{{h6}}}, {{{div}}}, {{{section}}}, {{{article}}}, {{{aside}}}, {{{header}}}, {{{footer}}}, {{{main}}}, {{{nav}}}, {{{address}}} || |
| 862 | || 링크와 인용 || {{{a}}}, {{{blockquote}}}, {{{hr}}} || |
| 863 | || 목록과 코드 || {{{ul}}}, {{{ol}}}, {{{li}}}, {{{pre}}}, {{{code}}}, {{{kbd}}}, {{{samp}}} || |
| 864 | || 표 || {{{table}}}, {{{caption}}}, {{{thead}}}, {{{tbody}}}, {{{tfoot}}}, {{{tr}}}, {{{th}}}, {{{td}}} || |
| 865 | || 접기와 보조 요소 || {{{details}}}, {{{summary}}}, {{{figure}}}, {{{figcaption}}}, {{{time}}} || |
| 866 | || 미디어 || {{{audio}}}, {{{video}}}, {{{source}}}, {{{track}}}, 제한된 {{{iframe}}} || |
| 867 | |
| 868 | {{{script}}}, {{{style}}}, {{{form}}}, {{{input}}}, {{{button}}}, {{{object}}}, {{{embed}}}, 인라인 {{{svg}}} 등은 제거됩니다. 이미지는 {{{img}}} 태그 대신 위키의 파일 삽입 문법을 사용합니다. 공용 CSS는 HTML의 {{{style}}} 태그 대신 별도의 {{{#!style}}} 블록에 작성합니다. |
| 869 | |
| 870 | === 속성과 주소 === |
| 871 | ||<thead><rowbgcolor=#eee,#2d2f34> 대상 || 허용 속성 || |
| 872 | || 공통 || {{{class}}}, {{{style}}}, {{{id}}}, {{{title}}}, {{{lang}}} || |
| 873 | || 링크 a || {{{href}}} || |
| 874 | || 표의 td·th || {{{colspan}}}, {{{rowspan}}} || |
| 875 | || 순서 목록 ol || {{{start}}} || |
| 876 | || 접기 details || {{{open}}} || |
| 877 | || 시각 time || {{{datetime}}} || |
| 878 | || audio·video || {{{src}}}, {{{width}}}, {{{height}}}, {{{controls}}}, {{{loop}}}, {{{muted}}}, {{{playsinline}}}, {{{preload}}}, {{{poster}}} || |
| 879 | || source || {{{src}}}, {{{type}}} || |
| 880 | || track || {{{src}}}, {{{kind}}}, {{{srclang}}}, {{{label}}}, {{{default}}} || |
| 881 | || iframe || 검증된 {{{src}}}, {{{width}}}, {{{height}}}, {{{frameborder="0"}}}, {{{allowfullscreen}}} || |
| 882 | |
| 883 | {{{onclick}}} 같은 이벤트 속성, 임의의 {{{data-*}}} 속성은 적용되지 않습니다. {{{style}}} 속성에도 앞의 CSS 허용 규칙을 적용합니다. 링크는 {{{http://}}}, {{{https://}}}, 사이트 내부 경로와 앵커를 사용할 수 있으며 {{{javascript:}}}·{{{data:}}} 주소는 허용하지 않습니다. |
| 884 | |
| 885 | {{{iframe}}}은 {{{https://www.google.com/maps/embed/v1/}}} 아래의 Google Maps Embed API 주소 중 {{{place}}}, {{{view}}}, {{{directions}}}, {{{streetview}}}, {{{search}}} 형식만 허용합니다. 유튜브 등 다른 영상은 [[투비위키:문법 도움말/파일]]의 동영상 매크로를 사용합니다. |
| 406 | 886 | |
| 407 | 887 | == 원문 표시와 주석 == |
| 408 | 888 | 중괄호 세 개로 감싸면 링크나 굵게 같은 문법을 적용하지 않고 원문을 표시합니다. 블록 문법 자체를 예시로 적을 때에는 바깥쪽을 한 번 더 감쌉니다. |
| | ... |