#lang scheme (require "../../xml.ss" "../../html.ss" "../../css.ss" "../../scm-markup.ss") (define tech-report-css (css (body (font-family "sans-serif") (font-size "11pt") (color "black") (background-color "#ffffff") (margin-top "2em") (margin-left "8%") (margin-right "8%")) (a:link (color "#336666")) (a:visited (color "#336666")) (a:active (color "#336666")) (h1 (margin-top ".5em") (font-size "13pt") (color "#006699")) ((h2 h3 h4 h5 h6) (margin-top ".5em") (font-size "11pt") (color "#006699")) (.bwgreen (color "#00cc00")) (.bwblue (color "#006699")) (.title (font-size "200%")) (.partheading (font-size "90%")) (.chapterheading (font-size "90%")) (pre (margin-left "2em")) ((// ol) (list-style-type "decimal")) ((// ol ol) (list-style-type "lower-alpha")) ((// ol ol ol) (list-style-type "lower-roman")) ((// ol ol ol ol) (list-style-type "upper-alpha")) ((// .scheme) (color "brown") (font-size "10pt")) ((// .scheme .keyword) (color "black") (font-weight "bold") (font-size "10pt")) ((// .scheme .builtin) (color "#990000") (font-size "10pt")) ((// .scheme .variable) (color "navy") (font-size "10pt")) ((// .scheme .global) (color "purple") (font-size "10pt")) ((// .scheme .selfeval) (color "green") (font-size "10pt")) ((// .scheme .comment) (color "teal") (font-size "10pt")) ((// .scheme .schemeresponse) (color "green") (font-size "10pt")) ((// .scheme .builtin) (color "#990000") (font-size "10pt")) (.navigation (color "red") (text-align "right") (font-style "italic")) (.disable (color "gray")) (.smallcaps (font-size "75%")) (.smallprint (color "gray") (font-size "75%") (text-align "right")) (.footnoterule (text-align "left") (width "40%")) (.collophon (color "gray") (font-size "80%") (font-style "italic") (text-align "right")) ((// .collophon a) (color "gray")) )) (define code-fact "; tree recursive version of the factorial function (define (fact n) (if (< n 2) 1 (* n (fact (- n 1))))) ") (define code-1 "(with-output-to-file \"example.txt\" (lambda () (display \"Testing strings \\\"with\\\" quotes.\") (display \"This sentence includes a \\n (a backslash-n).\"))) ") (define code-2 "`(p (a (@ (href ,url)) ,link-text) ,@(build-para-contents)) ") (define code-3 "(list #\\! 'a #\\space #(1 2 3) #\\311 #t #f)") (define code-4 "#| A block comment... The definition below illustrates syntax-coloring for a literal box. |# (define a-box #&(1 2 3))") (with-output-to-file "example.html" (lambda () (write-xml (h4:html (h4:head (h4:title "Demo of Syntax-coloring in HTML") (h4:style h4:type: "text/css" tech-report-css)) (h4:body (h4:p "Below is the factorial function, with syntax-coloring:") (scm-prog->html code-fact) (h4:p "More Examples:") (h4:p "Expression with string constants:") (scm-prog->html code-1) (h4:p "A quasiquote expression:") (scm-prog->html code-2) (h4:p "Test of octothorpe lexical notations:") (scm-prog->html code-3) (h4:p "Test of block comments:") (scm-prog->html code-4) (h4:p "Generated by WebIt!."))) #t)) 'replace)