Skip to content

Commit

Permalink
The ReStructuredText directive "figure" now is translated into the HT…
Browse files Browse the repository at this point in the history
…ML5 tag "figure"
  • Loading branch information
regebro committed Aug 21, 2018
1 parent b511250 commit c18e27c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 8 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changes
3.0 (unreleased)
----------------

- Nothing changed yet.
- The ReStructuredText directive "figure" now is translated into the HTML5
tag "figure", with the caption becoming a figcaption tag.


2.5 (2017-12-10)
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/hovercraft.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,9 @@ Presenter console!
**Hovercraft!**
===============

.. image:: images/hovercraft_logo.png
.. figure:: images/hovercraft_logo.png

The merge of convenience and cool!
The merge of convenience and cool!

.. note::

Expand Down
6 changes: 2 additions & 4 deletions hovercraft/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,8 @@ def update_positions(tree, positions):
els = tree.findall(".//*[@id='" + value + "']")
for el in els :
pos[abs_key] = num(el.get(abs_key)) + pos.get(abs_key)
print(num(el.get(abs_key)))
print(pos.get(abs_key))
step.attrib[abs_key] = str(pos.get(abs_key))
else:
else:
step.attrib[key] = str(pos[key])

if 'hovercraft-path' in step.attrib:
Expand All @@ -240,7 +238,7 @@ def update_positions(tree, positions):

def position_slides(tree):
"""Position the slides in the tree"""

positions = gather_positions(tree)
positions = calculate_positions(positions)
update_positions(tree, positions)
20 changes: 19 additions & 1 deletion hovercraft/templates/reST.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,12 @@
SUCH DAMAGE.
-->

<!-- Modifications by Lennart Regebro, 2013:
<!--
Modifications by Lennart Regebro, 2018:
* Added support for the HTML5 <figure> and <figcaption> tags.
Modifications by Lennart Regebro, 2013:
* Added support for the <notes>-tag.
Expand Down Expand Up @@ -482,6 +487,19 @@ Modification by Carl Mayer, 2013:
</span>
</xsl:template>

<xsl:template match="figure">
<figure>
<xsl:apply-templates />
</figure>
</xsl:template>

<xsl:template match="figure/caption">
<figcaption>
<xsl:apply-templates />
</figcaption>
</xsl:template>


<!-- Skip ReST comments -->
<xsl:template match="comment">
</xsl:template>
Expand Down

0 comments on commit c18e27c

Please sign in to comment.