Skip to main content

A text processing and literate programming tool inspired by antiweb, noweb

Project description

pnw is a text processing tool with a wide range of applications. It can be used to compile chunks of text from various sources into a new text file. The advantage over cut-and-paste techniques is that changes in the source file are automatically followed. Secondly, we provide a thin wrapper around the pandoc document converter. Therefore, chunks of text can be converted from and to a wide range of lightweight markup languages as well as html and tex/latex. Although literate programming has become a little out of fashion, pnw can be used as a literate programming tool, too. Not surprisingly, pnw itself and its documentation is written using pnw. pnw is remotely inspired by noweb and heavily inspired by (even borrowing part of the syntax from) antiweb. An important feature of pnw, which is not present in antiweb, is the support of namespaces. This allows to create reusable block libraries which can be imported and addressed in a dot-notation syntax similar to python modules.

A pnw file is a text file with tags defining named blocks of text. In a way this is similar to an xml file. Tags may be hidden behind comment characters, such that the file remains processable by another program. The blocks of text from various pnw files can be processed and rendered by another pnw file.

Nutshell

Here is a brief example of a pnw file:

$@path(../..)
$@path(..)
$@import(latex-blocks.tex)
$@import(md-blocks)
$@import(pnw.pnw)
$@include(ltxheader)
$@chunk(test,format=md)

   A block of text
$@end

$@chunk(pnw,format=rst)
PNW
===

$@include(moduledoc)
$@include(test)
$@end

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

pnw-0.0.5.tar.gz (681.7 kB view hashes)

Uploaded Source

Supported by

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