[NTG-context] pretty printers

Aditya Mahajan adityam at umich.edu
Wed May 8 22:55:41 CEST 2019


On Wed, 8 May 2019, Tomas Hala wrote:

> Wed, May 08, 2019 ve 10:14:45PM +0200 Wolfgang Schuster napsal(a):
> # Tomas Hala schrieb am 08.05.2019 um 21:58:
> # >Hi all,
> # >
> # >according to our wiki, there are pretty printers in ConTeXt
> # >implemented only for TEX, LUA, XML and MP.
> # >
> # >I am searching now for PHP pretty printer but I did not find
> # >anything on the net (only C and Java). I would like to ask
> # >whether is something for PHP (or for other programming languages)
> # >available.
> # 
> # 1. Use the scite module which provides additional styles (e.g. cpp
> # or json) but php is still missing.
> # 
> # 2. Use Aditya's vim module which uses vim to highlight source code.
> # 
> # Wolfgang
>
> Maybe it is a misunderstanding but how can use these modules
> in ConTeXt? I had in mind typesetting the code in ConTeXt
> like \startTEX etc.

Here is an example with the vim module:

\usemodule[vim]
\definevimtyping[HTML][syntax=html]
\definevimtyping[PHP] [syntax=php]

\starttext

\startHTML
<html>
    <head>
       <title>Hello World</title>
    </head>

    <body>
       <?php echo "Hello, World!";?>
    </body>
</html>
\stopHTML

\startPHP
<?php
    $a = 3;
    $b = 4;
    $c = sqrt($a**2 + $b**2)
?>
\stopPHP

\stoptext

See https://github.com/adityam/filter/blob/master/vim-README.md for more 
details.

Aditya


More information about the ntg-context mailing list