git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@15103 f3b2605a-c512-4ea7-a41b-209d697bcdaa
This commit is contained in:
@ -138,12 +138,18 @@ class Formatting(object):
|
||||
elif command == "dl":
|
||||
return self.definition_list(paragraph)
|
||||
elif command == "l":
|
||||
if "olb" in commands:
|
||||
self.current_list_mode = Formatting.ORDERED_LIST_MODE
|
||||
elif "ulb" in commands:
|
||||
self.current_list_mode = Formatting.UNORDERED_LIST_MODE
|
||||
|
||||
return self.list_item(paragraph)
|
||||
elif command == "dt":
|
||||
return self.definition_term(paragraph)
|
||||
elif command == "dd":
|
||||
return self.definition_description(paragraph)
|
||||
elif command == "ulb":
|
||||
self.current_list_mode = Formatting.UNORDERED_LIST_MODE
|
||||
return self.unordered_list_begin(paragraph)
|
||||
elif command == "ule":
|
||||
return self.unordered_list_end(paragraph)
|
||||
|
||||
@ -165,7 +165,7 @@ class RSTFormatting(Formatting):
|
||||
return paragraph
|
||||
|
||||
def unordered_list_end(self, paragraph):
|
||||
return paragraph
|
||||
return paragraph.rstrip() + '\n'
|
||||
|
||||
def ordered_list_begin(self, paragraph):
|
||||
if paragraph.startswith('* '):
|
||||
@ -179,7 +179,15 @@ class RSTFormatting(Formatting):
|
||||
return paragraph
|
||||
|
||||
def ordered_list_end(self, paragraph):
|
||||
return paragraph
|
||||
return paragraph.rstrip() + '\n'
|
||||
|
||||
def ordered_list(self, paragraph):
|
||||
paragraph = super().ordered_list(paragraph)
|
||||
return paragraph.rstrip() + '\n'
|
||||
|
||||
def unordered_list(self, paragraph):
|
||||
paragraph = super().unordered_list(paragraph)
|
||||
return paragraph.rstrip() + '\n'
|
||||
|
||||
def all_breaks(self, paragraph):
|
||||
indented = ""
|
||||
|
||||
@ -222,7 +222,7 @@ class TestListFormatting(unittest.TestCase):
|
||||
"three :ule,l\n")
|
||||
self.assertEqual("* one\n"
|
||||
"* two\n"
|
||||
"* three\n", s)
|
||||
"* three\n\n", s)
|
||||
|
||||
def test_multi_line_unordered_list_elements(self):
|
||||
s = self.txt2rst.convert("one :ulb,l\n"
|
||||
@ -232,7 +232,7 @@ class TestListFormatting(unittest.TestCase):
|
||||
self.assertEqual("* one\n"
|
||||
"* two\n"
|
||||
" words\n"
|
||||
"* three\n", s)
|
||||
"* three\n\n", s)
|
||||
|
||||
def test_ordered_list(self):
|
||||
s = self.txt2rst.convert("one\n"
|
||||
@ -248,7 +248,7 @@ class TestListFormatting(unittest.TestCase):
|
||||
"three :ole,l\n")
|
||||
self.assertEqual("#. one\n"
|
||||
"#. two\n"
|
||||
"#. three\n", s)
|
||||
"#. three\n\n", s)
|
||||
|
||||
def test_multi_line_ordered_list_elements(self):
|
||||
s = self.txt2rst.convert("one :olb,l\n"
|
||||
@ -258,7 +258,37 @@ class TestListFormatting(unittest.TestCase):
|
||||
self.assertEqual("#. one\n"
|
||||
"#. two\n"
|
||||
" words\n"
|
||||
"#. three\n", s)
|
||||
"#. three\n\n", s)
|
||||
|
||||
def test_paragraphs_ordered_list(self):
|
||||
s = self.txt2rst.convert("first\n"
|
||||
"paragraph :olb,l\n"
|
||||
"second\n"
|
||||
"paragraph :l\n"
|
||||
"third\n"
|
||||
"paragraph :ole,l\n")
|
||||
self.assertEqual("#. first\n"
|
||||
" paragraph\n"
|
||||
"#. second\n"
|
||||
" paragraph\n"
|
||||
"#. third\n"
|
||||
" paragraph\n\n", s)
|
||||
|
||||
def test_paragraphs_unordered_list(self):
|
||||
s = self.txt2rst.convert("first\n"
|
||||
"paragraph :ulb,l\n"
|
||||
"second\n"
|
||||
"paragraph :l\n"
|
||||
"third\n"
|
||||
"paragraph :ule,l\n")
|
||||
self.assertEqual("* first\n"
|
||||
" paragraph\n"
|
||||
"* second\n"
|
||||
" paragraph\n"
|
||||
"* third\n"
|
||||
" paragraph\n\n", s)
|
||||
|
||||
|
||||
|
||||
def test_definition_list(self):
|
||||
s = self.txt2rst.convert("A\n"
|
||||
|
||||
Reference in New Issue
Block a user