From af8c534f411ef0671f43fda1017f42fcd28a29fa Mon Sep 17 00:00:00 2001 From: Ludovic Courtes Date: Sun, 29 Jul 2007 10:30:53 +0000 Subject: Documented `html-navtabs'. * doc/user/package.skb (HTML Navigation Tabs): New subsection. Borrowed from Manuel Serrano's doc for `html-navtabs'. git-archimport-id: skribilo@sv.gnu.org--2006/skribilo--devo--1.2--patch-143 --- doc/user/package.skb | 51 ++++++++++++++++-- doc/user/src/html-navtabs.skb | 118 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 166 insertions(+), 3 deletions(-) create mode 100644 doc/user/src/html-navtabs.skb (limited to 'doc') diff --git a/doc/user/package.skb b/doc/user/package.skb index 997e263..dba26b3 100644 --- a/doc/user/package.skb +++ b/doc/user/package.skb @@ -1,7 +1,7 @@ ;;; package.skb -- Packages ;;; -;;; Copyright 2004, 2005 Manuel Serrano -;;; Copyright 2007 Ludovic Courtès +;;; Copyright 2001, 2004, 2005 Manuel Serrano +;;; Copyright 2007 Ludovic Courtès ;;; ;;; ;;; This program is free software; you can redistribute it and/or modify @@ -155,7 +155,52 @@ The ,(param :css) is a shorthand for ,(param :style). For instance:]) (index :index *package-index* "web-book.skr" :note "package") (p [ A convenient mode for rendering books (i.e., documents made of -chapters and sections) in HTML.])))) +chapters and sections) in HTML.])) + + (subsection :title [HTML Navigation Tabs] + + (p [The ,(tt [html-navtabs]) package enables quick navigation +inside HTML documents by means of tabs. The produced HTML code uses CSS +declarations. The ,(tt [html-navtabs]) package does not introduce any +new markups. It is configured via additional ,(ref :text [engine +customs.] :chapter "Engines")]) + + (subsubsection :title [HTML Engine Customization] + + (p [,(tt [html-navtabs]) is to be used in conjunction with the +,(ref :text (code "html-engine") :mark "html-engine") +engine. Specifically, it adds the following new customization to this +engine:]) + + (doc-engine 'html + `((html-navtabs [The tabs.]) + (html-navtabs-padding [Padding above tabs.]) + (html-navtabs-bar-background [Bar background color.])) + :def `(make-engine 'html + :custom '((html-navtabs ,(it [Containers whose + option ,(param :file) is ,(code "#t")])) + (html-navtabs-padding 20.) + (html-navtabs-bar-background + ,(engine-custom (find-engine 'html) + 'left-margin-background)))))) + + (subsubsection :title [Additional Container Options] + + (p [,(tt [html-navtabs]) introduces two new ,(ref :text +"containers" :section "Sectioning") (i.e., a ,(ref :text (code +"document") :mark "document") ,(ref :text (code "chapter") :mark +"chapter") ,(ref :text (code "section") :mark "subsection"), ...) +attributes: ,(param :html-tabs-bar) and ,(param :no-tabs). The +attribute ,(param :html-tabs-bar) may contain any Skribe expression. It +controls the content of the navtabs sub-bar (i.e., a small line above +the tabs). The attribute ,(param :no-tabs) disable tabs for this +container.])) + + (subsubsection :title [Example] + + (p [Below is a full example using ,(tt [html-navtabs]).]) + + (prgm :file "src/html-navtabs.skb"))))) ;*---------------------------------------------------------------------*/ ;* Emacs indentation */ diff --git a/doc/user/src/html-navtabs.skb b/doc/user/src/html-navtabs.skb new file mode 100644 index 0000000..27701d4 --- /dev/null +++ b/doc/user/src/html-navtabs.skb @@ -0,0 +1,118 @@ +;*---------------------------------------------------------------------*/ +;* Skribilo's `html-navtabs' package */ +;*---------------------------------------------------------------------*/ +(use-modules (skribilo package html-navtabs) + (srfi srfi-1)) + +;*---------------------------------------------------------------------*/ +;* HTML customization */ +;*---------------------------------------------------------------------*/ +(let* ((he (find-engine 'html)) + (oldh (markup-writer-get '&html-chapter-header he)) + (colors (circular-list "#ffb643" "#de8bff"))) + ;; re-bindings + (markup-writer '&html-chapter-header he + :options 'all + :predicate (lambda (n e) + (is-markup? (ast-parent n) 'chapter)) + :action (lambda (n e) + (engine-custom-set! e 'left-margin-background (car colors)) + (set! colors (cdr colors)) + (output n e oldh)))) + +;*---------------------------------------------------------------------*/ +;* menu ... */ +;*---------------------------------------------------------------------*/ +(define-markup (menu e #!rest opt #!key title) + (table :width 95. :border 1 :cellpadding 0 :cellspacing 0 + :class "menu" + (tr :bg (engine-custom e 'title-background) + (th (color :fg (engine-custom e 'background) (bold title)))) + (tr :bg (engine-custom e 'background) + (td (the-body opt))))) + +;*---------------------------------------------------------------------*/ +;* linux */ +;*---------------------------------------------------------------------*/ +(define (linux n e) + (menu e + :title "Linux" + (apply table :width 100. :border 0 :class "linux" + (tr (td :align 'left :valign 'top (bold "Linux"))) + (map (lambda (l) + (tr (td :align 'left :valign 'top l))) + (list (ref :url "http://www.kernel.org/" + :text "Linux kernel") + (ref :url "http://www.gentoo.org/" + :text "Gentoo") + (ref :url "http://www.debian.org/" + :text "Debian") + (ref :url "http://www.redhat.org/" + :text "Red Hat") + (ref :url "http://www.mandrake.org/" + :text "Mandrake")))))) + +;*---------------------------------------------------------------------*/ +;* HTML customizations */ +;*---------------------------------------------------------------------*/ +(let ((he (find-engine 'html))) + (engine-custom-set! he 'favicon "icons/serrano.gif") + (engine-custom-set! he 'left-margin-size 25.) + (engine-custom-set! he 'left-margin + (lambda (n e) + (list (center (linux n e))))) + (engine-custom-set! he 'javascript #t) + (engine-custom-set! he 'head "div.skribetitle { + padding-top: 40; + } + div.skribetitle td { + font-size: xx-large; + font-weight: bold; + font-style: oblique; + } + body { + border: 1px; + border-color: black; + border-style: inset; + margin: 0; + padding: 0; + } + div.navtabs-bar form { + border: 0 0 0 0; + padding: 2px 2px 2px 2px; + margin: 2px 2px 2px 2px; + clear: none; + display: inline; + } + div.navtabs-bar select { + margin: 2px 2px 2px 2px; + font-family: Arial,Helvetica,sans-serif; + font-size: small; + } +")) + +;*---------------------------------------------------------------------*/ +;* The title */ +;*---------------------------------------------------------------------*/ +(define title + (table :width 100. :cellpadding 10. + (tr (td :align 'center (image :file "linux.png")) + (td :align 'left [Skribilo ,(tt [html-navtabs]) Sample])))) + +;*---------------------------------------------------------------------*/ +;* The document */ +;*---------------------------------------------------------------------*/ +(document :title title :html-title "html-navtabs" + :html-tabs-bar + (table (tr (td :align 'right "a two-lines table")) + (tr (td :align 'right "yep"))) + + (section :title "Foo" :number #f (p [The in-line foo section])) + + (chapter :title "Bar" :file #t + :html-tabs-bar [This is the bar chapter] + (p [Yehhh.])) + (chapter :title "Gee" :file #t + :html-tabs-bar [This is the gee chapter] + (p ":-)"))) + -- cgit v1.2.3