Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix versionadded & version changed directives #982

Merged
merged 5 commits into from
Jan 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions rst2pdf/pdfbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
from sphinx.builders import Builder
from sphinx.environment.adapters.indexentries import IndexEntries
from sphinx.locale import _
from sphinx.locale import versionlabels
from sphinx.transforms import SphinxTransform
from sphinx.util.console import darkgreen, red
from sphinx.util import SEP
Expand Down Expand Up @@ -733,13 +732,7 @@ def visit_highlightlang(self, node):
raise nodes.SkipNode

def visit_versionmodified(self, node):
text = versionlabels[node['type']] % node['version']
if len(node):
text += ': '
else:
text += '.'
replacement = nodes.paragraph()
replacement += nodes.Text(text)
replacement.extend(node.children)
node.parent.replace(node, replacement)

Expand Down
45 changes: 45 additions & 0 deletions rst2pdf/tests/input/sphinx-versionmodified/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-

# -- General configuration -----------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['rst2pdf.pdfbuilder']

# The master toctree document.
master_doc = 'index'

# General information about the project.
project = u'sphinxmarkup'
copyright = u'2020'

# 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 = 'test'
# The full version, including alpha/beta/rc tags.
release = 'test'


# -- Options for PDF output ----------------------------------------------------

# Grouping the document tree into PDF files. List of tuples
# (source start file, target name, title, author).
pdf_documents = [('index', u'sphinx-versionmodified', u'My Project', u'Author Name')]

# A comma-separated list of custom stylesheets. Example:
pdf_stylesheets = ['sphinx']

# Language to be used for hyphenation support
pdf_language = "en_US"

# If false, no index is generated.
pdf_use_index = True

# If false, no modindex is generated.
pdf_use_modindex = False

# If false, no coverpage is generated.
pdf_use_coverpage = False
15 changes: 15 additions & 0 deletions rst2pdf/tests/input/sphinx-versionmodified/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

.. versionadded:: 0.0.1

.. versionadded:: 0.1.0
this feature was added

.. versionchanged:: 1.0.0
stable release changes

.. versionchanged:: 1.0.1

.. deprecated:: 0.0.2

.. deprecated:: 0.2.0
this feature has been deprecated
Binary file not shown.