Package: naucse-render
naucse_renderHelper for converting course material in YAML/Markdown/Jupyter to
naucse.python.cz JSON API.EntrypointsGet a list of available courses:naucse_render.get_course_slugs(*, path='.')Get general course information:naucse_render.get_course(course_slug, *, path='.', version=None)Get information about lessons:naucse_render.get_lessons(lesson_slugs, vars=None, path='.')Compile a given course into a directory of JSON & HTML files:def compile(slug=None, *, path='.', destination, edit_info=None)Thepathspecifies the local filesystem path to the root of the repository
(i.e. parent directory ofcourses,runsandlessons).Installation & CLI UsageInstall the latest released version from PyPI.
With an activated virtualenv, do:(venv)$pipinstallnaucse_renderFor development, you can instead install in editable mode
withdevdependencies:(venv)$pipinstall-e.[dev]You can run naucse_render from the command line.
To “compile” a course to a directory of JSON metadata and static files:(venv)$python-mnaucse_rendercompile_built/To output metadata for a course or individual lesson(s):(venv)$python-mnaucse_renderget-course(venv)$python-mnaucse_renderget-lessonsbeginners/installbeginners/venv-setupBy default, data is retreived from the current working directory.
Use the--pathoption to point naucse_render elsewhere.You can use--helpfor more info.TestsTo run tests, install this package with development dependencies:(venv)$pipinstall-e.[dev]then run the tests withpytest:(venv)$python-mpytestLicenseThe code is licensed under the terms of the MIT license, seeLICENSE.MITfile
for full text. By contributing code to this repository, you agree to have it
licensed under the same license.Changelognaucse_render 1.10naucse_render compilenow checks for links to missing lessons and
non-existentids in lessons. It fails if one is found.Fixed links after headingsAPI version 0.4Each page of a lesson now has alinksentry with a list of all links
found on the page.Each page of a lesson now has aidsentry with a list of allidattributes found on the page.naucse_render 1.9naucse_rendernow works with current releases of Jinja2.naucse_render 1.8naucse_render compilenow supports the--allswitch, which
compiles all available courses to directories under the
destination directory.
This is now the default when--slugis not given and a default course
is not found.
This change should allow using a common CI config for all repos with
course definitions.Anchors are now automatically added to all headers, making it possible to
link to individual sections. (thanks to Jakub Beránek)naucse_render 1.7Added the functionnaucse.get_course_slugs()and the CLI subcommandnaucse_render ls, which return a list of courses naucse_render can load
from the given directory.Courses may now be specified with a "flat" file likecourses/<course-slug>.yml, rather than ainfo.ymlfile nested in a
directory.naucse_render 1.6Courses can now specifyextra_lessons, a list of lessons thatcompilewill include in its output even if they don't appear in
session materials.
This is more explicit than relying on links in the course content
(which would need to be parsed any time this info is needed, making
things slower).naucse_render 1.5A new subcommand,compile, creates a directory with course data
and supporting files.API version 0.3A course may have information about "edit info", specifying where the
course's sources can be edited. (This is only set when compiling
courses; in other cases, the caller should know where the code lives.)Theslugis now optional; if not given (or None), the data is loaded
fromcourse.yml(in the givenpath, by default the current directory)
rather than a file inruns/orcourses/.naucse_render 1.4Compatible withnbconvert6.0.naucse_render 1.3Lesson directories without data are ignored
(https://github.com/pyvec/naucse_render/issues/15)API version 0.2Subpages now have subtitlesNon-indexsubpages may optionally have asubtitle. For example,
a lesson named "Installation" might have a OS-specific subpage with the
subtitle "Linux".If thetitleof a non-indexsubpage may now be missing in the input.
In that case, thesubtitlemust be present, and thetitleis generated
as"{lesson title} – {page subtitle}".Timezone information is passed throughMappings read from YAML must have unique keys.Subpages may now be linked with relative URLs:./page, just like
other lessons can be linked with../lessonor../../category/lesson.
("Short" linking to subpages of other lessons, like../lesson/page,
still doesn't work.)naucse_render 1.2API version 0.1Serial "numbers" are now generated for sessions.Serials are strings (or None). Usually they are numeric (like'1'),
and in the source YAML they may be specified as int.
But, for example, an appendix could use Roman numerals:i,ii,iii.When a serial is not given in the source YAML explicitly, it is
auto-generated as the previous serial plus 1 (or from1at the start).
Serials specified as str (or None) prevent this auto-generation.For courses with only one session, the serial is not auto-generated.naucse_render 1.1Make it possible to use data from a YAML file in lesson contentMake output the same on Windows as on "Unixy" systemsnaucse_render 1.0Source files are always reported as relative pathsYAML files are reloaded when they changeAdded integration testsnaucse_render 0.x0.x should successfully render courses hosted on naucse.python.cz
prior to 2019.The format of the source files grew organically, so there is no attempt here
to document it.