Skip to content

alexpdp7/prolog-asciidoc

Repository files navigation

Sample parsing of some AsciiDoc features.

Works on SWI Prolog, might work with Scryer Prolog.

Right now the parser is very limited. It can parse files like sample.adoc:

:xx_xx:

* This is a list.
* This item *has* emphasis
* This item _has**more**_ complex formatting.
* And we are * error tolerant.

Refer to parsing AsciiDoc in Prolog for further details.

Installing

A container image is available at quay.io/alexpdp7/prolog-asciidoc:main.

To run in your system you need SWI-Prolog.

You can install the parser with pipx by running:

$ pipx install git+https://github.com/alexpdp7/prolog-asciidoc.git

Running

To execute the parser, run the pasc command.

$ pasc sample.adoc | python -m json.tool
{
    "type": "Document",
    "header": {
        "type": "Header",
        "header_lines": [
            {
                "type": "AttributeEntry",
                "attribute_name": "xx_xx",
                "pos": {
                    "begin": {
                        "character": 0,
                        "line": 0,
                        "column": 0
                    },
                    "end": {
                        "character": 8,
                        "line": 1,
                        "column": 0
                    }
...

You can also use a container:

$ podman run --rm -v $(pwd):/pwd -w /pwd --security-opt label=disable quay.io/alexpdp7/prolog-asciidoc:main pasc sample.adoc

With cmdainer, run the following command to create a wrapper for the container.

$ cmdainer add-wrapper prolog-asciidoc pasc quay.io/alexpdp7/prolog-asciidoc:main

pasc takes a single argument The argument is the path to the file to parse. If the file is -, then pasc parses from standard input.

You can use - to use the container without requiring volumes:

$ cat sample.adoc | podman run --rm -i quay.io/alexpdp7/prolog-asciidoc:main pasc -

Differences from AsciiDoctor

Development

Testing

Run tests with:

$ python3 -c "import build ; build.test_prolog()"

Building and pushing images

$ python3 -c "import build ; build.build_image_and_push()"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published