PKY9Gnnsphinxcontrib/__init__.py# -*- 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__) PK:Gsphinxcontrib/proof/__init__.py# -*- coding: utf-8 -*- # Copyright 2015 Louis Paternault # # Sphinxcontrib-Proof is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Sphinxcontrib-Proof is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Sphinxcontrib-Proof. If not, see . """Provide tools to typeset theorems, proofs, etc. in Sphinx documentation.""" import os import pkg_resources from docutils import nodes from docutils.parsers.rst import directives from sphinx.util import copy_static_entry from sphinx.util.nodes import set_source_info from sphinx.util.compat import Directive def package_file(*filename): """Return the path to a filename present in package data.""" return pkg_resources.resource_filename("sphinxcontrib.proof", os.path.join("data", *filename)) VERSION = "0.1.0" PREFIX = "proof:" class StatementNode(nodes.General, nodes.Element): """Statement""" pass class ProofNode(nodes.Part, nodes.Element): """Proof""" pass class ContentNode(nodes.General, nodes.Element): """Content of a proof or a statement""" pass # This should be internationalized using gettext… Patch welcome! FRENCH = { 'lemma': u"Lemme", 'property': u"Propriété", 'example': u"Exemple", 'theorem': u"Théorème", 'definition': u"Définition", 'proof': u"Preuve", 'conjecture': u"Conjecture", 'algorithm': u"Algorithme", } class ProofEnvironment(Directive): """A proof environment""" has_content = True required_arguments = 0 optional_arguments = 1 final_argument_whitespace = True option_spec = { 'label': directives.unchanged_required, } def run(self): """Render this environment""" env = self.state.document.settings.env targetid = 'index-%s' % env.new_serialno('index') targetnode = nodes.target('', '', ids=[targetid]) node = ProofNode('\n'.join(self.content)) node['classes'] += ['proof-type-proof'] if self.arguments: node['title'] = self.arguments[0] content = ContentNode() self.state.nested_parse(self.content, self.content_offset, content) content['classes'] += ['proof-content'] node += content set_source_info(self, node) return [targetnode, node] class StatementEnvironment(Directive): """A statement environment""" has_content = True required_arguments = 0 optional_arguments = 1 final_argument_whitespace = True option_spec = { 'label': directives.unchanged_required, } def run(self): """Render this environment""" env = self.state.document.settings.env targetid = 'index-%s' % env.new_serialno('index') targetnode = nodes.target('', '', ids=[targetid]) node = StatementNode('\n'.join(self.content)) node['name'] = self.name[len(PREFIX):] node['classes'] += ['proof', 'proof-type-{}'.format(node['name'])] if self.arguments: node['title'] = self.arguments[0] content = ContentNode() self.state.nested_parse(self.content, self.content_offset, content) content['classes'] += ['proof-content'] node += content set_source_info(self, node) return [targetnode, node] # HTML def html_visit_proof_node(self, node): """Enter :class:`ProofNode` in HTML builder.""" self.body.append(self.starttag(node, 'div')) self.body.append("""
""") self.body.append("""Preuve""") if 'title' in node: self.body.append("""""") self.body.append(u"({})".format(node['title'])) self.body.append("""""") self.body.append("""
""") def html_depart_proof_node(self, node): """Leave :class:`ProofNode` in HTML builder.""" # pylint: disable=unused-argument self.body.append('') def html_visit_statement_node(self, node): """Enter :class:`StatementNode` in HTML builder.""" self.body.append(self.starttag(node, 'div')) self.body.append("""
""") self.body.append(u"""{}""".format(FRENCH[node['name']])) if 'title' in node: self.body.append("""""") self.body.append(u"({})".format(node['title'])) self.body.append("""""") self.body.append("""
""") def html_depart_statement_node(self, node): """Leave :class:`StatementNode` in HTML builder.""" # pylint: disable=unused-argument self.body.append('') def html_visit_content_node(self, node): """Enter :class:`ContentNode` in HTML builder.""" self.body.append(self.starttag(node, 'div')) def html_depart_content_node(self, node): """Leave :class:`ContentNode` in HTML builder.""" # pylint: disable=unused-argument self.body.append('') # LaTeX def latex_visit_proof_node(self, node): """Enter :class:`ProofNode` in LaTeX builder.""" self.body.append(r"\begin{proof}") if 'title' in node: self.body.append("[{}]".format(node['title'])) self.body.append("\n") def latex_depart_proof_node(self, node): """Leave :class:`ProofNode` in LaTeX builder.""" # pylint: disable=unused-argument self.body.append(r"\end{proof}") self.body.append("\n") def latex_visit_statement_node(self, node): """Enter :class:`StatementNode` in LaTeX builder.""" self.body.append(r"\begin{{{}}}".format(node['name'])) if 'title' in node: self.body.append("[{}]".format(node['title'])) self.body.append("\n") def latex_depart_statement_node(self, node): """Leave :class:`StatementNode` in LaTeX builder.""" self.body.append(r"\end{{{}}}".format(node['name'])) self.body.append("\n") def latex_visit_content_node(self, node): """Enter :class:`ContentNode` in LaTeX builder.""" # pylint: disable=unused-argument pass def latex_depart_content_node(self, node): """Leave :class:`ContentNode` in LaTeX builder.""" # pylint: disable=unused-argument pass def builder_inited(app): """Hook called when builder has been inited.""" if app.builder.name == "latex": app.builder.config.latex_additional_files.append( package_file("_static", "sphinxcontribproof.sty") ) def setup(app): """Plugin setup""" app.add_stylesheet("proof.css") app.add_javascript("proof.js") app.add_node( ProofNode, html=(html_visit_proof_node, html_depart_proof_node), latex=(latex_visit_proof_node, latex_depart_proof_node), ) app.add_node( StatementNode, html=(html_visit_statement_node, html_depart_statement_node), latex=(latex_visit_statement_node, latex_depart_statement_node), ) app.add_node( ContentNode, html=(html_visit_content_node, html_depart_content_node), latex=(latex_visit_content_node, latex_depart_content_node), ) app.add_directive(PREFIX + 'property', StatementEnvironment) app.add_directive(PREFIX + 'lemma', StatementEnvironment) app.add_directive(PREFIX + 'example', StatementEnvironment) app.add_directive(PREFIX + 'theorem', StatementEnvironment) app.add_directive(PREFIX + 'definition', StatementEnvironment) app.add_directive(PREFIX + 'proof', ProofEnvironment) app.add_directive(PREFIX + 'conjecture', StatementEnvironment) app.add_directive(PREFIX + 'algorithm', StatementEnvironment) app.connect('builder-inited', builder_inited) app.add_latex_package("sphinxcontribproof") PK8G`?]]7sphinxcontrib/proof/data/_static/sphinxcontribproof.sty\RequirePackage{amsthm} \makeatletter \newtheorem{theorem}{Théorème}[chapter] \newtheorem{property}[theorem]{Propriété} \newtheorem{lemma}[theorem]{Lemme} \newtheorem{example}[theorem]{Exemple} \newtheorem{definition}[theorem]{Définition} \newtheorem{conjecture}[theorem]{Conjecture} \newtheorem{algorithm}[theorem]{Algorithme} \makeatother PK9Hϼ{{3sphinxcontrib_proof-0.1.0.dist-info/DESCRIPTION.rstDescription of the `sphinxcontrib-proof` Sphinx Extension ========================================================= |sources| |pypi| |documentation| |license| This `sphinx `__ extension provides some directives to typeset theorems, properties, proofs, etc. You can see it in action in `Jouets' documentation `_. What's new? ----------- See `changelog `_. Install ------- This module is compatible with both python 2 and 3. See the end of list for a (quick and dirty) Debian package. * From sources: * Download: https://pypi.python.org/pypi/sphinxcontrib-proof * Install (in a `virtualenv`, if you do not want to mess with your distribution installation system):: python setup.py install * From pip:: pip install sphinxcontrib-proof * Quick and dirty Debian (and Ubuntu?) package This requires `stdeb `_ to be installed:: python setup.py --command-packages=stdeb.command bdist_deb sudo dpkg -i deb_dist/python3-sphinxcontrib-proof-_all.deb Documentation ------------- The documentation is available on `readthedocs `_. You can build it using:: cd doc && make html .. |documentation| image:: http://readthedocs.org/projects/sphinxcontrib-proof/badge :target: http://sphinxcontrib-proof.readthedocs.org .. |pypi| image:: https://img.shields.io/pypi/v/sphinxcontrib-proof.svg :target: http://pypi.python.org/pypi/sphinxcontrib-proof .. |license| image:: https://img.shields.io/pypi/l/sphinxcontrib-proof.svg :target: http://www.gnu.org/licenses/agpl-3.0.html .. |sources| image:: https://img.shields.io/badge/sources-sphinxcontrib--proof-brightgreen.svg :target: http://git.framasoft.org/spalax/sphinxcontrib-proof PK9HQ(1sphinxcontrib_proof-0.1.0.dist-info/metadata.json{"classifiers": ["Development Status :: 4 - Beta", "Framework :: Sphinx :: Extension", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "Operating System :: Unix", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Documentation :: Sphinx", "Topic :: Scientific/Engineering :: Mathematics", "Topic :: Software Development :: Libraries :: Python Modules"], "extensions": {"python.details": {"contacts": [{"email": "spalax@gresille.org", "name": "Louis Paternault", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://git.framasoft.org/spalax/sphinxcontrib-proof"}}}, "extras": [], "generator": "bdist_wheel (0.26.0)", "license": "AGPLv3 or any later version", "metadata_version": "2.0", "name": "sphinxcontrib-proof", "run_requires": [{"requires": ["sphinx"]}], "summary": "This packages contains the Proof sphinx extension, which provides directives to typeset theorems, lemmas, proofs, etc.", "version": "0.1.0"}PKܳ9HjP1sphinxcontrib_proof-0.1.0.dist-info/top_level.txtsphinxcontrib PK9Hndnn)sphinxcontrib_proof-0.1.0.dist-info/WHEELWheel-Version: 1.0 Generator: bdist_wheel (0.26.0) Root-Is-Purelib: true Tag: py2-none-any Tag: py3-none-any PK9H }o ,sphinxcontrib_proof-0.1.0.dist-info/METADATAMetadata-Version: 2.0 Name: sphinxcontrib-proof Version: 0.1.0 Summary: This packages contains the Proof sphinx extension, which provides directives to typeset theorems, lemmas, proofs, etc. Home-page: https://git.framasoft.org/spalax/sphinxcontrib-proof Author: Louis Paternault Author-email: spalax@gresille.org License: AGPLv3 or any later version Platform: UNKNOWN Classifier: Development Status :: 4 - Beta Classifier: Framework :: Sphinx :: Extension Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) Classifier: Operating System :: Unix Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.4 Classifier: Programming Language :: Python :: 3.5 Classifier: Topic :: Documentation :: Sphinx Classifier: Topic :: Scientific/Engineering :: Mathematics Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Dist: sphinx Description of the `sphinxcontrib-proof` Sphinx Extension ========================================================= |sources| |pypi| |documentation| |license| This `sphinx `__ extension provides some directives to typeset theorems, properties, proofs, etc. You can see it in action in `Jouets' documentation `_. What's new? ----------- See `changelog `_. Install ------- This module is compatible with both python 2 and 3. See the end of list for a (quick and dirty) Debian package. * From sources: * Download: https://pypi.python.org/pypi/sphinxcontrib-proof * Install (in a `virtualenv`, if you do not want to mess with your distribution installation system):: python setup.py install * From pip:: pip install sphinxcontrib-proof * Quick and dirty Debian (and Ubuntu?) package This requires `stdeb `_ to be installed:: python setup.py --command-packages=stdeb.command bdist_deb sudo dpkg -i deb_dist/python3-sphinxcontrib-proof-_all.deb Documentation ------------- The documentation is available on `readthedocs `_. You can build it using:: cd doc && make html .. |documentation| image:: http://readthedocs.org/projects/sphinxcontrib-proof/badge :target: http://sphinxcontrib-proof.readthedocs.org .. |pypi| image:: https://img.shields.io/pypi/v/sphinxcontrib-proof.svg :target: http://pypi.python.org/pypi/sphinxcontrib-proof .. |license| image:: https://img.shields.io/pypi/l/sphinxcontrib-proof.svg :target: http://www.gnu.org/licenses/agpl-3.0.html .. |sources| image:: https://img.shields.io/badge/sources-sphinxcontrib--proof-brightgreen.svg :target: http://git.framasoft.org/spalax/sphinxcontrib-proof PK9HKRR*sphinxcontrib_proof-0.1.0.dist-info/RECORDsphinxcontrib/__init__.py,sha256=AzwjVA-ne8AjYD3UB_A_YrXeXnaYuCX-HRJa6JIaLBQ,366 sphinxcontrib/proof/__init__.py,sha256=0XZR0j3aPVbDV4a9MIZ47kXxFfUSwQm5UsvRhBsfC3Q,8111 sphinxcontrib/proof/data/_static/sphinxcontribproof.sty,sha256=vfBZzCOLSIHyeAKzKTLmwBTsEUK81vZIqkqXjjFJrHg,349 sphinxcontrib_proof-0.1.0.dist-info/DESCRIPTION.rst,sha256=u6s3gzE6tXmRPNTM48WOK5eRUyVb4buZvAeGXtVF7mA,1915 sphinxcontrib_proof-0.1.0.dist-info/METADATA,sha256=SNdq6zHyZuJkmLJhq9XI_PBgKa-q14bkWn2IQp1RqdE,3044 sphinxcontrib_proof-0.1.0.dist-info/RECORD,, sphinxcontrib_proof-0.1.0.dist-info/WHEEL,sha256=GrqQvamwgBV4nLoJe0vhYRSWzWsx7xjlt74FT0SWYfE,110 sphinxcontrib_proof-0.1.0.dist-info/metadata.json,sha256=xgTY_YfLEkp8cL7KQdDcJP06r9JocwoAvVoynJ1QrxE,1242 sphinxcontrib_proof-0.1.0.dist-info/top_level.txt,sha256=VJrV3_vaiKQVgVpR0I1iecxoO0drzGu-M0j40PVP2QQ,14 PKY9Gnnsphinxcontrib/__init__.pyPK:Gsphinxcontrib/proof/__init__.pyPK8G`?]]7!sphinxcontrib/proof/data/_static/sphinxcontribproof.styPK9Hϼ{{3C#sphinxcontrib_proof-0.1.0.dist-info/DESCRIPTION.rstPK9HQ(1+sphinxcontrib_proof-0.1.0.dist-info/metadata.jsonPKܳ9HjP180sphinxcontrib_proof-0.1.0.dist-info/top_level.txtPK9Hndnn)0sphinxcontrib_proof-0.1.0.dist-info/WHEELPK9H }o ,J1sphinxcontrib_proof-0.1.0.dist-info/METADATAPK9HKRR*x=sphinxcontrib_proof-0.1.0.dist-info/RECORDPK !A