Module: LivingStyleGuide

Defined in:
lib/livingstyleguide.rb,
lib/livingstyleguide/version.rb,
lib/livingstyleguide/tilt_template.rb,
lib/livingstyleguide/markdown_extensions.rb,
lib/livingstyleguide/command_line_interface.rb

Defined Under Namespace

Classes: CommandLineInterface, Commands, Document, RedcarpetHTML, TiltTemplate

Constant Summary collapse

ROOT_PATH =
File.join(File.dirname(__FILE__), "..")
SASS_PATH =
File.join(ROOT_PATH, "stylesheets")
COMMANDS_REGEXP =
%r{
  ^@(?<name>[\w\d_-]+)                       # @command-name
  (?:[ ](?<arguments>[^\n]*[^\{\n:]))?       # arg1; arg2; opt1: 1
  (?:
    [ ]*\{\n(?<braces>(?:.|\n)*?)\n\} |      # {\ncontent\ncontent\n}
    (?<indented>(?:\n+[ \t].*)+(?=\n|\Z)) |  # \n  content\n  content\n
    [ ]*:\n(?<colon>(?:.|\n)*?)(?:\n\n|\Z)   # :\ncontent\ncontent\n\n
  )?
}x
VERSION =
"2.1.0"
REDCARPET_RENDER_OPTIONS =
{
  autolink: true,
  fenced_code_blocks: true,
  tables: true,
  strikethrough: true,
  space_after_headers: true,
  superscript: true
}
@@default_options =
{
  default_language: :example,
  title: "Living Style Guide",
  root: "/"
}

Class Method Summary collapse

Class Method Details

.command(*keys, &block) ⇒ Object



34
35
36
# File 'lib/livingstyleguide.rb', line 34

def self.command(*keys, &block)
  Commands.command(*keys, &block)
end

.default_optionsObject



30
31
32
# File 'lib/livingstyleguide.rb', line 30

def self.default_options
  @@default_options
end

.parse_data(data) ⇒ Object



38
39
40
41
42
43
44
45
46
# File 'lib/livingstyleguide.rb', line 38

def self.parse_data(data)
  if data
    if Psych.respond_to?(:safe_load)
      Psych.safe_load(data)
    else
      Psych.load(data)
    end
  end
end

.template(file, scope) ⇒ Object



48
49
50
51
52
# File 'lib/livingstyleguide.rb', line 48

def self.template(file, scope)
  file = "#{File.dirname(__FILE__)}/livingstyleguide/templates/#{file}"
  erb = File.read(file)
  ERB.new(erb).result(scope)
end