Class: Wikilink::Converter::Sites::RubyChina

Inherits:
Wikilink::Converter::Site show all
Includes:
HTMLAttributes, LinkHelper
Defined in:
lib/wikilink/converter/sites/ruby_china.rb

Direct Known Subclasses

RubyTaiwan

Constant Summary

Constants inherited from Wikilink::Converter::Site

Wikilink::Converter::Site::CURRENT_SITE_NAME, Wikilink::Converter::Site::DEFAULT_NAMESPACE

Instance Attribute Summary

Attributes inherited from Wikilink::Converter::Site

#options

Instance Method Summary collapse

Methods included from HTMLAttributes

#html_class

Methods included from LinkHelper

#link_to

Methods inherited from Wikilink::Converter::Site

#default_namespace, #namespace, #run

Methods included from ArgumentExtractor

#extract_arguments

Constructor Details

#initialize(options = {}) ⇒ RubyChina

Returns a new instance of RubyChina.



11
12
13
14
15
16
17
18
19
20
# File 'lib/wikilink/converter/sites/ruby_china.rb', line 11

def initialize(options = {})
  if options[:name] == CURRENT_SITE
    options[:domain] ||= '/'
  else
    options[:domain] ||= 'http://ruby-china.org/'
  end
  options[:prefix] = "#{options[:domain]}wiki/"

  super(options)
end

Instance Method Details

#run_namespace_node(run_options) ⇒ Object



27
28
29
30
# File 'lib/wikilink/converter/sites/ruby_china.rb', line 27

def run_namespace_node(run_options)
  path = "#{options[:domain]}topics/node#{run_options[:path]}"
  link_to run_options[:name], path, :class => html_class(run_options[:class])
end

#run_namespace_topic(run_options) ⇒ Object



22
23
24
25
# File 'lib/wikilink/converter/sites/ruby_china.rb', line 22

def run_namespace_topic(run_options)
  path = "#{options[:domain]}topics/#{run_options[:path]}"
  link_to run_options[:name], path, :class => html_class(run_options[:class])
end