Module: NanDoc::Config

Extended by:
Config
Included in:
Config
Defined in:
lib/nandoc/config.rb

Defined Under Namespace

Modules: Accessors

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#orphan_surrogate_filenameObject

Returns the value of attribute orphan_surrogate_filename.



10
11
12
# File 'lib/nandoc/config.rb', line 10

def orphan_surrogate_filename
  @orphan_surrogate_filename
end

Instance Method Details

#colorize?Boolean

in the future make this smarter. i don’t like now nanoc handles color (a command line argument?) There should be an autodetect, and/or set last setting in sticky json file; or however it is it is done. @todo

Returns:

  • (Boolean)


18
19
20
# File 'lib/nandoc/config.rb', line 18

def colorize?
  true
end

#diff_stylesheetObject

everybody wants to look like git



25
26
27
28
29
30
31
32
# File 'lib/nandoc/config.rb', line 25

def diff_stylesheet
  @diff_stylesheet ||= {
    :header => [:bold, :yellow],
    :add    => [:bold, :green],
    :remove => [:bold, :red],
    :range  => [:bold, :magenta]
  }
end

#file_utilsObject

some FileUtils actions are wrapped with this proxy to allow formatting and customizations from the typical FileUtils actions, to indent and colorize the notice stream sorta like nanoc does



40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/nandoc/config.rb', line 40

def file_utils
  @file_utils ||= begin
    Treebis::FileUtilsProxy.new do |fu|
      fu.pretty!
      fu.color?{ NanDoc::Config.colorize? }
      fu.prefix = ' ' * 6 # like nanoc
      fu.ui = proc{ $stdout }
      # it's normally $stderr, it needs to be reference-like
      # so that capture3 will work!
    end
  end
end