././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1575823024.9747076 sphinxcontrib-actdiag-2.0.0/0000755000076600000240000000000000000000000016577 5ustar00tkomiyastaff00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575804439.0 sphinxcontrib-actdiag-2.0.0/AUTHORS0000644000076600000240000000004500000000000017646 0ustar00tkomiyastaff00000000000000Takeshi KOMIYA ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575804439.0 sphinxcontrib-actdiag-2.0.0/LICENSE0000644000076600000240000000261200000000000017605 0ustar00tkomiyastaff00000000000000If not otherwise noted, the extensions in this package are licensed under the following license. Copyright (c) 2009 by the contributors (see AUTHORS file). All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575804439.0 sphinxcontrib-actdiag-2.0.0/MANIFEST.in0000644000076600000240000000010500000000000020331 0ustar00tkomiyastaff00000000000000include AUTHORS include LICENSE include README.rst include CHANGES.* ././@PaxHeader0000000000000000000000000000003300000000000011451 xustar000000000000000027 mtime=1575823024.974846 sphinxcontrib-actdiag-2.0.0/PKG-INFO0000644000076600000240000000457000000000000017702 0ustar00tkomiyastaff00000000000000Metadata-Version: 1.1 Name: sphinxcontrib-actdiag Version: 2.0.0 Summary: Sphinx "actdiag" extension Home-page: https://github.com/blockdiag/sphinxcontrib-actdiag Author: Takeshi KOMIYA Author-email: i.tkomiya@gmail.com License: BSD Description: ===================== sphinxcontrib-actdiag ===================== .. image:: https://travis-ci.org/blockdiag/sphinxcontrib-actdiag.svg?branch=master :target: https://travis-ci.org/blockdiag/sphinxcontrib-actdiag .. image:: https://coveralls.io/repos/blockdiag/sphinxcontrib-actdiag/badge.png?branch=master :target: https://coveralls.io/r/blockdiag/sphinxcontrib-actdiag?branch=master .. image:: https://codeclimate.com/github/blockdiag/sphinxcontrib-actdiag/badges/gpa.svg :target: https://codeclimate.com/github/blockdiag/sphinxcontrib-actdiag A sphinx extension for embedding activity diagram using actdiag_. This extension enables you to insert activity diagrams into your document. Following code is an example:: .. actdiag:: actdiag { A -> B -> C -> D; lane { A; B; } lane { C; D; } } .. _actdiag: http://bitbucket.org/blockdiag/actdiag/ For more details, see `online documentation`_ at http://blockdiag.com/. .. _online documentation: http://blockdiag.com/en/actdiag/sphinxcontrib.html Platform: any Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Environment :: Web Environment Classifier: Framework :: Sphinx :: Extension Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Documentation Classifier: Topic :: Documentation :: Sphinx Classifier: Topic :: Utilities ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575804439.0 sphinxcontrib-actdiag-2.0.0/README.rst0000644000076600000240000000210000000000000020257 0ustar00tkomiyastaff00000000000000===================== sphinxcontrib-actdiag ===================== .. image:: https://travis-ci.org/blockdiag/sphinxcontrib-actdiag.svg?branch=master :target: https://travis-ci.org/blockdiag/sphinxcontrib-actdiag .. image:: https://coveralls.io/repos/blockdiag/sphinxcontrib-actdiag/badge.png?branch=master :target: https://coveralls.io/r/blockdiag/sphinxcontrib-actdiag?branch=master .. image:: https://codeclimate.com/github/blockdiag/sphinxcontrib-actdiag/badges/gpa.svg :target: https://codeclimate.com/github/blockdiag/sphinxcontrib-actdiag A sphinx extension for embedding activity diagram using actdiag_. This extension enables you to insert activity diagrams into your document. Following code is an example:: .. actdiag:: actdiag { A -> B -> C -> D; lane { A; B; } lane { C; D; } } .. _actdiag: http://bitbucket.org/blockdiag/actdiag/ For more details, see `online documentation`_ at http://blockdiag.com/. .. _online documentation: http://blockdiag.com/en/actdiag/sphinxcontrib.html ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1575823024.9753451 sphinxcontrib-actdiag-2.0.0/setup.cfg0000644000076600000240000000044300000000000020421 0ustar00tkomiyastaff00000000000000[egg_info] tag_build = tag_date = 0 [build] build-base = _build [sdist] formats = gztar [wheel] universal = 1 [aliases] release = check -r -s register sdist bdist_wheel upload [check] strict = 1 restructuredtext = 1 [flake8] max-line-length = 120 ignore = W504 exclude = tests/docs/ ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823018.0 sphinxcontrib-actdiag-2.0.0/setup.py0000644000076600000240000000263200000000000020314 0ustar00tkomiyastaff00000000000000# -*- coding: utf-8 -*- from setuptools import setup, find_packages requires = ['blockdiag>=1.5.0', 'actdiag>=0.5.3', 'Sphinx>=2.0'] setup( name='sphinxcontrib-actdiag', version='2.0.0', url='https://github.com/blockdiag/sphinxcontrib-actdiag', license='BSD', author='Takeshi KOMIYA', author_email='i.tkomiya@gmail.com', description='Sphinx "actdiag" extension', long_description=open('README.rst').read(), zip_safe=False, classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', 'Environment :: Web Environment', 'Framework :: Sphinx :: Extension', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Topic :: Documentation', 'Topic :: Documentation :: Sphinx', 'Topic :: Utilities', ], platforms='any', packages=find_packages(exclude=['tests', 'tests.*']), include_package_data=True, install_requires=requires, namespace_packages=['sphinxcontrib'], ) ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1575823024.9726396 sphinxcontrib-actdiag-2.0.0/sphinxcontrib/0000755000076600000240000000000000000000000021471 5ustar00tkomiyastaff00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575804439.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib/__init__.py0000644000076600000240000000055500000000000023607 0ustar00tkomiyastaff00000000000000# -*- coding: utf-8 -*- """ sphinxcontrib ~~~~~~~~~~~~~ This package is a namespace package that contains all extensions distributed in the ``sphinx-contrib`` distribution. :copyright: Copyright 2007-2009 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ __import__('pkg_resources').declare_namespace(__name__) ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823000.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib/actdiag.py0000644000076600000240000002611300000000000023442 0ustar00tkomiyastaff00000000000000# -*- coding: utf-8 -*- """ actdiag.sphinx_ext ~~~~~~~~~~~~~~~~~~~~ Allow actdiag-formatted diagrams to be included in Sphinx-generated documents inline. :copyright: Copyright 2010 by Takeshi Komiya. :license: BSDL. """ from __future__ import absolute_import import os import re import posixpath import traceback import pkg_resources from collections import namedtuple from docutils import nodes from sphinx import addnodes from sphinx.util import logging from sphinx.util.osutil import ensuredir import actdiag.utils.rst.nodes import actdiag.utils.rst.directives from blockdiag.utils.bootstrap import detectfont, Application from blockdiag.utils.fontmap import FontMap from blockdiag.utils.rst.directives import with_blockdiag # fontconfig; it will be initialized on `builder-inited` event. fontmap = None logger = logging.getLogger(__name__) class actdiag_node(actdiag.utils.rst.nodes.actdiag): def to_drawer(self, image_format, builder, **kwargs): if 'filename' in kwargs: filename = kwargs.pop('filename') else: filename = self.get_abspath(image_format, builder) antialias = builder.config.actdiag_antialias transparency = builder.config.actdiag_transparency image = super(actdiag_node, self).to_drawer(image_format, filename, fontmap, antialias=antialias, transparency=transparency, **kwargs) for node in image.diagram.traverse_nodes(): node.href = resolve_reference(builder, node.href) return image def get_relpath(self, image_format, builder): options = dict(antialias=builder.config.actdiag_antialias, fontpath=builder.config.actdiag_fontpath, fontmap=builder.config.actdiag_fontmap, format=image_format, transparency=builder.config.actdiag_transparency) if hasattr(builder, 'imgpath'): # Sphinx (<= 1.2.x) or HTML writer outputdir = builder.imgpath else: outputdir = '' return posixpath.join(outputdir, self.get_path(**options)) def get_abspath(self, image_format, builder): options = dict(antialias=builder.config.actdiag_antialias, fontpath=builder.config.actdiag_fontpath, fontmap=builder.config.actdiag_fontmap, format=image_format, transparency=builder.config.actdiag_transparency) if hasattr(builder, 'imagedir'): # Sphinx (>= 1.3.x) outputdir = os.path.join(builder.outdir, builder.imagedir) elif hasattr(builder, 'imgpath'): # Sphinx (<= 1.2.x) and HTML writer outputdir = os.path.join(builder.outdir, '_images') else: outputdir = builder.outdir path = os.path.join(outputdir, self.get_path(**options)) ensuredir(os.path.dirname(path)) return path class Actdiag(actdiag.utils.rst.directives.ActdiagDirective): node_class = actdiag_node def node2image(self, node, diagram): return node def resolve_reference(builder, href): if href is None: return None pattern = re.compile("^:ref:`(.+?)`", re.UNICODE) matched = pattern.search(href) if matched is None: return href elif not hasattr(builder, 'current_docname'): # ex. latex builder return matched.group(1) else: refid = matched.group(1) domain = builder.env.domains['std'] node = addnodes.pending_xref(refexplicit=False) xref = domain.resolve_xref(builder.env, builder.current_docname, builder, 'ref', refid, node, node) if xref: if 'refid' in xref: return "#" + xref['refid'] else: return xref['refuri'] else: logger.warning('undefined label: %s', refid) return None def html_render_svg(self, node): image = node.to_drawer('SVG', self.builder, filename=None, nodoctype=True) image.draw() if 'align' in node['options']: align = node['options']['align'] self.body.append('
' % (align, align)) self.context.append('
\n') else: self.body.append('
') self.context.append('
\n') # reftarget for node_id in node['ids']: self.body.append('' % node_id) # resize image size = image.pagesize().resize(**node['options']) self.body.append(image.save(size)) self.context.append('') def html_render_clickablemap(self, image, width_ratio, height_ratio): href_nodes = [node for node in image.nodes if node.href] if not href_nodes: return self.body.append('' % id(image)) for node in href_nodes: x1, y1, x2, y2 = image.metrics.cell(node) x1 *= width_ratio x2 *= width_ratio y1 *= height_ratio y2 *= height_ratio areatag = '' % (x1, y1, x2, y2, node.href) self.body.append(areatag) self.body.append('') def html_render_png(self, node): image = node.to_drawer('PNG', self.builder) if not os.path.isfile(image.filename): image.draw() image.save() # align if 'align' in node['options']: align = node['options']['align'] self.body.append('
' % (align, align)) self.context.append('
\n') else: self.body.append('
') self.context.append('
') # link to original image relpath = node.get_relpath('PNG', self.builder) if 'width' in node['options'] or 'height' in node['options'] or 'scale' in node['options']: self.body.append('' % relpath) self.context.append('') else: self.context.append('') # tag original_size = image.pagesize() resized = original_size.resize(**node['options']) img_attr = dict(src=relpath, width=resized.width, height=resized.height) if any(node.href for node in image.nodes): img_attr['usemap'] = "#map_%d" % id(image) width_ratio = float(resized.width) / original_size.width height_ratio = float(resized.height) / original_size.height html_render_clickablemap(self, image, width_ratio, height_ratio) if 'alt' in node['options']: img_attr['alt'] = node['options']['alt'] self.body.append(self.starttag(node, 'img', '', empty=True, **img_attr)) @with_blockdiag def html_visit_actdiag(self, node): try: image_format = get_image_format_for(self.builder) if image_format.upper() == 'SVG': html_render_svg(self, node) else: html_render_png(self, node) except UnicodeEncodeError: if self.builder.config.actdiag_debug: traceback.print_exc() msg = ("actdiag error: UnicodeEncodeError caught " "(check your font settings)") logger.warning(msg) raise nodes.SkipNode except Exception as exc: if self.builder.config.actdiag_debug: traceback.print_exc() logger.warning('dot code %r: %s', node['code'], exc) raise nodes.SkipNode def html_depart_actdiag(self, node): self.body.append(self.context.pop()) self.body.append(self.context.pop()) def get_image_format_for(builder): if builder.format in ('html', 'slides'): image_format = builder.config.actdiag_html_image_format.upper() elif builder.format == 'latex': if builder.config.actdiag_tex_image_format: image_format = builder.config.actdiag_tex_image_format.upper() else: image_format = builder.config.actdiag_latex_image_format.upper() else: image_format = 'PNG' if image_format.upper() not in ('PNG', 'PDF', 'SVG'): raise ValueError('unknown format: %s' % image_format) if image_format.upper() == 'PDF': try: import reportlab # NOQA: importing test except ImportError: raise ImportError('Could not output PDF format. Install reportlab.') return image_format def on_builder_inited(self): # show deprecated message if self.builder.config.actdiag_tex_image_format: logger.warning('actdiag_tex_image_format is deprecated. Use actdiag_latex_image_format.') # initialize fontmap global fontmap try: fontmappath = self.builder.config.actdiag_fontmap fontmap = FontMap(fontmappath) except Exception: fontmap = FontMap(None) try: fontpath = self.builder.config.actdiag_fontpath if isinstance(fontpath, str): fontpath = [fontpath] if fontpath: config = namedtuple('Config', 'font')(fontpath) fontpath = detectfont(config) fontmap.set_default_font(fontpath) except Exception: pass def on_doctree_resolved(self, doctree, docname): if self.builder.format in ('html', 'slides'): return try: image_format = get_image_format_for(self.builder) except Exception as exc: if self.builder.config.actdiag_debug: traceback.print_exc() logger.warning('actdiag error: %s', exc) for node in doctree.traverse(actdiag_node): node.parent.remove(node) return for node in doctree.traverse(actdiag_node): try: with Application(): relfn = node.get_relpath(image_format, self.builder) image = node.to_drawer(image_format, self.builder) if not os.path.isfile(image.filename): image.draw() image.save() image = nodes.image(uri=relfn, candidates={'*': relfn}, **node['options']) node.parent.replace(node, image) except Exception as exc: if self.builder.config.actdiag_debug: traceback.print_exc() logger.warning('dot code %r: %s', node['code'], exc) node.parent.remove(node) def setup(app): app.add_node(actdiag_node, html=(html_visit_actdiag, html_depart_actdiag)) app.add_directive('actdiag', Actdiag) app.add_config_value('actdiag_fontpath', None, 'html') app.add_config_value('actdiag_fontmap', None, 'html') app.add_config_value('actdiag_antialias', False, 'html') app.add_config_value('actdiag_transparency', True, 'html') app.add_config_value('actdiag_debug', False, 'html') app.add_config_value('actdiag_html_image_format', 'PNG', 'html') app.add_config_value('actdiag_tex_image_format', None, 'html') # backward compatibility for 0.6.1 app.add_config_value('actdiag_latex_image_format', 'PNG', 'html') app.connect("builder-inited", on_builder_inited) app.connect("doctree-resolved", on_doctree_resolved) return { 'version': pkg_resources.require('actdiag')[0].version, 'parallel_read_safe': True, 'parallel_write_safe': True, } ././@PaxHeader0000000000000000000000000000003400000000000011452 xustar000000000000000028 mtime=1575823024.9745007 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/0000755000076600000240000000000000000000000024637 5ustar00tkomiyastaff00000000000000././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823024.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/PKG-INFO0000644000076600000240000000457000000000000025742 0ustar00tkomiyastaff00000000000000Metadata-Version: 1.1 Name: sphinxcontrib-actdiag Version: 2.0.0 Summary: Sphinx "actdiag" extension Home-page: https://github.com/blockdiag/sphinxcontrib-actdiag Author: Takeshi KOMIYA Author-email: i.tkomiya@gmail.com License: BSD Description: ===================== sphinxcontrib-actdiag ===================== .. image:: https://travis-ci.org/blockdiag/sphinxcontrib-actdiag.svg?branch=master :target: https://travis-ci.org/blockdiag/sphinxcontrib-actdiag .. image:: https://coveralls.io/repos/blockdiag/sphinxcontrib-actdiag/badge.png?branch=master :target: https://coveralls.io/r/blockdiag/sphinxcontrib-actdiag?branch=master .. image:: https://codeclimate.com/github/blockdiag/sphinxcontrib-actdiag/badges/gpa.svg :target: https://codeclimate.com/github/blockdiag/sphinxcontrib-actdiag A sphinx extension for embedding activity diagram using actdiag_. This extension enables you to insert activity diagrams into your document. Following code is an example:: .. actdiag:: actdiag { A -> B -> C -> D; lane { A; B; } lane { C; D; } } .. _actdiag: http://bitbucket.org/blockdiag/actdiag/ For more details, see `online documentation`_ at http://blockdiag.com/. .. _online documentation: http://blockdiag.com/en/actdiag/sphinxcontrib.html Platform: any Classifier: Development Status :: 5 - Production/Stable Classifier: Environment :: Console Classifier: Environment :: Web Environment Classifier: Framework :: Sphinx :: Extension Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: OS Independent Classifier: Programming Language :: Python Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Documentation Classifier: Topic :: Documentation :: Sphinx Classifier: Topic :: Utilities ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823024.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/SOURCES.txt0000644000076600000240000000065600000000000026532 0ustar00tkomiyastaff00000000000000AUTHORS LICENSE MANIFEST.in README.rst setup.cfg setup.py sphinxcontrib/__init__.py sphinxcontrib/actdiag.py sphinxcontrib_actdiag.egg-info/PKG-INFO sphinxcontrib_actdiag.egg-info/SOURCES.txt sphinxcontrib_actdiag.egg-info/dependency_links.txt sphinxcontrib_actdiag.egg-info/namespace_packages.txt sphinxcontrib_actdiag.egg-info/not-zip-safe sphinxcontrib_actdiag.egg-info/requires.txt sphinxcontrib_actdiag.egg-info/top_level.txt././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823024.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/dependency_links.txt0000644000076600000240000000000100000000000030705 0ustar00tkomiyastaff00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823024.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/namespace_packages.txt0000644000076600000240000000001600000000000031167 0ustar00tkomiyastaff00000000000000sphinxcontrib ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575804683.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/not-zip-safe0000644000076600000240000000000100000000000027065 0ustar00tkomiyastaff00000000000000 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823024.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/requires.txt0000644000076600000240000000005400000000000027236 0ustar00tkomiyastaff00000000000000blockdiag>=1.5.0 actdiag>=0.5.3 Sphinx>=2.0 ././@PaxHeader0000000000000000000000000000002600000000000011453 xustar000000000000000022 mtime=1575823024.0 sphinxcontrib-actdiag-2.0.0/sphinxcontrib_actdiag.egg-info/top_level.txt0000644000076600000240000000001600000000000027366 0ustar00tkomiyastaff00000000000000sphinxcontrib