File: samepage.py

package info (click to toggle)
openmm 8.1.2%2Bdfsg-12
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 119,192 kB
  • sloc: xml: 377,325; cpp: 226,673; ansic: 42,767; python: 32,634; lisp: 2,441; sh: 440; makefile: 254; f90: 233; csh: 19
file content (17 lines) | stat: -rw-r--r-- 585 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from docutils.parsers.rst import Directive
from docutils.nodes import compound, raw

class SamepageDirective(Directive):
    
    has_content = True

    def run(self):
        prefix = raw('', '\\par\\begin{samepage}', format='latex')
        suffix = raw('', '\\end{samepage}\\par', format='latex')
        text = '\n'.join(self.content)
        content_node = compound(rawsource=text)
        self.state.nested_parse(self.content, self.content_offset, content_node)
        return [prefix, content_node, suffix]

def setup(app):
    app.add_directive('samepage', SamepageDirective)