Skip to content

Commit e0757f9

Browse files
committed
doc: extensions: page_filter: fix script import snippet
app.builder.script_files is now a list of `_JavaScript` objects. To access the actual file name, the `filename` property must be used. Stringification of the class contains other info like priority or type, making it unusable to obtain the path only. Signed-off-by: Gerard Marull-Paretas <[email protected]>
1 parent a035182 commit e0757f9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

doc/_extensions/page_filter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ def page_filter_install(
197197
if visitor.found_filter_dropdown:
198198
app.add_css_file("page_filter.css")
199199
app.add_js_file("page_filter.mjs", type="module")
200-
filename = app.builder.script_files[-1]
200+
script = app.builder.script_files[-1]
201201

202202
page_depth = len(Path(pagename).parents) - 1
203-
body = f"import setupFiltering from './{page_depth * '../'}{filename}'; "
203+
body = f"import setupFiltering from './{page_depth * '../'}{script.filename}'; "
204204
for dropdown in visitor.found_filter_dropdown:
205205
body += f"setupFiltering('{dropdown.name}'"
206206
if dropdown.container_element and dropdown.filter_tags:

0 commit comments

Comments
 (0)