[blockdiag] 18/29: Import Upstream version 1.4.5

Andreas Tille tille at debian.org
Tue Jan 10 21:35:59 UTC 2017


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository blockdiag.

commit dd30e522c026fd9aec9aa41441fdf8f68c760d68
Author: Andreas Tille <tille at debian.org>
Date:   Tue Jan 10 11:08:05 2017 +0100

    Import Upstream version 1.4.5
---
 README.rst => CHANGES.rst                          | 134 +------
 MANIFEST.in                                        |   2 +-
 PKG-INFO                                           | 429 +--------------------
 README.rst                                         | 427 --------------------
 src/blockdiag.egg-info/PKG-INFO                    | 429 +--------------------
 src/blockdiag.egg-info/SOURCES.txt                 |   1 +
 src/blockdiag/__init__.py                          |   2 +-
 src/blockdiag/builder.py                           |  22 +-
 src/blockdiag/elements.py                          |  11 +-
 src/blockdiag/plugins/__init__.py                  |   4 +
 .../tests/rst/test_blockdiag_directives.py         |  32 +-
 src/blockdiag/tests/test_generate_diagram.py       |  20 +
 src/blockdiag/utils/bootstrap.py                   |  11 +-
 src/blockdiag/utils/compat.py                      |  11 +
 src/blockdiag/utils/images.py                      |   8 +-
 src/blockdiag/utils/rst/directives.py              |   5 +-
 16 files changed, 121 insertions(+), 1427 deletions(-)

diff --git a/README.rst b/CHANGES.rst
similarity index 74%
copy from README.rst
copy to CHANGES.rst
index c21bc23..a6b1319 100644
--- a/README.rst
+++ b/CHANGES.rst
@@ -1,126 +1,20 @@
-`blockdiag` generate block-diagram image file from spec-text file.
-
-.. image:: https://drone.io/bitbucket.org/blockdiag/blockdiag/status.png
-   :target: https://drone.io/bitbucket.org/blockdiag/blockdiag
-   :alt: drone.io CI build status
-
-.. image:: https://pypip.in/v/blockdiag/badge.png
-   :target: https://pypi.python.org/pypi/blockdiag/
-   :alt: Latest PyPI version
-
-.. image:: https://pypip.in/d/blockdiag/badge.png
-   :target: https://pypi.python.org/pypi/blockdiag/
-   :alt: Number of PyPI downloads
-
-
-Features
-========
-* Generate block-diagram from dot like text (basic feature).
-* Multilingualization for node-label (utf-8 only).
-
-You can get some examples and generated images on
-`blockdiag.com <http://blockdiag.com/blockdiag/build/html/index.html>`_ .
-
-Setup
-=====
-
-Use easy_install or pip::
-
-   $ sudo easy_install blockdiag
-
-   Or
-
-   $ sudo pip install blockdiag
-
-If you want to export as PDF format, give pdf arguments::
-
-   $ sudo easy_install "blockdiag[pdf]"
-
-
-Copy and modify ini file. example::
-
-   $ cp <blockdiag installed path>/blockdiag/examples/simple.diag .
-   $ vi simple.diag
-
-Please refer to `spec-text setting sample`_ section for the format of the
-`simpla.diag` configuration file.
-
-spec-text setting sample
-========================
-Few examples are available.
-You can get more examples at
-`blockdiag.com`_ .
-
-simple.diag
-------------
-simple.diag is simply define nodes and transitions by dot-like text format::
-
-    diagram admin {
-      top_page -> config -> config_edit -> config_confirm -> top_page;
-    }
-
-screen.diag
-------------
-screen.diag is more complexly sample. diaglam nodes have a alternative label
-and some transitions::
-
-    diagram admin {
-      top_page [label = "Top page"];
-
-      foo_index [label = "List of FOOs"];
-      foo_detail [label = "Detail FOO"];
-      foo_add [label = "Add FOO"];
-      foo_add_confirm [label = "Add FOO (confirm)"];
-      foo_edit [label = "Edit FOO"];
-      foo_edit_confirm [label = "Edit FOO (confirm)"];
-      foo_delete_confirm [label = "Delete FOO (confirm)"];
-
-      bar_detail [label = "Detail of BAR"];
-      bar_edit [label = "Edit BAR"];
-      bar_edit_confirm [label = "Edit BAR (confirm)"];
-
-      logout;
-
-      top_page -> foo_index;
-      top_page -> bar_detail;
-
-      foo_index -> foo_detail;
-                   foo_detail -> foo_edit;
-                   foo_detail -> foo_delete_confirm;
-      foo_index -> foo_add -> foo_add_confirm -> foo_index;
-      foo_index -> foo_edit -> foo_edit_confirm -> foo_index;
-      foo_index -> foo_delete_confirm -> foo_index;
-
-      bar_detail -> bar_edit -> bar_edit_confirm -> bar_detail;
-    }
-
-
-Usage
-=====
-Execute blockdiag command::
-
-   $ blockdiag simple.diag
-   $ ls simple.png
-   simple.png
-
-
-Requirements
-============
-* Python 2.6, 2.7, 3.2, 3.3, 3.4
-* Pillow 2.2.1 or later
-* funcparserlib 0.3.6 or later
-* reportlab (optional)
-* wand and imagemagick (optional)
-* setuptools
+Changelog
+=========
 
+1.4.5 (2014-10-04)
+------------------
+* Add node event: build_finished
+* Take config object to plugins
+* Fix bugs
 
-License
-=======
-Apache License 2.0
+  - Fix utils.images.get_image_size() does not close an image descriptor
 
+1.4.4 (2014-09-20)
+------------------
+* :caption: option of blockdiag directive recognizes inline markups
+* Fix bugs
 
-History
-=======
+  - Fix #58 failed to handle diagram definitions from stdin in py3
 
 1.4.3 (2014-07-30)
 ------------------
@@ -130,7 +24,6 @@ History
 
   - PNG: could not load png imagedrawer if could not access PIL.PILLOW_VERSION
 
-
 1.4.2 (2014-07-12)
 ------------------
 * SVG: Adjust text alignment precisely
@@ -543,4 +436,3 @@ History
 0.1 (2010-09-20)
 -----------------
 * first release
-
diff --git a/MANIFEST.in b/MANIFEST.in
index a08e362..01212f6 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,7 +1,7 @@
 include buildout.cfg
 include bootstrap.py
+include CHANGES.rst
 include MANIFEST.in
-include README.rst
 include LICENSE
 include blockdiag.1
 include tox.ini
diff --git a/PKG-INFO b/PKG-INFO
index 7358389..850da76 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: blockdiag
-Version: 1.4.3
+Version: 1.4.5
 Summary: blockdiag generates block-diagram image from text
 Home-page: http://blockdiag.com/
 Author: Takeshi Komiya
@@ -127,433 +127,6 @@ Description: `blockdiag` generate block-diagram image file from spec-text file.
         =======
         Apache License 2.0
         
-        
-        History
-        =======
-        
-        1.4.3 (2014-07-30)
-        ------------------
-        * Show warnings on loading imagedrawers in debug mode
-        * ImageDraw#image() accepts Image objects
-        * Fix bugs
-        
-          - PNG: could not load png imagedrawer if could not access PIL.PILLOW_VERSION
-        
-        
-        1.4.2 (2014-07-12)
-        ------------------
-        * SVG: Adjust text alignment precisely
-        * Add plugin events: node.changing and cleanup
-        * ImageDraw#image() accepts image from IO objects
-        * Fix bugs
-        
-          - PDF: Fix failure text rotating
-          - PDF: Fix failure pasting PNG images (256 palette/transparency)
-          - PNG: Fix background of node was transparent on pasting transparent images
-        
-        1.4.1 (2014-07-02)
-        ------------------
-        * Change interface of docutils node (for sphinxcontrib module)
-        * Fix bugs
-        
-        1.4.0 (2014-06-23)
-        ------------------
-        * Support embedding SVG/EPS images as background
-        * Use wand to paste background images that is not supported by Pillow (if installed)
-        * Add options to blockdiag directive (docutils extension)
-        
-          - \:width:
-          - \:height:
-          - \:scale:
-          - \:align:
-          - \:name:
-          - \:class:
-          - \:figwidth:
-          - \:figclass:
-        
-        * actor shape supports label rendering
-        
-        1.3.3 (2014-04-26)
-        ------------------
-        * Add diagram attribute: default_node_style
-        * Fix bugs
-        
-        1.3.2 (2013-11-19)
-        ------------------
-        * Fix bugs
-        
-        1.3.1 (2013-10-22)
-        ------------------
-        * Fix bugs
-        
-        1.3.0 (2013-10-05)
-        ------------------
-        * Support python 3.2 and 3.3 (thanks to @masayuko)
-        * Drop supports for python 2.4 and 2.5
-        * Replace dependency: PIL -> Pillow
-        
-        1.2.4 (2012-11-21)
-        ------------------
-        * Fix bugs
-        
-        1.2.3 (2012-11-05)
-        ------------------
-        * Fix bugs
-        
-        1.2.2 (2012-10-28)
-        ------------------
-        * Fix bugs
-        
-        1.2.1 (2012-10-28)
-        ------------------
-        * Add external imagedraw plugin supports
-        * Add node attribute: label_orientation*
-        * Fix bugs
-        
-        1.2.0 (2012-10-22)
-        ------------------
-        * Optimize algorithm for rendering shadow
-        * Add options to docutils directive
-        * Fix bugs
-        
-        1.1.8 (2012-09-28)
-        ------------------
-        * Add --ignore-pil option
-        * Fix bugs
-        
-        1.1.7 (2012-09-20)
-        ------------------
-        * Add diagram attribute: shadow_style
-        * Add font path for centos 6.2
-        * Add a setting 'antialias' in the configuration file
-        * Fix bugs
-        
-        1.1.6 (2012-06-06)
-        ------------------
-        * Support for readthedocs.org
-        * reST directive supports :caption: option
-        * Fix bugs
-        
-        1.1.5 (2012-04-22)
-        ------------------
-        * Embed source code to SVG document as description
-        * Fix bugs
-        
-        1.1.4 (2012-03-15)
-        ------------------
-        * Add new edge.hstyles: oneone, onemany, manyone, manymany
-        * Add edge attribute: description (for build description-tables)
-        * Fix bugs
-        
-        1.1.3 (2012-02-13)
-        ------------------
-        * Add new edge type for data-models (thanks to David Lang)
-        * Add --no-transparency option
-        * Fix bugs
-        
-        1.1.2 (2011-12-26)
-        ------------------
-        * Support font-index for TrueType Font Collections (.ttc file)
-        * Allow to use reST syntax in descriptions of nodes
-        * Fix bugs
-        
-        1.1.1 (2011-11-27)
-        ------------------
-        * Add node attribute: href (thanks to @r_rudi!)
-        * Fix bugs
-        
-        1.1.0 (2011-11-19)
-        ------------------
-        * Add shape: square and circle
-        * Add fontfamily attribute for switching fontface
-        * Fix bugs
-        
-        1.0.3 (2011-11-13)
-        ------------------
-        * Add plugin: attributes
-        * Change plugin syntax; (cf. plugin attributes [attr = value, attr, value])
-        * Fix bugs
-        
-        1.0.2 (2011-11-07)
-        ------------------
-        * Fix bugs
-        
-        1.0.1 (2011-11-06)
-        ------------------
-        * Add group attribute: shape
-        * Fix bugs
-        
-        1.0.0 (2011-11-04)
-        ------------------
-        * Add node attribute: linecolor
-        * Rename diagram attributes:
-           * fontsize -> default_fontsize
-           * default_line_color -> default_linecolor
-           * default_text_color -> default_textcolor
-        * Add docutils extention
-        * Fix bugs
-        
-        0.9.7 (2011-11-01)
-        ------------------
-        * Add node attribute: fontsize
-        * Add edge attributes: thick, fontsize
-        * Add group attribute: fontsize
-        * Change color of shadow in PDF mode
-        * Add class feature (experimental)
-        * Add handler-plugin framework (experimental)
-        
-        0.9.6 (2011-10-22)
-        ------------------
-        * node.style supports dashed_array format style
-        * Fix bugs
-        
-        0.9.5 (2011-10-19)
-        ------------------
-        * Add node attributes: width and height
-        * Fix bugs
-        
-        0.9.4 (2011-10-07)
-        ------------------
-        * Fix bugs
-        
-        0.9.3 (2011-10-06)
-        ------------------
-        * Replace SVG core by original's (simplesvg.py)
-        * Refactored
-        * Fix bugs
-        
-        0.9.2 (2011-09-30)
-        ------------------
-        * Add node attribute: textcolor
-        * Add group attribute: textcolor
-        * Add edge attribute: textcolor
-        * Add diagram attributes: default_text_attribute
-        * Fix beginpoint shape and endpoint shape were reversed
-        * Fix bugs
-        
-        0.9.1 (2011-09-26)
-        ------------------
-        * Add diagram attributes: default_node_color, default_group_color and default_line_color
-        * Fix bugs
-        
-        0.9.0 (2011-09-25)
-        ------------------
-        * Add icon attribute to node
-        * Make transparency to background of PNG images
-        * Fix bugs
-        
-        0.8.9 (2011-08-09)
-        ------------------
-        * Fix bugs
-        
-        0.8.8 (2011-08-08)
-        ------------------
-        * Fix bugs
-        
-        0.8.7 (2011-08-06)
-        ------------------
-        * Fix bugs
-        
-        0.8.6 (2011-08-01)
-        ------------------
-        * Support Pillow as replacement of PIL (experimental)
-        * Fix bugs
-        
-        0.8.5 (2011-07-31)
-        ------------------
-        * Allow dot characters in node_id
-        * Fix bugs
-        
-        0.8.4 (2011-07-05)
-        ------------------
-        * Fix bugs
-        
-        0.8.3 (2011-07-03)
-        ------------------
-        * Support input from stdin
-        * Fix bugs
-        
-        0.8.2 (2011-06-29)
-        ------------------
-        * Add node.stacked
-        * Add node shapes: dots, none
-        * Add hiragino-font to font search list
-        * Support background image fetching from web
-        * Add diagram.edge_layout (experimental)
-        * Fix bugs
-        
-        0.8.1 (2011-05-14)
-        ------------------
-        * Change license to Apache License 2.0
-        * Fix bugs
-        
-        0.8.0 (2011-05-04)
-        ------------------
-        * Add --separate option and --version option
-        * Fix bugs
-        
-        0.7.8 (2011-04-19)
-        ------------------
-        * Update layout engine
-        * Update requirements: PIL >= 1.1.5
-        * Update parser for tokenize performance
-        * Add --nodoctype option
-        * Fix bugs
-        * Add many testcases
-        
-        0.7.7 (2011-03-29)
-        ------------------
-        * Fix bugs
-        
-        0.7.6 (2011-03-26)
-        ------------------
-        * Add new layout manager for portrait edges
-        * Fix bugs
-        
-        0.7.5 (2011-03-20)
-        ------------------
-        * Support multiple nodes relations (cf. A -> B, C)
-        * Support node group declaration at attribute of nodes
-        * Fix bugs
-        
-        0.7.4 (2011-03-08)
-        ------------------
-        * Fix bugs
-        
-        0.7.3 (2011-03-02)
-        ------------------
-        * Use UTF-8 characters as Name token (by @swtw7466)
-        * Fix htmlentities included in labels was not escaped on SVG images
-        * Fix bugs
-        
-        0.7.2 (2011-02-28)
-        ------------------
-        * Add default_shape attribute to diagram
-        
-        0.7.1 (2011-02-27)
-        ------------------
-        * Fix edge has broken with antialias option
-        
-        0.7.0 (2011-02-25)
-        ------------------
-        * Support node shape
-        
-        0.6.7 (2011-02-12)
-        ------------------
-        * Change noderenderer interface to new style
-        * Render dashed ellipse more clearly (contributed by @cocoatomo)
-        * Support PDF exporting
-        
-        0.6.6 (2011-01-31)
-        ------------------
-        * Support diagram.shape_namespace
-        * Add new node shapes; mail, cloud, beginpoint, endpoint, minidiamond, actor
-        * Support plug-in structure to install node shapes
-        * Fix bugs
-        
-        0.6.5 (2011-01-18)
-        ------------------
-        * Support node shape (experimental)
-        
-        0.6.4 (2011-01-17)
-        ------------------
-        * Fix bugs
-        
-        0.6.3 (2011-01-15)
-        ------------------
-        * Fix bugs
-        
-        0.6.2 (2011-01-08)
-        ------------------
-        * Fix bugs
-        
-        0.6.1 (2011-01-07)
-        ------------------
-        * Implement 'folded' attribute for edge
-        * Refactor layout engine
-        
-        0.6 (2011-01-02)
-        ------------------
-        * Support nested groups.
-        
-        0.5.5 (2010-12-24)
-        ------------------
-        * Specify direction of edges as syntax (->, --, <-, <->)
-        * Fix bugs.
-        
-        0.5.4 (2010-12-23)
-        ------------------
-        * Remove debug codes.
-        
-        0.5.3 (2010-12-23)
-        ------------------
-        * Support NodeGroup.label.
-        * Implement --separate option (experimental)
-        * Fix right-up edge overrapped on other nodes.
-        * Support configration file: .blockdiagrc
-        
-        0.5.2 (2010-11-06)
-        ------------------
-        * Fix unicode errors for UTF-8'ed SVG exportion.
-        * Refactoring codes for running on GAE.
-        
-        0.5.1 (2010-10-26)
-        ------------------
-        * Fix license text on diagparser.py
-        * Update layout engine.
-        
-        0.5 (2010-10-15)
-        ------------------
-        * Support background-image of node (SVG)
-        * Support labels for edge.
-        * Fix bugs.
-        
-        0.4.2 (2010-10-10)
-        ------------------
-        * Support background-color of node groups.
-        * Draw edge has jumped at edge's cross-points.
-        * Fix bugs.
-        
-        0.4.1 (2010-10-07)
-        ------------------
-        * Fix bugs.
-        
-        0.4 (2010-10-07)
-        ------------------
-        * Support SVG exporting.
-        * Support dashed edge drawing.
-        * Support background image of nodes (PNG only)
-        
-        0.3.1 (2010-09-29)
-        ------------------
-        * Fasten anti-alias process.
-        * Fix text was broken on windows.
-        
-        0.3 (2010-09-26)
-        ------------------
-        * Add --antialias option.
-        * Fix bugs.
-        
-        0.2.2 (2010-09-25)
-        ------------------
-        * Fix edge bugs.
-        
-        0.2.1 (2010-09-25)
-        ------------------
-        * Fix bugs.
-        * Fix package style.
-        
-        0.2 (2010-09-23)
-        ------------------
-        * Update layout engine.
-        * Support group { ... } sentence for create Node-Groups.
-        * Support numbered badge on node (cf. A [numbered = 5])
-        
-        0.1 (2010-09-20)
-        -----------------
-        * first release
-        
-        
 Keywords: diagram,generator
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
diff --git a/README.rst b/README.rst
index c21bc23..541a2d3 100644
--- a/README.rst
+++ b/README.rst
@@ -117,430 +117,3 @@ Requirements
 License
 =======
 Apache License 2.0
-
-
-History
-=======
-
-1.4.3 (2014-07-30)
-------------------
-* Show warnings on loading imagedrawers in debug mode
-* ImageDraw#image() accepts Image objects
-* Fix bugs
-
-  - PNG: could not load png imagedrawer if could not access PIL.PILLOW_VERSION
-
-
-1.4.2 (2014-07-12)
-------------------
-* SVG: Adjust text alignment precisely
-* Add plugin events: node.changing and cleanup
-* ImageDraw#image() accepts image from IO objects
-* Fix bugs
-
-  - PDF: Fix failure text rotating
-  - PDF: Fix failure pasting PNG images (256 palette/transparency)
-  - PNG: Fix background of node was transparent on pasting transparent images
-
-1.4.1 (2014-07-02)
-------------------
-* Change interface of docutils node (for sphinxcontrib module)
-* Fix bugs
-
-1.4.0 (2014-06-23)
-------------------
-* Support embedding SVG/EPS images as background
-* Use wand to paste background images that is not supported by Pillow (if installed)
-* Add options to blockdiag directive (docutils extension)
-
-  - \:width:
-  - \:height:
-  - \:scale:
-  - \:align:
-  - \:name:
-  - \:class:
-  - \:figwidth:
-  - \:figclass:
-
-* actor shape supports label rendering
-
-1.3.3 (2014-04-26)
-------------------
-* Add diagram attribute: default_node_style
-* Fix bugs
-
-1.3.2 (2013-11-19)
-------------------
-* Fix bugs
-
-1.3.1 (2013-10-22)
-------------------
-* Fix bugs
-
-1.3.0 (2013-10-05)
-------------------
-* Support python 3.2 and 3.3 (thanks to @masayuko)
-* Drop supports for python 2.4 and 2.5
-* Replace dependency: PIL -> Pillow
-
-1.2.4 (2012-11-21)
-------------------
-* Fix bugs
-
-1.2.3 (2012-11-05)
-------------------
-* Fix bugs
-
-1.2.2 (2012-10-28)
-------------------
-* Fix bugs
-
-1.2.1 (2012-10-28)
-------------------
-* Add external imagedraw plugin supports
-* Add node attribute: label_orientation*
-* Fix bugs
-
-1.2.0 (2012-10-22)
-------------------
-* Optimize algorithm for rendering shadow
-* Add options to docutils directive
-* Fix bugs
-
-1.1.8 (2012-09-28)
-------------------
-* Add --ignore-pil option
-* Fix bugs
-
-1.1.7 (2012-09-20)
-------------------
-* Add diagram attribute: shadow_style
-* Add font path for centos 6.2
-* Add a setting 'antialias' in the configuration file
-* Fix bugs
-
-1.1.6 (2012-06-06)
-------------------
-* Support for readthedocs.org
-* reST directive supports :caption: option
-* Fix bugs
-
-1.1.5 (2012-04-22)
-------------------
-* Embed source code to SVG document as description
-* Fix bugs
-
-1.1.4 (2012-03-15)
-------------------
-* Add new edge.hstyles: oneone, onemany, manyone, manymany
-* Add edge attribute: description (for build description-tables)
-* Fix bugs
-
-1.1.3 (2012-02-13)
-------------------
-* Add new edge type for data-models (thanks to David Lang)
-* Add --no-transparency option
-* Fix bugs
-
-1.1.2 (2011-12-26)
-------------------
-* Support font-index for TrueType Font Collections (.ttc file)
-* Allow to use reST syntax in descriptions of nodes
-* Fix bugs
-
-1.1.1 (2011-11-27)
-------------------
-* Add node attribute: href (thanks to @r_rudi!)
-* Fix bugs
-
-1.1.0 (2011-11-19)
-------------------
-* Add shape: square and circle
-* Add fontfamily attribute for switching fontface
-* Fix bugs
-
-1.0.3 (2011-11-13)
-------------------
-* Add plugin: attributes
-* Change plugin syntax; (cf. plugin attributes [attr = value, attr, value])
-* Fix bugs
-
-1.0.2 (2011-11-07)
-------------------
-* Fix bugs
-
-1.0.1 (2011-11-06)
-------------------
-* Add group attribute: shape
-* Fix bugs
-
-1.0.0 (2011-11-04)
-------------------
-* Add node attribute: linecolor
-* Rename diagram attributes:
-   * fontsize -> default_fontsize
-   * default_line_color -> default_linecolor
-   * default_text_color -> default_textcolor
-* Add docutils extention
-* Fix bugs
-
-0.9.7 (2011-11-01)
-------------------
-* Add node attribute: fontsize
-* Add edge attributes: thick, fontsize
-* Add group attribute: fontsize
-* Change color of shadow in PDF mode
-* Add class feature (experimental)
-* Add handler-plugin framework (experimental)
-
-0.9.6 (2011-10-22)
-------------------
-* node.style supports dashed_array format style
-* Fix bugs
-
-0.9.5 (2011-10-19)
-------------------
-* Add node attributes: width and height
-* Fix bugs
-
-0.9.4 (2011-10-07)
-------------------
-* Fix bugs
-
-0.9.3 (2011-10-06)
-------------------
-* Replace SVG core by original's (simplesvg.py)
-* Refactored
-* Fix bugs
-
-0.9.2 (2011-09-30)
-------------------
-* Add node attribute: textcolor
-* Add group attribute: textcolor
-* Add edge attribute: textcolor
-* Add diagram attributes: default_text_attribute
-* Fix beginpoint shape and endpoint shape were reversed
-* Fix bugs
-
-0.9.1 (2011-09-26)
-------------------
-* Add diagram attributes: default_node_color, default_group_color and default_line_color
-* Fix bugs
-
-0.9.0 (2011-09-25)
-------------------
-* Add icon attribute to node
-* Make transparency to background of PNG images
-* Fix bugs
-
-0.8.9 (2011-08-09)
-------------------
-* Fix bugs
-
-0.8.8 (2011-08-08)
-------------------
-* Fix bugs
-
-0.8.7 (2011-08-06)
-------------------
-* Fix bugs
-
-0.8.6 (2011-08-01)
-------------------
-* Support Pillow as replacement of PIL (experimental)
-* Fix bugs
-
-0.8.5 (2011-07-31)
-------------------
-* Allow dot characters in node_id
-* Fix bugs
-
-0.8.4 (2011-07-05)
-------------------
-* Fix bugs
-
-0.8.3 (2011-07-03)
-------------------
-* Support input from stdin
-* Fix bugs
-
-0.8.2 (2011-06-29)
-------------------
-* Add node.stacked
-* Add node shapes: dots, none
-* Add hiragino-font to font search list
-* Support background image fetching from web
-* Add diagram.edge_layout (experimental)
-* Fix bugs
-
-0.8.1 (2011-05-14)
-------------------
-* Change license to Apache License 2.0
-* Fix bugs
-
-0.8.0 (2011-05-04)
-------------------
-* Add --separate option and --version option
-* Fix bugs
-
-0.7.8 (2011-04-19)
-------------------
-* Update layout engine
-* Update requirements: PIL >= 1.1.5
-* Update parser for tokenize performance
-* Add --nodoctype option
-* Fix bugs
-* Add many testcases
-
-0.7.7 (2011-03-29)
-------------------
-* Fix bugs
-
-0.7.6 (2011-03-26)
-------------------
-* Add new layout manager for portrait edges
-* Fix bugs
-
-0.7.5 (2011-03-20)
-------------------
-* Support multiple nodes relations (cf. A -> B, C)
-* Support node group declaration at attribute of nodes
-* Fix bugs
-
-0.7.4 (2011-03-08)
-------------------
-* Fix bugs
-
-0.7.3 (2011-03-02)
-------------------
-* Use UTF-8 characters as Name token (by @swtw7466)
-* Fix htmlentities included in labels was not escaped on SVG images
-* Fix bugs
-
-0.7.2 (2011-02-28)
-------------------
-* Add default_shape attribute to diagram
-
-0.7.1 (2011-02-27)
-------------------
-* Fix edge has broken with antialias option
-
-0.7.0 (2011-02-25)
-------------------
-* Support node shape
-
-0.6.7 (2011-02-12)
-------------------
-* Change noderenderer interface to new style
-* Render dashed ellipse more clearly (contributed by @cocoatomo)
-* Support PDF exporting
-
-0.6.6 (2011-01-31)
-------------------
-* Support diagram.shape_namespace
-* Add new node shapes; mail, cloud, beginpoint, endpoint, minidiamond, actor
-* Support plug-in structure to install node shapes
-* Fix bugs
-
-0.6.5 (2011-01-18)
-------------------
-* Support node shape (experimental)
-
-0.6.4 (2011-01-17)
-------------------
-* Fix bugs
-
-0.6.3 (2011-01-15)
-------------------
-* Fix bugs
-
-0.6.2 (2011-01-08)
-------------------
-* Fix bugs
-
-0.6.1 (2011-01-07)
-------------------
-* Implement 'folded' attribute for edge
-* Refactor layout engine
-
-0.6 (2011-01-02)
-------------------
-* Support nested groups.
-
-0.5.5 (2010-12-24)
-------------------
-* Specify direction of edges as syntax (->, --, <-, <->)
-* Fix bugs.
-
-0.5.4 (2010-12-23)
-------------------
-* Remove debug codes.
-
-0.5.3 (2010-12-23)
-------------------
-* Support NodeGroup.label.
-* Implement --separate option (experimental)
-* Fix right-up edge overrapped on other nodes.
-* Support configration file: .blockdiagrc
-
-0.5.2 (2010-11-06)
-------------------
-* Fix unicode errors for UTF-8'ed SVG exportion.
-* Refactoring codes for running on GAE.
-
-0.5.1 (2010-10-26)
-------------------
-* Fix license text on diagparser.py
-* Update layout engine.
-
-0.5 (2010-10-15)
-------------------
-* Support background-image of node (SVG)
-* Support labels for edge.
-* Fix bugs.
-
-0.4.2 (2010-10-10)
-------------------
-* Support background-color of node groups.
-* Draw edge has jumped at edge's cross-points.
-* Fix bugs.
-
-0.4.1 (2010-10-07)
-------------------
-* Fix bugs.
-
-0.4 (2010-10-07)
-------------------
-* Support SVG exporting.
-* Support dashed edge drawing.
-* Support background image of nodes (PNG only)
-
-0.3.1 (2010-09-29)
-------------------
-* Fasten anti-alias process.
-* Fix text was broken on windows.
-
-0.3 (2010-09-26)
-------------------
-* Add --antialias option.
-* Fix bugs.
-
-0.2.2 (2010-09-25)
-------------------
-* Fix edge bugs.
-
-0.2.1 (2010-09-25)
-------------------
-* Fix bugs.
-* Fix package style.
-
-0.2 (2010-09-23)
-------------------
-* Update layout engine.
-* Support group { ... } sentence for create Node-Groups.
-* Support numbered badge on node (cf. A [numbered = 5])
-
-0.1 (2010-09-20)
------------------
-* first release
-
diff --git a/src/blockdiag.egg-info/PKG-INFO b/src/blockdiag.egg-info/PKG-INFO
index 7358389..850da76 100644
--- a/src/blockdiag.egg-info/PKG-INFO
+++ b/src/blockdiag.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: blockdiag
-Version: 1.4.3
+Version: 1.4.5
 Summary: blockdiag generates block-diagram image from text
 Home-page: http://blockdiag.com/
 Author: Takeshi Komiya
@@ -127,433 +127,6 @@ Description: `blockdiag` generate block-diagram image file from spec-text file.
         =======
         Apache License 2.0
         
-        
-        History
-        =======
-        
-        1.4.3 (2014-07-30)
-        ------------------
-        * Show warnings on loading imagedrawers in debug mode
-        * ImageDraw#image() accepts Image objects
-        * Fix bugs
-        
-          - PNG: could not load png imagedrawer if could not access PIL.PILLOW_VERSION
-        
-        
-        1.4.2 (2014-07-12)
-        ------------------
-        * SVG: Adjust text alignment precisely
-        * Add plugin events: node.changing and cleanup
-        * ImageDraw#image() accepts image from IO objects
-        * Fix bugs
-        
-          - PDF: Fix failure text rotating
-          - PDF: Fix failure pasting PNG images (256 palette/transparency)
-          - PNG: Fix background of node was transparent on pasting transparent images
-        
-        1.4.1 (2014-07-02)
-        ------------------
-        * Change interface of docutils node (for sphinxcontrib module)
-        * Fix bugs
-        
-        1.4.0 (2014-06-23)
-        ------------------
-        * Support embedding SVG/EPS images as background
-        * Use wand to paste background images that is not supported by Pillow (if installed)
-        * Add options to blockdiag directive (docutils extension)
-        
-          - \:width:
-          - \:height:
-          - \:scale:
-          - \:align:
-          - \:name:
-          - \:class:
-          - \:figwidth:
-          - \:figclass:
-        
-        * actor shape supports label rendering
-        
-        1.3.3 (2014-04-26)
-        ------------------
-        * Add diagram attribute: default_node_style
-        * Fix bugs
-        
-        1.3.2 (2013-11-19)
-        ------------------
-        * Fix bugs
-        
-        1.3.1 (2013-10-22)
-        ------------------
-        * Fix bugs
-        
-        1.3.0 (2013-10-05)
-        ------------------
-        * Support python 3.2 and 3.3 (thanks to @masayuko)
-        * Drop supports for python 2.4 and 2.5
-        * Replace dependency: PIL -> Pillow
-        
-        1.2.4 (2012-11-21)
-        ------------------
-        * Fix bugs
-        
-        1.2.3 (2012-11-05)
-        ------------------
-        * Fix bugs
-        
-        1.2.2 (2012-10-28)
-        ------------------
-        * Fix bugs
-        
-        1.2.1 (2012-10-28)
-        ------------------
-        * Add external imagedraw plugin supports
-        * Add node attribute: label_orientation*
-        * Fix bugs
-        
-        1.2.0 (2012-10-22)
-        ------------------
-        * Optimize algorithm for rendering shadow
-        * Add options to docutils directive
-        * Fix bugs
-        
-        1.1.8 (2012-09-28)
-        ------------------
-        * Add --ignore-pil option
-        * Fix bugs
-        
-        1.1.7 (2012-09-20)
-        ------------------
-        * Add diagram attribute: shadow_style
-        * Add font path for centos 6.2
-        * Add a setting 'antialias' in the configuration file
-        * Fix bugs
-        
-        1.1.6 (2012-06-06)
-        ------------------
-        * Support for readthedocs.org
-        * reST directive supports :caption: option
-        * Fix bugs
-        
-        1.1.5 (2012-04-22)
-        ------------------
-        * Embed source code to SVG document as description
-        * Fix bugs
-        
-        1.1.4 (2012-03-15)
-        ------------------
-        * Add new edge.hstyles: oneone, onemany, manyone, manymany
-        * Add edge attribute: description (for build description-tables)
-        * Fix bugs
-        
-        1.1.3 (2012-02-13)
-        ------------------
-        * Add new edge type for data-models (thanks to David Lang)
-        * Add --no-transparency option
-        * Fix bugs
-        
-        1.1.2 (2011-12-26)
-        ------------------
-        * Support font-index for TrueType Font Collections (.ttc file)
-        * Allow to use reST syntax in descriptions of nodes
-        * Fix bugs
-        
-        1.1.1 (2011-11-27)
-        ------------------
-        * Add node attribute: href (thanks to @r_rudi!)
-        * Fix bugs
-        
-        1.1.0 (2011-11-19)
-        ------------------
-        * Add shape: square and circle
-        * Add fontfamily attribute for switching fontface
-        * Fix bugs
-        
-        1.0.3 (2011-11-13)
-        ------------------
-        * Add plugin: attributes
-        * Change plugin syntax; (cf. plugin attributes [attr = value, attr, value])
-        * Fix bugs
-        
-        1.0.2 (2011-11-07)
-        ------------------
-        * Fix bugs
-        
-        1.0.1 (2011-11-06)
-        ------------------
-        * Add group attribute: shape
-        * Fix bugs
-        
-        1.0.0 (2011-11-04)
-        ------------------
-        * Add node attribute: linecolor
-        * Rename diagram attributes:
-           * fontsize -> default_fontsize
-           * default_line_color -> default_linecolor
-           * default_text_color -> default_textcolor
-        * Add docutils extention
-        * Fix bugs
-        
-        0.9.7 (2011-11-01)
-        ------------------
-        * Add node attribute: fontsize
-        * Add edge attributes: thick, fontsize
-        * Add group attribute: fontsize
-        * Change color of shadow in PDF mode
-        * Add class feature (experimental)
-        * Add handler-plugin framework (experimental)
-        
-        0.9.6 (2011-10-22)
-        ------------------
-        * node.style supports dashed_array format style
-        * Fix bugs
-        
-        0.9.5 (2011-10-19)
-        ------------------
-        * Add node attributes: width and height
-        * Fix bugs
-        
-        0.9.4 (2011-10-07)
-        ------------------
-        * Fix bugs
-        
-        0.9.3 (2011-10-06)
-        ------------------
-        * Replace SVG core by original's (simplesvg.py)
-        * Refactored
-        * Fix bugs
-        
-        0.9.2 (2011-09-30)
-        ------------------
-        * Add node attribute: textcolor
-        * Add group attribute: textcolor
-        * Add edge attribute: textcolor
-        * Add diagram attributes: default_text_attribute
-        * Fix beginpoint shape and endpoint shape were reversed
-        * Fix bugs
-        
-        0.9.1 (2011-09-26)
-        ------------------
-        * Add diagram attributes: default_node_color, default_group_color and default_line_color
-        * Fix bugs
-        
-        0.9.0 (2011-09-25)
-        ------------------
-        * Add icon attribute to node
-        * Make transparency to background of PNG images
-        * Fix bugs
-        
-        0.8.9 (2011-08-09)
-        ------------------
-        * Fix bugs
-        
-        0.8.8 (2011-08-08)
-        ------------------
-        * Fix bugs
-        
-        0.8.7 (2011-08-06)
-        ------------------
-        * Fix bugs
-        
-        0.8.6 (2011-08-01)
-        ------------------
-        * Support Pillow as replacement of PIL (experimental)
-        * Fix bugs
-        
-        0.8.5 (2011-07-31)
-        ------------------
-        * Allow dot characters in node_id
-        * Fix bugs
-        
-        0.8.4 (2011-07-05)
-        ------------------
-        * Fix bugs
-        
-        0.8.3 (2011-07-03)
-        ------------------
-        * Support input from stdin
-        * Fix bugs
-        
-        0.8.2 (2011-06-29)
-        ------------------
-        * Add node.stacked
-        * Add node shapes: dots, none
-        * Add hiragino-font to font search list
-        * Support background image fetching from web
-        * Add diagram.edge_layout (experimental)
-        * Fix bugs
-        
-        0.8.1 (2011-05-14)
-        ------------------
-        * Change license to Apache License 2.0
-        * Fix bugs
-        
-        0.8.0 (2011-05-04)
-        ------------------
-        * Add --separate option and --version option
-        * Fix bugs
-        
-        0.7.8 (2011-04-19)
-        ------------------
-        * Update layout engine
-        * Update requirements: PIL >= 1.1.5
-        * Update parser for tokenize performance
-        * Add --nodoctype option
-        * Fix bugs
-        * Add many testcases
-        
-        0.7.7 (2011-03-29)
-        ------------------
-        * Fix bugs
-        
-        0.7.6 (2011-03-26)
-        ------------------
-        * Add new layout manager for portrait edges
-        * Fix bugs
-        
-        0.7.5 (2011-03-20)
-        ------------------
-        * Support multiple nodes relations (cf. A -> B, C)
-        * Support node group declaration at attribute of nodes
-        * Fix bugs
-        
-        0.7.4 (2011-03-08)
-        ------------------
-        * Fix bugs
-        
-        0.7.3 (2011-03-02)
-        ------------------
-        * Use UTF-8 characters as Name token (by @swtw7466)
-        * Fix htmlentities included in labels was not escaped on SVG images
-        * Fix bugs
-        
-        0.7.2 (2011-02-28)
-        ------------------
-        * Add default_shape attribute to diagram
-        
-        0.7.1 (2011-02-27)
-        ------------------
-        * Fix edge has broken with antialias option
-        
-        0.7.0 (2011-02-25)
-        ------------------
-        * Support node shape
-        
-        0.6.7 (2011-02-12)
-        ------------------
-        * Change noderenderer interface to new style
-        * Render dashed ellipse more clearly (contributed by @cocoatomo)
-        * Support PDF exporting
-        
-        0.6.6 (2011-01-31)
-        ------------------
-        * Support diagram.shape_namespace
-        * Add new node shapes; mail, cloud, beginpoint, endpoint, minidiamond, actor
-        * Support plug-in structure to install node shapes
-        * Fix bugs
-        
-        0.6.5 (2011-01-18)
-        ------------------
-        * Support node shape (experimental)
-        
-        0.6.4 (2011-01-17)
-        ------------------
-        * Fix bugs
-        
-        0.6.3 (2011-01-15)
-        ------------------
-        * Fix bugs
-        
-        0.6.2 (2011-01-08)
-        ------------------
-        * Fix bugs
-        
-        0.6.1 (2011-01-07)
-        ------------------
-        * Implement 'folded' attribute for edge
-        * Refactor layout engine
-        
-        0.6 (2011-01-02)
-        ------------------
-        * Support nested groups.
-        
-        0.5.5 (2010-12-24)
-        ------------------
-        * Specify direction of edges as syntax (->, --, <-, <->)
-        * Fix bugs.
-        
-        0.5.4 (2010-12-23)
-        ------------------
-        * Remove debug codes.
-        
-        0.5.3 (2010-12-23)
-        ------------------
-        * Support NodeGroup.label.
-        * Implement --separate option (experimental)
-        * Fix right-up edge overrapped on other nodes.
-        * Support configration file: .blockdiagrc
-        
-        0.5.2 (2010-11-06)
-        ------------------
-        * Fix unicode errors for UTF-8'ed SVG exportion.
-        * Refactoring codes for running on GAE.
-        
-        0.5.1 (2010-10-26)
-        ------------------
-        * Fix license text on diagparser.py
-        * Update layout engine.
-        
-        0.5 (2010-10-15)
-        ------------------
-        * Support background-image of node (SVG)
-        * Support labels for edge.
-        * Fix bugs.
-        
-        0.4.2 (2010-10-10)
-        ------------------
-        * Support background-color of node groups.
-        * Draw edge has jumped at edge's cross-points.
-        * Fix bugs.
-        
-        0.4.1 (2010-10-07)
-        ------------------
-        * Fix bugs.
-        
-        0.4 (2010-10-07)
-        ------------------
-        * Support SVG exporting.
-        * Support dashed edge drawing.
-        * Support background image of nodes (PNG only)
-        
-        0.3.1 (2010-09-29)
-        ------------------
-        * Fasten anti-alias process.
-        * Fix text was broken on windows.
-        
-        0.3 (2010-09-26)
-        ------------------
-        * Add --antialias option.
-        * Fix bugs.
-        
-        0.2.2 (2010-09-25)
-        ------------------
-        * Fix edge bugs.
-        
-        0.2.1 (2010-09-25)
-        ------------------
-        * Fix bugs.
-        * Fix package style.
-        
-        0.2 (2010-09-23)
-        ------------------
-        * Update layout engine.
-        * Support group { ... } sentence for create Node-Groups.
-        * Support numbered badge on node (cf. A [numbered = 5])
-        
-        0.1 (2010-09-20)
-        -----------------
-        * first release
-        
-        
 Keywords: diagram,generator
 Platform: UNKNOWN
 Classifier: Development Status :: 5 - Production/Stable
diff --git a/src/blockdiag.egg-info/SOURCES.txt b/src/blockdiag.egg-info/SOURCES.txt
index ad4ca91..436e95e 100644
--- a/src/blockdiag.egg-info/SOURCES.txt
+++ b/src/blockdiag.egg-info/SOURCES.txt
@@ -1,3 +1,4 @@
+CHANGES.rst
 LICENSE
 MANIFEST.in
 README.rst
diff --git a/src/blockdiag/__init__.py b/src/blockdiag/__init__.py
index 2296c6d..4e29346 100644
--- a/src/blockdiag/__init__.py
+++ b/src/blockdiag/__init__.py
@@ -13,4 +13,4 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-__version__ = '1.4.3'
+__version__ = '1.4.5'
diff --git a/src/blockdiag/builder.py b/src/blockdiag/builder.py
index e0f9527..b05951c 100644
--- a/src/blockdiag/builder.py
+++ b/src/blockdiag/builder.py
@@ -15,12 +15,14 @@
 
 from blockdiag import parser
 from blockdiag.elements import Diagram, DiagramNode, NodeGroup, DiagramEdge
+from blockdiag.plugins import fire_node_event
 from blockdiag.utils import unquote, XY
 from blockdiag.utils.compat import cmp_to_key
 
 
 class DiagramTreeBuilder:
-    def build(self, tree):
+    def build(self, tree, config):
+        self.config = config
         self.diagram = Diagram()
         self.instantiate(self.diagram, tree)
         for subgroup in self.diagram.traverse_groups():
@@ -28,8 +30,14 @@ class DiagramTreeBuilder:
                 subgroup.group.nodes.remove(subgroup)
 
         self.bind_edges(self.diagram)
+        self.fire_node_event('build_finished')
         return self.diagram
 
+    def fire_node_event(self, event_type):
+        for node in self.diagram.nodes:
+            if node.drawable:
+                fire_node_event(node, event_type)
+
     def is_related_group(self, group1, group2):
         if group1.is_parent(group2) or group2.is_parent(group1):
             return True
@@ -111,7 +119,8 @@ class DiagramTreeBuilder:
                     name = unquote(stmt.name)
                     Diagram.classes[name] = stmt
                 elif stmt.type == 'plugin':
-                    self.diagram.set_plugin(stmt.name, stmt.attrs)
+                    self.diagram.set_plugin(stmt.name, stmt.attrs,
+                                            config=self.config)
 
             elif isinstance(stmt, parser.Statements):
                 self.instantiate(group, stmt)
@@ -595,16 +604,17 @@ class EdgeLayoutManager(object):
 
 class ScreenNodeBuilder:
     @classmethod
-    def build(cls, tree, layout=True):
+    def build(cls, tree, config=None, layout=True):
         DiagramNode.clear()
         DiagramEdge.clear()
         NodeGroup.clear()
         Diagram.clear()
 
-        return cls(tree, layout).run()
+        return cls(tree, config, layout).run()
 
-    def __init__(self, tree, layout):
-        self.diagram = DiagramTreeBuilder().build(tree)
+    def __init__(self, tree, config, layout):
+        self.diagram = DiagramTreeBuilder().build(tree, config)
+        self.config = config
         self.layout = layout
 
     def run(self):
diff --git a/src/blockdiag/elements.py b/src/blockdiag/elements.py
index ff1d8c7..3a8d1f3 100644
--- a/src/blockdiag/elements.py
+++ b/src/blockdiag/elements.py
@@ -560,6 +560,7 @@ class Diagram(NodeGroup):
     def __init__(self):
         super(Diagram, self).__init__(None)
 
+        self.config = None
         self.node_width = None
         self.node_height = None
         self.span_width = None
@@ -567,14 +568,14 @@ class Diagram(NodeGroup):
         self.page_padding = None
         self.edge_layout = None
 
-    def set_plugin(self, name, attrs):
-        kwargs = dict([str(unquote(attr.name)), unquote(attr.value)]
-                      for attr in attrs)
+    def set_plugin(self, name, attrs, **kwargs):
+        kwargs.update(dict([str(unquote(attr.name)), unquote(attr.value)]
+                           for attr in attrs))
         plugins.load([name], diagram=self, **kwargs)
 
-    def set_plugins(self, value):
+    def set_plugins(self, value, **kwargs):
         modules = [name.strip() for name in value.split(',')]
-        plugins.load(modules, diagram=self)
+        plugins.load(modules, diagram=self, **kwargs)
 
     def set_default_shape(self, value):
         if noderenderer.get(value):
diff --git a/src/blockdiag/plugins/__init__.py b/src/blockdiag/plugins/__init__.py
index 6c0da69..1c5e98a 100644
--- a/src/blockdiag/plugins/__init__.py
+++ b/src/blockdiag/plugins/__init__.py
@@ -55,6 +55,7 @@ def fire_node_event(node, name, *args):
 class NodeHandler(object):
     def __init__(self, diagram, **kwargs):
         self.diagram = diagram
+        self.config = kwargs.get('config')
 
     def fire(self, name, *args):
         return getattr(self, "on_" + name)(*args)
@@ -67,3 +68,6 @@ class NodeHandler(object):
 
     def on_attr_changed(self, node, attr):
         return True
+
+    def on_build_finished(self, node):
+        return True
diff --git a/src/blockdiag/tests/rst/test_blockdiag_directives.py b/src/blockdiag/tests/rst/test_blockdiag_directives.py
index 4348eaf..3569a8d 100644
--- a/src/blockdiag/tests/rst/test_blockdiag_directives.py
+++ b/src/blockdiag/tests/rst/test_blockdiag_directives.py
@@ -334,8 +334,31 @@ class TestRstDirectives(unittest.TestCase):
         self.assertEqual(nodes.image, type(doctree[0][0]))
         self.assertEqual(nodes.caption, type(doctree[0][1]))
         self.assertEqual(1, len(doctree[0][1]))
-        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
-        self.assertEqual('hello world', doctree[0][1][0])
+        self.assertEqual(nodes.paragraph, type(doctree[0][1][0]))
+        self.assertEqual(nodes.Text, type(doctree[0][1][0][0]))
+        self.assertEqual('hello world', doctree[0][1][0][0])
+
+    def test_caption_option2(self):
+        directives.setup(format='SVG', outputdir=self.tmpdir)
+        text = (".. blockdiag::\n"
+                "   :caption: **hello** *world*\n"
+                "\n"
+                "   A -> B")
+        doctree = publish_doctree(text)
+        self.assertEqual(1, len(doctree))
+        self.assertEqual(nodes.figure, type(doctree[0]))
+        self.assertEqual(2, len(doctree[0]))
+        self.assertEqual(nodes.image, type(doctree[0][0]))
+        self.assertEqual(nodes.caption, type(doctree[0][1]))
+        self.assertEqual(1, len(doctree[0][1]))
+        self.assertEqual(nodes.paragraph, type(doctree[0][1][0]))
+        self.assertEqual(3, len(doctree[0][1][0]))
+        self.assertEqual(nodes.strong, type(doctree[0][1][0][0]))
+        self.assertEqual('hello', doctree[0][1][0][0][0])
+        self.assertEqual(nodes.Text, type(doctree[0][1][0][1]))
+        self.assertEqual(' ', doctree[0][1][0][1][0])
+        self.assertEqual(nodes.emphasis, type(doctree[0][1][0][2]))
+        self.assertEqual('world', doctree[0][1][0][2][0])
 
     def test_caption_option_and_align_option(self):
         directives.setup(format='SVG', outputdir=self.tmpdir)
@@ -353,8 +376,9 @@ class TestRstDirectives(unittest.TestCase):
         self.assertNotIn('align', doctree[0][0])
         self.assertEqual(nodes.caption, type(doctree[0][1]))
         self.assertEqual(1, len(doctree[0][1]))
-        self.assertEqual(nodes.Text, type(doctree[0][1][0]))
-        self.assertEqual('hello world', doctree[0][1][0])
+        self.assertEqual(nodes.paragraph, type(doctree[0][1][0]))
+        self.assertEqual(nodes.Text, type(doctree[0][1][0][0]))
+        self.assertEqual('hello world', doctree[0][1][0][0])
 
     @capture_stderr
     def test_maxwidth_option(self):
diff --git a/src/blockdiag/tests/test_generate_diagram.py b/src/blockdiag/tests/test_generate_diagram.py
index e890685..2c0b458 100644
--- a/src/blockdiag/tests/test_generate_diagram.py
+++ b/src/blockdiag/tests/test_generate_diagram.py
@@ -100,6 +100,26 @@ def not_exist_font_config_option_test():
         detectfont(options)
 
 
+def stdin_test():
+    testdir = os.path.dirname(__file__)
+    diagpath = os.path.join(testdir, 'diagrams', 'single_edge.diag')
+
+    try:
+        stdin = sys.stdin
+        sys.stdin = open(diagpath, 'r')
+
+        tmpdir = TemporaryDirectory()
+        fd, tmpfile = tmpdir.mkstemp()
+        os.close(fd)
+
+        args = ['-T', 'SVG', '-o', tmpfile, '-']
+        ret = blockdiag.command.main(args)
+        assert ret == 0
+    finally:
+        sys.stdin = stdin
+        tmpdir.clean()
+
+
 @capture_stderr
 def svg_includes_source_code_tag_test():
     from xml.etree import ElementTree
diff --git a/src/blockdiag/utils/bootstrap.py b/src/blockdiag/utils/bootstrap.py
index 1d18719..4e8888f 100644
--- a/src/blockdiag/utils/bootstrap.py
+++ b/src/blockdiag/utils/bootstrap.py
@@ -16,11 +16,11 @@
 import os
 import re
 import sys
-import codecs
 import traceback
 from optparse import OptionParser, SUPPRESS_HELP
 from blockdiag import imagedraw
 from blockdiag import plugins
+from blockdiag.utils.compat import codecs
 from blockdiag.utils.config import ConfigParser
 from blockdiag.utils.fontmap import parse_fontpath, FontMap
 from blockdiag.utils.logging import warning, error
@@ -68,10 +68,13 @@ class Application(object):
         return self.module.parser.parse_string(self.code)
 
     def build_diagram(self, tree):
-        DiagramDraw = self.module.drawer.DiagramDraw
-
-        diagram = self.module.builder.ScreenNodeBuilder.build(tree)
+        ScreenNodeBuilder = self.module.builder.ScreenNodeBuilder
+        try:
+            diagram = ScreenNodeBuilder.build(tree, self.options)
+        except:
+            diagram = ScreenNodeBuilder.build(tree)  # old interface
 
+        DiagramDraw = self.module.drawer.DiagramDraw
         drawer = DiagramDraw(self.options.type, diagram,
                              self.options.output, fontmap=self.fontmap,
                              code=self.code, antialias=self.options.antialias,
diff --git a/src/blockdiag/utils/compat.py b/src/blockdiag/utils/compat.py
index 973cb16..fb1a83a 100644
--- a/src/blockdiag/utils/compat.py
+++ b/src/blockdiag/utils/compat.py
@@ -30,6 +30,17 @@ def u(string):
         return string
 
 
+# replace codecs.getreader
+import codecs
+if sys.version_info[0] == 3:
+    getreader = codecs.getreader
+
+    def py3_getreader(encoding):
+        return lambda stream, *args: getreader(encoding)(stream.buffer, *args)
+
+    codecs.getreader = py3_getreader
+
+
 def cmp_to_key(mycmp):
     """Convert a cmp= function into a key= function"""
     class K(object):
diff --git a/src/blockdiag/utils/images.py b/src/blockdiag/utils/images.py
index fcc7b44..7859a9a 100644
--- a/src/blockdiag/utils/images.py
+++ b/src/blockdiag/utils/images.py
@@ -39,7 +39,13 @@ def urlopen(url, *args, **kwargs):
 
 
 def get_image_size(filename):
-    return open(filename).size
+    image = None
+    try:
+        image = open(filename)
+        return image.size
+    finally:
+        if image:
+            image.close()
 
 
 def calc_image_size(size, bounded):
diff --git a/src/blockdiag/utils/rst/directives.py b/src/blockdiag/utils/rst/directives.py
index 44cbd36..efa7689 100644
--- a/src/blockdiag/utils/rst/directives.py
+++ b/src/blockdiag/utils/rst/directives.py
@@ -168,9 +168,12 @@ class BlockdiagDirective(BlockdiagDirectiveBase):
         self.add_name(results[0])
 
         if node.get('caption'):
+            elem = nodes.Element()
+            self.state.nested_parse(ViewList([node['caption']], source=''),
+                                    0, elem)
             fig = nodes.figure()
             fig += results[0]
-            fig += nodes.caption(text=node['caption'])
+            fig += nodes.caption(node['caption'], '', *elem)
 
             if figwidth == 'image':
                 width = self.get_actual_width(node, diagram)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/blockdiag.git



More information about the debian-science-commits mailing list