-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Korean Translation for Handlebars.js Documentation (#145)
* Add Korean translation * Correct spacing errors * Live Demo Button path fix * Live Demo Button line break fix --------- Co-authored-by: 임현우_FO-FE개발 DEV_소프트웍스 <fddsgt1234@softworks.co.kr>
- Loading branch information
Showing
86 changed files
with
3,151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# (사전) 컴파일 | ||
|
||
## `Handlebars.compile(template, options)` | ||
|
||
템플릿을 컴파일하여 즉시 실행할 수 있게 합니다. | ||
|
||
```js | ||
const template = Handlebars.compile("{{foo}}"); | ||
template({}); | ||
``` | ||
|
||
템플릿 실행 방식을 변경하는 다양한 옵션을 지원합니다. | ||
|
||
::: v-pre | ||
|
||
- `data`: `@data` 추적을 비활성화하려면 false로 설정합니다. | ||
- `compat`: 재귀 필드 조회를 활성화하려면 true로 설정합니다. | ||
- `knownHelpers`: 템플릿 실행 시 존재하는 것으로 알려진 헬퍼 목록을 포함하는 해시입니다. 이를 전달하면 컴파일러가 여러 | ||
경우를 최적화할 수 있습니다. 내장 헬퍼는 이 목록에 자동으로 포함되며 값을 `false`로 설정하여 생략할 수 있습니다. | ||
- `knownHelpersOnly`: 알려진 헬퍼 목록을 기반으로 추가 최적화를 허용하려면 true로 설정합니다. | ||
- `noEscape`: HTML 이스케이프를 하지 않으려면 true로 설정합니다. | ||
- `strict`: 엄격 모드에서 실행합니다. 이 모드에서는 누락된 필드를 묵인하지 않고 예외를 발생시킵니다. 이로 인해 | ||
`{{^foo}}{{/foo}}`와 같은 역 연산이 데이터 소스 객체에 명시적으로 포함되지 않으면 비활성화됩니다. | ||
- `assumeObjects`: 경로를 탐색할 때 객체 존재 여부 확인을 제거합니다. 이는 데이터 입력이 안전하다고 알려진 경우 최적화된 | ||
템플릿을 생성하는 엄격 모드의 하위 집합입니다. | ||
- `preventIndent`: 기본적으로 들여쓰기된 부분 템플릿 호출은 전체 부분 템플릿 출력이 동일한 양으로 들여쓰기되게 합니다. | ||
이는 부분 템플릿이 `pre` 태그를 작성할 때 예기치 않은 동작을 초래할 수 있습니다. 이 옵션을 `true`로 설정하면 자동 들여 | ||
쓰기 기능이 비활성화됩니다. | ||
- `ignoreStandalone`: 설정 시 독립 태그 제거를 비활성화합니다. 설정하면 블록과 부분 템플릿이 각자 줄에 있을 때 해당 줄의 | ||
공백을 제거하지 않습니다. | ||
- `explicitPartialContext`: 부분 템플릿의 암시적 컨텍스트를 비활성화합니다. 활성화되면 컨텍스트 값을 전달받지 않은 부분 | ||
템플릿은 빈 객체를 대상으로 실행됩니다. | ||
|
||
::: | ||
|
||
## `Handlebars.precompile(template, options)` | ||
|
||
주어진 템플릿을 사전 컴파일하여 클라이언트로 전송한 후 컴파일 없이 실행할 수 있게 합니다. | ||
|
||
```js | ||
var templateSpec = Handlebars.precompile("{{foo}}"); | ||
``` | ||
|
||
`Handlebars.compile` 메서드와 동일한 옵션 매개변수를 지원합니다. 추가적으로 다음을 전달할 수 있습니다: | ||
|
||
- `srcName`: 입력 파일의 소스 맵을 생성하기 위해 전달됩니다. 이렇게 실행되면 반환 구조는 `{code, map}`이며, `code`에는 | ||
템플릿 정의가 포함되고 `map`에는 소스 맵이 포함됩니다. | ||
- `destName`: 소스 맵을 생성할 때 `srcName`과 함께 사용되는 선택적 매개변수로, 대상 파일 이름을 제공합니다. | ||
|
||
## `Handlebars.template(templateSpec)` | ||
|
||
`Handlebars.precompile`로 사전 컴파일된 템플릿을 설정합니다. | ||
|
||
```js | ||
var template = Handlebars.template(templateSpec); | ||
template({}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# `@data` 변수 | ||
|
||
다음 `@data` 변수들은 Handlebars와 내장 헬퍼에 의해 구현됩니다. | ||
|
||
## `@root` | ||
|
||
템플릿이 실행된 초기 컨텍스트입니다. | ||
|
||
```handlebars | ||
{{#each array}} {{@root.foo}} {{/each}} | ||
``` | ||
|
||
명시적으로 수정되지 않는 한, 이 값은 페이지 렌더링의 모든 부분에서 일관되게 유지되므로, 깊은 매개변수가 상위 템플릿을 참 | ||
조할 수 없는 부분 템플릿 내에서도 사용할 수 있습니다. | ||
|
||
## `@first` | ||
|
||
반복의 첫 번째 단계에서 `each` 헬퍼에 의해 true로 설정됩니다. | ||
|
||
```handlebars | ||
{{#each array}} {{#if @first}} First! {{/if}} {{/each}} | ||
``` | ||
|
||
## `@index` | ||
|
||
현재 반복 단계의 0부터 시작하는 인덱스입니다. `each` 헬퍼에 의해 설정됩니다. | ||
|
||
```handlebars | ||
{{#each array}} {{@index}} {{/each}} | ||
``` | ||
|
||
## `@key` | ||
|
||
현재 반복 단계의 키 이름입니다. 객체를 반복할 때 `each` 헬퍼에 의해 설정됩니다. | ||
|
||
```handlebars | ||
{{#each array}} {{@key}} {{/each}} | ||
``` | ||
|
||
## `@last` | ||
|
||
반복의 마지막 단계에서 `each` 헬퍼에 의해 true로 설정됩니다. | ||
|
||
```handlebars | ||
{{#each array}} {{#if @last}} Last :( {{/if}} {{/each}} | ||
``` | ||
|
||
## `@level` | ||
|
||
로그 레벨을 할당합니다. | ||
|
||
```js | ||
template({}, { data: { level: Handlebars.logger.WARN } }); | ||
``` | ||
|
||
`Handlebars.logger.DEBUG`,`Handlebars.logger.INFO`,`Handlebars.logger.WARN` 또는 `Handlebars.logger.ERROR` 중 하나로설 | ||
정할 수 있습니다. | ||
|
||
설정하게 되면, 로거는 출력에 `Handlebars.logger.level` 이상의 로그 레벨을 가진 메시지만 포함합니다. 기본 값은 | ||
`Handlebars.logger.ERROR`입니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# 헬퍼(Helpers) | ||
|
||
## `options` 파라미터 | ||
|
||
헬퍼 호출에 사용되는 파라미터 외에도, options 객체가 추가 파라미터로 헬퍼에 전달됩니다. | ||
|
||
- `lookupProperty(object, propertyName)`: 객체의 "자체 속성"을 반환하는 함수입니다. 이 함수는 `allowedProtoProperties`와 | ||
`allowedProtoMethods`에 지정된 화이트리스트를 따릅니다. 예시: | ||
|
||
<ExamplePart examplePage="/ko/examples/helper-lookup-property.md" show="preparationScript" /> | ||
|
||
- TODO:헬퍼에 전달되는 모든 옵션을 설명하세요. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# 인덱스 | ||
|
||
TODO: 여기에 모든 함수의 인덱스를 작성할 수 있습니다. 가장 좋은 방법은 API 참조 부분의 모든 헤더를 수집하는 사용자 정의 | ||
Vue-컴포넌트를 작성하는 것입니다. 하지만 지금은 페이지를 직접 찾아보거나 검색 기능을 사용해야 합니다. | ||
|
||
- [(사전) 컴파일](compilation.md) | ||
- [런타임](runtime.md) | ||
- [유틸리티](utilities.md) | ||
- [헬퍼 유틸리티](utilities.md#helper-utilities) | ||
- [일반 유틸리티](utilities.md#general-utilities) | ||
- [내장 헬퍼에서 사용하는 `@data` 변수](data-variables.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# 런타임 옵션 | ||
|
||
::: v-pre | ||
|
||
`Handlebars.compile` 및 `Handlebars.precompile` 함수는 함수를 생성합니다. 이 함수는 `template(context, options)`로 호출 | ||
될수 있으며, 여기서 `context`는 입력 객체입니다. | ||
|
||
`options` 는 다음 속성을 가질 수 있는 객체입니다. | ||
|
||
- `data` : 사용자 정의 `@variable` 프라이빗 변수를 정의하기 위해 객체를 전달합니다. | ||
- `helpers` 전역적으로 정의된 헬퍼 외에 사용자 정의 헬퍼를 제공하기 위해 전달합니다. 이 객체에 정의된 값은 템플릿 실행동 | ||
안 전역 객체에 정의된 값을 대체합니다. | ||
- `partials` 전역적으로 정의된 부분 템플릿 외에 사용자 정의 부분 템플릿을 제공하기 위해 전달합니다. 이 객체에 정의된 값 | ||
은 템플릿 실행 동안 전역 객체에 정의된 값을 대체합니다. | ||
- `allowCallsToHelperMissing`(4.3.0 이후, 안전하지 않음):`true`로 설정하면 `{{helperMissing}}` 및 | ||
`{{blockHelperMissing}}`와 같은 호출이 허용됩니다. 이 옵션을 설정하면 템플릿 작성자가 Handlebars를 실행하는 환경에서원 | ||
격 코드 실행을 위한 템플릿을 제작할 수 있으므로 주의해야 합니다 (자세한 내용은 여기를 참조하세요 | ||
https://github.com/handlebars-lang/handlebars.js/issues/1558). | ||
|
||
::: | ||
|
||
## 프로토타입 접근을 제어하는 옵션 | ||
|
||
버전 4.6.0부터 Handlebars는 기본적으로 컨텍스트 객체의 프로토타입 속성 및 메서드에 대한 접근을 금지합니다. 이는 이러한가 | ||
능성에서 발생하는 다양한 보안 문제 때문입니다. 다음 옵션을 사용하여 이 접근을 제어할 수 있습니다. | ||
|
||
::: 위험 이러한 속성을 사용하는 것은 보안 허점을 열 수 있습니다. | ||
|
||
프로토타입 속성을 허용하면 템플릿 작성자가 Handlebars가 실행되는 환경에서 임의의 코드를 실행할 수 있습니다. 일부 제한이 | ||
있더라도 공격자는 Handlebars 템플릿을 제작하여 머신을 충돌시킬 수 있습니다. | ||
|
||
자세한 내용은 npm 보안 권고 [755](https://www.npmjs.com/advisories/755), [1164](https://www.npmjs.com/advisories/1164), | ||
[1316](https://www.npmjs.com/advisories/1316), [1324](https://www.npmjs.com/advisories/1324) 및 | ||
[1325](https://www.npmjs.com/advisories/1325) 그리고 | ||
[Mahmoud Gamal](http://mahmoudsec.blogspot.com/2019/04/handlebars-template-injection-and-rce.html)의 블로그 기사를 참조 | ||
하세요. | ||
|
||
::: | ||
|
||
- `allowProtoMethodsByDefault`(4.7.0 이후):기본적으로 객체의 프로토타입에 정의된 메서드가 해석 가능해야 하는지 여부를정 | ||
의하는 부울 값 (기본값: false). | ||
|
||
`constructor`,`__defineGetter__`,`__defineSetter__`,`__lookupGetter__`, `__lookupSetter__` 메서드는 이 옵션이 | ||
`true`로 설정되어 있어도 금지됩니다. 이러한 메서드는 allowedProtoMethods에서 해당 키가 `true`로 설정된 경우에만 접근할 | ||
수 있습니다. | ||
|
||
이 옵션을 설정하면 프로토타입 메서드 접근이 시도되고 금지되었을 때 Handlebars가 콘솔에 기록하는 경고를 비활성화합니다. | ||
|
||
- `allowedProtoMethods`(4.6.0 이후):부모 객체의 메서드인 경우 허용되는 속성 이름의 문자열-부울 맵입니다. 정의되지 않은 | ||
값은 `allowProtoMethodsByDefault`에서 정의된 값으로 되돌아갑니다. | ||
|
||
- `allowProtoPropertiesByDefault`(4.7.0 이후):본적으로 객체의 프로토타입에 정의된 비메서드 속성이 해석 가능해야 하는지 | ||
여부를 정의하는 부울 값 (기본값: false). | ||
|
||
`__proto__` 속성은 이 옵션이 `true`로 설정되어 있어도 금지됩니다. 이 속성은 `allowedProtoProperties`에서 해당 키가 | ||
`true`로 설정된 경우에만 접근할 수 있습니다. | ||
|
||
이 옵션을 설정하면 프로토타입 속성 접근이 시도되고 금지되었을 때 Handlebars가 콘솔에 기록하는 경고를 비활성화합니다. | ||
|
||
- `allowedProtoProperties`(4.6.0 이후): 부모 객체의 메서드가 아닌 속성인 경우 허용되는 속성 이름의 문자열-부울 맵입니다. | ||
정의되지 않은 값은 `allowProtoPropertiesByDefault`에서 정의된 값으로 되돌아갑니다. | ||
|
||
```js | ||
const template = handlebars.compile("{{aString.trim}}"); | ||
const result = template({ aString: " abc " }); | ||
// result is empty, because trim is defined at String prototype | ||
``` | ||
|
||
```js | ||
const template = handlebars.compile("{{aString.trim}}"); | ||
const result = template( | ||
{ aString: " abc " }, | ||
{ | ||
allowedProtoMethods: { | ||
trim: true, | ||
}, | ||
} | ||
); | ||
// result = 'abc' | ||
``` | ||
|
||
런타임 옵션을 전달할 수 없는 경우, [express-handlebars](https://www.npmjs.com/package/express-handlebars) 와 같은 경우에 | ||
는 [@handlebars/allow-prototype-access](https://www.npmjs.com/package/@handlebars/allow-prototype-access) 패키지를 사용 | ||
하여 4.5.3 버전의 동작으로 되돌릴 수 있습니다. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Handlebars 런타임 | ||
|
||
## `Handlebars.registerPartial(name, partial)` | ||
|
||
환경 내 모든 템플릿에서 접근할 수 있는 부분 템플릿을 등록합니다. | ||
|
||
```js | ||
Handlebars.registerPartial("foo", partial); | ||
``` | ||
|
||
여러 부분 템플릿을 한 번에 등록하는 것도 지원합니다. | ||
|
||
```js | ||
Handlebars.registerPartial({ foo: partial, bar: partial }); | ||
``` | ||
|
||
전체 라이브러리를 로드하는 경우, 부분 템플릿은 필요할 때 컴파일되는 문자열 값일 수 있습니다. 런타임만 로드하는 경우, 부 | ||
분 템플릿은 `Handlebars.template` 메서드를 사용하여 적절히 설정된 사전 컴파일된 템플릿이어야 합니다. | ||
|
||
## `Handlebars.unregisterPartial(name)` | ||
|
||
이전에 등록된 부분 템플릿을 등록 해제합니다. | ||
|
||
```js | ||
Handlebars.unregisterPartial("foo"); | ||
``` | ||
|
||
## `Handlebars.registerHelper(name, helper)` | ||
|
||
환경 내 모든 템플릿에서 접근할 수 있는 헬퍼를 등록합니다. | ||
|
||
```js | ||
Handlebars.registerHelper("foo", function () {}); | ||
``` | ||
|
||
여러 헬퍼를 한 번에 등록하는 것도 지원합니다. | ||
|
||
```js | ||
Handlebars.registerHelper({ foo: function () {}, bar: function () {} }); | ||
``` | ||
|
||
## `Handlebars.unregisterHelper(name)` | ||
|
||
이전에 등록된 헬퍼를 등록 해제합니다. | ||
|
||
```js | ||
Handlebars.unregisterHelper("foo"); | ||
``` | ||
|
||
## `Handlebars.registerDecorator(name, helper)` (폐기 예정) | ||
|
||
::: 주의 폐기 예정 안내 | ||
|
||
사용자 정의 데코레이터는 폐기 예정이며 Handlebars의 다음 주요 버전에서 사라질 수 있습니다. 이들은 다른 언어로 포팅하기어 | ||
려운 내부 API의 너무 많은 부분을 노출하며 코드 유지 관리가 어렵게 만듭니다. | ||
|
||
::: | ||
|
||
환경 내 모든 템플릿에서 접근할 수 있는 데코레이터를 등록합니다. | ||
|
||
```js | ||
Handlebars.registerDecorator("foo", function () {}); | ||
``` | ||
|
||
여러 데코레이터를 한 번에 등록하는 것도 지원합니다. | ||
|
||
```js | ||
Handlebars.registerDecorator({ foo: function () {}, bar: function () {} }); | ||
``` | ||
|
||
## `Handlebars.unregisterDecorator(name)` | ||
|
||
이전에 등록된 데코레이터를 등록 해제합니다. | ||
|
||
```js | ||
Handlebars.unregisterDecorator("foo"); | ||
``` | ||
|
||
## `Handlebars.create()` | ||
|
||
고립된 Handlebars 환경을 만듭니다. | ||
|
||
```js | ||
var OtherHandlebars = Handlebars.create(); | ||
``` | ||
|
||
각 환경은 자체 헬퍼와 부분 템플릿을 가집니다. 이는 별개의 헬퍼 또는 부분 템플릿이 필요한 사용 사례에서만 필요합니다. 대 | ||
부분의 사용 사례는 루트 `Handlebars` 환경을 직접 사용할 수 있습니다. | ||
|
||
주어진 환경을 위해 생성된 템플릿은 해당 환경에 바인딩됩니다. 이는 여러 환경에서 실행되어야 하는 템플릿이 각 환경에 대해 | ||
다시 컴파일되거나 `Handlebars.template`을 통해 재구성되어야 함을 의미합니다. 이는 부분 템플릿에도 적용됩니다. | ||
|
||
## `Handlebars.noConflict()` | ||
|
||
이 Handlebars 인스턴스를 전역 네임스페이스에서 제거하고 전역 `Handlebars` 변수를 이전 값으로 복원합니다. | ||
|
||
```js | ||
var myHandlebars = Handlebars.noConflict(); | ||
``` | ||
|
||
이를 통해 라이브러리의 다양한 버전을 동시에 사용하면서 버전 충돌에 대한 걱정 없이 사용할 수 있습니다. |
Oops, something went wrong.