Documentos: KScript.Document
Estructura
<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 |
Qué es |
Author(affiliation, email) |
Un autor. Su texto es el nombre. O bien indica author: "Ada Lovelace; Alan Turing" en el documento. |
Abstract |
El resumen debajo del título. |
Section(title, id, numbered, new_page) |
Una sección. Una sección dentro de otra sección es una subsección, hasta seis niveles; un séptimo nivel es un error. |
Paragraph(id, align, lines) |
Un párrafo. |
List(style, start) y Item |
Una lista: bullet, number, letter o roman. Un List justo después de un Item queda anidado dentro de él. |
Quote(by) |
Una cita en bloque. |
Code(language) |
Código, en una fuente de ancho fijo, mantenido exactamente como está escrito. |
Contents(title, depth) |
Un índice de contenidos, con los números de página del PDF. |
Markdown(path) |
Markdown a partir de su texto o de un archivo: ver más abajo. |
Latex(path, value) |
LaTeX a partir de su texto, un valor de latex o un archivo .tex: consulta abajo. |
PageBreak, VSpace(height), Rule |
Una página nueva, un hueco como VSpace(height: '1cm') y una línea que atraviesa la página. |