From e89efdd5d11a8571b4fc3d71c2ec9cd235e0bad5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 5 Feb 2008 19:11:04 +0100 Subject: doc: Document C/Java source highlighting. --- doc/user/prgm.skb | 11 +++++++++++ doc/user/src/prgm4.skb | 28 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 doc/user/src/prgm4.skb (limited to 'doc') diff --git a/doc/user/prgm.skb b/doc/user/prgm.skb index e44ad10..5c681f8 100644 --- a/doc/user/prgm.skb +++ b/doc/user/prgm.skb @@ -98,6 +98,17 @@ can be rendered using different colors or faces.]) (example-produce (example :legend "The source markup" (prgm :file "src/prgm2.skb")) (disp (include "src/prgm2.skb"))) + +(p [Note that even awful programming languages of the C family can be +highlighted!]) + +(linebreak) +(example-produce + (example :legend "The source markup for C" (prgm :file "src/prgm4.skb")) + (disp (include "src/prgm4.skb"))) + +(p [You would highlight Java,(symbol "tm") code in a similar way, i.e., +with ,(tt [:language java]).]) (mark "*source-path*") (p [Files passed as the ,(tt [:file]) argument of ,(markup-ref "source") diff --git a/doc/user/src/prgm4.skb b/doc/user/src/prgm4.skb new file mode 100644 index 0000000..734de54 --- /dev/null +++ b/doc/user/src/prgm4.skb @@ -0,0 +1,28 @@ +(use-modules (skribilo source c)) + +(p [Here's how:]) + + (linebreak) + (prog + (source :language c +[#include + +static int foo = 10; +static float bar; + +/* This is the function responsible + for integer chbouibification. */ +float +chbouibify (int x) +{ + bar = foo + (float) x / random (); + foo = (float) x * random (); + + if (x > 2) + /* Great! */ + printf ("hello world!\n"); + else + printf ("lower than two\n"); + + return ((float) foo * bar); +}])) -- cgit v1.2.3