Skip to main content

Arches templating provides an extensible templating engine for various file types

Project description

arches-templating

An application to add templating/reporting capabilities to Arches.

Installation

Install via pip, arches-templating (forthcoming). Or install a development version by pulling down the repository and running pip install from the local repo directory.

Add the arches_templating module to the project's list of INSTALLED_APPLICATIONS.

Run migrations from your project to install database.

python manage.py migrate arches_templating

Add urls to your project's urls.py if you wish to use the built-in view to submit your templates.

path("your-base-url-here/", include("arches_templating.urls"))

Alternatively, you can call the template engine directory and provide your data container and template ID.

The Data Container

The data container is a json-based object that is provided to the template engine along with the template ID. It is referenced by the template designer when creating the template - the paths in the template should match the ones being provided by the data container.

Adding Templates

Currently, the only way to add templates is via the django admin interface. Visit the /admin url of your site and upload your templates there.

Creating Templates

We currently support five base tags.

  • value
  • context
  • if
  • image
  • end

Each of these tags requires a "path" attribute and is prefixed by "arches:". For example:

<arches:value path="path/in/data/container">

An end tag is required for the context and if tags.

The context tag will change the "context" of its child tags to whatever its path matches within the data container provided to the template engine.

Functionally, this means that

<arches:value path="foo/bar">

and

<arches:context path="foo">
<arches:value path="bar">
<arches:end>

are functionally equivalent and referencing the same data within the data container.

If the context is pointing to an array, this is currently the method being used to render table rows.

Elements can be optionally rendered by an if tag.

<arches:if path="foo">
Some optionally rendered content, depending on value at the "foo" path of your data container.
<arches:end>

An image tag can render an image from a URL or (optionally) a base64 encoded image from the backend. <arches:image path=“path_to_image_or_path_to_url”>

The if tag can be inverted by providing an "inverse" attribute set to true.

<arches:if inverse="true" path="foo">

Currently powerpoint, word, and spreadsheet templates are supported. We welcome the addition of more implementations and improvements/bug fixes on the ones that currently exist.

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

arches-templating-0.1.2.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

arches_templating-0.1.2-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file arches-templating-0.1.2.tar.gz.

File metadata

  • Download URL: arches-templating-0.1.2.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for arches-templating-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c5f0fab434b16197d296aff5c1c4ed81ee744b95a8e59b72219ea7a3332d978a
MD5 7f7eec139658d9e745272d8c9ebe1eed
BLAKE2b-256 1911f8a1d9ba44bc2bca72eb1bad7676c281af6bf2b256ad79bf4df60abcbd80

See more details on using hashes here.

File details

Details for the file arches_templating-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for arches_templating-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1710b358f285974827c0a11438dbf37337ef3c45520f536926b183d3109838a6
MD5 33bee3cd983583bbffaf9c77af5d07c7
BLAKE2b-256 49802c5e1a6e0f3ecded18d7af81e0ab39ad76da19cb2ed4e78919883f1ea577

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