Convert
Converts input notebooks to the specified target formats.
Usage
urnc convert [-f|-n|-i] [-t TARGET] [-s SOLPATH] [-o OUTPATH] INPUT
Description
Notebook conversion by urnc happens in two stages:
All lines of all input notebooks are checked for [keywords]. If a keyword is found, the containing cell is [tagged] accordingly.
All tagged cells are processed according to the specified target format.
This two-stage approach allows manual tagging of cells in addition to the use of keywords to configure the conversion behaviour. See -t, –target TARGET for a description of the effect of each tag on the conversion targets.
Options
INPUT
Path to a single input notebook or a directory containing notebooks. If INPUT is a directory, all notebooks in the directory are converted recursively.
-t, –target TARGET
Specifies the conversion target, i.e., the type of conversion to be performed.
This option can be used multiple times to specify multiple targets.
Valid targets are: student, solution, execute, clear, and fix.
Every target can contain an additional, colon-seperated output path, e.g.
student:out or solution:C:\tmp.
Paths can contain placeholder variables.
If not output path is provided, a target-specific default location is used, as
described in Plain Directory Paths.
Depending on the target, the following actions are performed for each input
notebook:
student:Tag cells matching
# <solution-keyword>assolution.Tag cells matching
# <skeleton-keyword>asskeleton.Find cells tagged as
solutionand/orskeletonbut not asignore.Remove
solutionlines and uncommentskeletonlines from these cells.
solution:Tag cells matching
# <skeleton-keyword>asskeleton.Find cells tagged as
skeleton, but not asignore.Uncomment
skeletonlines in these cells.
execute:Tag cells matching
# <solution-keyword>assolution.Find cells tagged as
solutionbut not asnoexecute.Execute these cells.
clear:Clear all output cells in the notebook.
fix:Fix all image paths in the notebook.
A summary of the effect of each tag (rows) on each target (columns) is shown below:
student |
solution |
execute |
clear |
fix |
|
|---|---|---|---|---|---|
ignore |
skip |
skip |
. |
. |
. |
noexecute |
. |
. |
skip |
. |
. |
solution |
remove |
. |
execute |
. |
. |
skeleton |
uncomment |
remove |
. |
. |
. |
assignment |
. |
. |
. |
. |
. |
assignmentstart |
. |
. |
. |
. |
. |
-o, –output OUTPATH
Path for storing the output of the student target.
Can be a file or directory path.
If -o OUTPATH is not specified, out/ is used by default.
Supports placeholder variables.
Remark: specifying -o OUTPUT is equivalent to specifying -t student:OUTPATH.
-s, –solution SOLPATH
Path for storing the output of the solution target.
Can be a file or directory path.
If -s SOLPATH is not specified, the solution target is not generated (unless
specified via -t solution).
Supports placeholder variables.
Remark: specifying -s SOLPATH is equivalent to specifying -t solution:SOLPATH.
-n, –dry-run
If specified, the conversions are performed in memory but nothing gets written to disk.
-f, –force
By default, if an output path exists already, the conversion is skipped.
Specifying -f forces existing files to be overwritten.
-i, –interactive
If an output path exists already, the user is prompted for confirmation before overwriting it.
-h, –help
Show this help message and exit.