Skip to content

Commit 2ff7aa0

Browse files
authored
Merge pull request #127 from fchapoton/varia1
various small details
2 parents 567d430 + 117f1ad commit 2ff7aa0

4 files changed

Lines changed: 46 additions & 45 deletions

File tree

docs/conf.py

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,15 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import sys, os
15-
1614
# If extensions (or modules to document with autodoc) are in another directory,
1715
# add these directories to sys.path here. If the directory is relative to the
1816
# documentation root, use os.path.abspath to make it absolute, like shown here.
19-
#sys.path.insert(0, os.path.abspath('.'))
17+
# sys.path.insert(0, os.path.abspath('.'))
2018

2119
# -- General configuration -----------------------------------------------------
2220

2321
# If your documentation needs a minimal Sphinx version, state it here.
24-
#needs_sphinx = '1.0'
22+
# needs_sphinx = '1.0'
2523

2624
# Add any Sphinx extension module names here, as strings. They can be extensions
2725
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -34,7 +32,7 @@
3432
source_suffix = '.rst'
3533

3634
# The encoding of source files.
37-
#source_encoding = 'utf-8-sig'
35+
# source_encoding = 'utf-8-sig'
3836

3937
# The master toctree document.
4038
master_doc = 'index'
@@ -54,37 +52,37 @@
5452

5553
# The language for content autogenerated by Sphinx. Refer to documentation
5654
# for a list of supported languages.
57-
#language = None
55+
# language = None
5856

5957
# There are two options for replacing |today|: either, you set today to some
6058
# non-false value, then it is used:
61-
#today = ''
59+
# today = ''
6260
# Else, today_fmt is used as the format for a strftime call.
63-
#today_fmt = '%B %d, %Y'
61+
# today_fmt = '%B %d, %Y'
6462

6563
# List of patterns, relative to source directory, that match files and
6664
# directories to ignore when looking for source files.
6765
exclude_patterns = ['_build']
6866

6967
# The reST default role (used for this markup: `text`) to use for all documents.
70-
#default_role = None
68+
# default_role = None
7169

7270
# If true, '()' will be appended to :func: etc. cross-reference text.
73-
#add_function_parentheses = True
71+
# add_function_parentheses = True
7472

7573
# If true, the current module name will be prepended to all description
7674
# unit titles (such as .. function::).
77-
#add_module_names = True
75+
# add_module_names = True
7876

7977
# If true, sectionauthor and moduleauthor directives will be shown in the
8078
# output. They are ignored by default.
81-
#show_authors = False
79+
# show_authors = False
8280

8381
# The name of the Pygments (syntax highlighting) style to use.
8482
pygments_style = 'sphinx'
8583

8684
# A list of ignored prefixes for module index sorting.
87-
#modindex_common_prefix = []
85+
# modindex_common_prefix = []
8886

8987

9088
# -- Options for HTML output ---------------------------------------------------
@@ -96,26 +94,26 @@
9694
# Theme options are theme-specific and customize the look and feel of a theme
9795
# further. For a list of options available for each theme, see the
9896
# documentation.
99-
#html_theme_options = {}
97+
# html_theme_options = {}
10098

10199
# Add any paths that contain custom themes here, relative to this directory.
102-
#html_theme_path = []
100+
# html_theme_path = []
103101

104102
# The name for this set of Sphinx documents. If None, it defaults to
105103
# "<project> v<release> documentation".
106-
#html_title = None
104+
# html_title = None
107105

108106
# A shorter title for the navigation bar. Default is the same as html_title.
109-
#html_short_title = None
107+
# html_short_title = None
110108

111109
# The name of an image file (relative to this directory) to place at the top
112110
# of the sidebar.
113-
#html_logo = None
111+
# html_logo = None
114112

115113
# The name of an image file (within the static path) to use as favicon of the
116114
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
117115
# pixels large.
118-
#html_favicon = None
116+
# html_favicon = None
119117

120118
# Add any paths that contain custom static files (such as style sheets) here,
121119
# relative to this directory. They are copied after the builtin static files,
@@ -124,44 +122,44 @@
124122

125123
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
126124
# using the given strftime format.
127-
#html_last_updated_fmt = '%b %d, %Y'
125+
# html_last_updated_fmt = '%b %d, %Y'
128126

129127
# If true, SmartyPants will be used to convert quotes and dashes to
130128
# typographically correct entities.
131-
#html_use_smartypants = True
129+
# html_use_smartypants = True
132130

133131
# Custom sidebar templates, maps document names to template names.
134-
#html_sidebars = {}
132+
# html_sidebars = {}
135133

136134
# Additional templates that should be rendered to pages, maps page names to
137135
# template names.
138-
#html_additional_pages = {}
136+
# html_additional_pages = {}
139137

140138
# If false, no module index is generated.
141-
#html_domain_indices = True
139+
# html_domain_indices = True
142140

143141
# If false, no index is generated.
144-
#html_use_index = True
142+
# html_use_index = True
145143

146144
# If true, the index is split into individual pages for each letter.
147-
#html_split_index = False
145+
# html_split_index = False
148146

149147
# If true, links to the reST sources are added to the pages.
150-
#html_show_sourcelink = True
148+
# html_show_sourcelink = True
151149

152150
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
153-
#html_show_sphinx = True
151+
# html_show_sphinx = True
154152

155153
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
156-
#html_show_copyright = True
154+
# html_show_copyright = True
157155

158156
# If true, an OpenSearch description file will be output, and all pages will
159157
# contain a <link> tag referring to it. The value of this option must be the
160158
# base URL from which the finished HTML is served.
161-
#html_use_opensearch = ''
159+
# html_use_opensearch = ''
162160

163161
# This is the file name suffix for HTML files (e.g. ".xhtml").
164-
#html_file_suffix = None
162+
# html_file_suffix = None
165163

166164
# Output file base name for HTML help builder.
167165
htmlhelp_basename = 'dot2texdoc'
@@ -170,40 +168,40 @@
170168
# -- Options for LaTeX output --------------------------------------------------
171169

172170
# The paper size ('letter' or 'a4').
173-
#latex_paper_size = 'letter'
171+
# latex_paper_size = 'letter'
174172

175173
# The font size ('10pt', '11pt' or '12pt').
176-
#latex_font_size = '10pt'
174+
# latex_font_size = '10pt'
177175

178176
# Grouping the document tree into LaTeX files. List of tuples
179177
# (source start file, target name, title, author, documentclass [howto/manual]).
180178
latex_documents = [
181-
('index', 'dot2tex.tex', u'dot2tex Documentation',
182-
u'Kjell Magne Fauske', 'manual'),
179+
('index', 'dot2tex.tex', u'dot2tex Documentation',
180+
u'Kjell Magne Fauske', 'manual'),
183181
]
184182

185183
# The name of an image file (relative to this directory) to place at the top of
186184
# the title page.
187-
#latex_logo = None
185+
# latex_logo = None
188186

189187
# For "manual" documents, if this is true, then toplevel headings are parts,
190188
# not chapters.
191-
#latex_use_parts = False
189+
# latex_use_parts = False
192190

193191
# If true, show page references after internal links.
194-
#latex_show_pagerefs = False
192+
# latex_show_pagerefs = False
195193

196194
# If true, show URL addresses after external links.
197-
#latex_show_urls = False
195+
# latex_show_urls = False
198196

199197
# Additional stuff for the LaTeX preamble.
200-
#latex_preamble = ''
198+
# latex_preamble = ''
201199

202200
# Documents to append as an appendix to all manuals.
203-
#latex_appendices = []
201+
# latex_appendices = []
204202

205203
# If false, no module index is generated.
206-
#latex_domain_indices = True
204+
# latex_domain_indices = True
207205

208206

209207
# -- Options for manual page output --------------------------------------------

dot2tex/base.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,8 @@ class DotConvBase:
216216
"""Dot2TeX converter base"""
217217

218218
def __init__(self, options=None):
219+
if options is None:
220+
options = {}
219221
self.color = ""
220222
self.opacity = None
221223
self.stroke_opacity = None
@@ -723,9 +725,8 @@ def init_template_vars(self):
723725
def output(self):
724726
self.init_template_vars()
725727
template = self.clean_template(self.template)
726-
code = replace_tags(template, self.templatevars,
728+
return replace_tags(template, self.templatevars,
727729
self.templatevars)
728-
return code
729730

730731
def get_label(self, drawobj, label_attribute="label", tex_label_attribute="texlbl"):
731732
text = ""

dot2tex/dot2tex.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ def main(run_as_module=False, dotdata=None, options=None):
262262
263263
"""
264264
import platform
265+
if options is None:
266+
options = {}
265267

266268
global log
267269
if not run_as_module:

tests/test_dot2tex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33
import unittest
4+
import re
45

56
from pyparsing import ParseException
67

78
import dot2tex
8-
import re
99
from dot2tex.utils import smart_float, is_multiline_label
1010

1111
testgraph = """

0 commit comments

Comments
 (0)