tdiary/tdiary-style-gfm — pull request #9 by minimum2scp (2014-09-08 16:21:36+00:00)
Title: do not replace `{{ }}` to plugin call in pre, code block

pre または code の中でプラグイン呼び出しと同じ `{{ }}` 記法を使用すると、
`<%= %>` に変換されてしまい、ERBに評価されてエラーになることがあります。

たとえば以下のような本文を書くとエラーになります。

# subTitle

Get IP Address of Docker Container:

```
% docker inspect -f "{{.NetworkSettings.IPAddress}} {{.Config.Hostname}} # Name:{{.Name}}" `docker ps -q`
```

NOTE: `{{.NetworkSettings.IPAddress}}` is golang template.

エラーメッセージ:

```
Plugin Error

Errors in plugins? Retry to Update or Configure.

SyntaxError
(TDiary::Plugin#eval_src):28: syntax error, unexpected '.'
; _erbout.concat((.NetworkSettings.IPAddress).to...
^
(TDiary::Plugin#eval_src):28: syntax error, unexpected '.'
....concat " "; _erbout.concat((.Config.Hostname).to_s); _erbo...
... ^
(TDiary::Plugin#eval_src):28: syntax error, unexpected '.'
... " # Name:"; _erbout.concat((.Name).to_s); _erbout.concat "...
... ^
(TDiary::Plugin#eval_src):31: syntax error, unexpected '.'
; _erbout.concat((.NetworkSettings.IPAddress).to...
^
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/plugin.rb:99:in `eval'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/plugin.rb:99:in `block in eval_src'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/core_ext.rb:112:in `block in safe'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/core_ext.rb:114:in `call'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/core_ext.rb:114:in `safe'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/plugin.rb:98:in `eval_src'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/base.rb:66:in `do_eval_rhtml'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/base.rb:30:in `eval_rhtml'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/view.rb:140:in `eval_rhtml'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/dispatcher/index_main.rb:43:in `run'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/dispatcher/index_main.rb:6:in `run'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/dispatcher.rb:26:in `dispatch_cgi'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/dispatcher.rb:21:in `call'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/rack/valid_request_path.rb:17:in `block in call'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/rack/valid_request_path.rb:16:in `each'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/rack/valid_request_path.rb:16:in `call'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/rack/static.rb:15:in `call'
/home/debian/go/src/github.com/tdiary/tdiary-core/lib/tdiary/rack/html_anchor.rb:20:in `call'
```

TDiary::Style::GFMSection#to_html メソッド中で、
preおよびcodeをstashから戻す際にplugin記法のstashを元々記述された通り (`{{ }}`) に戻すようにして、
preおよびcodeをstashから戻し終わったあとに残りのplugin記法のstashを従来通り ERB (`<%= %>`) で戻す、
というように変更しました。