Remap document ids backlinks to main headlines.
This commit is contained in:
parent
ac445d2e7c
commit
87e4a8aa7d
@ -259,6 +259,17 @@ def regen_all(src_top, dest_top, *, docs=None, db=None):
|
|||||||
if link['target'] in doc_to_headline_remapping:
|
if link['target'] in doc_to_headline_remapping:
|
||||||
link['target'] = doc_to_headline_remapping[link['target']]
|
link['target'] = doc_to_headline_remapping[link['target']]
|
||||||
|
|
||||||
|
# Remap document ids backlinks to main headlines
|
||||||
|
for doc_id, main_headline_id in doc_to_headline_remapping.items():
|
||||||
|
if doc_id.startswith('id:'):
|
||||||
|
doc_id = doc_id[len('id:'):]
|
||||||
|
if main_headline_id.startswith('id:'):
|
||||||
|
main_headline_id = main_headline_id[len('id:'):]
|
||||||
|
for backlink in backlink_graph.get(doc_id, []):
|
||||||
|
if main_headline_id not in backlink_graph:
|
||||||
|
backlink_graph[main_headline_id] = set()
|
||||||
|
backlink_graph[main_headline_id].add(backlink)
|
||||||
|
|
||||||
# Render docs after we've built the graph
|
# Render docs after we've built the graph
|
||||||
# Render main headlines
|
# Render main headlines
|
||||||
full_graph_info = { "nodes": graph, "backlinks": backlink_graph, "main_headlines": main_headlines_by_path }
|
full_graph_info = { "nodes": graph, "backlinks": backlink_graph, "main_headlines": main_headlines_by_path }
|
||||||
|
Loading…
Reference in New Issue
Block a user