DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:a2s

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:a2s [2017-07-27 04:01] – [a2s Plugin] compat schplurtzplugin:a2s [2023-04-10 17:21] (current) – compatible with jack jackrum (tested) schplurtz
Line 1: Line 1:
-====== a2s Plugin ======+====== A2S Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Convert ASCII art to nice embeded SVG images.+description: Convert ASCII art diagram to nice embedded SVG images.
 author     : Schplurtz le Déboulonné author     : Schplurtz le Déboulonné
 email      : Schplurtz@laposte.net email      : Schplurtz@laposte.net
 type       : syntax type       : syntax
-lastupdate : 2017-07-27 +lastupdate : 2022-06-21 
-compatible : elenor of tsort, detritus, frusterick manners+compatible : elenor of tsort, detritus, frusterick manners, greebo, hogfather, igor, jack jackrum
 depends    :  depends    : 
 conflicts  conflicts 
 similar    : ditaa, diagram similar    : ditaa, diagram
-tags       : ASCII, SVG +tags       : ASCII, SVG, image, images, media, diagram 
-downloadurl: http://github.com//schplurtz/a2s/zipball/master +downloadurl: https://github.com/schplurtz/a2s/zipball/master 
-bugtracker : http://github.com//schplurtz/a2s/issues +bugtracker : https://github.com/schplurtz/a2s/issues 
-sourcerepo : http://github.com//schplurtz/a2s+sourcerepo : https://github.com/schplurtz/a2s
 donationurl:  donationurl: 
  
Line 20: Line 20:
 ---- ----
  
-a2s is a little plugin that turns ASCII art boxes, lines and arrows into nice SVG images. It is based on [[https://github.com/dhobsd/asciitosvg|ASCIIToSVG]] by [[https://github.com/dhobsd|Devon H. O'Dell]]. It is very similar to the [[plugin:ditaa|ditaa]] plugin but does not require external programs to run. It is compatible with the ODT export plugin.+a2s is a little plugin that turns ASCII art boxes, lines and arrows into nice SVG images. It is based on [[https://github.com/dhobsd/asciitosvg|ASCIIToSVG]] by [[https://github.com/dhobsd|Devon H. O'Dell]]. It is very similar to the [[doku>plugin:ditaa|ditaa]] plugin but does not require external programs to run. It is compatible with the ODT export plugin.
  
 +-----------
 +
 +june 2022: a2s works well with DW igor RC2 and php 8.1. But exports to odt with the [[plugin:odt|odt]] plugin currently fails. There is no problem with php 7.4. See this [[https://github.com/schplurtz/a2s/issues/13|bug report]]. 
 ===== Installation ===== ===== Installation =====
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]]. It will install the latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 ===== Examples/Usage ===== ===== Examples/Usage =====
Line 58: Line 61:
         .-----#         |==+        |            |         .-----#         |==+        |            |
      '----#     '---------#      #------#   '-------'      '----#     '---------#      #------#   '-------'
-[0]: {"fill":"#CE3B83","stroke":"#F50078","stroke-dasharray":"5 5","stroke-width":4,"a2s:type":"cloud","a2s:delref":true}+[0]: {"a2s:link":"https://github.com/schplurtz/a2s","fill":"#CE3B83","stroke":"#F50078","stroke-dasharray":"5 5","stroke-width":4,"a2s:type":"cloud","a2s:delref":true}
 </a2s> </a2s>
 </code> </code>
Line 76: Line 79:
     * ''%%'%%'', ''.'' and ''#'' are used for box angle. Do not use ''+'', as it does not create closed shape.     * ''%%'%%'', ''.'' and ''#'' are used for box angle. Do not use ''+'', as it does not create closed shape.
     * closed shape can be styled.     * closed shape can be styled.
-      - Identify the form : In the **top left** angle of the form, put some text between square bracket. example ''[0]'', ''[logo]'' +      - Identify the shape : In the **top left** angle of the shape, put some text between square bracket. example ''[0]'', ''[logo]'', ''[some text]'' 
-      - **At the bottom** of the drawing, for each identified form, add a **single** line with the identifier and a JSON hash of property:value.+      - **At the bottom** of the drawing, for each identified shape, add a **single** line with the identifier and a JSON hash of property:value. See the section just below for details.
  
-==== Styling shapes ====+==== Styling shapes and linking ====
  
 Colors are expressed either Colors are expressed either
Line 103: Line 106:
 "stroke-dasharray":"5 5 10 3 2 8" "stroke-dasharray":"5 5 10 3 2 8"
 </code> </code>
-  * shape : ''"a2s:type":"shapename"'' where shapename is one of ''cloud'', ''computer'', ''diamond'', ''document'', ''storage'', ''printer''. Examples<code>a2s:type:cloud +  * shape : ''"a2s:type":"shapename"'' where shapename is one of ''cloud'', ''computer'', ''diamond'', ''document'', ''storage'', ''printer''. Examples<code>"a2s:type":"cloud" 
-a2s:type:storage+"a2s:type":"storage
 +</code> 
 +  * link : ''"a2s:link":"//linktext//"'' where //linktext// is either an internal wiki link, an [[doku>interwiki|interwiki link]], or a classic //%%protocol://server/resource%%// link. Since SVG can be included in ODT and PDF file, a2s does not obey the [[doku>config:canonical|canonical]] setting and always generate absolute links. Since neither libreoffice nor [[doku>plugin:dw2pdf|dw2pdf]] use this link, this seems rather useless and may change in the future.\\ Examples:<code> 
 +"a2s:link":"[[.:]]" 
 +"a2s:link":"[[:start]]" 
 +"a2s:link":"[[:start|The start page]]" 
 +"a2s:link":"[[doku>interwiki|interwiki link]] 
 +"a2s:link":"https://github.com/schplurtz/a2s" 
 +"a2s:link":"ftp://ftp.debian.org/debian/README"
 </code> </code>
   * identifier removal. By default the id is left in the image. This is useful when you have enough room to use a meaningful word as id. However, it is possible to remove it using this code <code>"a2s:delref":true</code>   * identifier removal. By default the id is left in the image. This is useful when you have enough room to use a meaningful word as id. However, it is possible to remove it using this code <code>"a2s:delref":true</code>
  
 here is a full example example : here is a full example example :
-<code>[0]: {"fill":"#d48","stroke":"#F50078","stroke-dasharray":"5 5","stroke-width":4,"a2s:type":"cloud","a2s:delref":true}</code>+<code>[0]: {"fill":"#d48","stroke":"#F50078","stroke-dasharray":"5 5","stroke-width":4,"a2s:type":"cloud","a2s:delref":true,"a2s:link":"https://github.com/schplurtz/a2s"}</code>
  
 ==== Alignment ==== ==== Alignment ====
Line 248: Line 259:
 {{http://imageshack.com/a/img922/5582/l6VrcE.png}} {{http://imageshack.com/a/img922/5582/l6VrcE.png}}
 <code> <code>
-<a2s+<a2s>
 .---------------------------.   .----------. .---------------------------.   .----------.
 |[storage]                  |   |[document]| |[storage]                  |   |[document]|
Line 277: Line 288:
 </a2s> </a2s>
 </code> </code>
- 
  
 ===== Configuration and Settings ===== ===== Configuration and Settings =====
Line 294: Line 304:
  
 :?: When I export to pdf with [[dw2pdf]], the arrowheads on line are not drawn, and alignment is not respected. Can you/I do something about that ?\\ :?: When I export to pdf with [[dw2pdf]], the arrowheads on line are not drawn, and alignment is not respected. Can you/I do something about that ?\\
-:!: NO. As of 2017/07/27, unless you are the a developer of dw2pdf or mpdf, its PDF library, there is nothing to do. Sorry. +:!: No. As of 2017/07/27, unless you are the a developer of dw2pdf or mpdf, its PDF library, there is nothing to do. Sorry.
  
 +:?: Is it possible to alter the line color using css or a configuration value? under the bootstrap / bootswatch / cyborg theme which is dark the lines are black on a black background.
 +For now I've just worked around it using the following in a less css file to alter the background color
 +<code>
 +&.cyborg {
 +  svg.a2s {
 +    background-color:#303030;
 +  }
 +}
 +</code>
plugin/a2s.1501120905.txt.gz · Last modified: 2017-07-27 04:01 by schplurtz

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki