Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix ToC building from H2's when the H2 has an extra tag #698

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
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: 3 additions & 8 deletions app/config/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,12 @@

uglify_js = get_filter("uglifyjs", extra_args=["--source-map", "-c", "-m"])


closure_js = get_filter("closure_js")
js_filters: list = []

if settings.DEBUG:
css_filters = [LIBSASS]
js_filters: list = []
else:
css_filters = [LIBSASS, "cssmin"]
js_filters = [closure_js]

core_css_files = ["_dev/scss/screen.scss"]

Expand Down Expand Up @@ -48,12 +45,10 @@
output="dist/css/admin_extra.min.css"
)

js_core_bundle = Bundle(
*core_js_files, filters=[closure_js], output="dist/js/main.min.js"
)
js_core_bundle = Bundle(*core_js_files, filters=[], output="dist/js/main.min.js")

js_admin_bundle = Bundle(
*admin_js_files, filters=[closure_js], output="dist/js/admin_extra.min.js"
*admin_js_files, filters=[], output="dist/js/admin_extra.min.js"
)


Expand Down
4 changes: 3 additions & 1 deletion app/modules/publications/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# stdlib
from email import header
import logging
import lxml.html
from collections import Counter
Expand Down Expand Up @@ -81,8 +82,9 @@ def replace_headers(self, html):
# NOTE: we import as HTML because we don't have a wrapping tag
root = lxml.html.fromstring(html)
for tag_name in header_tags:
for tag in root.xpath(f"//{tag_name}"):
for tag in root.xpath(f"//{tag_name} | //{tag_name}//*"):
# create a slugged name for the tag of the form tag-text-3
if not tag.text: continue
header_name = tag.text
bare_slug = slugify(header_name, allow_unicode=True)
self.slug_count[bare_slug] += 1
Expand Down
3 changes: 0 additions & 3 deletions docker/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ RUN apk update && apk add --no-cache \
# Install static asset compilers
####################################################################################################

RUN apk add closure-compiler --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted && \
rm -f /tmp/* /etc/apk/cache/* /root/.cache

# work around a bug in the version of node we are using
# https://github.com/npm/uid-number/issues/3
# https://github.com/nodejs/docker-node/issues/813
Expand Down
3 changes: 0 additions & 3 deletions docker/web/Dockerfile-prod
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ RUN apk update && apk add --no-cache \
# Install static asset compilers
####################################################################################################

RUN apk add closure-compiler --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted && \
rm -f /tmp/* /etc/apk/cache/* /root/.cache

# work around a bug in the version of node we are using
# https://github.com/npm/uid-number/issues/3
# https://github.com/nodejs/docker-node/issues/813
Expand Down