Skip to main content

hsx

Version: 0.0.2

hsx is a small macro-style preprocessor for static content.

It replaces XML-like tags in a source file with the contents of fragment files stored in a directory.

Fragments are plain text files (for example markdown, HTML, CSS) and are included by tag name composited using JSX like instructions. (hence the name)

Code Maturity

This code is experimental, and version 0.0.1 See SEMVER.md for how I use semantic versioning

Author

Michael Sparks (sparks.m@gmail.com / https://github.com/sparkslabs )

What it does

Replaces <Tag /> with the contents of Tag.<extension> from a fragment directory.

  • Supports attributes: <Tag key="value" /> with {args.key} substitution.

  • Supports block tags: <Tag> ... </Tag> with {args.__text__} substitution.

  • Supports nested tags.

  • Evaluates fragments recursively with a bounded recursion depth.

Deliberately fails on structural mismatches (eg misordered closing tags). It does not implement loops, conditionals, or a templating language.

Usage

Assuming copied onto your path somewhere

hsx.py

hsx.py [OPTIONS]

Where options are:

  • --dir <directory> Fragment directory
  • --extension <ext> Fragment file extension
  • --destfile <filename> Write output to file instead of stdout
  • --file <filename> Filename to process

Defaults:

  • Fragment directory: frags

  • Fragment extension: .hsx

  • Source file: markdown.hsx

Bonus mkAutoSite.py

mkAutoSite is intended to use hsx - in particular it's designed to statically compile a collection of templates, HSX files, and markdown files to a static website.

This is put here for the moment as an expediency to eradicate having 10 copies across my filesystem.

Plan for Autosite

Extend current template processing to build templates from HSX files

License

Apache License 2.0 (as usual)

Metadata

Release files for hsx 0.0.2

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

Source distribution (sdist)

Source distribution for hsx 0.0.2
File Size Uploaded Provenance
hsx-0.0.2.tar.gz 11.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for hsx 0.0.2
File Interpreter ABI Platform
hsx-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.4 kB

Release files / hsx-0.0.2.tar.gz

Download URL hsx-0.0.2.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
86d16810dcad35e39443c6130d0091d4a9e88af35f8e771178f4e0a087813147
BLAKE2b-256 checksum
How to use checksums
0aaef215521c4e5c06966624953c9066aefba4277a8997fef73a6b44ae40040c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / hsx-0.0.2-py3-none-any.whl

Download URL hsx-0.0.2-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aab46c779e6cb336feab6621cb15c7514498744683bf4dfbbc244ac54df15728
BLAKE2b-256 checksum
How to use checksums
1243f343797236c9ecf42f58aeeb26ba486523f7d9f248d58c4dfb3c9d955a23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for hsx 0.0.2

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.0.2 This release

2 release files 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