You are here: Home > Latest news from Darcs > Imports changes from MediaCloth's revision r119

Revision 20080320224040-9043f-566f23...

Imports changes from MediaCloth's revision r119

  Allow "https" as well as "http" in in-line links
vendor/mediacloth-trunk/lib/mediacloth/mediawikilexer.rb
vendor/mediacloth-trunk/test/lexer.rb

Changes to mediawikilexer.rb

398
  end
  end
398
399
399
400
  def match_h_char
  def match_h_char
400
401
    if @text[@cursor, 7] == 'http://'
    if @text[@cursor, 7] == 'http://' || @text[@cursor, 8] == 'https://'
401
402
      text = @text[@cursor, 7]
      text = @text[@cursor, 7]
402
403
      @cursor += 7
      @cursor += 7
403
404
      while @cursor < @text.size and TOKEN_CHAR_TABLE[@text[@cursor]] do
      while @cursor < @text.size and TOKEN_CHAR_TABLE[@text[@cursor]] do
404

Changes to lexer.rb

138
        [:PARA_END, ""], [false, false]],
        [:PARA_END, ""], [false, false]],
138
139
      lex("http://example.com"))
      lex("http://example.com"))
139
140
    assert_equal(
    assert_equal(
140
 
      [[:PARA_START, ""], [:LINK_START, ""], [:TEXT, "https://example.com"], [:LINK_END, ""],
141
 
        [:PARA_END, ""], [false, false]],
142
 
      lex("https://example.com"))
143
 
    assert_equal(
144
141
      [[:PARA_START, ""], [:LINK_START, ""], [:TEXT, "http://example.com"], [:LINK_END, ""],
      [[:PARA_START, ""], [:LINK_START, ""], [:TEXT, "http://example.com"], [:LINK_END, ""],
145
142
        [:PARA_END, ""], [false, false]],
        [:PARA_END, ""], [false, false]],
146
143
      lex("http://example.com\n"))
      lex("http://example.com\n"))
147