diff --git a/.gitignore b/.gitignore
index f48ff34..faa220c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,8 +7,7 @@ tests/tmp/
.project
.pydevproject
*.log
-
-
+venv/*
# Publishing
dist/*
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d7091b8..8ada50a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,8 @@
- Cleaning of the comments
- Basic colors are not redefined anymore
- Adding logo for SVG2TikZ
+- Adding theme for doc of SVG2TikZ
+- Adding autodoc
- Adding basic switch tag handle
- Adding failsafe for non defined sys.stdout.buffer
- Adding list of tikz color
diff --git a/README.md b/README.md
index 539d2e6..3c60970 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
-[![Documentation Status](https://readthedocs.org/projects/svg2tikz/badge/?version=latest)](https://svg2tikz.readthedocs.io/en/latest/?badge=latest)
+[![Documentation][documentation-badge]][documentation-url]
[![PyPI version](https://badge.fury.io/py/svg2tikz.svg)](https://badge.fury.io/py/svg2tikz)
# SVG2TikZ 2.0.X (Inkscape 1.x.x compatible)
@@ -25,3 +25,7 @@ All the informations to install (as an inkscape extension) and use `SVG2TikZ` ca
## Changes and Bug fixes
A complete changelog is available in the [CHANGELOG.md](CHANGELOG.md) file.
+
+
+[documentation-badge]: https://img.shields.io/website?up_message=Online&url=http%3A%2F%2Fxyz2tex.github.io%2Fsvg2tikz%2F&label=Doc
+[documentation-url]: https://xyz2tex.github.io/svg2tikz
diff --git a/docs/cmdlineguide.rst b/docs/cmdlineguide.rst
index 57164be..084a160 100644
--- a/docs/cmdlineguide.rst
+++ b/docs/cmdlineguide.rst
@@ -3,167 +3,7 @@ Command line guide
You can get direct help from the command line with ``svg2tikz -h``
-::
-
- usage: svg2tikz [-h] [--output OUTPUT] [--id IDS] [--selected-nodes SELECTED_NODES]
- [--codeoutput {standalone,codeonly,figonly}] [-t {math,escape,raw}]
- [--markings {ignore,include,interpret,arrows}] [--arrow {latex,stealth,to,>}]
- [--output-unit {mm,cm,m,in,pt,px,Q,pc}]
- [--input-unit {mm,cm,m,in,pt,px,Q,pc}] [--crop] [--clipboard] [--wrap]
- [--indent] [--latexpathtype] [--noreversey] [-r REMOVEABSOLUTE]
- [-m {output,effect,cli}] [--standalone] [--figonly] [--codeonly]
- [--scale SCALE] [-V] [--verbose]
- [INPUT_FILE]
-
- Doc string
-
- positional arguments:
- INPUT_FILE Filename of the input file (default is stdin)
-
- options:
- -h, --help show this help message and exit
- --output OUTPUT Optional output filename for saving the result (default is stdout).
- --id IDS id attribute of object to manipulate
- --selected-nodes SELECTED_NODES
- id:subpath:position of selected nodes, if any
- --codeoutput {standalone,codeonly,figonly}
- Amount of boilerplate code (standalone, figonly, codeonly).
- -t {math,escape,raw}, --texmode {math,escape,raw}
- Set text mode (escape, math, raw). Defaults to 'escape'
- --markings {ignore,include,interpret,arrows}
- Set markings mode. Defaults to 'ignore'
- --arrow {latex,stealth,to,>}
- Set arrow style for markings mode arrow. Defaults to 'latex'
- --output-unit {mm,cm,m,in,pt,px,Q,pc}
- Set output units. Defaults to 'cm'
- --input-unit {mm,cm,m,in,pt,px,Q,pc}
- Set input units. Defaults to 'mm'
- --crop Use the preview package to crop the tikzpicture
- --clipboard Export to clipboard
- --wrap Wrap long lines
- --indent Indent lines
- --latexpathtype Allow path modification for image
- --noreversey Do not reverse the y axis (Inkscape axis)
- --removeabsolute REMOVEABSOLUTE
- Remove the value of removeabsolute from image path
- -m {output,effect,cli}, --mode {output,effect,cli}
- Extension mode (effect default)
- --notext Ignore all text
- --standalone Generate a standalone document
- --figonly Generate figure only
- --codeonly Generate drawing code only
- --scale SCALE Apply scale to resulting image, defaults to 1.0
- -V, --version Print version information and exit
- --verbose Verbose output (useful for debugging)
-
-Argument
-========
-The only positional argument is the input file which must be a valid svg file
-
-Options
-=======
-
-Help
-----
-The option `-h`, `- -help` print the help
-
-Output file
------------
-Select an output file the `- -output` option
-
-
-Ids selections
---------------
-Select the id of the element to export with the `- -id` option.
-For multiple ids, multiple occurences of the option are allowed.
-
-Output Type
------------
-Set the type of output that SVG2TikZ will output with the `- -codeoutput` option:
-
-* `standalone` (default): a full `.tex` document
-* `figonly`: only the code to produce the figure
-* `codeonly`: only the tikz code
-
-The option can also be set with:
-
-* `- -standalone`
-* `- -figonly`
-* `- -codeonly`
-
-Text mode
----------
-Set how the text should be handled with `-t` option:
-
-* `math`: the text will be inside a `$` math environnement
-* `escape` (default): all special caracter will be escaped
-* `raw`: the text will not be altered
-
-The text can also be ignore with the `- -notext` option
-
-
-Markings
---------
-Set the marking mode with `- -markings`:
-
-* `ignore` (default): no marking will be added
-* `include`: Not available
-* `interpret`: Using the given mapping between inkscape markers and TikZ markers
-* `arrows`: Select the maker to use with the `- -arrow` option:
-
- * `latex`
- * `stealth`
- * `to`
- * `>`
-
-Units
------
-Select the unit from the document (`- -input-unit`) to convert to the input of the `.tex` file (`- -output-unit`):
-
-* `mm` (default input)
-* `cm` (default output)
-* `m`
-* `in`
-* `pt`
-* `px`
-* `Q`
-* `pc`
-
-Cropping the figure
--------------------
-Crop the pdf to figure with the `- -crop` option.
-
-
-Clipboard
----------
-Export the tikz code directly to your clipboard with the `- -clipboard` option
-
-Line wrapping
--------------
-Wrap long lines with the `- -wrap` option.
-
-Indent
-------
-Indent the code with the `- -indent` option.
-
-Image
------
-If the option `- -latexpathtype` is set, the path to the image image will be shortened by the value of `- -removeabsolute`
-
-Origin
-------
-
-The default origin of a svg file is the top left. The default origin of a tikz figure is the bottom left. The default behaviour of SVG2TikZ is to convert the origin of the svgfile to the origin of the tikz file. This option allow to keep the origin of the svg file.
-
-Scaling
--------
-Set the scaling of the tikz code with `- -scale`
-
-
-Version
--------
-Get the version of SVG2TikZ with `-v` / `- -version`
-
-Verbosity
----------
-Get a verbose output with `- -versbose`
+.. argparse::
+ :module: svg2tikz.tikz_export
+ :func: return_arg_parser_doc
+ :prog: svg2tikz
diff --git a/docs/conf.py b/docs/conf.py
index e6199b0..4a20757 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,192 +1,29 @@
-# -*- coding: utf-8 -*-
+# Configuration file for the Sphinx documentation builder.
#
-# svg2tikz documentation build configuration file, created by
-# sphinx-quickstart on Tue Oct 13 10:34:22 2009.
-#
-# This file is execfile()d with the current directory set to its containing dir.
-#
-# Note that not all possible configuration values are present in this
-# autogenerated file.
-#
-# All configuration values have a default; values that are commented out
-# serve to show the default.
-
-
-# If extensions (or modules to document with autodoc) are in another directory,
-# add these directories to sys.path here. If the directory is relative to the
-# documentation root, use os.path.abspath to make it absolute, like shown here.
-# sys.path.append(os.path.abspath('.'))
-
-# -- General configuration -----------------------------------------------------
+# For the full list of built-in configuration values, see the documentation:
+# https://www.sphinx-doc.org/en/master/usage/configuration.html
-# Add any Sphinx extension module names here, as strings. They can be extensions
-# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ["sphinx.ext.todo", "sphinx.ext.imgmath"]
+# -- Project information -----------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
-# Add any paths that contain templates here, relative to this directory.
-templates_path = ["_templates"]
-
-# The suffix of source filenames.
-source_suffix = ".rst"
-
-# The encoding of source files.
-# source_encoding = 'utf-8'
-
-# The master toctree document.
-master_doc = "index"
-
-# General information about the project.
project = "svg2tikz"
copyright = "2014, Kjell Magne Fauske, Louis Devillez"
-
-# The version info for the project you're documenting, acts as replacement for
-# |version| and |release|, also used in various other places throughout the
-# built documents.
-#
-# The short X.Y version.
-version = "2.1.0"
-# The full version, including alpha/beta/rc tags.
+author = "Kjell Magne Fauske, Louis Devillez"
release = "2.1.0"
-# The language for content autogenerated by Sphinx. Refer to documentation
-# for a list of supported languages.
-# language = None
-
-# There are two options for replacing |today|: either, you set today to some
-# non-false value, then it is used:
-# today = ''
-# Else, today_fmt is used as the format for a strftime call.
-# today_fmt = '%B %d, %Y'
-
-# List of documents that shouldn't be included in the build.
-# unused_docs = []
-
-# List of directories, relative to source directory, that shouldn't be searched
-# for source files.
-exclude_trees = ["_build"]
-
-# The reST default role (used for this markup: `text`) to use for all documents.
-# default_role = None
-
-# If true, '()' will be appended to :func: etc. cross-reference text.
-# add_function_parentheses = True
-
-# If true, the current module name will be prepended to all description
-# unit titles (such as .. function::).
-# add_module_names = True
-
-# If true, sectionauthor and moduleauthor directives will be shown in the
-# output. They are ignored by default.
-# show_authors = False
-
-# The name of the Pygments (syntax highlighting) style to use.
-pygments_style = "sphinx"
-
-# A list of ignored prefixes for module index sorting.
-# modindex_common_prefix = []
-
-
-# -- Options for HTML output ---------------------------------------------------
+# -- General configuration ---------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
-# The theme to use for HTML and HTML Help pages. Major themes that come with
-# Sphinx are currently 'default' and 'sphinxdoc'.
-html_theme = "default"
+extensions = ["sphinxarg.ext", "sphinx.ext.autodoc"]
-# Theme options are theme-specific and customize the look and feel of a theme
-# further. For a list of options available for each theme, see the
-# documentation.
-# html_theme_options = {}
-
-# Add any paths that contain custom themes here, relative to this directory.
-# html_theme_path = []
-
-# The name for this set of Sphinx documents. If None, it defaults to
-# " v documentation".
-# html_title = None
+templates_path = ["_templates"]
+exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
-# A shorter title for the navigation bar. Default is the same as html_title.
-# html_short_title = None
+root_doc = "index"
-# The name of an image file (relative to this directory) to place at the top
-# of the sidebar.
-# html_logo = None
-# The name of an image file (within the static path) to use as favicon of the
-# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
-# pixels large.
-# html_favicon = None
+# -- Options for HTML output -------------------------------------------------
+# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
-# Add any paths that contain custom static files (such as style sheets) here,
-# relative to this directory. They are copied after the builtin static files,
-# so a file named "default.css" will overwrite the builtin "default.css".
+html_theme = "furo"
html_static_path = ["_static"]
-
-# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
-# using the given strftime format.
-# html_last_updated_fmt = '%b %d, %Y'
-
-# If true, SmartyPants will be used to convert quotes and dashes to
-# typographically correct entities.
-# html_use_smartypants = True
-
-# Custom sidebar templates, maps document names to template names.
-# html_sidebars = {}
-
-# Additional templates that should be rendered to pages, maps page names to
-# template names.
-# html_additional_pages = {}
-
-# If false, no module index is generated.
-# html_use_modindex = True
-
-# If false, no index is generated.
-# html_use_index = True
-
-# If true, the index is split into individual pages for each letter.
-# html_split_index = False
-
-# If true, links to the reST sources are added to the pages.
-# html_show_sourcelink = True
-
-# If true, an OpenSearch description file will be output, and all pages will
-# contain a tag referring to it. The value of this option must be the
-# base URL from which the finished HTML is served.
-# html_use_opensearch = ''
-
-# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
-# html_file_suffix = ''
-
-# Output file base name for HTML help builder.
-htmlhelp_basename = "svg2tikzdoc"
-
-
-# -- Options for LaTeX output --------------------------------------------------
-
-# The paper size ('letter' or 'a4').
-# latex_paper_size = 'letter'
-
-# The font size ('10pt', '11pt' or '12pt').
-# latex_font_size = '10pt'
-
-# Grouping the document tree into LaTeX files. List of tuples
-# (source start file, target name, title, author, documentclass [howto/manual]).
-latex_documents = [
- ("index", "svg2tikz.tex", "svg2tikz Documentation", "Louis Devillez", "manual"),
-]
-
-# The name of an image file (relative to this directory) to place at the top of
-# the title page.
-# latex_logo = None
-
-# For "manual" documents, if this is true, then toplevel headings are parts,
-# not chapters.
-# latex_use_parts = False
-
-# Additional stuff for the LaTeX preamble.
-# latex_preamble = ''
-
-# Documents to append as an appendix to all manuals.
-# latex_appendices = []
-
-# If false, no module index is generated.
-# latex_use_modindex = True
diff --git a/docs/index.rst b/docs/index.rst
index 8961ac6..4a32ecf 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -11,6 +11,7 @@ Contents
.. toctree::
:maxdepth: 2
+ :caption: Contents:
install.rst
inkscapeguide.rst
@@ -18,5 +19,9 @@ Contents
moduleguide.rst
contribute.rst
-Background and motivation
--------------------------
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/docs/moduleguide.rst b/docs/moduleguide.rst
index f4c0719..348b9fa 100644
--- a/docs/moduleguide.rst
+++ b/docs/moduleguide.rst
@@ -2,111 +2,16 @@
.. _module-guide:
package guide
-============
+=============
.. module:: svg2tikz
:synopsis: Interface to the SVG to TikZ converter
-.. function:: convert_file(filename_or_stream, no_output=True, **kwargs)
+.. autofunction:: svg2tikz.convert_file
- Main interface
- :param filename_or_stream: Path to an SVG file or a stream to a SVG document.
- :type filename_or_stream: string
- :param no_output: Set the output of the converter to None
- :type no_output: bool
- :param returnstring: Return the output code as as string
- :type returnstring: bool
- :param ids: A list of path ids to convert
- :type ids: list of strings
- :param wrap: Wrap generated code lines
- :type wrap: bool
- :param crop: Crop figure using the preview package
- :type crop: bool
- :param codeoutput: Amount of code to generate. Allowed values:
+.. autofunction:: svg2tikz.convert_svg
- - ``standalone`` -- output a standalone document (default)
- - ``figonly`` -- wrap code in a ``tikzpicture`` environment
- - ``codeonly``
- :type codeoutput: string
- :param t: Text mode. Allowed values:
-
- - ``math`` -- output the text in a $ math environment
- - ``escape`` -- escape the tex characters (default)
- - ``raw`` -- do not modify the text
- :type t: string
- :param markings: Marking mode. Allowed values:
-
- - ``ignore`` -- No marking (default)
- - ``include`` -- Not implemented
- - ``interpret`` -- Defined Mapping between inkscape and tikz markings
- - ``arrows`` -- Use the making defined by the arrow option
- :type t: string
-
- :param arrow: Tikz marking used in the marking mode. Allowed values:
-
- - ``latex`` (default)
- - ``stealth``
- - ``to``
- - ``>``
- :type t: string
-
- :param round-number: Number after the decimal after rounding
- :type round-number: integer
-
- :param output-unit: Unit of the tikz file. Allowed values:
-
- - ``mm``
- - ``cm`` (default)
- - ``m``
- - ``in``
- - ``pt``
- - ``px``
- - ``Q``
- - ``pc``
- :type t: string
-
- :param indent: indent the tikz code
- :type indent: bool
-
- :param noreversey: keep the origin in the svg convention (top left) instead of converting it to the origin of the tikz convention (bottom left)
- :type noreversey: bool
-
- :param latexpathtype: Allow path modification for image
- :type latexpathtype: bool
-
- :param removeabsolute: Remove specified part form path
- :type removeabsolute: string
-
- :param notext: The text will be ignored
- :type notext: bool
-
- :param standalone: Set the codeoutput to standalone
- :type standalone: bool
-
- :param figonly: Set the codeoutput to figonly
- :type figonly: bool
-
- :param codeonly: Set the codeoutput to codeonly
- :type codeonly: bool
-
- :param scale: Apply the scale factor to the figure
- :type scale: float
-
-
- :rtype: string or None
-
- Examples::
-
- from svg2tikz import convert_file
-
- code = convert_file("example.svg", ids=['1', '2', 'id2'], verbose=True)
- code = convert_file("example.svg", verbose=True)
-
-
-.. function:: convert_svg(filename_or_string, **kwargs)
-
- All the parameter are the same as convert_file
Examples::
diff --git a/poetry.lock b/poetry.lock
index 399fc48..a4f6212 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -4,6 +4,7 @@
name = "alabaster"
version = "0.7.13"
description = "A configurable sidebar-enabled Sphinx theme"
+category = "dev"
optional = false
python-versions = ">=3.6"
files = [
@@ -15,6 +16,7 @@ files = [
name = "babel"
version = "2.12.1"
description = "Internationalization utilities"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -25,10 +27,30 @@ files = [
[package.dependencies]
pytz = {version = ">=2015.7", markers = "python_version < \"3.9\""}
+[[package]]
+name = "beautifulsoup4"
+version = "4.12.2"
+description = "Screen-scraping library"
+category = "dev"
+optional = false
+python-versions = ">=3.6.0"
+files = [
+ {file = "beautifulsoup4-4.12.2-py3-none-any.whl", hash = "sha256:bd2520ca0d9d7d12694a53d44ac482d181b4ec1888909b035a3dbf40d0f57d4a"},
+ {file = "beautifulsoup4-4.12.2.tar.gz", hash = "sha256:492bbc69dca35d12daac71c4db1bfff0c876c00ef4a2ffacce226d4638eb72da"},
+]
+
+[package.dependencies]
+soupsieve = ">1.2"
+
+[package.extras]
+html5lib = ["html5lib"]
+lxml = ["lxml"]
+
[[package]]
name = "certifi"
version = "2023.7.22"
description = "Python package for providing Mozilla's CA Bundle."
+category = "dev"
optional = false
python-versions = ">=3.6"
files = [
@@ -40,6 +62,7 @@ files = [
name = "charset-normalizer"
version = "3.1.0"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
+category = "dev"
optional = false
python-versions = ">=3.7.0"
files = [
@@ -124,6 +147,7 @@ files = [
name = "click"
version = "8.1.3"
description = "Composable command line interface toolkit"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -133,12 +157,12 @@ files = [
[package.dependencies]
colorama = {version = "*", markers = "platform_system == \"Windows\""}
-importlib-metadata = {version = "*", markers = "python_version < \"3.8\""}
[[package]]
name = "colorama"
version = "0.4.6"
description = "Cross-platform colored terminal text."
+category = "dev"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
files = [
@@ -150,6 +174,7 @@ files = [
name = "cssselect"
version = "1.2.0"
description = "cssselect parses CSS3 Selectors and translates them to XPath 1.0"
+category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -161,6 +186,7 @@ files = [
name = "docutils"
version = "0.19"
description = "Docutils -- Python Documentation Utilities"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -168,10 +194,29 @@ files = [
{file = "docutils-0.19.tar.gz", hash = "sha256:33995a6753c30b7f577febfc2c50411fec6aac7f7ffeb7c4cfe5991072dcf9e6"},
]
+[[package]]
+name = "furo"
+version = "2023.9.10"
+description = "A clean customisable Sphinx documentation theme."
+category = "dev"
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "furo-2023.9.10-py3-none-any.whl", hash = "sha256:513092538537dc5c596691da06e3c370714ec99bc438680edc1debffb73e5bfc"},
+ {file = "furo-2023.9.10.tar.gz", hash = "sha256:5707530a476d2a63b8cad83b4f961f3739a69f4b058bcf38a03a39fa537195b2"},
+]
+
+[package.dependencies]
+beautifulsoup4 = "*"
+pygments = ">=2.7"
+sphinx = ">=6.0,<8.0"
+sphinx-basic-ng = "*"
+
[[package]]
name = "idna"
version = "3.4"
description = "Internationalized Domain Names in Applications (IDNA)"
+category = "dev"
optional = false
python-versions = ">=3.5"
files = [
@@ -183,6 +228,7 @@ files = [
name = "imagesize"
version = "1.4.1"
description = "Getting image size from png/jpeg/jpeg2000/gif file"
+category = "dev"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
files = [
@@ -194,6 +240,7 @@ files = [
name = "importlib-metadata"
version = "6.6.0"
description = "Read metadata from Python packages"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -202,7 +249,6 @@ files = [
]
[package.dependencies]
-typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""}
zipp = ">=0.5"
[package.extras]
@@ -214,6 +260,7 @@ testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packag
name = "inkex"
version = "1.2.2+dairiki.1"
description = "Python extensions for Inkscape core, separated out from main repository."
+category = "main"
optional = false
python-versions = ">=3.6,<4.0"
files = [
@@ -229,7 +276,6 @@ numpy = [
]
Pillow = ">=7.0.0"
pySerial = ">=3.4,<4.0"
-typing-extensions = {version = ">=3.10.0", markers = "python_version < \"3.8\""}
[package.extras]
gui = ["PyGObject (>=3.36)"]
@@ -243,6 +289,7 @@ reference = "inkex_gitlab"
name = "jinja2"
version = "3.1.2"
description = "A very fast and expressive template engine."
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -260,6 +307,7 @@ i18n = ["Babel (>=2.7)"]
name = "lxml"
version = "4.9.2"
description = "Powerful and Pythonic XML processing library combining libxml2/libxslt with the ElementTree API."
+category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, != 3.4.*"
files = [
@@ -352,6 +400,7 @@ source = ["Cython (>=0.29.7)"]
name = "markupsafe"
version = "2.1.2"
description = "Safely add untrusted strings to HTML/XML markup."
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -407,50 +456,11 @@ files = [
{file = "MarkupSafe-2.1.2.tar.gz", hash = "sha256:abcabc8c2b26036d62d4c746381a6f7cf60aafcc653198ad678306986b09450d"},
]
-[[package]]
-name = "numpy"
-version = "1.21.6"
-description = "NumPy is the fundamental package for array computing with Python."
-optional = false
-python-versions = ">=3.7,<3.11"
-files = [
- {file = "numpy-1.21.6-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:8737609c3bbdd48e380d463134a35ffad3b22dc56295eff6f79fd85bd0eeeb25"},
- {file = "numpy-1.21.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:fdffbfb6832cd0b300995a2b08b8f6fa9f6e856d562800fea9182316d99c4e8e"},
- {file = "numpy-1.21.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:3820724272f9913b597ccd13a467cc492a0da6b05df26ea09e78b171a0bb9da6"},
- {file = "numpy-1.21.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f17e562de9edf691a42ddb1eb4a5541c20dd3f9e65b09ded2beb0799c0cf29bb"},
- {file = "numpy-1.21.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:5f30427731561ce75d7048ac254dbe47a2ba576229250fb60f0fb74db96501a1"},
- {file = "numpy-1.21.6-cp310-cp310-win32.whl", hash = "sha256:d4bf4d43077db55589ffc9009c0ba0a94fa4908b9586d6ccce2e0b164c86303c"},
- {file = "numpy-1.21.6-cp310-cp310-win_amd64.whl", hash = "sha256:d136337ae3cc69aa5e447e78d8e1514be8c3ec9b54264e680cf0b4bd9011574f"},
- {file = "numpy-1.21.6-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:6aaf96c7f8cebc220cdfc03f1d5a31952f027dda050e5a703a0d1c396075e3e7"},
- {file = "numpy-1.21.6-cp37-cp37m-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:67c261d6c0a9981820c3a149d255a76918278a6b03b6a036800359aba1256d46"},
- {file = "numpy-1.21.6-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:a6be4cb0ef3b8c9250c19cc122267263093eee7edd4e3fa75395dfda8c17a8e2"},
- {file = "numpy-1.21.6-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7c4068a8c44014b2d55f3c3f574c376b2494ca9cc73d2f1bd692382b6dffe3db"},
- {file = "numpy-1.21.6-cp37-cp37m-win32.whl", hash = "sha256:7c7e5fa88d9ff656e067876e4736379cc962d185d5cd808014a8a928d529ef4e"},
- {file = "numpy-1.21.6-cp37-cp37m-win_amd64.whl", hash = "sha256:bcb238c9c96c00d3085b264e5c1a1207672577b93fa666c3b14a45240b14123a"},
- {file = "numpy-1.21.6-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:82691fda7c3f77c90e62da69ae60b5ac08e87e775b09813559f8901a88266552"},
- {file = "numpy-1.21.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:643843bcc1c50526b3a71cd2ee561cf0d8773f062c8cbaf9ffac9fdf573f83ab"},
- {file = "numpy-1.21.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:357768c2e4451ac241465157a3e929b265dfac85d9214074985b1786244f2ef3"},
- {file = "numpy-1.21.6-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:9f411b2c3f3d76bba0865b35a425157c5dcf54937f82bbeb3d3c180789dd66a6"},
- {file = "numpy-1.21.6-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:4aa48afdce4660b0076a00d80afa54e8a97cd49f457d68a4342d188a09451c1a"},
- {file = "numpy-1.21.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d6a96eef20f639e6a97d23e57dd0c1b1069a7b4fd7027482a4c5c451cd7732f4"},
- {file = "numpy-1.21.6-cp38-cp38-win32.whl", hash = "sha256:5c3c8def4230e1b959671eb959083661b4a0d2e9af93ee339c7dada6759a9470"},
- {file = "numpy-1.21.6-cp38-cp38-win_amd64.whl", hash = "sha256:bf2ec4b75d0e9356edea834d1de42b31fe11f726a81dfb2c2112bc1eaa508fcf"},
- {file = "numpy-1.21.6-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:4391bd07606be175aafd267ef9bea87cf1b8210c787666ce82073b05f202add1"},
- {file = "numpy-1.21.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:67f21981ba2f9d7ba9ade60c9e8cbaa8cf8e9ae51673934480e45cf55e953673"},
- {file = "numpy-1.21.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ee5ec40fdd06d62fe5d4084bef4fd50fd4bb6bfd2bf519365f569dc470163ab0"},
- {file = "numpy-1.21.6-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:1dbe1c91269f880e364526649a52eff93ac30035507ae980d2fed33aaee633ac"},
- {file = "numpy-1.21.6-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:d9caa9d5e682102453d96a0ee10c7241b72859b01a941a397fd965f23b3e016b"},
- {file = "numpy-1.21.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:58459d3bad03343ac4b1b42ed14d571b8743dc80ccbf27444f266729df1d6f5b"},
- {file = "numpy-1.21.6-cp39-cp39-win32.whl", hash = "sha256:7f5ae4f304257569ef3b948810816bc87c9146e8c446053539947eedeaa32786"},
- {file = "numpy-1.21.6-cp39-cp39-win_amd64.whl", hash = "sha256:e31f0bb5928b793169b87e3d1e070f2342b22d5245c755e2b81caa29756246c3"},
- {file = "numpy-1.21.6-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:dd1c8f6bd65d07d3810b90d02eba7997e32abbdf1277a481d698969e921a3be0"},
- {file = "numpy-1.21.6.zip", hash = "sha256:ecb55251139706669fdec2ff073c98ef8e9a84473e51e716211b41aa0f18e656"},
-]
-
[[package]]
name = "numpy"
version = "1.24.3"
description = "Fundamental package for array computing in Python"
+category = "main"
optional = false
python-versions = ">=3.8"
files = [
@@ -488,6 +498,7 @@ files = [
name = "packaging"
version = "23.1"
description = "Core utilities for Python packages"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -499,6 +510,7 @@ files = [
name = "pillow"
version = "9.5.0"
description = "Python Imaging Library (Fork)"
+category = "main"
optional = false
python-versions = ">=3.7"
files = [
@@ -578,6 +590,7 @@ tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "pa
name = "pygments"
version = "2.15.1"
description = "Pygments is a syntax highlighting package written in Python."
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -592,6 +605,7 @@ plugins = ["importlib-metadata"]
name = "pyserial"
version = "3.5"
description = "Python Serial Port Extension"
+category = "main"
optional = false
python-versions = "*"
files = [
@@ -606,6 +620,7 @@ cp2110 = ["hidapi"]
name = "pytz"
version = "2023.3"
description = "World timezone definitions, modern and historical"
+category = "dev"
optional = false
python-versions = "*"
files = [
@@ -617,6 +632,7 @@ files = [
name = "requests"
version = "2.31.0"
description = "Python HTTP for Humans."
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -638,6 +654,7 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"]
name = "snowballstemmer"
version = "2.2.0"
description = "This package provides 29 stemmers for 28 languages generated from Snowball algorithms."
+category = "dev"
optional = false
python-versions = "*"
files = [
@@ -645,28 +662,41 @@ files = [
{file = "snowballstemmer-2.2.0.tar.gz", hash = "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1"},
]
+[[package]]
+name = "soupsieve"
+version = "2.5"
+description = "A modern CSS selector implementation for Beautiful Soup."
+category = "dev"
+optional = false
+python-versions = ">=3.8"
+files = [
+ {file = "soupsieve-2.5-py3-none-any.whl", hash = "sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7"},
+ {file = "soupsieve-2.5.tar.gz", hash = "sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690"},
+]
+
[[package]]
name = "sphinx"
-version = "5.3.0"
+version = "6.2.1"
description = "Python documentation generator"
+category = "dev"
optional = false
-python-versions = ">=3.6"
+python-versions = ">=3.8"
files = [
- {file = "Sphinx-5.3.0.tar.gz", hash = "sha256:51026de0a9ff9fc13c05d74913ad66047e104f56a129ff73e174eb5c3ee794b5"},
- {file = "sphinx-5.3.0-py3-none-any.whl", hash = "sha256:060ca5c9f7ba57a08a1219e547b269fadf125ae25b06b9fa7f66768efb652d6d"},
+ {file = "Sphinx-6.2.1.tar.gz", hash = "sha256:6d56a34697bb749ffa0152feafc4b19836c755d90a7c59b72bc7dfd371b9cc6b"},
+ {file = "sphinx-6.2.1-py3-none-any.whl", hash = "sha256:97787ff1fa3256a3eef9eda523a63dbf299f7b47e053cfcf684a1c2a8380c912"},
]
[package.dependencies]
alabaster = ">=0.7,<0.8"
babel = ">=2.9"
colorama = {version = ">=0.4.5", markers = "sys_platform == \"win32\""}
-docutils = ">=0.14,<0.20"
+docutils = ">=0.18.1,<0.20"
imagesize = ">=1.3"
importlib-metadata = {version = ">=4.8", markers = "python_version < \"3.10\""}
Jinja2 = ">=3.0"
packaging = ">=21.0"
-Pygments = ">=2.12"
-requests = ">=2.5.0"
+Pygments = ">=2.13"
+requests = ">=2.25.0"
snowballstemmer = ">=2.0"
sphinxcontrib-applehelp = "*"
sphinxcontrib-devhelp = "*"
@@ -677,13 +707,50 @@ sphinxcontrib-serializinghtml = ">=1.1.5"
[package.extras]
docs = ["sphinxcontrib-websupport"]
-lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-bugbear", "flake8-comprehensions", "flake8-simplify", "isort", "mypy (>=0.981)", "sphinx-lint", "types-requests", "types-typed-ast"]
-test = ["cython", "html5lib", "pytest (>=4.6)", "typed_ast"]
+lint = ["docutils-stubs", "flake8 (>=3.5.0)", "flake8-simplify", "isort", "mypy (>=0.990)", "ruff", "sphinx-lint", "types-requests"]
+test = ["cython", "filelock", "html5lib", "pytest (>=4.6)"]
+
+[[package]]
+name = "sphinx-argparse"
+version = "0.4.0"
+description = "A sphinx extension that automatically documents argparse commands and options"
+category = "dev"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "sphinx_argparse-0.4.0-py3-none-any.whl", hash = "sha256:73bee01f7276fae2bf621ccfe4d167af7306e7288e3482005405d9f826f9b037"},
+ {file = "sphinx_argparse-0.4.0.tar.gz", hash = "sha256:e0f34184eb56f12face774fbc87b880abdb9017a0998d1ec559b267e9697e449"},
+]
+
+[package.dependencies]
+sphinx = ">=1.2.0"
+
+[package.extras]
+markdown = ["CommonMark (>=0.5.6)"]
+
+[[package]]
+name = "sphinx-basic-ng"
+version = "1.0.0b2"
+description = "A modern skeleton for Sphinx themes."
+category = "dev"
+optional = false
+python-versions = ">=3.7"
+files = [
+ {file = "sphinx_basic_ng-1.0.0b2-py3-none-any.whl", hash = "sha256:eb09aedbabfb650607e9b4b68c9d240b90b1e1be221d6ad71d61c52e29f7932b"},
+ {file = "sphinx_basic_ng-1.0.0b2.tar.gz", hash = "sha256:9ec55a47c90c8c002b5960c57492ec3021f5193cb26cebc2dc4ea226848651c9"},
+]
+
+[package.dependencies]
+sphinx = ">=4.0"
+
+[package.extras]
+docs = ["furo", "ipython", "myst-parser", "sphinx-copybutton", "sphinx-inline-tabs"]
[[package]]
name = "sphinx-click"
version = "4.4.0"
description = "Sphinx extension that automatically documents click applications"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -700,6 +767,7 @@ sphinx = ">=2.0"
name = "sphinx-copybutton"
version = "0.5.2"
description = "Add a copy button to each of your code cells."
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -718,6 +786,7 @@ rtd = ["ipython", "myst-nb", "sphinx", "sphinx-book-theme", "sphinx-examples"]
name = "sphinxcontrib-applehelp"
version = "1.0.2"
description = "sphinxcontrib-applehelp is a sphinx extension which outputs Apple help books"
+category = "dev"
optional = false
python-versions = ">=3.5"
files = [
@@ -733,6 +802,7 @@ test = ["pytest"]
name = "sphinxcontrib-devhelp"
version = "1.0.2"
description = "sphinxcontrib-devhelp is a sphinx extension which outputs Devhelp document."
+category = "dev"
optional = false
python-versions = ">=3.5"
files = [
@@ -748,6 +818,7 @@ test = ["pytest"]
name = "sphinxcontrib-htmlhelp"
version = "2.0.0"
description = "sphinxcontrib-htmlhelp is a sphinx extension which renders HTML help files"
+category = "dev"
optional = false
python-versions = ">=3.6"
files = [
@@ -763,6 +834,7 @@ test = ["html5lib", "pytest"]
name = "sphinxcontrib-jsmath"
version = "1.0.1"
description = "A sphinx extension which renders display math in HTML via JavaScript"
+category = "dev"
optional = false
python-versions = ">=3.5"
files = [
@@ -777,6 +849,7 @@ test = ["flake8", "mypy", "pytest"]
name = "sphinxcontrib-qthelp"
version = "1.0.3"
description = "sphinxcontrib-qthelp is a sphinx extension which outputs QtHelp document."
+category = "dev"
optional = false
python-versions = ">=3.5"
files = [
@@ -792,6 +865,7 @@ test = ["pytest"]
name = "sphinxcontrib-serializinghtml"
version = "1.1.5"
description = "sphinxcontrib-serializinghtml is a sphinx extension which outputs \"serialized\" HTML files (json and pickle)."
+category = "dev"
optional = false
python-versions = ">=3.5"
files = [
@@ -807,6 +881,7 @@ test = ["pytest"]
name = "sphinxext-opengraph"
version = "0.7.5"
description = "Sphinx Extension to enable OGP support"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -817,21 +892,11 @@ files = [
[package.dependencies]
sphinx = ">=4.0"
-[[package]]
-name = "typing-extensions"
-version = "4.5.0"
-description = "Backported and Experimental Type Hints for Python 3.7+"
-optional = false
-python-versions = ">=3.7"
-files = [
- {file = "typing_extensions-4.5.0-py3-none-any.whl", hash = "sha256:fb33085c39dd998ac16d1431ebc293a8b3eedd00fd4a32de0ff79002c19511b4"},
- {file = "typing_extensions-4.5.0.tar.gz", hash = "sha256:5cb5f4a79139d699607b3ef622a1dedafa84e115ab0024e0d9c044a9479ca7cb"},
-]
-
[[package]]
name = "urllib3"
version = "2.0.6"
description = "HTTP library with thread-safe connection pooling, file post, and more."
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -849,6 +914,7 @@ zstd = ["zstandard (>=0.18.0)"]
name = "zipp"
version = "3.15.0"
description = "Backport of pathlib-compatible object wrapper for zip files"
+category = "dev"
optional = false
python-versions = ">=3.7"
files = [
@@ -862,5 +928,5 @@ testing = ["big-O", "flake8 (<5)", "jaraco.functools", "jaraco.itertools", "more
[metadata]
lock-version = "2.0"
-python-versions = "^3.7"
-content-hash = "04b116d2d16abdc14c5bb8e41941c0c513e97d6c53ea9ecf69d37e6735c03a32"
+python-versions = "^3.8"
+content-hash = "7834a735c3d9689a35aef1ce3e69a751e6bb7e9f17d60df400a4e457bbb51d8f"
diff --git a/pyproject.toml b/pyproject.toml
index 7beb12b..97b2f2e 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -8,15 +8,17 @@ license = "GPL-2.0-or-later"
readme = "README.md"
[tool.poetry.dependencies]
-python = "^3.7"
+python = "^3.8"
lxml = "^4.9.2"
inkex = "^1.2.2"
[tool.poetry.group.docs.dependencies]
-sphinx = "^5.3.0"
+sphinx = "^6.0.0"
sphinx-click = "^4.4.0"
sphinx-copybutton = "^0.5.1"
sphinxext-opengraph = "^0.7.5"
+furo = "^2023.9.10"
+sphinx-argparse = "^0.4.0"
[[tool.poetry.source]]
diff --git a/svg2tikz/tikz_export.py b/svg2tikz/tikz_export.py
index 7307216..c8f69ff 100644
--- a/svg2tikz/tikz_export.py
+++ b/svg2tikz/tikz_export.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python3
+#!/usr/bin/env python/
# -*- coding: utf-8 -*-
"""\
@@ -385,9 +385,17 @@ def marking_interpret(marker):
return raw_marker
+def return_arg_parser_doc():
+ """
+ Methode to return the arg parser of TikzPathExporter to help generate the doc
+ """
+ tzp = TikZPathExporter()
+ return tzp.arg_parser
+
+
# pylint: disable=too-many-ancestors
class TikZPathExporter(inkex.Effect, inkex.EffectExtension):
- """Class to export a svg to tikz code"""
+ """Class to convert a svg to tikz code"""
def __init__(self, inkscape_mode=True):
self.inkscape_mode = inkscape_mode
@@ -1458,8 +1466,16 @@ def convert(self, svg_file=None, no_output=False, **kwargs):
def convert_file(svg_file, no_output=True, returnstring=True, **kwargs):
"""
Convert SVG file to tikz code
- - Svg file can be a str representing the path to a file
- - A steam object of a file
+
+ :param svg_file: input file representend by a path or a stream
+ :type svg_file: str, stream object
+ :param no_output: If the output is redirected to None (default: True)
+ :type no_output: Bool
+ :param returnstring: if the output code should be returned
+ :type returnstring: Bool
+ :param kwargs: See argparse output / svg2tikz -h / commandline documentation
+ :return: tikz code or empty string
+ :rtype: str
"""
kwargs["returnstring"] = returnstring
@@ -1469,8 +1485,17 @@ def convert_file(svg_file, no_output=True, returnstring=True, **kwargs):
def convert_svg(svg_source, no_output=True, returnstring=True, **kwargs):
"""
- Convert a SVG to tikz code
- - svg source is a str representing a svg
+ Convert SVG to tikz code
+
+ :param svg_source: content of svg file
+ :type svg_source: str
+ :param no_output: If the output is redirected to None (default: True)
+ :type no_output: Bool
+ :param returnstring: if the output code should be returned
+ :type returnstring: Bool
+ :param kwargs: See argparse output / svg2tikz -h / commandline documentation
+ :return: tikz code or empty string
+ :rtype: str
"""
kwargs["returnstring"] = returnstring