Package atessera.publ
Class BiblioExtractor
java.lang.Object
atessera.publ.BiblioExtractor
Extracts bibliography entries from the Markdown sections of a
publication.
This utility scans all sections of type MARKDOWN in a
publication, parses each one through a dedicated
LatexTarget instance configured with a
BibItemParserFactory, and collects every
BibItem node found in the
resulting document tree.
The result is a Map where:
- Key — the citation label (e.g.
"knuth1984"), as defined in the Markdown source. - Value — the fully rendered LaTeX
representation of the bibliography entry, suitable for
inclusion in a
thebibliographyenvironment.
Processing details
- Filters the section list to retain only
MARKDOWNsections. - For each section, parses the Markdown source through a
LatexTargetthat recognizesBibItemblocks. - Walks the resulting AST using
EnumNodesto find allBibItemnodes. - Renders each
BibItemto its LaTeX representation and collects the results into a map.
Thread safety
Instances of this class are stateless and thread-safe. A single instance may be reused across multiple extractions.
Typical usage
BiblioExtractor extractor = new BiblioExtractor();
Map<String, String> bibliography = extractor.extract(publication.getSections());
for (var entry : bibliography.entrySet()) {
System.out.println("Key: " + entry.getKey());
System.out.println("Text: " + entry.getValue());
}
- See Also:
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
BiblioExtractor
public BiblioExtractor()
-
-
Method Details
-
extract
Extracts bibliography entries from the given list of sections.Only sections of type
MARKDOWNare processed. Other section types are silently ignored.- Parameters:
sections- the list of publication sections; may benullor empty- Returns:
- a map from citation label to rendered bibliography text;
never
null, but may be empty if no bibliography items are found
-