KScript documentation
FR

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')"
  }
}
Élément Ce que c'est
Author(affiliation, email) Un auteur. Son texte est le nom. Ou indiquez author: "Ada Lovelace; Alan Turing" sur le document.
Abstract Le résumé sous le titre.
Section(title, id, numbered, new_page) Une section. Une section à l'intérieur d'une section est une sous-section, jusqu'à six niveaux ; un septième est une erreur.
Paragraph(id, align, lines) Un paragraphe.
List(style, start) et Item Une liste : bullet, number, letter ou roman. Un List placé juste après un Item est imbriqué dans celui-ci.
Quote(by) Une citation en bloc.
Code(language) Du code, dans une police à chasse fixe, conservé tel quel.
Contents(title, depth) Une table des matières, avec les numéros de page dans le PDF.
Markdown(path) Du Markdown à partir de son texte ou d'un fichier : voir ci-dessous.
Latex(path, value) Du LaTeX à partir de son texte, d'une valeur latex ou d'un fichier .tex : voir ci-dessous.
PageBreak, VSpace(height), Rule Une nouvelle page, un espacement tel que VSpace(height: '1cm'), et une ligne horizontale sur la page.