Version française
Home     About     Download     Resources     Contact us    
Browse thread
Syntax highlighting and Ocaml/PHP integration
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Martin Jambon <martin.jambon@e...>
Subject: Re: [Caml-list] Syntax highlighting and Ocaml/PHP integration
On Wed, 1 Oct 2008, Dario Teixeira wrote:

> P.S.  Another (possibly far-fetched) solution is to take advantage of the
>      syntax highlighting capabilities of Vim or Emacs.  Something along
>      the lines of embedding or remotely invoking one of these editors,
>      with the sole purpose of asking them to highlight a text file.
>      Is this even possible?

I've used vim a little bit for my static webpages, here's the result:

http://martin.jambon.free.fr/hello.c.html
http://martin.jambon.free.fr/quine.sh.html
http://martin.jambon.free.fr/micmatch/Makefile.html


The script is:


#!/bin/sh -e

# Usage : any2html <file1> [<file2> ...]
# Requires : vim

[ $# -lt 1 ] && echo "Usage : $0 <fic1> <fic2> ..." && exit 1

while [ -n "$1" ]
do
     file=`basename "$1"`
     cp -f "$1" /tmp
     vim -f +"syn on" +"so \\\$VIMRUNTIME/syntax/2html.vim" +"wq" +"q" /tmp/"$file"
     cp -f /tmp/"$file".html "$1".html
     shift
done
###########################################################


Martin
--
http://mjambon.com/