Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
foss-2024-2-final
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
During summer vacation, Gitlab will be restart frequently. Use it carefully.
Show more breadcrumbs
Jaemin Shin
foss-2024-2-final
Commits
3a96694b
Commit
3a96694b
authored
7 months ago
by
Jaemin Shin
Browse files
Options
Downloads
Patches
Plain Diff
Update file api.rst
parent
84ebdecd
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
jinja-kr/docs/api.rst
+14
-24
14 additions, 24 deletions
jinja-kr/docs/api.rst
with
14 additions
and
24 deletions
jinja-kr/docs/api.rst
+
14
−
24
View file @
3a96694b
...
@@ -11,9 +11,9 @@ Jinja 탬플릿을 만드는 사람들 보다는 어플리케이션의 인터페
...
@@ -11,9 +11,9 @@ Jinja 탬플릿을 만드는 사람들 보다는 어플리케이션의 인터페
Basics
Basics
------
------
Jinja는 핵심 개체로 탬플릿 :class:`Environment`를 사용합니다.
Jinja는 핵심 개체로 탬플릿 :class:`Environment`
(환경)
를 사용합니다.
이 개체의 instance는 구성과 전역변수를 저장하고 파일 시스템 또는 다른 위치로부터 탬플릿을 로드합니다.
이 개체의 instance는 구성과 전역변수를 저장하고 파일 시스템 또는 다른 위치로부터 탬플릿을 로드합니다.
당신이 :class:`Template`의 생성자를 사용하여 탬플릿을 만들더라도, 공유되는
:class:`Environment`를
자동적으로 생성합니다.
당신이 :class:`Template`의 생성자를 사용하여 탬플릿을 만들더라도, 공유되는
환경을
자동적으로 생성합니다.
대부분의 어플리케이션은 초기 실행될때 하나의 :class:`Environment` 객체를 생성하고 탬플릿들을 호출합니다.
대부분의 어플리케이션은 초기 실행될때 하나의 :class:`Environment` 객체를 생성하고 탬플릿들을 호출합니다.
다만 다른 구성들이 사용되는 경우에는 경우에 따라 복수의 환경을 사용하는 것이 유리합니다.
다만 다른 구성들이 사용되는 경우에는 경우에 따라 복수의 환경을 사용하는 것이 유리합니다.
...
@@ -29,35 +29,26 @@ Jinja는 핵심 개체로 탬플릿 :class:`Environment`를 사용합니다.
...
@@ -29,35 +29,26 @@ Jinja는 핵심 개체로 탬플릿 :class:`Environment`를 사용합니다.
autoescape=select_autoescape()
autoescape=select_autoescape()
)
)
이것은 탬플릿
이것은 파이썬 패키지인 ``yourapp`` 내부에 ``templates`` 폴더(또는 파이썬 모듈 ``yourapp.py`` 옆)에서 탬플릿들을 찾는 호출자(loader)와 HTML 파일들 에서 autoescape가 정의된 탬플릿 환경을 생성합니다.
호출자(loader)가 동작하기 위해서는 적어도 ``yourapp``이 가져오기(importable) 가능해야 하고 그때 폴더의 경로를 이해합니다.
This will create a template environment with a loader that looks up
다른 호출자들은 탬플릿을 다른 방법이나 다른 위치로부터 호출할 수 있습니다. 그런 호출자들은 아래 `Loaders`_에 정리되어 있습니다.
templates in the ``templates`` folder inside the ``yourapp`` Python
또한 프로젝트에 더 특화된 소스로부터 탬플릿을 호출하도록 직접 구성할 수도 있습니다.
package (or next to the ``yourapp.py`` Python module). It also enables
autoescaping for HTML files. This loader only requires that ``yourapp``
is importable, it figures out the absolute path to the folder for you.
Different loaders are available to load templates in other ways or from
이 환경으로부터 탬플릿을 호출하기 위해서는, :meth:`get_template` 메소드를 사용합니다.
other locations. They're listed in the `Loaders`_ section below. You can
also write your own if you want to load templates from a source that's
more specialized to your project.
To load a template from this environment, call the :meth:`get_template`
method, which returns the loaded :class:`Template`.
.. code-block:: python
.. code-block:: python
template = env.get_template("mytemplate.html")
template = env.get_template("mytemplate.html")
To render it with some variables, call the
:meth:`render`
method.
몇몇 변수와 함꼐 렌더링 하기 위해서는
:meth:`render`
메소드를 활용합니다
.. code-block:: python
.. code-block:: python
print(template.render(the="variables", go="here"))
print(template.render(the="variables", go="here"))
Using a template loader rather than passing strings to :class:`Template`
탬플릿 호출자를 사용하는 것은 :class:`Template`나 :meth:`Environment.from_string`를 통해 문자열을 전송하는 것 보다 많은 장점을 갖습니다.
or :meth:`Environment.from_string` has multiple advantages. Besides being
이는 사용이 쉽고 상속 또한 가능합니다.
a lot easier to use it also enables template inheritance.
.. admonition:: Notes on Autoescaping
.. admonition:: Notes on Autoescaping
...
@@ -66,13 +57,12 @@ a lot easier to use it also enables template inheritance.
...
@@ -66,13 +57,12 @@ a lot easier to use it also enables template inheritance.
configure autoescaping now instead of relying on the default.
configure autoescaping now instead of relying on the default.
High Level
API
상위 수준
API
--------------
--------------
The high-level API is the API you will use in the application to load and
상위 수준 API는 Jinja 템플릿을 호출하고 렌더링하는 데 사용하는 API입니다.
render Jinja templates. The :ref:`low-level-api` on the other side is only
:ref:`low-level-api`는 Jinja를 보다 더 심도 깊게 사용하거나 :ref:`develop extensions<jinja-extensions>`를 활용하기 위해 필요합니다.
useful if you want to dig deeper into Jinja or :ref:`develop extensions
<jinja-extensions>`.
.. autoclass:: Environment([options])
.. autoclass:: Environment([options])
:members: from_string, get_template, select_template,
:members: from_string, get_template, select_template,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment