Documents: KScript.Document
Structure
<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')"
}
}
| Element |
What it is |
Author(affiliation, email) |
An author. Its text is the name. Or give author: "Ada Lovelace; Alan Turing" on the document. |
Abstract |
The summary under the title. |
Section(title, id, numbered, new_page) |
A section. A section inside a section is a subsection, down to six levels; a seventh is an error. |
Paragraph(id, align, lines) |
A paragraph. |
List(style, start) and Item |
A list: bullet, number, letter or roman. A List right after an Item is nested in it. |
Quote(by) |
A block quotation. |
Code(language) |
Code, in a fixed-width font, kept exactly as written. |
Contents(title, depth) |
A table of contents, with page numbers in the PDF. |
Markdown(path) |
Markdown from its text or a file: see below. |
Latex(path, value) |
LaTeX from its text, a latex value or a .tex file: see below. |
PageBreak, VSpace(height), Rule |
A new page, a gap such as VSpace(height: '1cm'), and a line across the page. |