Skip to content

Commit 5657aae

Browse files
MaoSong2022MaoSong2022
authored andcommitted
feat(order_annotation.py): add reference for table and algorithm
1 parent e73d968 commit 5657aae

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

vrdu/order_annotation.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,26 @@ def generate_cross_reference_order(self):
104104
}
105105
)
106106

107+
# generate reference for float environments
108+
for block in self.annotations["annotations"]:
109+
if config.category2name[block.category] not in ["Table", "Algorithm"]:
110+
continue
111+
block.references = [
112+
x
113+
for group in re.findall(ref_patterns, block.source_code)
114+
for x in group
115+
if x
116+
]
117+
for _label in block.references:
118+
if _label in label_to_block_id:
119+
annotations.append(
120+
{
121+
"type": "explicit-cite",
122+
"from": block.block_id,
123+
"to": label_to_block_id[_label],
124+
}
125+
)
126+
107127
self.annotations["orders"].extend(annotations)
108128

109129
def generate_float_envs_order(self):

0 commit comments

Comments
 (0)