Sha256: fda51044b2c062e5d24cfccad920bb5869c7b2d451393651eca2388a93849bdd

Contents?: true

Size: 1.23 KB

Versions: 4

Compression:

Stored size: 1.23 KB

Contents

require 'wikilink/converter/site'
require 'wikilink/converter/utils'

module Wikilink
  class Converter
    module Sites
      class RubyChina < Wikilink::Converter::Site
        include Wikilink::Converter::LinkHelper
        include Wikilink::Converter::HTMLAttributes

        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

        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

        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
      end

      class RubyTaiwan < RubyChina
        def initialize(options = {})
          if options[:name] != CURRENT_SITE
            options[:domain] ||= 'http://ruby-taiwan.org/'
          end

          super(options)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
wikilink-converter-0.2.4 lib/wikilink/converter/sites/ruby_china.rb
wikilink-converter-0.2.3 lib/wikilink/converter/sites/ruby_china.rb
wikilink-converter-0.2.2 lib/wikilink/converter/sites/ruby_china.rb
wikilink-converter-0.2.1 lib/wikilink/converter/sites/ruby_china.rb