Skip to content

Add: The Runestone target. - #516

Merged
oscarlevin merged 2 commits into
PreTeXtBook:refactor2from
bjones1:runestone-format
Aug 5, 2023
Merged

oscarlevin merged 2 commits into
PreTeXtBook:refactor2from
bjones1:runestone-format

Conversation

@bjones1

@bjones1 bjones1 commented Aug 4, 2023

Copy link
Copy Markdown
Collaborator

Add a Runestone format to the project file, making it much easier to build for Runestone.

@bjones1

bjones1 commented Aug 4, 2023

Copy link
Copy Markdown
Collaborator Author

Note that tests fail, but not (necessarily) because of this PR -- we still have lots of other fixing to do.

@oscarlevin oscarlevin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great.

Comment thread pretext/project/__init__.py Outdated
@StevenClontz

StevenClontz commented Aug 5, 2023 •

Copy link
Copy Markdown
Member

I missed the discussion yesterday, but something to consider if it hasn't already: if the object is for an author to only worry about a working HTML-format target (either the default "web" name, or a "runestone" name if customizations are desired specifically for Runestone), and the only time a Runestone version is built is when Brad's book server builds it, would it make sense for us to concentrate on just providing the hooks necessary to modify a working HTML-format target, and let the implementation happen on the book server side?

E.g. the book server gets the book from Github, grabs (via the Project() api) the "runestone" named target if it exists, and uses "web" if not. Then the format can be coerced to HTML (or error if not HTML), a copy of the publication.ptx file can be made, modified to ensure the runestone method is used for html, and the target's publication path can be rewritten to point to this copy. Finally the output-dir is pointed to wherever it needs to be pointed.

@bnmnetp

bnmnetp commented Aug 5, 2023

Copy link
Copy Markdown
Contributor

@StevenClontz you can see a summary here #513

My favorite option is described there. An author works with regular html and then deploys to runestone at that point. we either add a Runestone target or make one up programmatically and then copy the publisher file, or just use the publisher file for html and change the platform programmatically .

I think we want to preserve the "old" option of having an explicit runestone target and publisher file for people like Sean who choose to run their own server. But don't want or need to mess with the author server infrastructure.

I will need to create some kind of api, that accepts the request to deploy, and validates some kind of token (I still want to grant permission to publish on runestone, not just let anyone deploy anything there). On my side I would then handle the details of cloning to the right place, making sure the document-id is valid and available, adding an entry to the library table etc.

@StevenClontz

Copy link
Copy Markdown
Member

One other possibility that doesn't require modifying an author's publication file: what would be the result of having a single Runestone publication file that's used for all books hosted on Runestone? If Runestone is the publisher, why are authors allowed to make publication decisions for that platform? (I expect it's not so simple in practice, but I think this might fit with the underlying theory for having a separate publication file in the first place.)

@bnmnetp

bnmnetp commented Aug 5, 2023

Copy link
Copy Markdown
Contributor

@StevenClontz we did talk about that, but there are many options wrt knowls and other things that authors do set. Oscar has custom CSS and custom XSL (as do runestone RST authors) so I don't think the "one publication file to rule them all" approach is feasible.

@bnmnetp

bnmnetp commented Aug 5, 2023

Copy link
Copy Markdown
Contributor

Having just said that, I would say that custom xsl feels like an author option not a publisher option. I want to allow custom xsl especially for author/researchers who want to add new interactive elements that may not be relevant to any text but their own and so do not belong in pretext.

@oscarlevin

Copy link
Copy Markdown
Member

Custom xsl could be used to modify the look/feel of a book, making it very much a publisher option. But it can also be used to support additional features the author has implemented. So both authors and publishers would be interested in custom xsl.

@oscarlevin oscarlevin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. After our discussion yesterday, I think we need to do more, but let's merge this in so we have everything in once place.

@oscarlevin
oscarlevin merged commit b37d337 into PreTeXtBook:refactor2 Aug 5, 2023
@StevenClontz

Copy link
Copy Markdown
Member

Just ignore me if I'm beating a horse y'all already killed. :-) But custom XSL is controlled by project.ptx, so that's not precluded by providing an offiical Runestone publication file.

CSS was maybe what I had in mind earlier when suggesting practice vs theory: if CSS is an option an author should get to choose, why is it in the publication file? If there's a very small subset of publisher choices an author is allowed to make when hosting on Runestone, we could let them set them via either metadata in project.ptx or via the Runestone book server ("choose your publication file" from a finite list, or create a publication file dynamically from options chosen).

I do think that having Runestone be more opinionated about publication settings is a major change from the status quo that can wait though.

@bjones1
bjones1 deleted the runestone-format branch August 5, 2023 22:47
oscarlevin added a commit that referenced this pull request Aug 12, 2023
* start converting to refactored project; fix logging

* finish fixing logging

* make ptx_version optional, use legacy if not 2

* reimplement pretext support

* Fix: Make project.py the new __init__.py. (#500)

Add in new output_dir/output_file structure.

* Clean: Rename output_file to output_filename.

* Fix: Basic renames for new project class.

* Fix: More renames for new project class.

* get  working

* build working in default case

* integrate webwork-reps and output-dir checking

* Add: Support for server URLs. (#511)

Fix: Correct output-dir/output-filename tests, add more.

* Main merge (#512)

* fix zip_templates so it doesn't recreated duplicate devcont (#497)

* Fix: Run tests only on a PR; do this on any branch. (#495)

* Fix: Run tests only on a PR; do this on any branch.

* Fix: Per discussion, also run testing on any pushes to the main branch.

* Fix: Update major versions of older packages. (#499)

* Fix: Update major versions of older packages.

See #496.

* Update: poetry.lock based on project file changes.

* Fix: Make mapping file platform-independent. (#504)

* bubble up warning if a user isn't compatible with upcoming v2 (#505)

* bubble up warning if a user isn't compatible with upcoming v2

* add success messages, error report to support

---------

Co-authored-by: Oscar Levin <oscar.levin@unco.edu>

* bump version to next patch level for nightly releases

* revert to previous pdfCropMargins version (#509)

* revert to previous pdfCropMargins version

* update action to trigger docker

* bump version to next patch level for nightly releases

* Update deploy-stable.yml

Quick fix to get docker to update

---------

Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
Co-authored-by: Steven Clontz <steven.clontz@gmail.com>
Co-authored-by: GitHub Actions Bot <>

* clean up pretext build (#506)

* clean up pretext build

* reenable codechat

* add zip option to html build

* incorporate suggestions

* add remaining build targets, except custom

* add custom build format

* fix ensure_webwork_reps

* remove pre-2.0 warning message (#514)

* Set up generate for refactor (#508)

* get generate working

* a few minor improvements

* Complete merge

* remove old build code

* add check for finding assets to be built

* refactor asset hash function

* generate almost working

* complete refactor of generate

* fix interactive/preview dir bug

* fix flake error

* Fix: mypy errors. (#515)

Co-authored-by: Oscar Levin <oscar.levin@unco.edu>
Just removed some conflicting changes that were no longer needed after generate refactor.

* Add: The Runestone target. (#516)

* Add: The Runestone target.

* Fix: The WeBWorK target also supports compression.

* Merge latest changes from main (#519)

* fix zip_templates so it doesn't recreated duplicate devcont (#497)

* Fix: Run tests only on a PR; do this on any branch. (#495)

* Fix: Run tests only on a PR; do this on any branch.

* Fix: Per discussion, also run testing on any pushes to the main branch.

* Fix: Update major versions of older packages. (#499)

* Fix: Update major versions of older packages.

See #496.

* Update: poetry.lock based on project file changes.

* Fix: Make mapping file platform-independent. (#504)

* bubble up warning if a user isn't compatible with upcoming v2 (#505)

* bubble up warning if a user isn't compatible with upcoming v2

* add success messages, error report to support

---------

Co-authored-by: Oscar Levin <oscar.levin@unco.edu>

* bump version to next patch level for nightly releases

* revert to previous pdfCropMargins version (#509)

* revert to previous pdfCropMargins version

* update action to trigger docker

* bump version to next patch level for nightly releases

* Update deploy-stable.yml

Quick fix to get docker to update

* reconfigure playwright install process (#518)

* bump version to next patch level for nightly releases

---------

Co-authored-by: Bryan A. Jones <bjones@ece.msstate.edu>
Co-authored-by: Steven Clontz <steven.clontz@gmail.com>
Co-authored-by: GitHub Actions Bot <>

* Refactor `view` command (#520)

* update view commands before actual view call

* port oldinit's view command

* fix typos

* start adding persistent server logic

* implement reusable server

* fix flake errors

* remove unneded module

* improve keyboard interrupt

* improve checking for running server; reporting of url

* Refactor deploy (#522)

* wire up deploy with refactor

* clean up

* Change: Instead of a Runestone format, provide a platform="runestone" attribute. (#527)

* Update: Template project files to v2 format. (#528)

* update default to server for asymptote

* Fix errors with view

* Improvements to view server checking (#529)

* Improvements to view server checking

* remove obsolete view functions

* Gen (#530)

* remove project overlay

* clean up generate code

* Fix issue with xmlid persisting through generate

* Docs for a Runestone target (#526)

* Add: Runestone elements for the demo template.

* Add: Runestone elements for the article template.

* Remove: Runestone elements from the article template.

See #526 (comment).

* Add: Runestone elements for the book template.

* Fix: Update language based on Rob's feedback.

* Fix: Update demo template as well.

* Fix: Correct indent, avoid hyphens.

* Misc fixes (#533)

* Fix: Black/Flake8/mypy errors (except for oldinit.py).

* Fix: Delete, following fac5e44.

* Fix: Move default values from Target.server to Project.server; fix syntax.

* Fix: Ignore project/oldinit.py in mypy.

* Fix: Update to newer mypy.

* Fix: Avoid syntax that requires Python 3.9.

* fix bug with non-existant assets being saved in hash

* fix qrcode typo

* remove debugging hack

* Add: Missing target from default template. (#535)

* Add: Missing target from default template.

* Fix: Correct tests for subset.

* Get test_view working (#537)

* clean up old code

* update dependencies

* clean up old code

* update dependencies

* remove depricated  test

* fix custom_webwork_server test

* Get serve test working (#538)

* Fix: Correct handling of output-filename to prepend the output-dir. (#540)

* Fix: Correct handling of output-filename to prepend the output-dir.

* Fix: Flake8.

* update core commit and version

* fix elaborate build test (#541)

* fix elaborate build test

* add playwright install for previews

* Fix view tests with connection errors

* flake8

* Add asymptote method (#542)

* add executables to gitignore

* remove bad merge

---------

Co-authored-by: Bryan A. Jones <bjones@ece.msstate.edu>
Co-authored-by: Steven Clontz <steven.clontz@gmail.com>
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.

4 participants