This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
# ticketml [![Build Status](https://travis-ci.org/lukegb/ticketml.svg?branch=master)](https://travis-ci.org/lukegb/ticketml) [![PyPI Version](https://pypip.in/version/ticketml/badge.svg?style=flat)](https://pypi.python.org/pypi/ticketml)
A small XML-based markup language for tickets

Why?
====

As part of the code I write for [Imperial Cinema](http://www.imperialcinema.co.uk), I decided
I need some way of cleanly abstracting over multiple different (but similar) ticket printers.

I decided on a sort-of HTML-ish language, for which you will find a parser and ticket printing
backend for the following receipt printers:

* Citizen CBM-1000
* IBM 4610 family (tested on the 4610-TF6)

The XML
=======

The XML document has the following sort of style:

```xml

<ticket>
<head>
<logo num="1"/>
not bold<b> suddenly bold</b> not bold again

not underlined <u>suddenly underlined</u> not underlined

now <b>for <u>a mix</u></b> <u>of <b>settings</b></u>

<align mode="center"><logo num="2"/></align>
base font

<font width="2">2x wide</font>

<font height="2">2x high</font>

<font width="2" height="2">2x big</font>

<font width="8" height="8">MASSIVE</font>
</head>
</ticket>
```

(Note that this document is formatted neatly - leading per-line whitespace is NOT stripped by the parser and may cause you issues!)

The following tags are implemented - unknown tags are ignored (but are still recursed into!):

* `ticket`: this is the root tag and is not treated specially
* `b`: activates emphasis (usually bold)
* `u`: activates underlining
* `logo num="NUMBER"`: prints pre-loaded image NUMBER
* `align mode="left|right|center"`: changes the alignment of text
* `br`: prints a newline
* `font (width="WIDTH") (height="HEIGHT")`: changes the font width/height multiplier

Using it
========

At the moment there's a fairly simplistic API. In order to get started, you'll need some sort of file-like output device. This is usually a PySerial `Serial` object.

```python
import serial
output = serial.Serial('/dev/ttyS1', 19200)
```

Now that you have an output device, you can construct a `Backend`. At present there's a choice of two, the `CbmBackend` (for Citizen CBM-1000 printers) and the `Ibm4610Backend` (for IBM 4610 series printers). Backends are up to take whatever arguments they choose - at the moment this is just the output device they should talk to.

```python
backend = ticketml.Ibm4610Backend(output)
```

Now you can finally construct a parser. This takes place in two stages - first you parse the input XML, then you tell the parser to render it to the output device:

```python
ticket = ticketml.TicketML.parse('\n<ticket>Hello! This is my first ticket!</ticket>')
context = {}
ticket.go(context, backend)
```

The `context` parameter is unused at the moment, but is planned to be used for future templating functionality.
Release History

Release History

0.2.3

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
ticketml-0.2.3-py2.py3-none-any.whl (10.2 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Dec 11, 2015
ticketml-0.2.3.tar.gz (8.2 kB) Copy SHA256 Checksum SHA256 Source Dec 11, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting