Compare commits
No commits in common. "434fb8ab0e23869f5a25194e2667a1ee4757afbd" and "6b8b4de21e8327fbbfb0b986d3f6e2aa913e44af" have entirely different histories.
434fb8ab0e
...
6b8b4de21e
@ -102,14 +102,6 @@ NON_FINISHED_GROUPS = (type(None), dom.ListGroupNode, dom.ResultsDrawerNode, dom
|
|||||||
FREE_GROUPS = (dom.CodeBlock,)
|
FREE_GROUPS = (dom.CodeBlock,)
|
||||||
|
|
||||||
|
|
||||||
class NonReproducibleDocument(Exception):
|
|
||||||
"""
|
|
||||||
Exception thrown when a document would be saved as different contents
|
|
||||||
from what it's loaded from.
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def get_tokens(value):
|
def get_tokens(value):
|
||||||
if isinstance(value, Text):
|
if isinstance(value, Text):
|
||||||
return value.contents
|
return value.contents
|
||||||
@ -1673,7 +1665,7 @@ class OrgDoc:
|
|||||||
yield from headline.get_code_snippets()
|
yield from headline.get_code_snippets()
|
||||||
|
|
||||||
# Writing
|
# Writing
|
||||||
def dump_headline(self, headline, recursive=True):
|
def dump_headline(self, headline):
|
||||||
|
|
||||||
tags = ""
|
tags = ""
|
||||||
if len(headline.shallow_tags) > 0:
|
if len(headline.shallow_tags) > 0:
|
||||||
@ -1746,9 +1738,8 @@ class OrgDoc:
|
|||||||
content = content[:-1]
|
content = content[:-1]
|
||||||
yield content
|
yield content
|
||||||
|
|
||||||
if recursive:
|
for child in headline.children:
|
||||||
for child in headline.children:
|
yield from self.dump_headline(child)
|
||||||
yield from self.dump_headline(child, recursive=recursive)
|
|
||||||
|
|
||||||
def dump(self):
|
def dump(self):
|
||||||
lines = []
|
lines = []
|
||||||
@ -2017,7 +2008,7 @@ def loads(s, environment=BASE_ENVIRONMENT, extra_cautious=True):
|
|||||||
context_last_line = None
|
context_last_line = None
|
||||||
# print("---\n" + after_dump + "\n---")
|
# print("---\n" + after_dump + "\n---")
|
||||||
|
|
||||||
raise NonReproducibleDocument("Difference found between existing version and dumped")
|
raise Exception("Difference found between existing version and dumped")
|
||||||
return doc
|
return doc
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user