Documentos: KScript.Document
Estrutura
<KScript.Document template="report" title="Annual Report" author="The team" to="'report.pdf'">
<Contents />
<Section title="Summary" id="summary">
<Paragraph>Visits rose every quarter.</Paragraph>
<Section title="Details">
<List style="number">
<Item>First point.</Item>
<Item>Second point.</Item>
<List>
<Item>A point under the second.</Item>
</List>
</List>
</Section>
</Section>
<Section title="Appendix" numbered="false" new_page="true">
<Quote by="John Conway">I'm not a mathematician who's interested in applications.</Quote>
<Code language="python">print('hello')</Code>
</Section>
</KScript.Document>
import KScript.Document
Document(template: report, title: 'Annual Report', author: 'The team', to: 'report.pdf') {
Contents
Section(title: 'Summary', id: 'summary') {
Paragraph "Visits rose every quarter."
Section(title: 'Details') {
List(style: number) {
Item "First point."
Item "Second point."
List {
Item "A point under the second."
}
}
}
}
Section(title: 'Appendix', numbered: false, new_page: true) {
Quote(by: 'John Conway') "I'm not a mathematician who's interested in applications."
Code(language: 'python') "print('hello')"
}
}
| Elemento |
O que é |
Author(affiliation, email) |
Um autor. Seu texto é o nome. Ou informe author: "Ada Lovelace; Alan Turing" no documento. |
Abstract |
O resumo abaixo do título. |
Section(title, id, numbered, new_page) |
Uma seção. Uma seção dentro de outra seção é uma subseção, até seis níveis; um sétimo nível é um erro. |
Paragraph(id, align, lines) |
Um parágrafo. |
List(style, start) e Item |
Uma lista: bullet, number, letter ou roman. Um List logo após um Item fica aninhado nele. |
Quote(by) |
Uma citação em bloco. |
Code(language) |
Código, em fonte de largura fixa, mantido exatamente como escrito. |
Contents(title, depth) |
Um sumário, com números de página no PDF. |
Markdown(path) |
Markdown a partir do seu texto ou de um arquivo: veja abaixo. |
Latex(path, value) |
LaTeX a partir do seu texto, de um valor latex ou de um arquivo .tex: veja abaixo. |
PageBreak, VSpace(height), Rule |
Uma nova página, um espaço como VSpace(height: '1cm') e uma linha horizontal atravessando a página. |