Skip to content

Conversation

@kweav
Copy link
Contributor

@kweav kweav commented Dec 15, 2025

Change file reading from doc_path to dest_file before processing to attempt to fix error identified while testing this branch

While testing the changes in this branch, I encountered a new issue with the readLines function. Comparing to the original function, I see a different variable was used.

How I tested this branch:
-- used this branch specifically for ottrpal within the base_ottr dockerfile, building it and pushing it to dockerhub with the testBC tag.
-- Used that image on a few repos and called ottrpal borrow_chapter to test rendering/borrowing a chapter

Error I observed:
-- the error acted like the file didn't exist. But that seems to be because it was looking for a local file which indeed did not exist.

How this should fix it:
-- updating it to look at the full path, not a local path, trying to mirror the original code (https://github.com/jhudsl/cow/blob/be112c8bb9c6ddb9c3b5668a7dd2faa1042281e9/R/borrow_chapter.R#L108)

Change file reading from doc_path to dest_file before processing to attempt to fix error identified while testing this branch
@kweav
Copy link
Contributor Author

kweav commented Dec 15, 2025

This is working, but there are header warnings on the top of the borrowed content:

Course:
image

Quarto website:
image

@acoffman @carriewright11 any idea what I need to do to suppress those warnings? Looking into the quarto website one because that is not private material and it worked, so I'm going to inspect the test more closely

@kweav kweav mentioned this pull request Dec 15, 2025
@acoffman
Copy link
Contributor

acoffman commented Dec 15, 2025

@kweav The warnings about get_token are definitely coming from the tryCatch added in my PR. If you call get_token and you haven't authorized previously, you will get that warning printed. It's non-fatal but I didn't realize it would get printed in the output like that. I can see if there's a convenient way to suppress that in context.

@acoffman
Copy link
Contributor

@kweav I pushed a commit to the original PR that hides the warning coming from get_token

@kweav
Copy link
Contributor Author

kweav commented Dec 16, 2025

Thanks @acoffman -- Warnings are gone now!

And I can confirm that ottrpal borrow chapter works for

  • website and course
  • qmd and Rmd
  • outside jhudsl/fhdsl and within jhudsl

test 1: website, qmd, outside jhudsl/fhdsl:
https://kweav.github.io/quarto_borrow_chapter_test/
https://github.com/kweav/quarto_borrow_chapter_test/actions/runs/20272157667

test2: course, Rmd, within jhudsl:
https://jhudatascience.org/test_borrow_chapter/testing-borrow-chapter.html
https://github.com/jhudsl/test_borrow_chapter/actions/runs/20271671624

good to merge this and #19 @carriewright11?

@kweav kweav merged commit 52131b4 into acoffman/borrow-chapter-token-fix Dec 16, 2025
@kweav kweav deleted the kweav-additional-borrow-chapter-fix branch December 16, 2025 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants