Changeset 15464 in project


Ignore:
Timestamp:
08/14/09 14:15:01 (10 years ago)
Author:
sjamaan
Message:

Add internal wiki link rules and allow pretty urls

Location:
release/4/qwiki/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/qwiki/trunk/qwiki-sxml.scm

    r15450 r15464  
    113113           `(tt ,@terms)))
    114114
     115     (wiki *macro* . ,(lambda (tag href . contents)
     116                        `(a (@ (class "wiki-page") (href ,href))
     117                            ,(if (pair? contents) contents
     118                                 href))))
     119
    115120     (url *macro* . ,(lambda (tag href . contents)
    116                        `(a (@ (href ,href))
     121                       `(a (@ (class "external") (href ,href))
    117122                           ,(if (pair? contents) contents
    118123                                href))))
  • release/4/qwiki/trunk/qwiki.scm

    r15443 r15464  
    4848
    4949(import chicken scheme)
    50 (use extras files posix ports data-structures srfi-1 srfi-13
     50(use extras files posix ports data-structures srfi-1 srfi-13 srfi-14
    5151     intarweb uri-common spiffy sxml-transforms
    5252     wiki-parse qwiki-sxml doctype sxml-fu sxml-shortcuts
     
    7070  (make-parameter (list)))
    7171
     72;; This must match name-to-base in svnwiki/deps.scm
     73;; It is changed slightly to disallow newlines, tabs or other "weird"
     74;; whitespace characters.
     75(define (simplify-pagename pagename)
     76  (if (file-exists? (make-pathname (qwiki-source-path) pagename))
     77      pagename
     78      (string-downcase
     79       (string-filter (char-set-union char-set:letter+digit
     80                                      (char-set #\space #\/ #\-))
     81                      (string-translate pagename " " "-")))))
     82
     83(define wiki-link-normalization
     84  `((wiki . ,(lambda (tag href . contents)
     85               (let ((pretty-href (simplify-pagename href)))
     86                 (if (pair? contents)
     87                     `(wiki ,pretty-href ,@contents)
     88                     `(wiki ,pretty-href ,href)))))
     89    ,@alist-conv-rules))
     90
    7291;; The rules used for transforming page SXML structure
    7392(define (qwiki-transformation-steps content)
    74   (append (qwiki-extensions)
     93  (append (list wiki-link-normalization)
     94          (qwiki-extensions)
    7595          ((qwiki-output-driver) content)
    7696          ))
Note: See TracChangeset for help on using the changeset viewer.