misc:software:Gauche:WiLiKi

misc:software:Gauche:WiLiKi

入手とインストール

./configure --prefix=$HOME/local
./make
./make install

./configure --prefix=$HOME/local を実行すると、 $HOME/local/share/gauche-0.9/site/lib 以下に Wiliki の関連ファイルが設置される。

{{{lang を {{{ に書き換える

{{{{{{lang と書いてしまったときに、エラーにならないよう {{{ に置き換える。

wiliki/parse.scmを書き換える。

  (define (lex line ctx)
    (cond [(eof-object? line)                '(eof)]
          [(string-null? line)               '(null)]
          [(string=? "----" line)            '(hr)]
          [(string=? "{{{" line)             '(open-verb)]
          ;; {{{lang -> {{{ 
          [(rxmatch #/^{{{.+/ line)          '(open-verb)]
                        
          [(string=? "<<<" line)             '(open-quote)]
          [(and (string=? ">>>" line)
                (memq 'blockquote ctx))      '(close-quote)]
          [(string-prefix? " " line)         `(pre . ,line)]
          [(rxmatch #/^(\*{1,}) / line)      => (cut cons 'heading <>)]
          [(rxmatch #/^(--*) / line)         => (cut cons 'ul <>)]
          [(rxmatch #/^(##*) / line)         => (cut cons 'ol <>)]
          [(rxmatch #/^:(.*):([^:]*)$/ line) => (cut cons 'dl <>)]
          [(rxmatch #/^\|\|(.*)\|\|$/ line)  => (cut cons 'table <>)]
          [else                              `(p . ,line)]))

シンタックスハイライト

highlight.js のように、プログラミング言語を自動的に判定するライブラリを利用すること

*.js や *.css の読み込み

(define-class <my-formatter> (<wiliki-formatter>) ())

(define-method wiliki:format-head-elements ((fmt <my-formatter>) page . opts)
  (append (next-method)
          '(
            (link (@ (href "/path/to/test.css") (type "text/css") (rel "stylesheet")))
            (script (@ (src "/path/to/test.js") (type "text/javascript")))
           )))

(wiliki:formatter (make <my-formatter>))

google map の表示

(define-reader-macro (google-map . args)
  (let* ((long-lat (car args))
         (zoom (if (null? (cdr args)) "12" (cadr args)))
         (url (string-append "http://maps.google.co.jp/maps?f=q"
                             "&source=s_q&hl=ja&geocode=&aq="
                             "&sll=" long-lat "&ie=UTF8t=m"
                             "&z=" zoom
                             "&iwloc=A"))
         (url-for-embed (string-append url "&output=embed")))
    `((iframe (@ (width "640")
                 (src ,url-for-embed)
                 (scrolling "no")
                 (marginwidth "0")
                 (marginheight "0")
                 (height "480")
                 (frameborder "0")))
      (br)
      (small (a (@ (href ,url)
                   (style "color:#0000FF;text-align:left"))
                "大きな地図で見る")))))

経度・緯度を調べる(地図作成作業補助サンプル)v0.44 等を使い、以下のように記述する。 その際、経度の直前に空白を入れないようにすること。

[[$$google-map 35.658725884775244,139.74541783332825]]


大きな地図で見る

;; Zoom の値を 8 に設定する
[[$$google-map 35.658725884775244,139.74541783332825 8]]


大きな地図で見る


Last modified : 2016/12/28 14:52:33 JST
blechmusik (blechmusik@gmail.com)