Skip to main content

pybars3_extensions library.

This introduces #each, #case and #default for building switch/case statements.

Usage

Template:

{{#each cool.items}}
{{#switch this.type}}
{{#case '1'}}MATCH: {{this}}{{/case}}
{{#default}}NO MATCH{{/default}}
{{/switch}}
{{/each}}

Python code:

from pybars3_extensions import helpers

# ...

hbs = pybars.Compiler().compile(source=template)
print(hbs(data, helpers=helpers))

Installation

pip install pybars3_extensions

Download files

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

Source Distribution

pybars3_extensions-1.0.0.tar.gz (1.6 kB view details)

Uploaded Source

File details

Details for the file pybars3_extensions-1.0.0.tar.gz.

File metadata

  • Download URL: pybars3_extensions-1.0.0.tar.gz
  • Upload date:
  • Size: 1.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.6

File hashes

Hashes for pybars3_extensions-1.0.0.tar.gz
Algorithm Hash digest
SHA256 99fa229af3fe32957d7008b3d64465d79c2ea47d735375d094cc9a32d6506657
MD5 a210e4353df85dbba6a780d5d8be8b0b
BLAKE2b-256 de53c4a5bcf5edb5ecb82fb5261b853569757dd23176a4c359128a802a1ffae4

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 file

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