Renew file converter to turn files parsed with RenewEx (Repository) into a canonical structure that can be worked with more easily (for example be imported into a database).
The conveter is tested on more than 1000 example files.
All test:
mix test
Only fast tests:
mix test --exclude slow
# Read rnw file
{:ok, file_content} = File.read("example.rnw")
# Parse file content
{:ok, %Renewex.Document{} = document} = Renewex.parse_document(file_content)
{:ok, %LayeredDocument{
version: version,
# ^ 11
kind: kind,
# ^ de.renew.gui.CPNDrawing
layers: layers,
# ^ [%RenewexConverter.Layer{
# id: _,
# content: _,
# tag: "de.renew.gui.PlaceFigure",
# z_index: 0,
# hidden: false} | _]
hierarchy: hierarchy,
# ^ [%LayeredDocument.Nesting{
# ancestor_id: _,
# descendant_id: _,
# depth: 0} | _]
hyperlinks: hyperlinks,
# ^ [%LayeredDocument.Hyperlink{
# source_id: _,
# target_id: _} | _]
}} = RenewexConverter.consume_document(doc)