How to use the dungeonsheets.make_sheets.rst_to_latex function in dungeonsheets

To help you get started, we’ve selected a few dungeonsheets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
def test_headings(self):
        # Simple heading by itself
        text = make_sheets.rst_to_latex('Hello, world\n============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Simple heading with leading whitespace
        text = make_sheets.rst_to_latex('    Hello, world\n    ============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Heading with text after it
        text = make_sheets.rst_to_latex('Hello, world\n============\n\nThis is some text')
        self.assertEqual('\\section*{Hello, world}\n\nThis is some text', text)
        # Heading with text before it
        text = make_sheets.rst_to_latex('This is a paragraph\n\nHello, world\n============\n')
        self.assertEqual('This is a paragraph\n\n\\section*{Hello, world}\n', text)
        # Check that levels of headings are parsed appropriately
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n')
        self.assertEqual('\\subsubsection*{Hello, world}\n', text)
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n', top_heading_level=3)
        self.assertEqual('\\subparagraph*{Hello, world}\n', text)
        # This is a bad heading missing with all the underline on one line
        text = make_sheets.rst_to_latex('Hello, world^^^^^^^^^^^^\n')
        self.assertEqual('Hello, world\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\n', text)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
def test_bullet_list(self):
        tex = make_sheets.rst_to_latex("\n- Hello\n- World\n\n")
        expected_tex = "\n\\begin{itemize}\n\\item{Hello}\n\\item{World}\n\\end{itemize}\n\n"
        self.assertEqual(expected_tex, tex)
        # Other bullet characters
        tex = make_sheets.rst_to_latex("\n* Hello\n* World\n\n")
        self.assertEqual(expected_tex, tex)
        tex = make_sheets.rst_to_latex("\n+ Hello\n+ World\n\n")
        self.assertEqual(expected_tex, tex)
        # A real list taken from a docstring
        real_list = """
        - Secondhand (you have heard of the target)  +5
        - Firsthand (you have met the target) - +0
        - Familiar (you know the target well) - -5
        
        """
        tex = make_sheets.rst_to_latex(real_list)
        self.assertIn("\\begin{itemize}", tex)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
def test_verbatim(self):
        text = make_sheets.rst_to_latex('``hello, world``')
        self.assertIn(r'\begin{verbatim}', text)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
def test_headings(self):
        # Simple heading by itself
        text = make_sheets.rst_to_latex('Hello, world\n============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Simple heading with leading whitespace
        text = make_sheets.rst_to_latex('    Hello, world\n    ============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Heading with text after it
        text = make_sheets.rst_to_latex('Hello, world\n============\n\nThis is some text')
        self.assertEqual('\\section*{Hello, world}\n\nThis is some text', text)
        # Heading with text before it
        text = make_sheets.rst_to_latex('This is a paragraph\n\nHello, world\n============\n')
        self.assertEqual('This is a paragraph\n\n\\section*{Hello, world}\n', text)
        # Check that levels of headings are parsed appropriately
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n')
        self.assertEqual('\\subsubsection*{Hello, world}\n', text)
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n', top_heading_level=3)
        self.assertEqual('\\subparagraph*{Hello, world}\n', text)
        # This is a bad heading missing with all the underline on one line
        text = make_sheets.rst_to_latex('Hello, world^^^^^^^^^^^^\n')
        self.assertEqual('Hello, world\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\n', text)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
# Simple heading with leading whitespace
        text = make_sheets.rst_to_latex('    Hello, world\n    ============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Heading with text after it
        text = make_sheets.rst_to_latex('Hello, world\n============\n\nThis is some text')
        self.assertEqual('\\section*{Hello, world}\n\nThis is some text', text)
        # Heading with text before it
        text = make_sheets.rst_to_latex('This is a paragraph\n\nHello, world\n============\n')
        self.assertEqual('This is a paragraph\n\n\\section*{Hello, world}\n', text)
        # Check that levels of headings are parsed appropriately
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n')
        self.assertEqual('\\subsubsection*{Hello, world}\n', text)
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n', top_heading_level=3)
        self.assertEqual('\\subparagraph*{Hello, world}\n', text)
        # This is a bad heading missing with all the underline on one line
        text = make_sheets.rst_to_latex('Hello, world^^^^^^^^^^^^\n')
        self.assertEqual('Hello, world\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\n', text)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
# Simple heading by itself
        text = make_sheets.rst_to_latex('Hello, world\n============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Simple heading with leading whitespace
        text = make_sheets.rst_to_latex('    Hello, world\n    ============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Heading with text after it
        text = make_sheets.rst_to_latex('Hello, world\n============\n\nThis is some text')
        self.assertEqual('\\section*{Hello, world}\n\nThis is some text', text)
        # Heading with text before it
        text = make_sheets.rst_to_latex('This is a paragraph\n\nHello, world\n============\n')
        self.assertEqual('This is a paragraph\n\n\\section*{Hello, world}\n', text)
        # Check that levels of headings are parsed appropriately
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n')
        self.assertEqual('\\subsubsection*{Hello, world}\n', text)
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n', top_heading_level=3)
        self.assertEqual('\\subparagraph*{Hello, world}\n', text)
        # This is a bad heading missing with all the underline on one line
        text = make_sheets.rst_to_latex('Hello, world^^^^^^^^^^^^\n')
        self.assertEqual('Hello, world\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\n', text)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
def test_bullet_list(self):
        tex = make_sheets.rst_to_latex("\n- Hello\n- World\n\n")
        expected_tex = "\n\\begin{itemize}\n\\item{Hello}\n\\item{World}\n\\end{itemize}\n\n"
        self.assertEqual(expected_tex, tex)
        # Other bullet characters
        tex = make_sheets.rst_to_latex("\n* Hello\n* World\n\n")
        self.assertEqual(expected_tex, tex)
        tex = make_sheets.rst_to_latex("\n+ Hello\n+ World\n\n")
        self.assertEqual(expected_tex, tex)
        # A real list taken from a docstring
        real_list = """
        - Secondhand (you have heard of the target)  +5
        - Firsthand (you have met the target) - +0
        - Familiar (you know the target well) - -5
        
        """
        tex = make_sheets.rst_to_latex(real_list)
        self.assertIn("\\begin{itemize}", tex)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
def test_headings(self):
        # Simple heading by itself
        text = make_sheets.rst_to_latex('Hello, world\n============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Simple heading with leading whitespace
        text = make_sheets.rst_to_latex('    Hello, world\n    ============\n')
        self.assertEqual('\\section*{Hello, world}\n', text)
        # Heading with text after it
        text = make_sheets.rst_to_latex('Hello, world\n============\n\nThis is some text')
        self.assertEqual('\\section*{Hello, world}\n\nThis is some text', text)
        # Heading with text before it
        text = make_sheets.rst_to_latex('This is a paragraph\n\nHello, world\n============\n')
        self.assertEqual('This is a paragraph\n\n\\section*{Hello, world}\n', text)
        # Check that levels of headings are parsed appropriately
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n')
        self.assertEqual('\\subsubsection*{Hello, world}\n', text)
        text = make_sheets.rst_to_latex('Hello, world\n^^^^^^^^^^^^\n', top_heading_level=3)
        self.assertEqual('\\subparagraph*{Hello, world}\n', text)
        # This is a bad heading missing with all the underline on one line
        text = make_sheets.rst_to_latex('Hello, world^^^^^^^^^^^^\n')
        self.assertEqual('Hello, world\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\\^\n', text)
github canismarko / dungeon-sheets / tests / test_make_sheets.py View on Github external
tex = make_sheets.rst_to_latex("\n- Hello\n- World\n\n")
        expected_tex = "\n\\begin{itemize}\n\\item{Hello}\n\\item{World}\n\\end{itemize}\n\n"
        self.assertEqual(expected_tex, tex)
        # Other bullet characters
        tex = make_sheets.rst_to_latex("\n* Hello\n* World\n\n")
        self.assertEqual(expected_tex, tex)
        tex = make_sheets.rst_to_latex("\n+ Hello\n+ World\n\n")
        self.assertEqual(expected_tex, tex)
        # A real list taken from a docstring
        real_list = """
        - Secondhand (you have heard of the target)  +5
        - Firsthand (you have met the target) - +0
        - Familiar (you know the target well) - -5
        
        """
        tex = make_sheets.rst_to_latex(real_list)
        self.assertIn("\\begin{itemize}", tex)