Liking cljdoc? Tell your friends :D
Clojure only.

mermaid-processor.behaviors.regex_based


buildclj

(build libraries chart regex-to-action-map)

Constructs a behavior function for a given chart using specified libraries and a regex-to-action map.

ARGUMENTS:

  • libraries: A collection of libraries containing predefined actions and conditions.
  • chart: The mermaid chart content, parsed into a map with nodes, routes, etc.
  • regex-to-action-map: A map where keys are regex patterns and values are corresponding actions.

The function processes the nodes of the chart, attempting to match each node's text with a regex pattern from the regex-to-action map. If all nodes are matched, it returns a behavior function that, when invoked with a command, will execute the corresponding action or condition from the cache. If any nodes are not matched, it throws an exception detailing the missing matches.

RETURNS: A behavior function that takes a command and executes the corresponding action or condition from the cache.

THROWS:

  • ExceptionInfo if there are nodes or routes in the chart that do not match any actions in the regex-to-action map.

EXAMPLE:

(build libraries chart regex-to-action-map)

NOTE: The returned behavior function is essentially a cached lookup for actions and conditions based on the command it receives. This is typically used to pass into the process/process-chart function.

Constructs a behavior function for a given chart using specified libraries and a regex-to-action map.

ARGUMENTS:
- libraries: A collection of libraries containing predefined actions and conditions.
- chart: The mermaid chart content, parsed into a map with nodes, routes, etc.
- regex-to-action-map: A map where keys are regex patterns and values are corresponding actions.

The function processes the nodes of the chart, attempting to match each node's text with a regex pattern from the regex-to-action map. If all nodes are matched, it returns a behavior function that, when invoked with a command, will execute the corresponding action or condition from the cache. If any nodes are not matched, it throws an exception detailing the missing matches.

RETURNS:
A behavior function that takes a command and executes the corresponding action or condition from the cache.

THROWS:
- ExceptionInfo if there are nodes or routes in the chart that do not match any actions in the regex-to-action map.

EXAMPLE:
```
(build libraries chart regex-to-action-map)
```
 
NOTE:
The returned behavior function is essentially a cached lookup for actions and conditions based on the command it receives.
This is typically used to pass into the process/process-chart function.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close