Fix pelican landing page links for print/single-file targets#1128
Merged
oscarlevin merged 4 commits intomainfrom Mar 21, 2026
Merged
Fix pelican landing page links for print/single-file targets#1128oscarlevin merged 4 commits intomainfrom
oscarlevin merged 4 commits intomainfrom
Conversation
When output_filename is not set for single-file output formats (PDF, EPUB, KINDLE, BRAILLE), deploy_path() now scans the output directory for the actual output file and returns a path including the filename. This allows the pelican-generated landing page to link directly to the PDF (or other single-file output) rather than the directory containing it. Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/870d27e1-a45a-439c-943b-f8852da66683
Copilot
AI
changed the title
[WIP] Fix print target links in Pelican generated site
Fix pelican landing page links for print/single-file targets
Mar 20, 2026
Copilot AI
added a commit
that referenced
this pull request
Mar 21, 2026
* Initial plan * Fix: print targets get better links in pelican generated site When output_filename is not set for single-file output formats (PDF, EPUB, KINDLE, BRAILLE), deploy_path() now scans the output directory for the actual output file and returns a path including the filename. This allows the pelican-generated landing page to link directly to the PDF (or other single-file output) rather than the directory containing it. Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/870d27e1-a45a-439c-943b-f8852da66683 * format * add copilot instructions --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
oscarlevin
added a commit
that referenced
this pull request
Mar 22, 2026
* Initial plan * Add test for pretext generate datafile Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/2dcc278a-da1e-4d0d-9c35-f17aa1fa7f57 * Fix pelican landing page links for print/single-file targets (#1128) * Initial plan * Fix: print targets get better links in pelican generated site When output_filename is not set for single-file output formats (PDF, EPUB, KINDLE, BRAILLE), deploy_path() now scans the output directory for the actual output file and returns a path including the filename. This allows the pelican-generated landing page to link directly to the PDF (or other single-file output) rather than the directory containing it. Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/870d27e1-a45a-439c-943b-f8852da66683 * format * add copilot instructions --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu> * Initial plan * Fix formatting with black and rebase onto main Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/2aff3401-df98-4e89-ad7d-d303784b6b77 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
Copilot AI
added a commit
that referenced
this pull request
Mar 22, 2026
* Initial plan * Fix: print targets get better links in pelican generated site When output_filename is not set for single-file output formats (PDF, EPUB, KINDLE, BRAILLE), deploy_path() now scans the output directory for the actual output file and returns a path including the filename. This allows the pelican-generated landing page to link directly to the PDF (or other single-file output) rather than the directory containing it. Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/870d27e1-a45a-439c-943b-f8852da66683 * format * add copilot instructions --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
Copilot AI
added a commit
that referenced
this pull request
Mar 22, 2026
* Initial plan * Add test for pretext generate datafile Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/2dcc278a-da1e-4d0d-9c35-f17aa1fa7f57 * Fix pelican landing page links for print/single-file targets (#1128) * Initial plan * Fix: print targets get better links in pelican generated site When output_filename is not set for single-file output formats (PDF, EPUB, KINDLE, BRAILLE), deploy_path() now scans the output directory for the actual output file and returns a path including the filename. This allows the pelican-generated landing page to link directly to the PDF (or other single-file output) rather than the directory containing it. Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/870d27e1-a45a-439c-943b-f8852da66683 * format * add copilot instructions --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu> * Initial plan * Fix formatting with black and rebase onto main Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/2aff3401-df98-4e89-ad7d-d303784b6b77 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
Copilot AI
added a commit
that referenced
this pull request
Mar 22, 2026
- Rebased on origin/main (includes new tests and changes from #1124-#1128) - Ran `poetry run black .` for formatting (reformatted test_generate.py) - Added Fixed entry in CHANGELOG.md under [Unreleased] Co-authored-by: oscarlevin <6504596+oscarlevin@users.noreply.github.com> Agent-Logs-Url: https://github.com/PreTeXtBook/pretext-cli/sessions/72d5b309-fec0-4dad-8af0-1cbe035c2679
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a target with
deploy-dirproduces a single output file (PDF, EPUB, etc.), the pelican-generated landing page linked to the deploy directory rather than the actual file.Changes
pretext/project/__init__.py: Modifieddeploy_path()to scanoutput_dir_abspath()for the actual output file whenoutput_filenameis not explicitly set and the format is a known single-file type. Returnsdeploy_dir / filenameif exactly one match is found; falls back to directory path otherwise._SINGLE_FILE_FORMAT_EXTENSIONSconstant mappingFormat.PDF → .pdf,Format.EPUB / Format.KINDLE → .epub,Format.BRAILLE → .brltests/test_project.py: Addedtest_deploy_pathcovering PDF/EPUB auto-detection, explicitoutput_filenameprecedence, HTML directory-output unchanged behavior, and fallback when output dir doesn't exist yet.Before: a PDF print target with
deploy-dir="print"would generate<a href="print">Print</a>After: it generates
<a href="print/main.pdf">Print</a>Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
runestone.academy/usr/bin/python python scripts/fetch_core.py(dns block)/usr/bin/python python -m pytest tests/test_project.py::test_deploy tests/test_project.py::test_defaults tests/test_project.py::test_manifest_elaborate tests/test_project.py::test_stage -v(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.