# Copyright (C) 2003-2006 Kouichirou Eto, All rights reserved. # This is free software with ABSOLUTELY NO WARRANTY. # You can redistribute it and/or modify it under the terms of the GNU GPL 2. $LOAD_PATH << 'compat' unless $LOAD_PATH.include? 'compat' require 'htree' $LOAD_PATH.unshift '..' unless $LOAD_PATH.include? '..' require 'qwik/htree-to-wabisabi' require 'qwik/wabisabi-template' require 'qwik/util-string' module Qwik class HtmlToWabisabi def self.parse(str) html = ""+str+"" html = html.normalize_newline htree = HTree(html) first_child = htree.children[0] wabisabi = first_child.to_wabisabi wabisabi = wabisabi.inside return wabisabi end end end if $0 == __FILE__ require 'qwik/testunit' $test = true end if defined?($test) && $test class TestHtmlToWabisabi < Test::Unit::TestCase def ok(e, s) ok_eq(e, Qwik::HtmlToWabisabi.parse(s)) end def test_ref #ok(["\240"], " ") #ok(["?"], " ") ok(["<"], "<") ok([">"], ">") end def test_html_parser ok([], '') ok(['a'], 'a') # Div element can contain another div element. ok([[:div, 't1', [:div, 't2']]], "
詳細な説明はTextFormatをごらんください。
整形済みテキスト。
引用。
項目1-1 | 項目1-2 | 項目1-3 |
項目2-1 | 項目2-2 | 項目2-3 |
強調、さらに強調、取り消し線 FrontPage Yahoo!