Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Book
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUDE
Book
Commits
89344005
Verified
Commit
89344005
authored
1 year ago
by
Rok Štular
Browse files
Options
Downloads
Patches
Plain Diff
feat(build): Remove some chapters from published book
parent
172fff27
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!80
check toc purge
,
!77
feat(build): Remove some chapters from published book
Pipeline
#207222
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
book/_toc.yml
+2
-0
2 additions, 0 deletions
book/_toc.yml
build-book.sh
+14
-10
14 additions, 10 deletions
build-book.sh
with
16 additions
and
10 deletions
book/_toc.yml
+
2
−
0
View file @
89344005
...
...
@@ -142,6 +142,7 @@ parts:
-
file
:
sandbox/1-5-NumericalMethods/1-general-solvers.ipynb
-
file
:
sandbox/1-5-NumericalMethods/2-implicit-ode-solver.ipynb
# START REMOVE-FROM-PUBLISH
-
caption
:
MUDE Cookbook
chapters
:
-
file
:
cookbook/blank
...
...
@@ -159,6 +160,7 @@ parts:
-
file
:
cookbook/example_quiz_interactive.ipynb
-
file
:
cookbook/coding_theory_widgets.ipynb
-
file
:
cookbook/theory_questions
# END REMOVE-FROM-PUBLISH
-
caption
:
Old Material
chapters
:
-
file
:
old/blank
...
...
This diff is collapsed.
Click to expand it.
build-book.sh
+
14
−
10
View file @
89344005
...
...
@@ -4,13 +4,20 @@ set -euo pipefail
START_SERVER
=
${
1
:-
false
}
PAGE_ROOT
=
${
2
:-
"/"
}
USE_TOC_BLACKLIST
=
${
3
:-
false
}
# Pre-process the book using the blacklist comment
if
[
"
$USE_TOC_BLACKLIST
"
=
true
]
;
then
echo
"Using TOC blacklist"
sed
--in-place
=
".bak"
'/# START REMOVE-FROM-PUBLISH/,/# END REMOVE-FROM-PUBLISH/{//!d}'
book/_toc.yml
fi
# Build the jupyter book, everything else is post-processing
jupyter-book build book/
# Note: the structure of thebe_lite mimicks where thing are needed in the html folder
cp
thebe_lite/
*
book/_build/html/
-r
sed
"s,const PAGE_ROOT =
\"
/
\"
;,const PAGE_ROOT =
\"
$PAGE_ROOT
\"
;,g"
thebe_lite/_static/sphinx-thebe.js
>
book/_build/html/_static/sphinx-thebe.js
sed
"s,const PAGE_ROOT =
\"
/
\"
;,const PAGE_ROOT =
\"
$PAGE_ROOT
\"
;,g"
thebe_lite/_static/sphinx-thebe.js
>
book/_build/html/_static/sphinx-thebe.js
rm
book/_build/html/THEBE_LITE.md
# Copy all non notebook, markdown or build files into the build for local access in pyodide etc.
...
...
@@ -21,28 +28,25 @@ rm book/_build/html/THEBE_LITE.md
# 4. xargs: will execute the script inside the quotes
# 5. grep: finds a file's parent's path by matching against the section of the string ending in a '/'
# 6. mkdir: makes all the parent directories, -p will do so recrusively
# 7. cp: finally copies all files from the /book folder to /book/_build/html
# 7. cp: finally copies all files from the /book folder to /book/_build/html
find book/
-type
f |
grep
-v
"^book/_.*
\|
.*
\.\(
md
\|
ipynb
\)
"
|
cut
-c
6- | xargs
-i
sh
-c
'echo "book/_build/html/{}" | grep -o "^.*/" | xargs -d "\n" mkdir -p; cp book/"{}" book/_build/html/"{}"'
# Check whether python has the alias 'python' or 'python3'
if
command
-v
python3
>
/dev/null 2>&1
then
if
command
-v
python3
>
/dev/null 2>&1
;
then
python_command
=
"python3"
else
if
command
-v
python
>
/dev/null 2>&1
then
if
command
-v
python
>
/dev/null 2>&1
;
then
python_command
=
"python"
fi
fi
if
[
"
$python_command
"
=
""
]
;
then
if
[
"
$python_command
"
=
""
]
;
then
echo
"Book successfully built. If you want to use interactive elements, start a local HTTP server for the _build/html folder."
exit
0
fi
# Serves the files on port 8000, localhost (127.0.0.1:8000)
if
[
"
$START_SERVER
"
=
true
]
;
then
if
[
"
$START_SERVER
"
=
true
]
;
then
echo
"Starting server on port 8000"
$python_command
-m
http.server 8000
--directory
book/_build/html
else
...
...
@@ -50,7 +54,7 @@ else
start a server locally using the command:
$python_command
-m http.server 8000 --directory book/_build/html.
Or run this script again (book will build again!):
${
0
}
true"
${
0
}
true"
fi
echo
"To close a python server run the commeand:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment