Skip to main content

Generate icon libraries from AsciiDoc-based descriptions.

Project description

a2dl | (A)sciidoc(2D)rawio(L)ibrary

This script generates a library from AsciiDoc-based descriptions and updates diagrams that use icons from these libraries.

  • It recursively searches for adoc files in a specified folder and scans for particular lines within these files.
  • These lines are then integrated into HTML tooltips of icons.
  • The icons are bundled into a / library.

I needed to visualize the relationship within previously written content. I wrote this script to extract relevant information from these articles into tooltips for icons. This allows me to concentrate on connecting the information and provide contextual information during a presentation.


python3 -m pip install a2dl

Prepare Asciidoc files

To use this script, simply add the identifiers to any adoc file.

Set these variables at the top of the file

  • :icon_image_rel_path: images/generated/3.png -> Path to an Icon Image PNG

  • :icon_name: Icon3 -> Name for the Icon

  • :read_more: #sec-icon3 -> Link for more info, to be appended to the tooltips end

These two lines form the start of a Tooltips content, while the first line will also work as a stop sign for the content extraction:

  • == or === up to =====

  • :variable_name: short_description -> choose any name for your variable, but do not include whitespace

Example Adoc

:icon_image_rel_path: images/generated/3.png
:icon_name: Icon3
:read_more: #sec-icon3

== Icon 3

image::{icon_image_rel_path}[The Icon 3s Alternative Text,160,160,float="right"]

=== Short Description
:variable_name: short_description

This is short Text to Describe the icon
A short abstract of the Topic

WARNING: Not Safe For Work

=== XML Attribute 1
:variable_name: xml_attribute_1

Some part of the text to add to the icons data 


Use in CLI

python3 -m a2dl --library path/to/folder-to-scan path/to/library-file-to-write.xml
# OR
python3 -m a2dl --diagram path/to/folder-to-scan path/to/file-to-update
# OR
python3 -m a2dl --example path/to/folder-to-write


a2dl --library path/to/folder-to-scan path/to/library-file-to-write.xml
# OR
a2dl --diagram path/to/folder-to-scan path/to/file-to-update
# OR
a2dl --example path/to/folder-to-write

Use in python script

A basic example.

import a2dl.a2dl

# Overwrite some constants
a2dl.a2dl.ICON_STYLE = "rounded=1;whiteSpace=wrap;html=1;"
a2dl.a2dl.IMAGE_STYLE = 'fillColor=none;rounded=1;shape=image;verticalLabelPosition=bottom;labelBackgroundColor=default;verticalAlign=top;aspect=fixed;imageAspect=0;image=data:image/{},{};'


# create icon
DI = a2dl.a2dl.Diagicon()
# write the icon to a Diagram file

# create a library
DL = a2dl.a2dl.Diaglibrary()

#  update a diagram
DG = a2dl.a2dl.Diagdiagram()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a2dl-0.1.2.tar.gz (35.0 MB view hashes)

Uploaded Source

Built Distribution

a2dl-0.1.2-py3-none-any.whl (35.0 MB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page