File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 7
7
inventory = {}
8
8
9
9
10
+ class ConfigError (Exception ):
11
+ pass
12
+
13
+
10
14
def load_mock_inventory (items : "dict[str, str]" ):
11
15
for k , v in items .items ():
12
16
inventory [k ] = v
@@ -75,7 +79,7 @@ def parse_rst_style_ref(full_text):
75
79
76
80
pf .debug (full_text )
77
81
78
- m = re .match (r"(?P<text>.+?)\<(?P<ref>[a-zA-Z\.\-: ]+)\>" , full_text )
82
+ m = re .match (r"(?P<text>.+?)\<(?P<ref>[a-zA-Z\.\-: _ ]+)\>" , full_text )
79
83
if m is None :
80
84
# TODO: print a warning or something
81
85
return full_text , None
@@ -98,7 +102,17 @@ def visit(el, doc):
98
102
def visit (el : pf .MetaList , doc ):
99
103
meta = doc .get_metadata ()
100
104
101
- for doc_name , cfg in meta ["interlinks" ]["sources" ].items ():
105
+ try :
106
+ sources = meta ["interlinks" ]["sources" ]
107
+ except KeyError :
108
+ raise ConfigError (
109
+ "No interlinks.sources field detected in your metadata."
110
+ "Please add this to your header:\n \n "
111
+ "interlinks:"
112
+ "\n sources:"
113
+ "\n - <source_name>: {url: ..., inv: ..., fallback: ... }"
114
+ )
115
+ for doc_name , cfg in sources .items ():
102
116
json_data = json .load (open (cfg ["fallback" ]))
103
117
104
118
for item in json_data ["items" ]:
You can’t perform that action at this time.
0 commit comments