Skip to content

Latest commit

 

History

History

lang-doc-templates

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Document template language

This is a small, statically typed typed document authoring language. Templates are type-checked and translated to a simple functional language, which means that type errors occur on the templates themselves, as opposed to in the generated code, or at runtime.

The language was inspired by Forester and Mylink which use functional languages as a basis for document processing. Another source of inspiration was “A Core Calculus for Documents”, which uses evaluation rules to translate templates into other primitives in the core language, as opposed to elaboration.

The language currently naively concatenates strings together, but it might be a good idea to explore using document trees in the future.

Example

Input document:

${let place := "world"}

Hello ${place}!

Elaborated document:

let place : Text := "world";
"\n\nHello " + place + "!"

Normalised term:

Hello world!

Todo List

  • Initial concrete syntax
  • String templates
  • Lists and list combinators
  • Imports and cross-document references
  • Markdown-inspired syntax hooks (headings, links, lists, etc.)
  • Labelled function parameters
  • Parameterised templates
  • Metadata fields (for information like title, author, date, tags)
  • Attributed node templates (with namespaced nodes?)
  • Improve syntax (perhaps something similar to Scribble?)
  • External renderers (KaTeX, Graphvis, Penrose, PlantUML, syntax highlighting, railroad diagrams, reference lists, etc)
  • Datalog-style query language
  • Back-ends (HTML, Markdown, TeX, RSS)

Inspiration

Papers:

Lightweight markup languages:

  • Djot: A simpler alternative to markdown with less ambiguities
  • Org Mode: Document editing language for Emacs
  • Subtext: Tiny markup language geared towards index-card note-taking
  • Cooklang: Recipe markup language
  • mexdown: A markdown-like language that allows commands to generate parts of a document

String interpolation:

Programmable markup languages:

Template languages:

String/Node/Document Literals:

Document DSLs:

Quasiquoting:

Wiki markup and personal knowledge management:

  • Forester
  • Mylink
  • Omake: cardfile format written in XML, presented with an XSL transform
  • Org-roam: Emacs-based knowledge management with Org Mode
  • Oscean: Wiki engine written entirely in assembler
  • yon: Wiki editor in a standalone HTML file with no dependencies
  • TiddlyWiki: a non-linear personal web notebook

Attributed node languages:

Data serialisation languages:

Configuration languages:

Type checking XML Papers: