Ultraviolet Hack แบบใช้ไปก่อน

Posted by Revolution Wed, 21 Nov 2007 12:43:24 GMT

วิธีการก็เอา syntax ที่มีอยู่ใน typo มา hack ซะ ซึ่งมันเป็น macro อยู่แล้ว จาก plugin ชื่อ typo_textfilter_code ก็ copy ทั้ง folder มาเป็นชื่อ typo_textfilter_uvcode จากนั้นก็แก้ทุกอย่างที่เดิมเป็น code ให้เป็น uvcode แล้วก็แก้ไฟล์ typo_textfilter_uvcode/lib/typo_textfilter_uvcode.rb ดังนี้

def self.macrofilter(blog,content,attrib,params,text="")

        lang       = attrib['lang'] || "plain_text"
        title      = attrib['title']
        cssclass   = attrib['class'] || 'iplastic'
        linenumber = attrib['linenumber'] || false

        text = text.to_s.gsub(/\r/,'').gsub(/\A\n/,'').chomp
        convertor = Uv
        text = convertor.parse(text, "xhtml", lang, linenumber, cssclass)

        "<div class=\"typocode\">#{text}</div>"   

end

จากนั้นก็เอา css จะใช้ไปใส่ที่ public/stylesheets/user-style.css ในนี้เพิ่ม

overflow: auto; 

เข้าไปใน class pre

Comments - (Leave a comment)

Trackbacks

Use the following link to trackback from your own site:
/articles/trackback/2136

Leave a comment