aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBlake DeMarcy <ofunknowndescent@gmail.com>2017-05-04 18:15:16 -0500
committerBlake DeMarcy <ofunknowndescent@gmail.com>2017-05-04 18:15:16 -0500
commit78ee2fc531d71ddb9fbc908a2be9a052722e76b9 (patch)
treec84cb0ef73dde531c104365346d8b51768b451dd /src
parentf4aec05c4885f1c426ca8a1a2ea65b2571aa506c (diff)
downloadbbj-78ee2fc531d71ddb9fbc908a2be9a052722e76b9.tar.gz
remove whitespace handling from the formatter
Diffstat (limited to 'src')
-rw-r--r--src/formatting.py30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/formatting.py b/src/formatting.py
index f9a2299..5e9e7fa 100644
--- a/src/formatting.py
+++ b/src/formatting.py
@@ -105,42 +105,18 @@ def parse_segments(text, sanitize_linequotes=True):
[bracketed] representations.
"""
result = list()
- hard_quote = False
for paragraph in re.split("\n{2,}", text):
pg = str()
for line in paragraph.split("\n"):
- if line == "```":
- # because of this lazy way of handling it,
- # its not actually necessary to close a
- # hard quote segment. i guess thats a positive
- # just because i dont have to throw syntax
- # errors at the users for it. feels dirty
- # but its easier for all of us.
- if hard_quote:
- pg += "\n"
- hard_quote = not hard_quote
- continue
-
- elif hard_quote:
- pg += "\n" + line
- continue
-
- elif not line:
- continue
-
if linequote_p(line):
if sanitize_linequotes:
inner = line.replace("]", "\\]")
-
else:
inner = apply_directives(line)
-
- pg += "[linequote: %s]" % inner.strip()
-
+ pg += "[linequote: %s]" % inner
else:
- sep = "\n" if line[0] in punctuation else " "
- pg += apply_directives(line.rstrip()) + sep
-
+ pg += apply_directives(line)
+ pg += "\n"
result.append(pg.rstrip())
return result
Un proyecto texto-plano.xyz