Skip to content

Instantly share code, notes, and snippets.

@mrmt
Created January 9, 2022 08:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrmt/f256013309a6e3a24cfa8701dcf28386 to your computer and use it in GitHub Desktop.
Save mrmt/f256013309a6e3a24cfa8701dcf28386 to your computer and use it in GitHub Desktop.
diff -urN lib-/wiliki/format.scm lib/wiliki/format.scm
--- lib-/wiliki/format.scm 2004-09-09 00:42:14.000000000 +0900
+++ lib/wiliki/format.scm 2004-09-09 00:33:01.000000000 +0900
@@ -226,14 +226,16 @@
(path (match 4))
(openp (match 1))
(name (match 8))
+ (wlki (wiliki))
+ (trampoline #`",(cgi-name-of wlki)?c=j&url=")
(url (if server #`",|scheme|:,|server|,|path|" path)))
;; NB: url is already HTML-escaped. we can't use
;; (html:a :href url url) here, for it will escape the first URL
;; again.
(if (and openp name)
- (format #f "<a href=\"~a\">~a</a>" url name)
- (format #f "~a<a href=\"~a\">~a:~a~a</a>"
- (if openp "[" "") url
+ (format #f "<a href=\"~a~a\">~a</a>" trampoline url name)
+ (format #f "~a<a href=\"~a~a\">~a:~a~a</a>"
+ (if openp "[" "") trampoline url
scheme (or server "") path))))))
(define (mailto line)
(regexp-replace-all
diff -urN lib-/wiliki/trampoline.scm lib/wiliki/trampoline.scm
--- lib-/wiliki/trampoline.scm 1970-01-01 09:00:00.000000000 +0900
+++ lib/wiliki/trampoline.scm 2004-09-09 00:15:49.000000000 +0900
@@ -0,0 +1,48 @@
+;;;
+;;; wiliki/trampoline - trampoline url jump page routine for WiLiKi
+;;;
+;;; Copyright (c) 2004 Jun Morimoto, All rights reserved.
+;;;
+;;; Permission is hereby granted, free of charge, to any person
+;;; obtaining a copy of this software and associated documentation
+;;; files (the "Software"), to deal in the Software without restriction,
+;;; including without limitation the rights to use, copy, modify,
+;;; merge, publish, distribute, sublicense, and/or sell copies of
+;;; the Software, and to permit persons to whom the Software is
+;;; furnished to do so, subject to the following conditions:
+;;;
+;;; The above copyright notice and this permission notice shall be
+;;; included in all copies or substantial portions of the Software.
+;;;
+;;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+;;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+;;; OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+;;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+;;; BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+;;; AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
+;;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+;;; IN THE SOFTWARE.
+;;;
+;;; $Id: wiliki-trampoline-patch,v 1.1 2004/09/10 08:28:29 morimoto Exp $
+;;;
+
+(define-module wiliki.trampoline
+ (extend wiliki)
+ (export trampoline-page))
+(select-module wiliki.trampoline)
+
+(define (trampoline-page url)
+ `("Content-type: text/html\n\n"
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\""
+ "\"http://www.w3.org/TR/html4/loose.dtd\">"
+ "<html>"
+ "<head>"
+ "<title>" ,url "</title>"
+ "<meta http-equiv=\"Refresh\" content=\"0;URL=" ,url "\">"
+ "</head>"
+ "<body>"
+ "<a href=\"" ,url "\">" ,url "</a>"
+ "</body>"
+ "</html>"))
+
+(provide "wiliki/trampoline")
diff -urN lib-/wiliki.scm lib/wiliki.scm
--- lib-/wiliki.scm 2004-09-09 00:42:14.000000000 +0900
+++ lib/wiliki.scm 2004-09-09 00:02:21.000000000 +0900
@@ -56,6 +56,7 @@
(autoload "wiliki/macro" handle-reader-macro handle-writer-macro
handle-virtual-page virtual-page?)
(autoload wiliki.rss rss-page)
+(autoload wiliki.trampoline trampoline-page)
(autoload wiliki.pasttime how-long-since)
(autoload wiliki.format format-page format-footer format-content
format-time format-colored-box format-wikiname-anchor
@@ -472,6 +473,8 @@
:write))
((equal? command "rss")
(with-db (cut rss-page (db))))
+ ((equal? command "j")
+ (with-db (cut trampoline-page (cgi-get-parameter "url" param))))
(else (error "Unknown command" command))
))))
:merge-cookies #t
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment