KScript документация
RU

Язык

Переведено автоматически с английского; оригинал на английском.

Документы: KScript.Document

Структура

<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')"
  }
}
Элемент Что это такое
Author(affiliation, email) Автор. Его текст — это имя. Либо укажите author: "Ada Lovelace; Alan Turing" у документа.
Abstract Краткое описание под заголовком.
Section(title, id, numbered, new_page) Раздел. Раздел внутри раздела — это подраздел, до шести уровней; седьмой — ошибка.
Paragraph(id, align, lines) Абзац.
List(style, start) и Item Список: bullet, number, letter или roman. List, идущий сразу после Item, вложен в него.
Quote(by) Блочная цитата.
Code(language) Код моноширинным шрифтом, сохраняется в точности как написано.
Contents(title, depth) Оглавление с номерами страниц в PDF.
Markdown(path) Markdown из текста или файла: см. ниже.
Latex(path, value) LaTeX из текста, значения latex или файла .tex: см. ниже.
PageBreak, VSpace(height), Rule Новая страница, промежуток вроде VSpace(height: '1cm') и горизонтальная линия на странице.

Edit this page on GitHub