;;; html.scm -- HTML implementation of the `slide' package. ;;; ;;; Copyright 2003, 2004 Manuel Serrano ;;; ;;; ;;; This file is part of Skribilo. ;;; ;;; Skribilo is free software: you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation, either version 3 of the License, or ;;; (at your option) any later version. ;;; ;;; Skribilo is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with Skribilo. If not, see . (define-module (skribilo package slide html) :use-module (skribilo utils syntax) :use-module (skribilo ast) :use-module (skribilo engine) :use-module (skribilo writer) :autoload (skribilo resolve) (resolve!) :autoload (skribilo output) (output) :autoload (skribilo evaluator) (evaluate-document) :autoload (skribilo engine html) (html-width html-title-authors) :use-module (skribilo package slide) :use-module (skribilo package base)) (skribilo-module-syntax) (define-public (%slide-html-initialize!) (let ((he (find-engine 'html))) (display "HTML slides setup...\n" (current-error-port)) ;; &html-page-title (markup-writer '&html-document-title he ;;:predicate (lambda (n e) %slide-initialized) :action html-slide-title) ;; slide (markup-writer 'slide he :options '(:title :number :transition :toc :bg) :before (lambda (n e) (display "
\n") (format #t "" (markup-ident n))) :action (lambda (n e) (let ((nb (markup-option n :number)) (t (markup-option n :title)) (class (markup-class n))) (if class (let ((title-class (string-append class "-title"))) ;; When a class is specified, let the user play ;; with CSS. (format #t "\n
" class) (format #t "
" title-class) (format #t "~a / ~a -- " nb (slide-number)) (output t e) (display "
\n") (output (markup-body n) e) (display "\n
\n")) ;; When no class is specified, do HTML tricks. (evaluate-document (center (color :width (slide-body-width e) :bg (or (markup-option n :bg) "#ffffff") (table :width 100. (tr (th :align 'left (list (if nb (format #f "~a / ~a -- " nb (slide-number))) t))) (tr (td (hrule))) (tr (td :width 100. :align 'left (markup-body n)))) (linebreak))) e)))) :after "
") ;; slide-vspace (markup-writer 'slide-vspace he :action (lambda (n e) (display "
"))))) ;*---------------------------------------------------------------------*/ ;* slide-body-width ... */ ;*---------------------------------------------------------------------*/ (define (slide-body-width e) (let ((w (engine-custom e 'body-width))) (if (or (number? w) (string? w)) w 95.))) ;*---------------------------------------------------------------------*/ ;* html-slide-title ... */ ;*---------------------------------------------------------------------*/ (define (html-slide-title n e) (let* ((title (markup-body n)) (authors (markup-option n 'author)) (tbg (engine-custom e 'title-background)) (tfg (engine-custom e 'title-foreground)) (tfont (engine-custom e 'title-font))) (format #t "
\n" (html-width (slide-body-width e))) (if (string? tbg) (format #t "
" tbg) (display "")) (if (string? tfg) (format #t "" tfg)) (if title (begin (display "
") (if (string? tfont) (begin (format #t "" tfont) (output title e) (display "")) (begin (display "
") (output title e) (display ""))) (display "
\n"))) (if (not authors) (display "\n") (html-title-authors authors e)) (if (string? tfg) (display "
")) (display "
\n"))) ;;; ;;; Slide topics/subtopics. ;;; (markup-writer 'slide-topic (find-engine 'html) :options '(:title :outline? :class :ident) :action (lambda (n e) (let ((title (markup-option n :title)) (class (markup-class n))) ;; top-level class (if class (format #t "\n
" class)) ;; the title (if class (format #t "\n
" class) (display "\n

")) (if (markup-ident n) (format #t "" (markup-ident n))) (output title e) (if class (display "

\n") (display "
\n")) ;; pointers to the slides (if class (format #t "\n
" class) (display "\n
")) (for-each (lambda (s) (let* ((title (markup-option s :title)) (ident (markup-ident s)) (sref (ref :text title :ident ident)) (sref* (resolve! sref e `((parent ,n))))) (output sref* e) (display " -- "))) (filter (lambda (n) (or (is-markup? n 'slide-subtopic) (is-markup? n 'slide))) (markup-body n))) (display "\n
") (if class (display "\n
\n") (display "\n

\n")) ;; the slides (output (markup-body n) e)))) ;;; ;;; Initialization. ;;; (%slide-html-initialize!) ;;; arch-tag: 8be0cdf2-b755-4baa-baf6-739cdd00e193