KScript 문서
KO

언어

영어에서 자동 번역되었습니다. 원문은 영어입니다.

latex의 필드와 메서드

필드는 값에 관한 단순한 정보로, 대괄호 없이 점으로 읽어요: $value.name. 메서드는 인수를 받거나 작업을 수행하며, ->로 호출하거나 $value->name(arguments)처럼 값을 파이프로 넘겨서 호출해요: $value |> name(arguments).

필드

필드타입설명
.extensionstring점 없이 나타낸 원본 파일 확장자예요.
.textstring감싸진 값의 원본 텍스트예요.

KScript.Document에서 가져옴

이 항목에는 <import package="KScript.Document" />import KScript.Document가 필요합니다. KScript.Document를 참고하세요.

#latex->find(text: string) → number KScript.Document

문서 소스에서 리터럴이 처음 일치하는 위치의 0부터 시작하는 오프셋이며, 없으면 -1입니다.
매개변수받는 값
text 필수string
예시
<let name="paper" value="```latex
  \section*{Introduction}
  Some ideas.
  ```" />
<echo>{ $paper->find('ideas') }</echo>
$paper = ```latex
  \section*{Introduction}
  Some ideas.
  ```
echo $paper->find('ideas')

#latex->insert(content, at?: int) → latex KScript.Document

같은 형식의 텍스트나 원본을 0부터 시작하는 오프셋 위치에 넣은 복사본을 반환해요. 오프셋을 생략하면 끝에 추가해요.
매개변수받는 값
content 필수모든 값
at 선택int

인수는 이름을 붙여 전달할 수 있습니다: ->insert(…, at: …).

예시
<let name="paper" value="```latex
  \section*{Introduction}
  Some ideas.
  ```" />
<echo>{ $paper->insert(' More soon.').text }</echo>
$paper = ```latex
  \section*{Introduction}
  Some ideas.
  ```
echo $paper->insert(' More soon.').text

#latex->pages() → number KScript.Document

PDF에 있는 페이지 수입니다.
예시
<let name="paper" value="```latex
  \section*{Introduction}
  Some \emph{ideas}.
  ```" />
<echo>{ $paper->pages() } pages</echo>
$paper = ```latex
  \section*{Introduction}
  Some \emph{ideas}.
  ```
echo "{ $paper->pages() } pages"

#latex->replace(search: string, replacement: string) → latex KScript.Document

리터럴 일치 항목을 모두 바꾼 복사본을 반환해요.
매개변수받는 값
search 필수string
replacement 필수string

인수는 이름을 붙여 전달할 수 있습니다: ->replace(…, replacement: …).

예시
<let name="paper" value="```latex
  \section*{Introduction}
  Some ideas.
  ```" />
<echo>{ $paper->replace('ideas', 'plans').text }</echo>
$paper = ```latex
  \section*{Introduction}
  Some ideas.
  ```
echo $paper->replace('ideas', 'plans').text

#latex->save(path: string, as?: pdf|docx|'latex'|'markdown'|html) KScript.Document

문서를 파일로 저장합니다. 파일 확장자(또는 as:)가 형식을 정합니다. .tex는 소스를 그대로 저장하고, .pdf, .docx, .md 또는 .html은 문서 부분이 읽는 LaTeX를 렌더링합니다. 확장자가 없으면 .tex로 저장합니다.
매개변수받는 값
path 필수string
as 선택다음 단어 중 하나: pdf|docx|'latex'|'markdown'|html

인수는 이름을 붙여 전달할 수 있습니다: ->save(…, as: …).

예시
<let name="paper" value="```latex
  \section*{Introduction}
  Some ideas.
  ```" />
<do>$paper->save('paper.tex')</do>
$paper = ```latex
  \section*{Introduction}
  Some ideas.
  ```
$paper->save('paper.tex')

#latex->words() → number KScript.Document

텍스트에 수학 기호와 코드를 제외하고 단어가 몇 개인지 나타냅니다.
예시
<let name="paper" value="```latex
  \section*{Introduction}
  Some \emph{ideas}.
  ```" />
<echo>{ $paper->words() } words</echo>
$paper = ```latex
  \section*{Introduction}
  Some \emph{ideas}.
  ```
echo "{ $paper->words() } words"

any의 메서드