Skip to main content

Builds Sphinx documentation source to XWiki-syntax output

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx-xwiki-builder-0.1.1.tar.gz (13.3 kB view details)

Uploaded Source

File details

Details for the file sphinx-xwiki-builder-0.1.1.tar.gz.

File metadata

  • Download URL: sphinx-xwiki-builder-0.1.1.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for sphinx-xwiki-builder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3ef63791f128e63d00c62b1d6e312d11a698de7796ba19affab6dd926c8b3745
MD5 8bc1df6a19f990edbea20dfe7eb6e782
BLAKE2b-256 3a1c93e63030625cd8da499f695f238ba96575e904a7057c97c276a6b7c46cbe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page