Welcome to the CHICKEN Scheme pasting service

qwiki-mobile added by arthurmaciel on Sun Aug 9 07:39:11 2015

;; 
;; qwiki-mobile - qwiki extension to add mobile support for qwiki pages
;;
;; Needed for responsive webdesign.
;;
;; Copyright (c) 2015 Arthur Maciel
;;
;;  Redistribution and use in source and binary forms, with or without
;;  modification, are permitted provided that the following conditions
;;  are met:
;; 
;;  - Redistributions of source code must retain the above copyright
;;  notice, this list of conditions and the following disclaimer.
;; 
;;  - Redistributions in binary form must reproduce the above
;;  copyright notice, this list of conditions and the following
;;  disclaimer in the documentation and/or other materials provided
;;  with the distribution.
;; 
;;  - Neither name of the copyright holders nor the names of its
;;  contributors may be used to endorse or promote products derived
;;  from this software without specific prior written permission.
;; 
;;  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND THE
;;  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
;;  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
;;  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
;;  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR THE
;;  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
;;  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
;;  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
;;  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
;;  AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
;;  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
;;  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
;;  POSSIBILITY OF SUCH DAMAGE.

(use qwiki qwiki-sxml sxml-transforms)

(define viewport
  '(meta (@ (name viewport) 
	    (content "width=device-width, initial-scale=1"))))

(define viewport-rules
  `((wiki-page
     ((Header
       *preorder*
       . ,(lambda (tag contents)
            (cons tag (cons viewport contents)))))
     . ,(lambda contents contents))
    ,@alist-conv-rules*))

(define logos
   '((img (@ (id "logo") (src "/CHICKEN-logo-text.svg")))
     (img (@ (id "logo-mobile") (src="/CHICKEN-logo-text-wrapped.svg")))))

(define logos-rules
  `((wiki-page
     ((body 
       *preorder*
       . ,(lambda (tag contents)
            `(body ,@logos
                   . ,contents))))
     . ,(lambda contents contents))
    ,@alist-conv-rules*))

(define mobile-rules (append viewport-rules logos-rules))

(define (mobile-install!)
  (qwiki-extensions (cons mobile-rules (qwiki-extensions))))

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
Which module provides `foreign-declare'?
Visually impaired? Let me spell it for you (wav file) download WAV