Skip to content

Update build script and docs config to handle newer versions #58

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ def convert_file(dst_path, fn, editors, created, modified):

root = tree.getroot()
head = root.find('head')
container, = root.xpath("//div[@id='notebook-container']")
try:
container, = root.xpath("//div[@id='notebook-container']")
except ValueError:
container, = root.xpath("//body[@class='jp-Notebook']")

headers = container.xpath('//h1')
if headers:
Expand Down Expand Up @@ -344,18 +347,18 @@ def parse_wiki_legacy_tags():
prev_line = None

for line in f:
if re.match('^====+\s*$', line):
if re.match(r'^====+\s*$', line):
tags[0] = prev_line.strip()
tags[1] = None
tags[2] = None
continue

if re.match('^----+\s*$', line):
if re.match(r'^----+\s*$', line):
tags[1] = prev_line.strip()
tags[2] = None
continue

if re.match('^""""+\s*$', line):
if re.match(r'^""""+\s*$', line):
tags[2] = prev_line.strip()
continue

Expand Down
5 changes: 4 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@
html_theme = 'sphinx_rtd_theme'
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
def setup(app):
app.add_stylesheet('scipy-cookbook.css')
try:
app.add_stylesheet('scipy-cookbook.css')
except AttributeError:
app.add_css_file('scipy-cookbook.css')
else:
html_context = {
'css_files': [
Expand Down