WikiChunk::Link (Class)

In: app/models/chunks/wiki.rb
Parent: WikiLink

This chunk handles [[bracketted wiki words]] and [[AliasedWords|aliased wiki words]]. The first part of an aliased wiki word must be a WikiWord. If the WikiWord is aliased, the link_text field will contain the alias, otherwise link_text will contain the entire contents within the double brackets.

NOTE: This chunk must be tested before WikiWord since

      a WikiWords can be a substring of a WikiLink.


new   pattern  


ALIASED_LINK_PATTERN ='^(.*)?\|(.*)$', 0, "utf-8")


link_text  [R] 
page_name  [R] 

Public Class methods


    # File app/models/chunks/wiki.rb, line 69
69:     def initialize(match_data)
70:       super(match_data)
72:           # If the like is aliased, set the page name to the first bit

73:           # and the link text to the second, otherwise set both to the

74:           # contents of the double brackets.

75:       if match_data[1] =~ ALIASED_LINK_PATTERN
76:         @page_name, @link_text = $1, $2
77:       else
78:         @page_name, @link_text = match_data[1], match_data[1]
79:       end
80:     end


    # File app/models/chunks/wiki.rb, line 64
64:     def self.pattern() /\[\[([^\]]+)\]\]/ end