{ "info": { "author": "Glen Fletcher", "author_email": "glen.fletcher@alphaomega-technology.com.au", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha" ], "description": "Railroad-diagram Generator\r\n==========================\r\n\r\nThis is a small js library for generating railroad diagrams (like what `JSON.org `_ uses) using SVG.\r\n\r\nRailroad diagrams are a way of visually representing a grammar in a form that is more readable than using regular expressions or BNF.\r\n\r\nThis code is forked from `tabatkins/railroad-diagrams `_, which implimented a Javascript and Python Version, This project has reworked the Python Version into a proper Python Package, installable using setup tools.\r\n\r\nDetails\r\n-------\r\n\r\nTo use the library, import railroad_diagram, and then call the railroad_diagram.Diagram() function. Its arguments are the components of the diagram (Diagram is a special form of Sequence). Components are either leaves or containers.\r\n\r\nThe leaves:\r\n\r\n* railroad_diagram.Terminal(text) or a bare string - represents literal text, EBNF ``\"text\"``\r\n* railroad_diagram.NonTerminal(text) - represents an instruction or another production, EBNF ``text``\r\n* Comment(text) - a comment, EBNF ``(* text *)``\r\n* Skip() - an empty line\r\n\r\nThe containers:\r\n\r\n* railroad_diagram.Sequence(children) - like simple concatenation in a regex, EBNF ``s1, s2, ...``\r\n* railroad_diagram.Choice(index, children) - List of Options. The index argument specifies which child is the \"normal\" choice and should go in the middle, EBNF ``c1 | c2 | ...``\r\n* Optional(child, skip) - A shorthand for `Choice(1, [Skip(), child])`. If the optional `skip` parameter has the value `\"skip\"`, it instead puts the Skip() in the straight-line path, for when the \"normal\" behavior is to omit the item. EBNF ``[child]`` or ``child?``\r\n* railroad_diagram.OneOrMore(child, repeat) - The 'repeat' argument is optional, and specifies something that must go between the repetitions. EBNF ``{child}`` or ``child+``\r\n* railroad_diagram.ZeroOrMore(child, repeat, skip) - A shorthand for `Optional(OneOrMore(child, repeat))`. The optional `skip` parameter is identical to Optional(). EBNF ``[{child}]`` or ``child*``\r\n\r\nYou'll find a `writeSvg(writerFunc)` method on `Diagram`, which takes a callback of one argument and passes it the string form of the diagram. For example, it can be used like ``Diagram(...).writeSvg(sys.stdout.write)`` to write to stdout.\r\n\r\n.. Note:: the callback will be called multiple times as it builds up the string, not just once with the whole thing. If you need it all at once, consider something like a `StringIO` as an easy way to collect it into a single string.\r\n\r\nOptions\r\n-------\r\n\r\nThere are a few options you can tweak, at the bottom of the file. Just tweak either until the diagram looks like what you want.\r\nYou can also change the CSS file - feel free to tweak to your heart's content.\r\nNote, though, that if you change the text sizes in the CSS,\r\nyou'll have to go adjust the metrics for the leaf nodes as well.\r\n\r\n* railroad_diagram.VERTICAL_SEPARATION - sets the minimum amount of vertical separation between two items. Note that the stroke width isn't counted when computing the separation; this shouldn't be relevant unless you have a very small separation or very large stroke width.\r\n* railroad_diagram.ARC_RADIUS - the radius of the arcs used in the branching containers like Choice. This has a relatively large effect on the size of non-trivial diagrams. Both tight and loose values look good, depending on what you're going for.\r\n* railroad_diagram.DIAGRAM_CLASS - the class set on the root `` element of each diagram, for use in the CSS stylesheet.\r\n* railroad_diagram.STROKE_ODD_PIXEL_LENGTH - the default stylesheet uses odd pixel lengths for 'stroke'. Due to rasterization artifacts, they look best when the item has been translated half a pixel in both directions. If you change the styling to use a stroke with even pixel lengths, you'll want to set this variable to `false`.\r\n* railroad_diagram.INTERNAL_ALIGNMENT - when some branches of a container are narrower than others, this determines how they're aligned in the extra space. Defaults to \"center\", but can be set to \"left\" or \"right\".\r\n\r\nCaveats\r\n-------\r\n\r\nAt this early stage, the generator is feature-complete and works as intended, but still has several TODOs:\r\n\r\n* The font-sizes are hard-coded right now, and the font handling in general is very dumb - I'm just guessing at some metrics that are probably \"good enough\" rather than measuring things properly.\r\n\r\n\r\nLicense\r\n-------\r\n\r\nThis Fork is Copyright 2014 AlphaOmega Technology\r\n \r\nLicensed under the AlphaOmega Technology Open License Version 1.0\r\n\r\nYou may obtain a copy of the License at http://www.alphaomega-technology.com.au/license/AOT-OL/1.0\r\n\r\nThis License only applies to the modifications made by this fork, the files\r\n**railroad_diagram/core.py** and **railroad_diagram/style.css** are unmodified and the orginal license applies.\r\n\r\n\r\nThe Orginal project `tabatkins/railroad-diagrams `_ is licensed under `CC0 `_. And can be used freely.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/alphaomega-technology/syntax-diagram", "keywords": "", "license": "AlphaOmega Technology Open License Version 1.0 (http://www.alphaomega-technology.com.au/license/AOT-OL/1.0)", "maintainer": "", "maintainer_email": "", "name": "syntax-diagram", "package_url": "https://pypi.org/project/syntax-diagram/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/syntax-diagram/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/alphaomega-technology/syntax-diagram" }, "release_url": "https://pypi.org/project/syntax-diagram/1.0.dev-20140530/", "requires_dist": null, "requires_python": null, "summary": "UNKNOWN", "version": "1.0.dev-20140530" }, "last_serial": 1108770, "releases": { "1.0.dev-20140530": [] }, "urls": [] }