-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
279 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env python | ||
from markdown.parser.base.block_element import BlockElement | ||
|
||
|
||
class ContainerElement(BlockElement): | ||
""" | ||
The abstract container element. | ||
""" | ||
|
||
def __init__(self): | ||
super(ContainerElement, self).__init__() | ||
self._blocks = [] | ||
|
||
def get_blocks(self): | ||
""" | ||
Get the blocks elements. | ||
Returns: | ||
An array. | ||
""" | ||
return self._blocks | ||
|
||
def add_block(self, block): | ||
""" | ||
Append a block element. | ||
Args: | ||
block: a block element. | ||
Returns: | ||
None. | ||
""" | ||
self._blocks.append(block) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
from markdown.parser.base.block_element_parser import BlockElementParser | ||
|
||
|
||
class ContainerElementParser(BlockElementParser): | ||
""" | ||
The abstract container element parser. | ||
""" | ||
|
||
AUX_ALIGN = 'align' # The align offset for lists. | ||
|
||
def __init__(self, config): | ||
super(ContainerElementParser, self).__init__(config) | ||
|
||
def get_align(self, auxiliary): | ||
""" | ||
Get the align offset. | ||
Args: | ||
auxiliary: A dict. | ||
Returns: | ||
An integer. | ||
""" | ||
if auxiliary is None: | ||
return 0 | ||
if self.AUX_ALIGN not in auxiliary: | ||
return 0 | ||
return int(auxiliary[self.AUX_ALIGN]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,4 @@ | ||
#!/usr/bin/env python | ||
|
||
from markdown.parser.containers.block_quote_parser import BlockQuoteParser | ||
from markdown.parser.containers.bullet_list_parser import BulletListParser | ||
from markdown.parser.containers.container_parser import ContainerParser | ||
from markdown.parser.containers.list_parser import ListParser | ||
from markdown.parser.containers.ordered_list_parser import OrderedListParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env python | ||
from markdown.parser.base import ContainerElement | ||
|
||
|
||
class BlockQuoteElement(ContainerElement): | ||
""" | ||
The block quote element. | ||
""" | ||
|
||
def __init__(self): | ||
super(BlockQuoteElement, self).__init__() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python | ||
from markdown.parser.base import ContainerElement | ||
|
||
|
||
class ListElement(ContainerElement): | ||
""" | ||
The list element. | ||
""" | ||
|
||
def __init__(self): | ||
super(ListElement, self).__init__() | ||
self._is_bullet = True | ||
self._start = 1 | ||
|
||
def is_bullet(self): | ||
return self._is_bullet | ||
|
||
def is_ordered(self): | ||
return not self._is_bullet | ||
|
||
def start_number(self): | ||
return self._start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env python | ||
from markdown.parser.base import ContainerElementParser | ||
|
||
|
||
class ListItemParser(ContainerElementParser): | ||
""" | ||
The block quote element. | ||
""" | ||
|
||
def __init__(self, config): | ||
super(ListItemParser, self).__init__(config) | ||
|
||
def parse(self, code, index, auxiliary=None): | ||
start = index | ||
# 0~3 spaces | ||
align = self.get_align() | ||
success, index = self.check_indent(code, index, align) | ||
if not success: | ||
return None, start |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
#!/usr/bin/env python | ||
|
||
from markdown.parser.leaves.atx_heading_parser import AtxHeadingParser | ||
from markdown.parser.leaves.setext_heading_element import SetextHeadingElement | ||
from markdown.parser.leaves.paragraph_element import ParagraphElement | ||
from markdown.parser.leaves.empty_line_element import EmptyLineElement | ||
from markdown.parser.leaves.paragraph_parser import ParagraphParser | ||
from markdown.parser.leaves.thematic_break_element import ThematicBreakElement | ||
from markdown.parser.leaves.thematic_break_parser import ThematicBreakParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.