asciidiagram 1.3 → 1.3.1
raw patch · 14 files changed
+127/−108 lines, 14 files
Files
- asciidiagram.cabal +3/−3
- changelog +0/−32
- changelog.md +42/−0
- docimages/arrows.svg +8/−8
- docimages/baseExample.svg +6/−6
- docimages/bulletTest.svg +4/−4
- docimages/cabalSchema.svg +6/−6
- docimages/dashed_lines.svg +3/−3
- docimages/dashingClosed.svg +3/−3
- docimages/deepStyleExample.svg +18/−18
- docimages/styleExample.svg +11/−11
- src/Text/AsciiDiagram.hs +11/−5
- src/Text/AsciiDiagram/Geometry.hs +1/−1
- src/Text/AsciiDiagram/SvgRender.hs +11/−8
asciidiagram.cabal view
@@ -1,7 +1,7 @@ -- Initial hitaa.cabal generated by cabal init. For further documentation, -- see http://haskell.org/cabal/users-guide/ name: asciidiagram-version: 1.3+version: 1.3.1 synopsis: Pretty rendering of Ascii diagram into svg or png. description: Transform Ascii art diagram like this:@@ -29,7 +29,7 @@ -- copyright: category: Text, Diagram build-type: Simple-extra-source-files: changelog+extra-source-files: changelog.md extra-doc-files: docimages/*.svg cabal-version: >=1.10 @@ -40,7 +40,7 @@ Source-Repository this Type: git Location: git://github.com/Twinside/asciidiagram.git- Tag: v1.3+ Tag: v1.3.1 library ghc-options: -O2 -Wall
− changelog
@@ -1,32 +0,0 @@-Change log-==========--v1.2 February 2016-------------------- * Breaking change: DPI parameter on the rendering functions- * Fix: exposing grid size- * Fix: Bumped dependencies--v1.1.1.1 May 2015-------------------- * Fix: Bumping lens dependency--v1.1.1 May 2015------------------ * Fix: Removing some bad reconstructed shapes in presence of lines.- * Fix: Bumping rasterific-svg dependency.- * Fix: creating font cache in a temporary directory.- * Adding: PDF output.--v1.1 April 2015------------------ * Bump: svg-tree & rasterific-svg dependencies--v1.0 February 2015--------------------- * Initial version-
+ changelog.md view
@@ -0,0 +1,42 @@+Change log+==========++v1.3.1 March 2016+-----------------+ * Fix: CSS problems in case of bullet on closed shapes.+ * Fix: some documentation.++v1.3 March 2016+---------------+ * Added: Hierachisation of shapes in shapes and text.+ * Added: shape transformation using CSS.++v1.2 February 2016+------------------+ * Breaking change: DPI parameter on the rendering functions+ * Fix: exposing grid size+ * Fix: Bumped dependencies++v1.1.1.1 May 2015+-----------------++ * Fix: Bumping lens dependency++v1.1.1 May 2015+---------------++ * Fix: Removing some bad reconstructed shapes in presence of lines.+ * Fix: Bumping rasterific-svg dependency.+ * Fix: creating font cache in a temporary directory.+ * Adding: PDF output.++v1.1 April 2015+---------------++ * Bump: svg-tree & rasterific-svg dependencies++v1.0 February 2015+------------------++ * Initial version+
docimages/arrows.svg view
@@ -48,20 +48,20 @@ </defs> <text x="85.5" y="77.5">< > v ^</text> <path class="line_element" d="M60.0,56.0 L60.0,56.0" /> - <g class="line_element"> - <path d="M60.0,56.0 L60.0,56.0 L20.0,56.0 L10.0,56.0" /> + <g> + <path class="line_element" d="M60.0,56.0 L60.0,56.0 L20.0,56.0 L10.0,56.0" /> <path class="arrow_head" d="M10.0,49.0 L0.0,56.0 L10.0,63.0 Z" /> </g> - <g class="line_element"> - <path d="M60.0,56.0 L60.0,56.0 L60.0,28.0 L60.0,14.0" /> + <g> + <path class="line_element" d="M60.0,56.0 L60.0,56.0 L60.0,28.0 L60.0,14.0" /> <path class="arrow_head" d="M55.0,14.0 L65.0,14.0 L60.0,0.0 Z" /> </g> - <g class="line_element"> - <path d="M60.0,56.0 L60.0,56.0 L100.0,56.0 L110.0,56.0" /> + <g> + <path class="line_element" d="M60.0,56.0 L60.0,56.0 L100.0,56.0 L110.0,56.0" /> <path class="arrow_head" d="M110.0,49.0 L120.0,56.0 L110.0,63.0 Z" /> </g> - <g class="line_element"> - <path d="M60.0,98.0 L60.0,98.0 L60.0,70.0 L60.0,56.0" /> + <g> + <path class="line_element" d="M60.0,98.0 L60.0,98.0 L60.0,70.0 L60.0,56.0" /> <path class="arrow_head" d="M55.0,98.0 L65.0,98.0 L60.0,112.0 Z" /> </g> </svg>
docimages/baseExample.svg view
@@ -49,21 +49,21 @@ <path class="filled_shape" d="m4.8122,13.97 4.779e-2,0.30672 0.13807,0.30272 0.22834,0.29872 0.31464,0.29344 0.40094,0.28944 0.48325,0.2828 0.56423,0.27744 0.64256,0.2708 0.71823,0.26416 0.79258,0.25752 0.86294,0.25096 0.9333,0.2416 0.99968,0.23496 1.0647,0.22568 1.1271,0.2164 1.1869,0.2084 1.2453,0.19784 1.301,0.1872 1.3555,0.17792 1.4046,0.16728 1.455,0.15536 1.5002,0.14336 1.5466,0.1328 1.5865,0.11952 1.6276,0.10752 1.6648,9.42e-2 1.7007,8.1e-2 1.7338,6.64e-2 1.7644,5.31e-2 1.7923,3.72e-2 1.8188,2.39e-2 1.8427,8.0e-3 c19.78,0.0 35.848,-2.6818 35.848,-5.9743" /> </symbol> </defs> - <g class="line_element"> - <path d="M160.0,42.0 L160.0,42.0 L120.0,42.0 L110.0,42.0" /> + <g> + <path class="line_element" d="M160.0,42.0 L160.0,42.0 L120.0,42.0 L110.0,42.0" /> <path class="arrow_head" d="M160.0,35.0 L170.0,42.0 L160.0,49.0 Z" /> </g> <path class="line_element" d="M200.0,70.0 L200.0,70.0" /> - <g class="line_element"> - <path class="dashed_elem" d="M200.0,70.0 L200.0,70.0 S200.0,84.0 190.0,84.0 L130.0,84.0 L120.0,84.0" /> + <g> + <path class="dashed_elem line_element" d="M200.0,70.0 L200.0,70.0 S200.0,84.0 190.0,84.0 L130.0,84.0 L120.0,84.0" /> <path class="arrow_head" d="M120.0,77.0 L110.0,84.0 L120.0,91.0 Z" /> </g> <g> <path class="filled_shape" d="M11.5,42.0 L11.5,42.0 L11.5,54.5 L100.0,54.5 L108.5,54.5 L108.5,42.0 L108.5,29.5 L20.0,29.5 L11.5,29.5 Z" /> <text x="35.5" y="49.5">ASCII </text> </g> - <g class="filled_shape"> - <path class="flat" d="M11.5,70.0 L11.5,70.0 S10.0,84.0 20.0,82.5 L40.0,82.5 L50.0,82.5 L100.0,82.5 S110.0,84.0 108.5,70.0 L108.5,70.0 L108.5,57.5 L20.0,57.5 L11.5,57.5 Z" /> + <g class="flat"> + <path class="filled_shape flat" d="M11.5,70.0 L11.5,70.0 S10.0,84.0 20.0,82.5 L40.0,82.5 L50.0,82.5 L100.0,82.5 S110.0,84.0 108.5,70.0 L108.5,70.0 L108.5,57.5 L20.0,57.5 L11.5,57.5 Z" /> <circle class="bullet" cx="50.0" cy="82.5" r="3.0" /> </g> <g>
docimages/bulletTest.svg view
@@ -47,14 +47,14 @@ </symbol> </defs> <text x="105.5" y="63.5">* * </text> - <g class="line_element"> - <path d="M150.0,56.0 L150.0,56.0 L150.0,42.0 L150.0,28.0 L110.0,28.0 L100.0,28.0" /> + <g> + <path class="line_element" d="M150.0,56.0 L150.0,56.0 L150.0,42.0 L150.0,28.0 L110.0,28.0 L100.0,28.0" /> <circle class="bullet" cx="150.0" cy="56.0" r="3.0" /> <circle class="bullet" cx="150.0" cy="28.0" r="3.0" /> <circle class="bullet" cx="100.0" cy="28.0" r="3.0" /> </g> - <g class="filled_shape"> - <path d="M31.5,28.0 L31.5,28.0 L31.5,40.5 L60.0,40.5 S70.0,42.0 68.5,28.0 L68.5,28.0 L68.5,15.5 L60.0,15.5 L50.0,15.5 L40.0,15.5 L31.5,15.5 Z" /> + <g> + <path class="filled_shape" d="M31.5,28.0 L31.5,28.0 L31.5,40.5 L60.0,40.5 S70.0,42.0 68.5,28.0 L68.5,28.0 L68.5,15.5 L60.0,15.5 L50.0,15.5 L40.0,15.5 L31.5,15.5 Z" /> <circle class="bullet" cx="68.5" cy="15.5" r="3.0" /> <circle class="bullet" cx="50.0" cy="15.5" r="3.0" /> <circle class="bullet" cx="31.5" cy="15.5" r="3.0" />
docimages/cabalSchema.svg view
@@ -46,21 +46,21 @@ <path class="filled_shape" d="m4.8122,13.97 4.779e-2,0.30672 0.13807,0.30272 0.22834,0.29872 0.31464,0.29344 0.40094,0.28944 0.48325,0.2828 0.56423,0.27744 0.64256,0.2708 0.71823,0.26416 0.79258,0.25752 0.86294,0.25096 0.9333,0.2416 0.99968,0.23496 1.0647,0.22568 1.1271,0.2164 1.1869,0.2084 1.2453,0.19784 1.301,0.1872 1.3555,0.17792 1.4046,0.16728 1.455,0.15536 1.5002,0.14336 1.5466,0.1328 1.5865,0.11952 1.6276,0.10752 1.6648,9.42e-2 1.7007,8.1e-2 1.7338,6.64e-2 1.7644,5.31e-2 1.7923,3.72e-2 1.8188,2.39e-2 1.8427,8.0e-3 c19.78,0.0 35.848,-2.6818 35.848,-5.9743" /> </symbol> </defs> - <g class="line_element"> - <path d="M160.0,42.0 L160.0,42.0 L120.0,42.0 L110.0,42.0" /> + <g> + <path class="line_element" d="M160.0,42.0 L160.0,42.0 L120.0,42.0 L110.0,42.0" /> <path class="arrow_head" d="M160.0,35.0 L170.0,42.0 L160.0,49.0 Z" /> </g> <path class="line_element" d="M200.0,70.0 L200.0,70.0" /> - <g class="line_element"> - <path class="dashed_elem" d="M200.0,70.0 L200.0,70.0 S200.0,84.0 190.0,84.0 L130.0,84.0 L120.0,84.0" /> + <g> + <path class="dashed_elem line_element" d="M200.0,70.0 L200.0,70.0 S200.0,84.0 190.0,84.0 L130.0,84.0 L120.0,84.0" /> <path class="arrow_head" d="M120.0,77.0 L110.0,84.0 L120.0,91.0 Z" /> </g> <g> <path class="filled_shape" d="M11.5,42.0 L11.5,42.0 L11.5,54.5 L100.0,54.5 L108.5,54.5 L108.5,42.0 L108.5,29.5 L20.0,29.5 L11.5,29.5 Z" /> <text x="35.5" y="49.5">ASCII </text> </g> - <g class="filled_shape"> - <path d="M11.5,70.0 L11.5,70.0 S10.0,84.0 20.0,82.5 L40.0,82.5 L50.0,82.5 L100.0,82.5 S110.0,84.0 108.5,70.0 L108.5,70.0 L108.5,57.5 L20.0,57.5 L11.5,57.5 Z" /> + <g> + <path class="filled_shape" d="M11.5,70.0 L11.5,70.0 S10.0,84.0 20.0,82.5 L40.0,82.5 L50.0,82.5 L100.0,82.5 S110.0,84.0 108.5,70.0 L108.5,70.0 L108.5,57.5 L20.0,57.5 L11.5,57.5 Z" /> <circle class="bullet" cx="50.0" cy="82.5" r="3.0" /> </g> <g>
docimages/dashed_lines.svg view
@@ -48,7 +48,7 @@ </defs> <path class="line_element" d="M20.0,112.0 L20.0,112.0 L20.0,56.0" /> <path class="line_element" d="M20.0,14.0 L60.0,14.0" /> - <path class="line_element dashed_elem" d="M70.0,112.0 L30.0,112.0 L20.0,112.0" /> - <path class="line_element dashed_elem" d="M40.0,28.0 L100.0,28.0" /> - <path class="line_element dashed_elem" d="M90.0,84.0 L60.0,84.0 S50.0,84.0 50.0,70.0 L50.0,56.0" /> + <path class="dashed_elem line_element" d="M70.0,112.0 L30.0,112.0 L20.0,112.0" /> + <path class="dashed_elem line_element" d="M40.0,28.0 L100.0,28.0" /> + <path class="dashed_elem line_element" d="M90.0,84.0 L60.0,84.0 S50.0,84.0 50.0,70.0 L50.0,56.0" /> </svg>
docimages/dashingClosed.svg view
@@ -47,7 +47,7 @@ </symbol> </defs> <rect class="filled_shape" width="27.0" height="25.0" x="31.5" y="15.5" /> - <rect class="filled_shape dashed_elem" width="27.0" height="25.0" x="91.5" y="15.5" /> - <rect class="filled_shape dashed_elem" width="27.0" height="25.0" x="151.5" y="15.5" /> - <rect class="filled_shape dashed_elem" width="27.0" height="25.0" x="211.5" y="15.5" /> + <rect class="dashed_elem filled_shape" width="27.0" height="25.0" x="91.5" y="15.5" /> + <rect class="dashed_elem filled_shape" width="27.0" height="25.0" x="151.5" y="15.5" /> + <rect class="dashed_elem filled_shape" width="27.0" height="25.0" x="211.5" y="15.5" /> </svg>
docimages/deepStyleExample.svg view
@@ -82,8 +82,8 @@ <text x="585.5" y="21.5">. </text> <text x="605.5" y="133.5">e0 </text> <text x="845.5" y="133.5">.</text> - <g class="line_element"> - <path d="M680.0,140.0 L680.0,140.0 L580.0,140.0 L570.0,140.0" /> + <g> + <path class="line_element" d="M680.0,140.0 L680.0,140.0 L580.0,140.0 L570.0,140.0" /> <path class="arrow_head" d="M680.0,133.0 L690.0,140.0 L680.0,147.0 Z" /> </g> <g class="li"> @@ -99,22 +99,22 @@ <text x="215.5" y="77.5">s2 </text> </g> <path class="line_element" d="M120.0,112.0 L120.0,112.0" /> - <g class="line_element"> - <path d="M120.0,112.0 L120.0,112.0 L210.0,112.0 S220.0,112.0 220.0,126.0 L220.0,126.0" /> + <g> + <path class="line_element" d="M120.0,112.0 L120.0,112.0 L210.0,112.0 S220.0,112.0 220.0,126.0 L220.0,126.0" /> <path class="arrow_head" d="M215.0,126.0 L225.0,126.0 L220.0,140.0 Z" /> </g> - <g class="line_element"> - <path d="M180.0,70.0 L180.0,70.0 L150.0,70.0 L140.0,70.0" /> + <g> + <path class="line_element" d="M180.0,70.0 L180.0,70.0 L150.0,70.0 L140.0,70.0" /> <path class="arrow_head" d="M180.0,63.0 L190.0,70.0 L180.0,77.0 Z" /> <circle class="bullet" cx="140.0" cy="70.0" r="3.0" /> </g> - <g class="line_element"> - <path d="M230.0,126.0 L230.0,126.0 L230.0,98.0 L230.0,84.0" /> + <g> + <path class="line_element" d="M230.0,126.0 L230.0,126.0 L230.0,98.0 L230.0,84.0" /> <path class="arrow_head" d="M225.0,126.0 L235.0,126.0 L230.0,140.0 Z" /> </g> <path class="line_element" d="M230.0,168.0 L230.0,168.0" /> - <g class="line_element"> - <path d="M230.0,168.0 L230.0,168.0 S230.0,182.0 220.0,182.0 L140.0,182.0 L130.0,182.0" /> + <g> + <path class="line_element" d="M230.0,168.0 L230.0,168.0 S230.0,182.0 220.0,182.0 L140.0,182.0 L130.0,182.0" /> <path class="arrow_head" d="M130.0,175.0 L120.0,182.0 L130.0,189.0 Z" /> </g> <path class="line_element" d="M360.0,140.0 L360.0,140.0" /> @@ -140,23 +140,23 @@ <text x="75.5" y="273.5">s20 </text> </g> <path class="line_element" d="M90.0,196.0 L90.0,196.0 L110.0,196.0 L120.0,196.0" /> - <g class="line_element"> - <path d="M90.0,238.0 L90.0,238.0 L90.0,210.0 L90.0,196.0" /> + <g> + <path class="line_element" d="M90.0,238.0 L90.0,238.0 L90.0,210.0 L90.0,196.0" /> <path class="arrow_head" d="M85.0,238.0 L95.0,238.0 L90.0,252.0 Z" /> </g> <path class="line_element" d="M120.0,196.0 L120.0,196.0 L320.0,196.0 L330.0,196.0" /> <path class="line_element" d="M330.0,196.0 L330.0,196.0" /> - <g class="line_element"> - <path d="M330.0,196.0 L330.0,196.0 L330.0,210.0 S330.0,224.0 340.0,224.0 L380.0,224.0 S390.0,224.0 390.0,210.0 L390.0,196.0 S390.0,182.0 380.0,182.0 L380.0,182.0 L370.0,182.0" /> + <g> + <path class="line_element" d="M330.0,196.0 L330.0,196.0 L330.0,210.0 S330.0,224.0 340.0,224.0 L380.0,224.0 S390.0,224.0 390.0,210.0 L390.0,196.0 S390.0,182.0 380.0,182.0 L380.0,182.0 L370.0,182.0" /> <path class="arrow_head" d="M370.0,175.0 L360.0,182.0 L370.0,189.0 Z" /> </g> <path class="line_element" d="M330.0,196.0 L330.0,196.0 L350.0,196.0 S360.0,196.0 360.0,182.0 L360.0,154.0 L360.0,140.0" /> - <g class="line_element"> - <path d="M360.0,70.0 L360.0,70.0 L430.0,70.0 L440.0,70.0" /> + <g> + <path class="line_element" d="M360.0,70.0 L360.0,70.0 L430.0,70.0 L440.0,70.0" /> <path class="arrow_head" d="M440.0,63.0 L450.0,70.0 L440.0,77.0 Z" /> </g> - <g class="line_element"> - <path d="M360.0,140.0 L360.0,140.0 L470.0,140.0 S480.0,140.0 480.0,126.0 L480.0,112.0 L480.0,98.0" /> + <g> + <path class="line_element" d="M360.0,140.0 L360.0,140.0 L470.0,140.0 S480.0,140.0 480.0,126.0 L480.0,112.0 L480.0,98.0" /> <path class="arrow_head" d="M475.0,98.0 L485.0,98.0 L480.0,84.0 Z" /> </g> <text x="25.5" y="35.5">s100 </text>
docimages/styleExample.svg view
@@ -1,5 +1,5 @@ <?xml version='1.0' ?> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="465.0" height="159.0"> +<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="605.0" height="159.0"> <style type="text/css">text { font-family: Consolas , "DejaVu Sans Mono" , monospace; font-size: 16.0px; @@ -26,10 +26,10 @@ fill: #000000; stroke: none; } -.src { +.src .filled_shape { fill: #AAAAFF; } -.dst { +.dst .filled_shape { stroke: #FFAAAA; stroke-width: 3.0px; } @@ -53,13 +53,13 @@ <path class="filled_shape" d="m4.8122,13.97 4.779e-2,0.30672 0.13807,0.30272 0.22834,0.29872 0.31464,0.29344 0.40094,0.28944 0.48325,0.2828 0.56423,0.27744 0.64256,0.2708 0.71823,0.26416 0.79258,0.25752 0.86294,0.25096 0.9333,0.2416 0.99968,0.23496 1.0647,0.22568 1.1271,0.2164 1.1869,0.2084 1.2453,0.19784 1.301,0.1872 1.3555,0.17792 1.4046,0.16728 1.455,0.15536 1.5002,0.14336 1.5466,0.1328 1.5865,0.11952 1.6276,0.10752 1.6648,9.42e-2 1.7007,8.1e-2 1.7338,6.64e-2 1.7644,5.31e-2 1.7923,3.72e-2 1.8188,2.39e-2 1.8427,8.0e-3 c19.78,0.0 35.848,-2.6818 35.848,-5.9743" /> </symbol> </defs> - <g class="line_element"> - <path d="M200.0,28.0 L200.0,28.0 L120.0,28.0 L110.0,28.0" /> + <g> + <path class="line_element" d="M200.0,28.0 L200.0,28.0 L120.0,28.0 L110.0,28.0" /> <path class="arrow_head" d="M200.0,21.0 L210.0,28.0 L200.0,35.0 Z" /> </g> <path class="line_element" d="M250.0,42.0 L250.0,42.0" /> - <g class="line_element"> - <path d="M250.0,42.0 L250.0,42.0 L250.0,56.0 S250.0,70.0 240.0,70.0 L230.0,70.0 L220.0,70.0" /> + <g> + <path class="line_element" d="M250.0,42.0 L250.0,42.0 L250.0,56.0 S250.0,70.0 240.0,70.0 L230.0,70.0 L220.0,70.0" /> <path class="arrow_head" d="M220.0,63.0 L210.0,70.0 L220.0,77.0 Z" /> </g> <g class="src"> @@ -70,13 +70,13 @@ <rect class="filled_shape dst" width="67.0" height="39.0" x="21.5" y="85.5" /> <text x="35.5" y="105.5">Dest </text> </g> - <g class="line_element"> - <path d="M120.0,84.0 L110.0,84.0 L100.0,84.0" /> + <g> + <path class="line_element" d="M120.0,84.0 L110.0,84.0 L100.0,84.0" /> <path class="arrow_head" d="M100.0,77.0 L90.0,84.0 L100.0,91.0 Z" /> </g> <g> - <g class="filled_shape"> - <path d="M131.5,84.0 L131.5,84.0 L131.5,96.5 L200.0,96.5 L208.5,96.5 L208.5,84.0 L208.5,71.5 L140.0,71.5 L131.5,71.5 Z" /> + <g> + <path class="filled_shape" d="M131.5,84.0 L131.5,84.0 L131.5,96.5 L200.0,96.5 L208.5,96.5 L208.5,84.0 L208.5,71.5 L140.0,71.5 L131.5,71.5 Z" /> <circle class="bullet" cx="208.5" cy="71.5" r="3.0" /> </g> <text x="145.5" y="91.5">op2 </text>
src/Text/AsciiDiagram.hs view
@@ -382,7 +382,9 @@ -- -- $linesdoc--- The basic syntax of asciidiagrams is made of lines made out\nof \'-\' and \'|\' characters. They can be connected with anchors\nlike \'+\' (direct connection) or \'\\\' and \'\/\' (smooth connections)\n+-- The basic syntax of asciidiagrams is made of lines made out+-- of \'-\' and \'|\' characters. They can be connected with anchors+-- like \'+\' (direct connection) or \'\\\' and \'\/\' (smooth connections) -- -- -- @@@ -397,7 +399,8 @@ -- @ -- <<docimages/simple_lines.svg>> -- --- You can use dashed lines by using ':' for vertical lines or '=' for\nhorizontal lines.+-- You can use dashed lines by using ':' for vertical lines or '=' for+-- horizontal line -- -- -- @@@ -412,7 +415,9 @@ -- @ -- <<docimages/dashed_lines.svg>> -- --- Arrows are made out of the \'\<\', \'\>\', \'^\' and \'v\'\ncharacters.\nIf the arrows are not connected to any lines, the text is left as is.\n+-- Arrows are made out of the \'\<\', \'\>\', \'^\' and \'v\'+-- characters.+-- If the arrows are not connected to any lines, the text is left as is. -- -- -- @@@ -423,6 +428,7 @@ -- | \< \> v ^ -- | -- v+-- -- @ -- <<docimages/arrows.svg>> -- @@ -509,8 +515,8 @@ -- |{dst} | -- +------+ -- --- ::: .src { fill: #AAF; }--- ::: .dst { stroke: #FAA; stroke-width: 3px; }+-- ::: .src .filled_shape { fill: #AAF; }+-- ::: .dst .filled_shape { stroke: #FAA; stroke-width: 3px; } -- @ -- <<docimages/styleExample.svg>> --
src/Text/AsciiDiagram/Geometry.hs view
@@ -119,7 +119,7 @@ , shapeIsClosed :: !Bool -- | Tags "{tagname}" placed inside the shape. , shapeTags :: !(S.Set T.Text)-+ -- | List of eleents contained in this shape , shapeChildren :: ![Element] } deriving (Eq, Ord, Show)
src/Text/AsciiDiagram/SvgRender.hs view
@@ -1,5 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RankNTypes #-} module Text.AsciiDiagram.SvgRender ( GridSize( .. ) , defaultGridSize@@ -344,8 +345,9 @@ classSet shape e = e & drawAttr . attrClass %~ (++ S.toList (shapeTags shape)) -shapeToTree :: GridSize -> Shape -> Svg.Tree-shapeToTree gscale shape@Shape+shapeToTree :: (forall a. (Svg.WithDrawAttributes a) => a -> a)+ -> GridSize -> Shape -> Svg.Tree+shapeToTree classSetter gscale shape@Shape { shapeIsClosed = True , shapeElements = [ ShapeSegment _@@ -359,6 +361,7 @@ } = classSet shape . dashingSet shape . Svg.RectangleTree+ . classSetter $ Svg.defaultSvg { Svg._rectWidth = Svg.Num sWidth , Svg._rectHeight = Svg.Num sHeight@@ -374,12 +377,11 @@ pt@(V2 px py) = toSvg gscale mini ^+^ contractionVector V2 sWidth sHeight = maxiPoint ^-^ pt ---shapeToTree gscale shape =+shapeToTree classSetter gscale shape = case concat arrows of [] -> svgPath- lst -> Svg.GroupTree $ Svg.defaultSvg { Svg._groupChildren = svgPath : lst }+ lst -> Svg.GroupTree . classSet shape+ $ Svg.defaultSvg { Svg._groupChildren = svgPath : lst } where toS = toSvg gscale shapeElems = associateNextPoint (shapeIsClosed shape)@@ -387,6 +389,7 @@ $ rollToSegment shape svgPath = classSet shape . dashingSet shape . Svg.PathTree+ . classSetter $ Svg.Path mempty pathCommands pathCommands =@@ -444,9 +447,9 @@ svgOfShape :: GridSize -> Shape -> Svg.Tree svgOfShape scale shape | shapeIsClosed shape =- applyDefaultShapeDrawAttr $ shapeToTree scale shape+ shapeToTree applyDefaultShapeDrawAttr scale shape | otherwise =- applyDefaultLineDrawAttr $ shapeToTree strokeScale shape+ shapeToTree applyDefaultLineDrawAttr strokeScale shape where strokeScale = scale { _gridShapeContraction = 0 }