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
8 changes: 5 additions & 3 deletions pretext/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,10 @@
"devcontainer.json": Path(".devcontainer/devcontainer.json"),
"requirements.txt": Path("requirements.txt"),
"pretext-cli.yml": Path(".github", "workflows", "pretext-cli.yml"),
"installPretext.sh": Path(".devcontainer", "instalPretext.sh"),
"installPandoc.sh": Path(".devcontainer", "instalPandoc.sh"),
"installLatex.sh": Path(".devcontainer", "instalLatex.sh"),
"pretext-deploy.yml": Path(".github", "workflows", "pretext-deploy.yml"),
"installPretext.sh": Path(".devcontainer", "installPretext.sh"),
"installPandoc.sh": Path(".devcontainer", "installPandoc.sh"),
"installLatex.sh": Path(".devcontainer", "installLatex.sh"),
"installSage.sh": Path(".devcontainer", "installSage.sh"),
}

Expand All @@ -244,6 +245,7 @@
GIT_RESOURCES = [
".gitignore",
"pretext-cli.yml",
"pretext-deploy.yml",
"devcontainer.json",
"installPretext.sh",
"installPandoc.sh",
Expand Down
9 changes: 5 additions & 4 deletions pretext/resources/resource_hash_table.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,11 @@
"project.ptx": "ac4c1327126f021006b2e043df35287e593c5c89de2f5d7bcc3e653227b46e0e",
"codechat_config.yaml": "dd2a54caa22b056fd4442b39c230adb359e61a195fcad921c1733c5beea0f89f",
".gitignore": "7df710ee93f2d5b67d3b90292f195b35c2053915eec3a4265a440585a2c94816",
"devcontainer.json": "21c7b3bde8d88e2bd0956221d0f7b935c021738f6e078d9798831785326ffa4d",
"pretext-cli.yml": "419d0487e446a6ec7d1c9a1f78c431dd7ac8f7e5fe683d772685110d1ca99e14",
"installPretext.sh": "e6d198cad4402d18965fbbd7e40b05c4dc858b4d334536b3c00fc835a971e4e6",
"installPandoc.sh": "1d73faa032b137af74dcb9fad2cbc4f70da3bf09a682f90cc213943d4e60710c",
"devcontainer.json": "4d8a29737ff080e9312bad1646262cdf40f54e7e017298d0f59a1cab7fde6955",
"pretext-cli.yml": "2436f740b3d9aa1b1c64ff5da9a2ef281c12087267225d3c9870ccf0c6d87b16",
"pretext-deploy.yml": "2f02ebfe0ae2a54edf8e66561e906567424cec5b5467db7d6dd891b56e23ca7b",
"installPretext.sh": "8b4ffc06b5bfd75b63ea2f06406ba72e88c6a1f70ddd365e3eed3d4099bf3a92",
"installPandoc.sh": "0dfd2cf2455efeff82293ba2b3724bc94e20620ed9f87c4cd3ee967d0dedd076",
"installLatex.sh": "89fc36da1ac5bf3c79e70990d760f288b94afb71dac03f0651424efbf55663aa",
"installSage.sh": "7f2b791271aaf21a0b6c742e9758d4f131b59216c261902fe43c8461143cb407"
}
Expand Down
20 changes: 9 additions & 11 deletions templates/article/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,17 @@ The most important thing to remember when authoring in a codespace is that you a
We have tried to keep the codespace small (so it starts up quickly and doesn't eat through your monthly storage allotment), so we do not include a full TeXLive distribution. We have tried to include most packages and fonts you are likely to need to generate images using `<latex-image>` elements, and to generate PDF print output. However, if you run into a situation where the LaTeX gives errors about packages missing (like it cannot find a `mypackage.sty` file), here is what you should do.

1. To quickly resolve the issue yourself, open a terminal (``Ctrl+Shift+` ``) and use the TeXLive Package Manager to install the missing package.
1. If you know that the package is called `mypackage` then enter the following two lines:
a. If you know that the package is called `mypackage` then enter the following two lines:

```bash
tlmgr install mypackage
tlmgr path add
```

2. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```
```bash
tlmgr install mypackage
tlmgr path add
```
b. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```

2. To ensure that you don't have to repeat this step every time you recreate the codespace, add the package name to the list of installs inside the file `.devcontainer/installLatex.sh` which gets run every time a codespace is created.

Expand Down
23 changes: 10 additions & 13 deletions templates/book/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,17 @@ The most important thing to remember when authoring in a codespace is that you a
We have tried to keep the codespace small (so it starts up quickly and doesn't eat through your monthly storage allotment), so we do not include a full TeXLive distribution. We have tried to include most packages and fonts you are likely to need to generate images using `<latex-image>` elements, and to generate PDF print output. However, if you run into a situation where the LaTeX gives errors about packages missing (like it cannot find a `mypackage.sty` file), here is what you should do.

1. To quickly resolve the issue yourself, open a terminal (``Ctrl+Shift+` ``) and use the TeXLive Package Manager to install the missing package.
1. If you know that the package is called `mypackage` then enter the following two lines:
a. If you know that the package is called `mypackage` then enter the following two lines:

```bash
tlmgr install mypackage
tlmgr path add
```

2. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```
```bash
tlmgr install mypackage
tlmgr path add
```
b. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```

2. To ensure that you don't have to repeat this step every time you recreate the codespace, add the package name to the list of installs inside the file `.devcontainer/installLatex.sh` which gets run every time a codespace is created.

Expand All @@ -59,5 +57,4 @@ tlmgr search --global --all "mypackage.sty"

By far the largest space-hog in a PreTeXt authoring environment is SageMath, which is only required if you generate images using sageplots. By default, SageMath is not installed in a PreTeXt codespace, but it should be easy to install if you need it.

Just open the command palette (`Ctrl+Shift+P` of `F1`) and search for "PreTeXt: Install SageMath". This will also update the `.devcontainer/devcontainer.json` file so that the next time you create a codespace for this project, it should install automatically.

Just open the command palette (`Ctrl+Shift+P` of `F1`) and search for "PreTeXt: Install SageMath". This will also update the `.devcontainer/devcontainer.json` file so that the next time you create a codespace for this project, it should install automatically.
20 changes: 9 additions & 11 deletions templates/course/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,17 @@ The most important thing to remember when authoring in a codespace is that you a
We have tried to keep the codespace small (so it starts up quickly and doesn't eat through your monthly storage allotment), so we do not include a full TeXLive distribution. We have tried to include most packages and fonts you are likely to need to generate images using `<latex-image>` elements, and to generate PDF print output. However, if you run into a situation where the LaTeX gives errors about packages missing (like it cannot find a `mypackage.sty` file), here is what you should do.

1. To quickly resolve the issue yourself, open a terminal (``Ctrl+Shift+` ``) and use the TeXLive Package Manager to install the missing package.
1. If you know that the package is called `mypackage` then enter the following two lines:
a. If you know that the package is called `mypackage` then enter the following two lines:

```bash
tlmgr install mypackage
tlmgr path add
```

2. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```
```bash
tlmgr install mypackage
tlmgr path add
```
b. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```

2. To ensure that you don't have to repeat this step every time you recreate the codespace, add the package name to the list of installs inside the file `.devcontainer/installLatex.sh` which gets run every time a codespace is created.

Expand Down
21 changes: 9 additions & 12 deletions templates/demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,17 @@ The most important thing to remember when authoring in a codespace is that you a
We have tried to keep the codespace small (so it starts up quickly and doesn't eat through your monthly storage allotment), so we do not include a full TeXLive distribution. We have tried to include most packages and fonts you are likely to need to generate images using `<latex-image>` elements, and to generate PDF print output. However, if you run into a situation where the LaTeX gives errors about packages missing (like it cannot find a `mypackage.sty` file), here is what you should do.

1. To quickly resolve the issue yourself, open a terminal (``Ctrl+Shift+` ``) and use the TeXLive Package Manager to install the missing package.
1. If you know that the package is called `mypackage` then enter the following two lines:
a. If you know that the package is called `mypackage` then enter the following two lines:

```bash
tlmgr install mypackage
tlmgr path add
```

2. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```
```bash
tlmgr install mypackage
tlmgr path add
```
b. If you don't know the name of the package, but know it should contain `mypackage.sty`, then you can search using

```bash
tlmgr search --global --all "mypackage.sty"
```

2. To ensure that you don't have to repeat this step every time you recreate the codespace, add the package name to the list of installs inside the file `.devcontainer/installLatex.sh` which gets run every time a codespace is created.

Expand All @@ -60,4 +58,3 @@ tlmgr search --global --all "mypackage.sty"
By far the largest space-hog in a PreTeXt authoring environment is SageMath, which is only required if you generate images using sageplots. By default, SageMath is not installed in a PreTeXt codespace, but it should be easy to install if you need it.

Just open the command palette (`Ctrl+Shift+P` of `F1`) and search for "PreTeXt: Install SageMath". This will also update the `.devcontainer/devcontainer.json` file so that the next time you create a codespace for this project, it should install automatically.

5 changes: 2 additions & 3 deletions templates/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@

// Comment or uncomment lines below if you don't or do need that feature.
"postCreateCommand": {
"install pretext": "bash ./.devcontainer/installPretext.sh",
// "install sagemath": "bash ./.devcontainer/installSage.sh",
"install pandoc": "bash ./.devcontainer/installPandoc.sh",
"install latex": "bash ./.devcontainer/installLatex.sh",
// "install sagemath": "bash ./.devcontainer/installSage.sh",
"working": "echo 'installing additional software into codespace.'"
"install pretext": "bash ./.devcontainer/installPretext.sh"
},


Expand Down
2 changes: 1 addition & 1 deletion templates/installPandoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

wget https://github.com/jgm/pandoc/releases/download/3.6.4/pandoc-3.6.4-1-amd64.deb -O pandoc.deb

# wait for 30 second and then double check that no other script is using apt-get:
# wait for 60 second and then double check that no other script is using apt-get:
sleep 60
while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do
echo "Waiting for apt-get to be free..."
Expand Down
8 changes: 0 additions & 8 deletions templates/installPretext.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
# This file was automatically generated with PreTeXt 2.16.1.
# If you modify this file, PreTeXt will no longer automatically update it.

while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do
echo "Waiting for apt-get to be free..."
sleep 15
done
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
python3-louis \
Expand All @@ -19,10 +15,6 @@ pip install pretext[homepage,prefigure] --only-binary {greenlet} --break-system

pip install codechat-server --break-system-packages

while fuser /var/lib/dpkg/lock >/dev/null 2>&1; do
echo "Waiting for apt-get to be free..."
sleep 15
done
playwright install-deps

playwright install
Expand Down
12 changes: 9 additions & 3 deletions templates/pretext-cli.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
# This file was automatically generated with PreTeXt 2.16.1.
# If you modify this file, PreTeXt will no longer automatically update it.
#
# This workflow file can be used to automatically build a project and create
# an artifact for deployment. It can also be used to deploy the project to
# GitHub Pages or Cloudflare Pages.
#
# The workflow is triggered on pull requests or can be run manually. You can uncomment
# the `push` event to have it run on pushes to the main branch as well.
name: PreTeXt-CLI Actions
on:
# Runs on pull requests
pull_request:
branches: ["*"]
# Runs on pushes to main
push:
branches: ["main"]
## Runs on pushes to main
#push:
# branches: ["main"]
# Runs on demand
workflow_dispatch:

Expand Down
64 changes: 64 additions & 0 deletions templates/pretext-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# This file was automatically generated with PreTeXt 2.16.1.
# If you modify this file, PreTeXt will no longer automatically update it.
#

name: Build and Deploy
on:
# Currently, this workflow only runs when manually selected (the `workflow_dispatch` event).
# If you would like it to run on other events, uncomment some of the lines below.

# # Runs on pull requests
# pull_request:
# branches: ["*"]

# # Runs on pushes to main
# push:
# branches: ["main"]

# # Runs every day at 00:00 UTC
# schedule:
# - cron: '0 0 * * *'

# Runs on demand
workflow_dispatch:

permissions:
contents: write

jobs:
build-and-deploy:
runs-on: ubuntu-latest
container: oscarlevin/pretext:small

steps:
- name: Checkout source
uses: actions/checkout@v4

- name: add gh-cli
run: |
apt-get update
apt-get install gh jq -y

- name: setup git config
run: |
git config --global --add safe.directory $(pwd)
git config user.name "${{ github.actor }} via GitHub Actions"
git config user.email "${{ github.actor }}@github_actions.no_reply"

- name: install deps
run: pip install -r requirements.txt --break-system-packages

- name: install local ptx files
run: pretext --version

- name: build deploy targets
run: pretext build --deploys

- name: run deploy
run: pretext deploy --no-push

- name: push gh-pages branch
run: git push origin gh-pages --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}