Documenti: KScript.Document
Struttura
<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 |
Cosa fa |
Author(affiliation, email) |
Un autore. Il suo testo è il nome. Oppure indica author: "Ada Lovelace; Alan Turing" nel documento. |
Abstract |
Il riepilogo sotto il titolo. |
Section(title, id, numbered, new_page) |
Una sezione. Una sezione dentro una sezione è una sottosezione, fino a sei livelli; un settimo è un errore. |
Paragraph(id, align, lines) |
Un paragrafo. |
List(style, start) e Item |
Un elenco: bullet, number, letter o roman. Un List subito dopo un Item è annidato in esso. |
Quote(by) |
Una citazione in blocco. |
Code(language) |
Codice, in un carattere a spaziatura fissa, mantenuto esattamente come scritto. |
Contents(title, depth) |
Un indice, con i numeri di pagina nel PDF. |
Markdown(path) |
Markdown dal suo testo o da un file: vedi sotto. |
Latex(path, value) |
LaTeX dal suo testo, da un valore latex o da un file .tex: vedi sotto. |
PageBreak, VSpace(height), Rule |
Una nuova pagina, uno spazio come VSpace(height: '1cm'), e una linea orizzontale sulla pagina. |