Options
All
  • Public
  • Public/Protected
  • All
Menu

The DataPlugin parses Argdown YAML front matter and YAML data of statements, arguments, headings or inferences. In the ParserPlugin the Argdown lexer treats these sections as single tokens so that their contents are ignored by the Argdown parser. Instead the YAML parsing is done afterwards in this plugin by traversing the produced AST and using the js-yaml parser for parsing the content of the FrontMatter and Data tokens.

The parsed data is added to the AST nodes and the data model elements it is meant for. If multiple data sections exist for the same argument or equivalence class, the data is merged in order of appearance (last wins).

The front matter data is added to the topmost AST argdown node and to the [[IDataResponse.frontMatter]] response property. By default (or if response.data.mergeFrontMatterIntoRequest is true) the front matter is also merged into the request object so that it can be used to configure subsequent plugins.

Depends on data of: ParserPlugin

Hierarchy

  • DataPlugin

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

defaults

defaults: IDataSettings

name

name: string = "DataPlugin"

The name of the plugin

prepare

prepare: IRequestHandler = ...

Called each time the plugin's processor is run, before any other method of this plugin is called. Use this to add default settings to the request and to check that all required data is present in the response. If not, throw an ArgdownPluginError to cancel the the current processor's execution.

tokenListeners

tokenListeners: {}

A map of ITokenNode event listeners. You can use tokenListeners to visit every token node in the Argdown abstract syntax tree.

The listeners will be called by the ArgdownTreeWalker event emitter before the run method and after the prepare method.

The tree walker visits the nodes depth first and emits [TokenNames.TOKEN_NAME] events for every ITokenNode encountered.

The eventId has to be a TokenNames member.

Type declaration

Methods

getSettings

Generated using TypeDoc