WP-Syntax & CodeColorer
多數的程式語法格式化插件都是基於GeSHi專案延伸而來,WP-Syntax也不例外,之前編寫Wiki文件時就已經習慣這樣的格式化功能,程式人的部落格站台裡沒有這樣的套件還挺困擾的呢!老實說有些語言格式化預設樣式並不是很討喜,偏偏我不太有美感,也懶得去改CSS,理想是能顯示出 TextMate IR_Black theme 風格,另一套 CodeColorer也很類似,算是WP-Syntax的加強版,標籤額外控制參數較多。不過兩者似乎不能並存,暫時先用CodeColorer看看。目前遇到的問題是,預覽完程式碼縮排會不見!可能是Visual/HTML編輯模式交替使用,解析器自動將某些字元轉換之故。
使用rails測試:
<h1>Change My Password</h1>
<%# :user is the name of the model and @user is the actual object being edited. %>
<% form_for @user, :url => password_reset_path, :method => :put do |f| %>
<%= f.error_messages %>
<%= f.label :password %><br />
<%= f.password_field :password %><br />
<br />
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %><br />
<br />
<%= f.submit "Update my password and log me in" %>
<% end %>
<%# :user is the name of the model and @user is the actual object being edited. %>
<% form_for @user, :url => password_reset_path, :method => :put do |f| %>
<%= f.error_messages %>
<%= f.label :password %><br />
<%= f.password_field :password %><br />
<br />
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %><br />
<br />
<%= f.submit "Update my password and log me in" %>
<% end %>
使用ruby測試,使用blackboard樣式,去掉水平捲軸,加上行號,設定寬度480,奇怪的是在Firefox中上下會多出黑色框,作者的網站卻不會出現,不知道是樣式問題還是?
1 2 3 4 5 6 7 8 9 10 11 | class Notifier < ActionMailer::Base default_url_options[:host] = "bossyang.com" def password_reset_instructions(user) subject "Password Reset Instructions" from "CupCake Inc. Notifier" recipients user.email sent_on Time.now body :edit_password_reset_url => edit_password_reset_url(user.perishable_token) end end |
WP-Termial
如果要表現命令列語法呢?mismone提供了WP-Terminal插件。用法很簡單,但有時候不想顯示提示字元,也不知道怎樣關掉?
user@computer:$ ls -a
命令多行範例:
user@computer:$ script/plugin install git://github.com/aeden/activewarehouse.git
gem install activewarehouse
gem install gemsonrails
rake gems:link GEM=activewarehouse
gem install activewarehouse
gem install gemsonrails
rake gems:link GEM=activewarehouse
自己留言試試Gravatars大頭照功能