Skip to content

Commit

Permalink
Merge cbdfb4e into bcc50e3
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Mar 9, 2020
2 parents bcc50e3 + cbdfb4e commit e7a4a75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 23 deletions.
2 changes: 1 addition & 1 deletion myst_parser/__init__.py
@@ -1,4 +1,4 @@
__version__ = "0.5.0"
__version__ = "0.5.1"


def text_to_tokens(text: str):
Expand Down
29 changes: 7 additions & 22 deletions myst_parser/block_tokens.py
Expand Up @@ -13,30 +13,15 @@
class Document(block_tokens.Document):
"""Document token."""

# TODO this class should eventually be removed

@classmethod
def read(
cls,
lines,
start_line: int = 0,
reset_definitions=True,
store_definitions=False,
front_matter=True,
propogate_pos: bool = True,
):
"""Read a document
:param lines: Lines or string to parse
:param start_line: The initial line (used for nested parsing)
:param reset_definitions: remove any previously stored link_definitions
:param store_definitions: store LinkDefinitions or ignore them
:param front_matter: search for an initial YAML block front matter block
(note this is not strictly CommonMark compliant)
"""
doc = super().read(
lines, start_line, reset_definitions, store_definitions, front_matter
)
def read(cls, *args, **kwargs):
# default to front matter is True
kwargs["front_matter"] = kwargs.get("front_matter", True)
doc = super().read(*args, **kwargs)

if propogate_pos:
if kwargs.get("propogate_pos", True):
# TODO this is a placeholder for implementing span level range storage
# (with start/end character attributes)
for result in doc.walk():
Expand Down

0 comments on commit e7a4a75

Please sign in to comment.