Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.
haxscramperPublic archive

About

Statically typed wrappers for various markup lanuages - grapvhiz, svg, openscad, latex & more

Resources

Stars

10 stars

Watchers

1 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

deprecated, functionality is moved to hmisc

Statically typed wrappers for various markup lanuages - grapvhiz, svg, openscad, latex. Allows easier generation - library takes care of as much edge cases as possible, and composition - instead of ropes and string interpolation all over the place you can use (somewhat) statically typed API with lots of helper functions.

Installation

nimble install hasts

Links

Usage

Most of the markup ast nodes has lots of fields - providing parametetric constructor functions for all of them would be really tedious to implement. Instead withIt template from hmisc/algo/halgorithm might be used for constructing ast element and setting all fields immediately.

import hasts/graphviz_ast
import hmisc/algo/halgorithm

var g = makeDotGraph()
g.styleNode.shape = nsaEgg
for i in 0 .. 5:
  g.addEdge makeEdge(i, i * 2)
  g.addNode makeNode(i, "Position " & $i).withIt do:
    it.height = i.float

echo g
digraph G {
  node[shape=egg];
  t0[label="Position 0"];
  t1[label="Position 1", height=1.0];
  t2[label="Position 2", height=2.0];
  t3[label="Position 3", height=3.0];
  t4[label="Position 4", height=4.0];
  t5[label="Position 5", height=5.0];
  t0 -> t0;
  t1 -> t2;
  t2 -> t4;
  t3 -> t6;
  t4 -> t8;
  t5 -> t10;
}

Parially implemented (not 100% coverage, but most important parts are present)

  • graphviz
  • openscad
  • svg
  • html

WIP

  • latex
  • latex math
  • pandoc

Conitribution & development

  • [ ] REFACTOR: use regular strings instead of ropes for AST conversion.

Most of the features in the library are implemented on as-needed basis. If you have any question about implementation details or API free to join my discord server and ask questions there.

About

Statically typed wrappers for various markup lanuages - grapvhiz, svg, openscad, latex & more

Resources

Stars

10 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages