Skip to content

Commit

Permalink
Remove specific arguments from Document.read
Browse files Browse the repository at this point in the history
This is to make it more compatible with upstream changes
  • Loading branch information
chrisjsewell committed Mar 9, 2020
1 parent bcc50e3 commit 0e9502a
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions myst_parser/block_tokens.py
Original file line number Diff line number Diff line change
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 0e9502a

Please sign in to comment.