Skip to content

Commit

Permalink
Merge pull request #982 from 2bndy5/master
Browse files Browse the repository at this point in the history
fix versionadded & version changed directives
  • Loading branch information
lornajane committed Jan 14, 2021
2 parents cd0b8a3 + 17245de commit 107cc24
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 7 deletions.
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.

0 comments on commit 107cc24

Please sign in to comment.