Package atessera.publ

Class BiblioExtractor

java.lang.Object
atessera.publ.BiblioExtractor

public final class BiblioExtractor extends Object
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 thebibliography environment.

Processing details

  1. Filters the section list to retain only MARKDOWN sections.
  2. For each section, parses the Markdown source through a LatexTarget that recognizes BibItem blocks.
  3. Walks the resulting AST using EnumNodes to find all BibItem nodes.
  4. Renders each BibItem to 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 Details

    • BiblioExtractor

      public BiblioExtractor()
  • Method Details

    • extract

      public Map<String,String> extract(List<PublicationContent.Section> sections)
      Extracts bibliography entries from the given list of sections.

      Only sections of type MARKDOWN are processed. Other section types are silently ignored.

      Parameters:
      sections - the list of publication sections; may be null or empty
      Returns:
      a map from citation label to rendered bibliography text; never null, but may be empty if no bibliography items are found