Sha256: 7e0e7f35160275dc27ab220aebfdb7a24bb3cb8a6c725f02c4f6fd3f137b3af2

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true

module Yaw
  class WikiPageDecorator < Draper::Decorator
    delegate_all

    def render_body
      # rubocop:disable all
      link_reg = /\[\[([^\]]+)\]\]/
      body.gsub(link_reg) do |match|
        matched = match[link_reg, 1]
        options = { class: 'internal' }
        options[:class] = 'absent' if find_sibling(matched).blank?
        h.link_to matched, h.yaw.wiki_space_wiki_page_path(wiki_space, matched), options
      end.html_safe
      # rubocop:enable all
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
yaw-0.0.2 app/decorators/yaw/wiki_page_decorator.rb