• 회원가입
  • 로그인
  • 구글아이디로 로그인

[filters] Jinja - center() 필터 - 문자열 가운데 정렬/배치. (= center필터 = 센터필터)

목차
  1. center() 예제 - 문자열값을 지정 너비의 필드의 중앙에 배치
  2. center() 정의
  3. center() 구문

 

center() 예제 - 문자열값을 지정 너비의 필드의 중앙에 배치

 

<xmp>

{% set hz = "Homzzang.com" %}

{{ hz|center(100) }}

</xmp> 

 

 

center() 정의

 

문자열값을 지정 너비의 필드의 중앙에 배치하는 필터.

 


 

1.

<xmp> 또는 <pre> 태그로 감싸야 효과를 볼 수 있음.

 

2. 공식 매뉴얼

https://jinja.palletsprojects.com/en/3.1.x/templates/#jinja-filters.center

 

 

center() 구문

 

jinja-filters.center(value: str, width: int = 80) str

 


[매개변수]

 

value: str

필수. 이 필터를 적용할 문자열.

 

width: int = 80

선택. 필드 너비

 


[반환값]

 

지정 너비 필드의 가운데 배치된 문자열 반환.

 



분류 제목
sandbox Jinja - 샌드박스 - 보안 고려 사항 (Sandbox - Security Considerations)
sandbox Jinja - 샌드박스 - API (Sandbox - API)
sandbox Jinja - 샌드박스 - 연산자 가로채기 (Sandbox - Operator Intercepting)
python_types Jinja - 고유 파이썬 타입 - 예제들 (Native Python Types - Examples)
python_types Jinja - 고유 파이썬 타입 - API (Native Python Types - API)
template Jinja - 템플릿 - 개요 / 템플릿파일확장자 (Template - Synopsis / Template …
template Jinja - 템플릿 - 변수 (Template - Variables)
template Jinja - 템플릿 - 필터 (Template - Filters)
template Jinja - 템플릿 - 테스트 (Template - Tests)
template Jinja - 템플릿 - 주석 (Template - Comments)
template Jinja - 템플릿 - 공백 제어 ★ (Template - Whitespace Control)
template Jinja - 템플릿 - 회피처리 (Template - Escaping) ※ 진자 템플릿 코드를 문자 그대로…
template Jinja - 템플릿 - 라인 구문 (Template - Line Statements) ※ 약식 코드
template Jinja - 템플릿 - 템플릿 상속 ★★★ (Template - Template Inheritance)
template Jinja - 템플릿 - HTML 회피 (Template - HTML Escaping) ※ e필터 = 이필터
template Jinja - 템플릿 - 제어 구조 목록 ★★★ (Template - List of Control Struc…
template Jinja - 템플릿 - 컨텍스트 동작 가져오기 (Template - Import Context Behavi…
template Jinja - 템플릿 - 표현식 ★ (Template - Expressions) ※ (자료형/연산자/기호/키…
template Jinja - 템플릿 - 내장필터 목록 (Template - List of Builtin Filters)
template Jinja - 템플릿 - 내장테스트 목록 (Template - List of Builtin Tests)
2/9
목록
찾아주셔서 감사합니다. Since 2012