File: config.rb

package info (click to toggle)
ruby-reverse-markdown 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 440 kB
  • sloc: ruby: 1,452; makefile: 4
file content (38 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module ReverseMarkdown
  class Config
    attr_writer :unknown_tags, :github_flavored, :tag_border, :force_encoding

    def initialize
      @unknown_tags     = :pass_through
      @github_flavored  = false
      @force_encoding   = false
      @em_delimiter     = '_'.freeze
      @strong_delimiter = '**'.freeze
      @inline_options   = {}
      @tag_border       = ' '.freeze
    end

    def with(options = {})
      @inline_options = options
      result = yield
      @inline_options = {}
      result
    end

    def unknown_tags
      @inline_options[:unknown_tags] || @unknown_tags
    end

    def github_flavored
      @inline_options[:github_flavored] || @github_flavored
    end

    def tag_border
      @inline_options[:tag_border] || @tag_border
    end

    def force_encoding
      @inline_options[:force_encoding] || @force_encoding
    end
  end
end