Tables in the plain-text target, with captions
A @table now renders to txt. What it needed settled how plain text sets a block off from the prose around it, which is by INDENTING it: that is the only structural device the medium has, where html and LaTeX have boxes, rules and space. An indented block is one that has already been laid out, and the target leaves its lines alone. A caption is placed above a table or a listing and below a figure, in every target rather than only in plain text. A figure is taken in at a glance, and the caption then names what the reader has already seen; a table is read, and a reader who meets the rows before the subject has to read them twice. Also fixed, all three of them silent: an indented paragraph was dropped from plain-text output rather than left as written; an @indent block was re-flowed, so the indentation of its later lines appeared as gaps in the middle of a line; and a table captioned with ":number false" lost the rule under its caption, while an unnumbered table wrongly consumed a number that a reader counting captions would then find missing. (from dev 8173c371bba6)
This commit is contained in:
1 parent
af29bbf7ac
commit
b80e823ab3
7 files changed
+197
-25
No files matched your search
+5
-12
@@ -74,23 +74,16 @@ def protect_klammertext_special_characters(text):
|
||||
result = re.compile(r"\|").sub("̅B̅", result)
|
||||
return result
|
||||
|
||||
# When did this ever make sense? Before the new word patterns, probably.
|
||||
|
||||
def bar_delimiter():
|
||||
return "\3"
|
||||
|
||||
def double_bar_delimiter():
|
||||
return "\4"
|
||||
|
||||
def caption_delimiter():
|
||||
return "__CAPTION__"
|
||||
|
||||
def caption_marker(name, caption, delimiter=" - "):
|
||||
def caption_marker(name, caption, label_delimiter=" -- "):
|
||||
caption = re.sub("\n", " ", caption)
|
||||
d = caption_delimiter()
|
||||
if caption:
|
||||
caption = f"{delimiter}{caption}"
|
||||
return f"{d}{name}{d}{caption}{d}"
|
||||
if caption and label_delimiter:
|
||||
caption = f"{label_delimiter}{caption}"
|
||||
result = f"{d}{name}{d}{caption}{d}"
|
||||
return result
|
||||
|
||||
def rest_split(s, dimensions=1):
|
||||
"""Split bar-delimited text into nested lists, one level per dimension.
|
||||
|
||||
Reference in new issue
Block a user