Skip to main content

A Python module for parsing and rendering PawML

Project description

Pawser

Pawser is a lightweight Python parser for PAWML (Pawso Markup Language).
It allows you to read, parse, and convert .pawml files into a tree of nodes or instruction lists.

Installation

Install via pip through PyPI

pip install pawser

This is the most common method, however if you do not have pip and/or would like to download this without or for other reasons, you can;

Clone the repository and install locally:

git clone https://github.com/komoriiwakura/pawser
cd file:///home/komori/Desktop/PAW/pawser/README.md
pawser
pip install -e .

PAWML Syntax

PAWML supports the following elements:

  • #h1, #h2, #h3 - Headers with text
  • #p - Paragraphs with text
  • #li - List container
  • #it - List items
  • #ol - Open links with URL and link text
  • #mdata - Metadata, supports title, and desc

Convert PAWML to Instructions

from pawser import pawml2instructions, printInstructions

# Parse PAWML file and convert to instructions
instructions = pawml2instructions("example.pawml")

# Print instructions
if instructions:
    printInstructions(instructions)

# Or use the instructions list programmatically
if instructions:
    for instruction in instructions:
        print(instruction)
        # Process each instruction as needed

Available Functions

  • parsePawml(filePath) - Parse a PAWML file into a tree structure
  • pawml2domtree(filePath) - Parse a PAWML file and return the DOM tree
  • pawml2instructions(filePath) - Parse a PAWML file and convert to instruction list
  • printTree(node) - Print the tree structure in a readable format
  • printInstructions(instructions) - Print instructions in a readable format

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

pawser-1.0.1.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pawser-1.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pawser-1.0.1.tar.gz.

File metadata

  • Download URL: pawser-1.0.1.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pawser-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d04bfa2d711fa0da0c9ed616d3319025d62802ddfb44891da99a1d3bc1239268
MD5 62998b1f193aa28b2c12a3c72f5aad01
BLAKE2b-256 916595a7dc69f6225f7d6e193c10a4386bbbece0e565a9f39b44dc2e769a0c33

See more details on using hashes here.

File details

Details for the file pawser-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pawser-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for pawser-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7e87dcc6a5b7d08d32bd56b1dcf62a6251bc11b90e3006a4c7a564256eae483b
MD5 f205ef601829789cd8102d7f2d9cd840
BLAKE2b-256 3f2615417ab0681f5fed81fdefaacd8bfb0e6fcf71544e45b8b1d628c796baaf

See more details on using hashes here.

Supported by

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