Skip to content
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
2 changes: 1 addition & 1 deletion config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ summaryLength = 50 # Listing summary length in words. Also, see `abstract_lengt
paginate = 10 # Number of items per page in paginated lists.
enableEmoji = true
footnotereturnlinkcontents = "<sup>^</sup>"
ignoreFiles = ["\\.ipynb$", ".ipynb_checkpoints$", "\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
ignoreFiles = ["\\.ipynb$", ".ipynb_checkpoints$", "\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$", "\\.py$", "\\.mdOUT$"]
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved

# Workaround Hugo publishing taxonomy URLs as plurals - consistently use singular across Academic.
[permalinks]
Expand Down
5 changes: 5 additions & 0 deletions scripts/rebrand/allowed_changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ resources/directory.json # The directory's filter data (D16, #868)
resources/search.json # The directory's search data, fetched on first search (D16, #868)
resources/index.html # Became a list page for its pager, so its SEO tags gain CollectionPage
home/7-newsletter.md.old # A retired draft that Hugo copied out by accident, not a page
resources/resource.py # #976: generator script (or draft) Hugo published by accident, not a page
summaries/summaries.py # #976: generator script (or draft) Hugo published by accident, not a page
glossary/_create_glossaries.py # #976: generator script (or draft) Hugo published by accident, not a page
glossary/_build_references.py # #976: generator script (or draft) Hugo published by accident, not a page
replication-hub/submit/submit.mdOUT # #976: generator script (or draft) Hugo published by accident, not a page
about/visitors/index.html # Its generated description quotes the stats table, whose link text lost "https://" for the preview
js/load-theme.js # The theme's day/night script, gone with the theme's look
js/academic.min.FINGERPRINT.js # The theme's script bundle, without its search, under a new name while some pages still need it
Expand Down
33 changes: 33 additions & 0 deletions scripts/tests/test_bundle_exclusions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""Hugo's ignoreFiles keeps generator scripts and drafts in content/ out of the site (#976).

Run: python3 -m unittest discover -s scripts/tests -p test_bundle_exclusions.py
"""

from pathlib import Path
import re
import tomllib
import unittest

ROOT = Path(__file__).resolve().parents[2]
CONFIG = tomllib.loads((ROOT / "config/_default/config.toml").read_text(encoding="utf-8"))


def ignored(path):
return any(re.search(pattern, path) for pattern in CONFIG["ignoreFiles"])


class BundleExclusionTests(unittest.TestCase):
def test_generator_scripts_and_drafts_are_ignored(self):
Comment thread
LukasWallrich marked this conversation as resolved.
Resolved
for path in sorted(ROOT.glob("content/**/*.py")) + sorted(ROOT.glob("content/**/*.mdOUT")):
with self.subTest(path=path):
self.assertTrue(ignored(str(path.relative_to(ROOT))))

def test_pages_and_bundle_assets_are_not_ignored(self):
for path in ("content/summaries/_index.md", "content/summaries/FORRT_O&R_101_Syllabus.pdf",
"content/glossary/apa_lookup.json", "content/clusters/FORRT_Clusters.webp"):
with self.subTest(path=path):
self.assertFalse(ignored(path))


if __name__ == "__main__":
unittest.main()
Loading