Class PresentationParser
PresentationContent.
A presentation file consists of optional global headers followed by a
sequence of frames. Each frame is delimited by FRAME BEGIN and
FRAME END markers and may contain optional metadata lines followed
by source content.
File format example
TITLE EN My Presentation
SUBTITLE An Optional Subtitle
AUTHORS John Doe, Jane Roe
DATE 2025-01-15
THEME default
FRAME BEGIN MARKDOWN
TITLE First Slide
SUBTITLE Introduction
LABEL intro
## Hello World
This is the slide body.
FRAME END
FRAME BEGIN LATEX
TITLE LaTeX Slide
\section{Introduction}
\begin{itemize}
\item Point one
\end{itemize}
FRAME END
Global headers
Global headers must appear before the firstFRAME BEGIN line.
Each header occupies a single line and starts with a keyword:
TITLE <lang> <text>— presentation title;<lang>is a two-letter uppercase language code (e.g.EN,RU)SUBTITLE <text>— presentation subtitleAUTHORS <text>— comma-separated list of authorsDATE <text>— date stringTHEME <text>— theme name
Frame syntax
Each frame starts withFRAME BEGIN [type] and ends with
FRAME END. The optional type is a case-insensitive name
matching one of the PresentationContent.FrameType enum constants (e.g. MARKDOWN,
LATEX, METAPOST, GNUPLOT, PLANTUML,
LISTING, EQUATION, GRAPHVIZ_DOT, etc.).
If the type is omitted or unrecognised, MARKDOWN
is used by default.
Within a frame, optional metadata lines may appear before any source content. Metadata lines are recognised by their keyword prefix:
TITLE <text>— frame titleSUBTITLE <text>— frame subtitleLABEL <text>— cross-reference labelLISTING_LANG <text>— programming language for listing frames
FRAME END form the frame's source content. Empty lines before
the first metadata or source line are skipped.
Frame-level metadata keys are the same strings as some global header keys
(TITLE, SUBTITLE), but they are interpreted in their
respective context and do not conflict.
Usage
var content = PresentationParser.parse(lines);
-
Nested Class Summary
Nested classes/interfaces inherited from class atessera.markup.TextStateParser
TextStateParser.HeaderLine<M>, TextStateParser.NewStateLine<M>, TextStateParser.State<M> -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new presentation parser with all header and state-boundary matchers configured. -
Method Summary
Modifier and TypeMethodDescriptionReturns the parsedPresentationContentmodel.static PresentationContentparsePresentation(List<String> lines) Convenience method that parses a list of lines and returns the populatedPresentationContent.Methods inherited from class atessera.markup.TextStateParser
parse
-
Constructor Details
-
PresentationParser
public PresentationParser()Creates a new presentation parser with all header and state-boundary matchers configured.
-
-
Method Details
-
getResult
Returns the parsedPresentationContentmodel.This method should be called after
TextStateParser.parse(java.util.List<java.lang.String>)to retrieve the result. The returned model is the same instance that was passed to the constructor and mutated during parsing.- Returns:
- the populated presentation content, never
null
-
parsePresentation
Convenience method that parses a list of lines and returns the populatedPresentationContent.- Parameters:
lines- the lines of a presentation file to parse, must not benull- Returns:
- the parsed presentation content, never
null - Throws:
NullPointerException- iflinesisnull
-