Skip to main content

Sphinx XWiki Builder

Builds XWiki syntax output from Sphinx documentation source files. For more information, see:

Additionally, this extension will automatically convert snake-case input files into a CamelCase variant in line with XWiki page names, so using this extension doesn’t require you to change your filenames to be more “wiki” like. You can override this behavior, however, by using the xwiki_page_name_overrides option to set your own file to XWiki page name mapping.

You can easily copy the output for any of the generated pages and paste it or upload it to your XWiki instance.

Installing

To install the extension, run:

python3 ./setup.py install --user

or install it from PyPi:

pip3 install sphinx-xwiki-builder

Using the extension

In your conf.py, add the following:

extensions.append("abstrys.sphinx_xwiki_builder")

Now you can build XWiki output by building the “xwiki” target:

sphinx-build -b xwiki <sourcedir> <outputdir>

The files will be stored as <PageName>.xwiki within the ‘xwiki’ directory within <outputdir>.

Options

You can use the following options to modify the output:

xwiki_root_page

Set the XWiki page that serves as the “root” page. This is the page that will contain the contents of your Sphinx documentation’s index.rst file.

All other pages in the documentation will be sub-pages of the root page:

{RootPage}/{PageName}
 |          |
 |          +-- All other pages in the toctree.
 |
 +-- The `index.rst` file.

No attempt is made to create further sub-pages to avoid incompatibility with normal Sphinx projects, and to prevent linking issues due to varying local paths.

You should definitely set this option! It has no default value.

xwiki_page_template

By default, the output of the writer will be fairly plain, with minimal styling. Use this option to provide a path to your own Jinja2 template that will be used when writing output files.

If you want to add CSS style rules to a page, for example. or include XWiki templates, custom headers or footers, this is the place to do it.

This is optional—no template is needed to get a reasonable XWiki page from a Sphinx project.

Important

Because XWiki uses the {% and {{ syntax that’s also Jinja’s default block and variable markers, and uses [[ and (( markers for links and group markers, you must use the following characters in your template to begin and end blocks, variables, and comments:

  • blocks: enclose within <% and %>

  • variables: enclose within << and >>

  • comments: enclose within <# and #>

In other words, just change your normal curly-braces with angle braces.

The following variables are provided for placement of the content within the template:

  • doc_name: the name of the page itself (not the title of the H1 element).

  • page_contents: the rendered XWiki contents of the page.

xwiki_page_name_overrides

By default, Sphinx (HTML) style snake-case page names will be automatically converted to CamelCase, which is the way that XWiki page names tend to be written.

You can use this option to provide a mapping of input file names to output wiki names. As with Sphinx toctrees, use the file’s basename—the filename’s extension (.rst, .md) should not be included.

License and further information

This Sphinx extension was originally developed by Eron Hennessey <eron@abstrys.com>.

This software is provided under the conditions of the MIT open-source license. See the LICENSE file included in this repository for complete details.

Metadata

Release files for sphinx-xwiki-builder 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-xwiki-builder 0.1.1
File Size Uploaded Provenance Actions
sphinx-xwiki-builder-0.1.1.tar.gz 13.3 kB Without provenance Details for sphinx-xwiki-builder-0.1.1.tar.gz

Release files / sphinx-xwiki-builder-0.1.1.tar.gz

Download URL sphinx-xwiki-builder-0.1.1.tar.gz
Size 13.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3ef63791f128e63d00c62b1d6e312d11a698de7796ba19affab6dd926c8b3745
BLAKE2b-256 checksum
How to use checksums
3a1c93e63030625cd8da499f695f238ba96575e904a7057c97c276a6b7c46cbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.2 pkginfo/1.4.2 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.37.0 CPython/3.7.6

Security for sphinx-xwiki-builder 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page