livingstyleguide 2.0.0.alpha.10 → 2.0.0.alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/livingstyleguide +5 -6
- data/lib/livingstyleguide.rb +18 -12
- data/lib/livingstyleguide/command_line_interface.rb +5 -6
- data/lib/livingstyleguide/commands.rb +39 -0
- data/lib/livingstyleguide/commands/add_wrapper_class.rb +4 -0
- data/lib/livingstyleguide/commands/coffee_script.rb +5 -0
- data/lib/livingstyleguide/{filters → commands}/colors.rb +1 -1
- data/lib/livingstyleguide/{filters → commands}/css.rb +1 -1
- data/lib/livingstyleguide/{filters → commands}/data.rb +1 -1
- data/lib/livingstyleguide/{filters → commands}/default.rb +1 -1
- data/lib/livingstyleguide/{filters → commands}/font_example.rb +2 -2
- data/lib/livingstyleguide/commands/full_width.rb +4 -0
- data/lib/livingstyleguide/commands/haml.rb +4 -0
- data/lib/livingstyleguide/{filters → commands}/import_and_use.rb +5 -5
- data/lib/livingstyleguide/{filters → commands}/javascript.rb +1 -1
- data/lib/livingstyleguide/{filters → commands}/layout.rb +4 -4
- data/lib/livingstyleguide/commands/markdown.rb +4 -0
- data/lib/livingstyleguide/{filters → commands}/options.rb +3 -3
- data/lib/livingstyleguide/commands/require.rb +4 -0
- data/lib/livingstyleguide/{filters → commands}/sass.rb +4 -2
- data/lib/livingstyleguide/commands/search_box.rb +10 -0
- data/lib/livingstyleguide/{filters → commands}/style.rb +1 -1
- data/lib/livingstyleguide/commands/syntax.rb +4 -0
- data/lib/livingstyleguide/commands/toggle_code.rb +4 -0
- data/lib/livingstyleguide/commands/type.rb +4 -0
- data/lib/livingstyleguide/document.rb +29 -26
- data/lib/livingstyleguide/integration.rb +4 -4
- data/lib/livingstyleguide/integration/compass.rb +2 -3
- data/lib/livingstyleguide/integration/rails.rb +3 -6
- data/lib/livingstyleguide/integration/sass.rb +1 -1
- data/lib/livingstyleguide/integration/sprockets.rb +2 -3
- data/lib/livingstyleguide/markdown_extensions.rb +9 -9
- data/lib/livingstyleguide/templates/code.html.erb +1 -1
- data/lib/livingstyleguide/templates/example.html.erb +1 -1
- data/lib/livingstyleguide/templates/javascript.html.erb +1 -1
- data/lib/livingstyleguide/templates/layout.html.erb +13 -1
- data/lib/livingstyleguide/templates/scripts/copy.js.erb +24 -0
- data/lib/livingstyleguide/templates/scripts/copy_code.js.erb +19 -0
- data/lib/livingstyleguide/templates/scripts/copy_colors.js.erb +36 -0
- data/lib/livingstyleguide/templates/scripts/search.js.erb +66 -0
- data/lib/livingstyleguide/templates/scripts/toggle_code.js.erb +53 -0
- data/lib/livingstyleguide/templates/search-box.html.erb +1 -68
- data/lib/livingstyleguide/templates/toggle-code.html.erb +1 -0
- data/lib/livingstyleguide/version.rb +1 -1
- data/stylesheets/_livingstyleguide.scss +6 -3
- data/stylesheets/livingstyleguide/_before.scss +10 -0
- data/stylesheets/livingstyleguide/_code.scss +4 -7
- data/stylesheets/livingstyleguide/_color-swatches.scss +15 -16
- data/stylesheets/livingstyleguide/_content.scss +5 -5
- data/stylesheets/livingstyleguide/_layout.scss +4 -3
- data/stylesheets/livingstyleguide/_reset.scss +2 -1
- data/stylesheets/livingstyleguide/_toggle-code.scss +21 -0
- data/stylesheets/livingstyleguide/_variables.scss +5 -1
- metadata +46 -29
- data/assets/javascripts/livingstyleguide.js +0 -75
- data/lib/livingstyleguide/engine.rb +0 -194
- data/lib/livingstyleguide/filters.rb +0 -38
- data/lib/livingstyleguide/filters/add_wrapper_class.rb +0 -4
- data/lib/livingstyleguide/filters/coffee_script.rb +0 -5
- data/lib/livingstyleguide/filters/full_width.rb +0 -4
- data/lib/livingstyleguide/filters/haml.rb +0 -4
- data/lib/livingstyleguide/filters/markdown.rb +0 -4
- data/lib/livingstyleguide/filters/require.rb +0 -4
- data/lib/livingstyleguide/filters/search_box.rb +0 -9
- data/lib/livingstyleguide/filters/syntax.rb +0 -4
- data/lib/livingstyleguide/filters/type.rb +0 -4
- data/lib/livingstyleguide/templates/code-example.html.erb +0 -21
- data/lib/livingstyleguide/templates/colors-example.html.erb +0 -38
- data/lib/livingstyleguide/templates/javascript-copy.html.erb +0 -26
- data/stylesheets/livingstyleguide/_search.scss +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac71c904b754f1bf069310514347b950d2d0ab8d
|
4
|
+
data.tar.gz: 37b597563643b5db04e73fb181f8be5b23917ada
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bea2424d954964fd4c77f113ba255858efb06479f961089580c00617add66e69960b3b3599c53400587a6f0a0f3e4c947086ab118d6c344f88d71efb4d52c1f0
|
7
|
+
data.tar.gz: 6c051d0f26ef17995e7f1ebeef29ef520d937136b93976107351fda9f8e8a8f0f83d0e6a51d802a9cbfd616dd3bc8b776726f7ca0e26f9182b4f1ae1e05dfb01
|
data/bin/livingstyleguide
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require "rubygems"
|
4
4
|
begin
|
5
|
-
require
|
5
|
+
require "bundler/setup"
|
6
6
|
rescue LoadError
|
7
7
|
end
|
8
8
|
|
9
|
-
lib = File.expand_path(
|
9
|
+
lib = File.expand_path("../lib", File.dirname(__FILE__))
|
10
10
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
11
11
|
|
12
|
-
require
|
13
|
-
require
|
12
|
+
require "livingstyleguide"
|
13
|
+
require "livingstyleguide/command_line_interface"
|
14
14
|
|
15
15
|
LivingStyleGuide::CommandLineInterface.start(ARGV)
|
16
|
-
|
data/lib/livingstyleguide.rb
CHANGED
@@ -4,25 +4,25 @@ Encoding.default_internal = Encoding::UTF_8
|
|
4
4
|
require "yaml"
|
5
5
|
|
6
6
|
begin
|
7
|
-
require
|
7
|
+
require "compass"
|
8
8
|
rescue LoadError
|
9
9
|
end
|
10
10
|
|
11
11
|
module LivingStyleGuide
|
12
12
|
@@default_options = {
|
13
13
|
default_language: :example,
|
14
|
-
title:
|
15
|
-
header:
|
16
|
-
footer:
|
17
|
-
root:
|
14
|
+
title: "Living Style Guide",
|
15
|
+
header: %Q(<h1 class="lsg--page-title">Living Style Guide</h1>),
|
16
|
+
footer: %Q(<div class="lsg--footer"><a class="lsg--logo" href="http://livingstyleguide.org">Made with the LivingStyleGuide gem.</a></div>),
|
17
|
+
root: "/"
|
18
18
|
}
|
19
19
|
|
20
20
|
def self.default_options
|
21
21
|
@@default_options
|
22
22
|
end
|
23
23
|
|
24
|
-
def self.
|
25
|
-
|
24
|
+
def self.command(*keys, &block)
|
25
|
+
Commands.command(*keys, &block)
|
26
26
|
end
|
27
27
|
|
28
28
|
def self.parse_data(data)
|
@@ -34,10 +34,16 @@ module LivingStyleGuide
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
def self.template(file, scope)
|
39
|
+
file = "#{File.dirname(__FILE__)}/livingstyleguide/templates/#{file}"
|
40
|
+
erb = File.read(file)
|
41
|
+
ERB.new(erb).result(scope)
|
42
|
+
end
|
37
43
|
end
|
38
44
|
|
39
|
-
require
|
40
|
-
require
|
41
|
-
require
|
42
|
-
require
|
43
|
-
require
|
45
|
+
require "livingstyleguide/version"
|
46
|
+
require "livingstyleguide/markdown_extensions"
|
47
|
+
require "livingstyleguide/document"
|
48
|
+
require "livingstyleguide/commands"
|
49
|
+
require "livingstyleguide/integration"
|
@@ -1,10 +1,10 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require "thor"
|
2
|
+
require "tilt"
|
3
3
|
|
4
4
|
module LivingStyleGuide
|
5
5
|
class CommandLineInterface < Thor
|
6
6
|
|
7
|
-
desc
|
7
|
+
desc "compile input_file output_file", "Compiles the living style guide to HTML."
|
8
8
|
def compile(input_file = nil, output_file = nil)
|
9
9
|
doc = LivingStyleGuide::Document.new(input_file) do
|
10
10
|
input(input_file)
|
@@ -12,7 +12,7 @@ module LivingStyleGuide
|
|
12
12
|
output doc.render, input_file, output_file
|
13
13
|
end
|
14
14
|
|
15
|
-
desc
|
15
|
+
desc "version", "Shows the current version of the Gem"
|
16
16
|
def version
|
17
17
|
puts "LivingStyleGuide #{LivingStyleGuide::VERSION}"
|
18
18
|
end
|
@@ -31,7 +31,7 @@ module LivingStyleGuide
|
|
31
31
|
if input_file.nil?
|
32
32
|
puts html
|
33
33
|
else
|
34
|
-
output_file = input_file.sub(/(\.html)?\.lsg$/,
|
34
|
+
output_file = input_file.sub(/(\.html)?\.lsg$/, ".html") if output_file.nil?
|
35
35
|
if defined?(Compass)
|
36
36
|
Compass.add_project_configuration
|
37
37
|
output_file = output_file.sub(/^#{Compass.configuration.sass_dir}/, Compass.configuration.css_dir)
|
@@ -43,4 +43,3 @@ module LivingStyleGuide
|
|
43
43
|
|
44
44
|
end
|
45
45
|
end
|
46
|
-
|
@@ -0,0 +1,39 @@
|
|
1
|
+
class LivingStyleGuide::Commands
|
2
|
+
attr_reader :document
|
3
|
+
|
4
|
+
def initialize(doc)
|
5
|
+
@document = doc
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_binding
|
9
|
+
binding
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.command(*keys, &block)
|
13
|
+
keys.each do |key|
|
14
|
+
define_method key, &block
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
require "livingstyleguide/commands/options"
|
20
|
+
require "livingstyleguide/commands/default"
|
21
|
+
require "livingstyleguide/commands/import_and_use"
|
22
|
+
require "livingstyleguide/commands/require"
|
23
|
+
require "livingstyleguide/commands/full_width"
|
24
|
+
require "livingstyleguide/commands/haml"
|
25
|
+
require "livingstyleguide/commands/type"
|
26
|
+
require "livingstyleguide/commands/markdown"
|
27
|
+
require "livingstyleguide/commands/javascript"
|
28
|
+
require "livingstyleguide/commands/coffee_script"
|
29
|
+
require "livingstyleguide/commands/add_wrapper_class"
|
30
|
+
require "livingstyleguide/commands/font_example"
|
31
|
+
require "livingstyleguide/commands/colors"
|
32
|
+
require "livingstyleguide/commands/css"
|
33
|
+
require "livingstyleguide/commands/sass"
|
34
|
+
require "livingstyleguide/commands/style"
|
35
|
+
require "livingstyleguide/commands/data"
|
36
|
+
require "livingstyleguide/commands/layout"
|
37
|
+
require "livingstyleguide/commands/syntax"
|
38
|
+
require "livingstyleguide/commands/search_box"
|
39
|
+
require "livingstyleguide/commands/toggle_code"
|
@@ -1,4 +1,4 @@
|
|
1
|
-
LivingStyleGuide.
|
1
|
+
LivingStyleGuide.command :default do |arguments, options, block|
|
2
2
|
key = arguments.first ? arguments.first.gsub("-", "_").to_sym : :global
|
3
3
|
document.defaults[key] ||= {}
|
4
4
|
document.defaults[key].merge!(options)
|
@@ -5,11 +5,11 @@ LivingStyleGuide.default_options[:font_example] = { text: <<-TEXT }
|
|
5
5
|
!&/()$=@;:,.
|
6
6
|
TEXT
|
7
7
|
|
8
|
-
LivingStyleGuide.
|
8
|
+
LivingStyleGuide.command :font_example do |arguments, options, text|
|
9
9
|
text ||= LivingStyleGuide.default_options[:font_example][:text]
|
10
10
|
text = ERB::Util.html_escape(text)
|
11
11
|
text.strip!
|
12
12
|
text.gsub!(/\n/, "<br>\n")
|
13
13
|
font = ERB::Util.html_escape(arguments.first)
|
14
|
-
|
14
|
+
LivingStyleGuide.template("font-example.html.erb", binding)
|
15
15
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require "tilt"
|
2
2
|
|
3
3
|
def map_files(glob, &block)
|
4
|
-
glob <<
|
5
|
-
glob.gsub!(/[^\/]+$/,
|
4
|
+
glob << ".lsg" unless glob =~ /\.(\w+|\*)$/
|
5
|
+
glob.gsub!(/[^\/]+$/, "{_,}\\0")
|
6
6
|
glob = File.join(document.path, glob)
|
7
7
|
|
8
8
|
Dir.glob(glob).map do |file|
|
@@ -11,7 +11,7 @@ def map_files(glob, &block)
|
|
11
11
|
end.join
|
12
12
|
end
|
13
13
|
|
14
|
-
LivingStyleGuide.
|
14
|
+
LivingStyleGuide.command :import do |arguments, options, data|
|
15
15
|
glob = arguments.first
|
16
16
|
if glob =~ /\.s[ac]ss$/
|
17
17
|
raise "Error: Please use `@css #{glob}` instead of `@import #{glob}` for importing Sass."
|
@@ -26,7 +26,7 @@ LivingStyleGuide.add_filter :import do |arguments, options, data|
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
LivingStyleGuide.
|
29
|
+
LivingStyleGuide.command :use do |arguments, options, data|
|
30
30
|
glob = arguments.first
|
31
31
|
map_files glob do |file|
|
32
32
|
File.read(file)
|
@@ -1,11 +1,11 @@
|
|
1
|
-
LivingStyleGuide.
|
1
|
+
LivingStyleGuide.command :title do |arguments, options, block|
|
2
2
|
document.title = arguments.first
|
3
3
|
nil
|
4
4
|
end
|
5
5
|
|
6
6
|
{ :before => :head, :after => :footer }.each do |name, destination|
|
7
7
|
eval <<-RUBY
|
8
|
-
LivingStyleGuide.
|
8
|
+
LivingStyleGuide.command :javascript_#{name} do |arguments, options, block|
|
9
9
|
if src = arguments.first
|
10
10
|
document.#{destination} << %Q(<script src="\#{src}"></script>)
|
11
11
|
else
|
@@ -19,9 +19,9 @@ end
|
|
19
19
|
RUBY
|
20
20
|
end
|
21
21
|
|
22
|
-
%w(head header footer).each do |part|
|
22
|
+
%w(head header footer before after).each do |part|
|
23
23
|
eval <<-RUBY
|
24
|
-
LivingStyleGuide.
|
24
|
+
LivingStyleGuide.command :#{part} do |arguments, options, block|
|
25
25
|
html = LivingStyleGuide::Document.new(livingstyleguide: document) { block }
|
26
26
|
html.type = options[:type]
|
27
27
|
document.#{part} << html.render + "\n"
|
@@ -1,9 +1,9 @@
|
|
1
|
-
LivingStyleGuide.
|
1
|
+
LivingStyleGuide.command :set do |arguments, options, block|
|
2
2
|
options.each do |key, value|
|
3
3
|
document.options[key] = case value
|
4
|
-
when
|
4
|
+
when "true"
|
5
5
|
true
|
6
|
-
when
|
6
|
+
when "false"
|
7
7
|
false
|
8
8
|
when /^\d+$/
|
9
9
|
value.to_i
|
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
require "sass"
|
2
|
+
|
3
|
+
LivingStyleGuide.command :scss do |arguments, options, scss|
|
2
4
|
file = arguments.first
|
3
5
|
if file
|
4
6
|
if document.file
|
@@ -12,7 +14,7 @@ LivingStyleGuide.add_filter :scss do |arguments, options, scss|
|
|
12
14
|
nil
|
13
15
|
end
|
14
16
|
|
15
|
-
LivingStyleGuide.
|
17
|
+
LivingStyleGuide.command :sass do |arguments, options, sass|
|
16
18
|
file = arguments.first
|
17
19
|
if file
|
18
20
|
if document.file
|
@@ -0,0 +1,10 @@
|
|
1
|
+
LivingStyleGuide.default_options[:search_box] = {
|
2
|
+
placeholder: "Search …"
|
3
|
+
}
|
4
|
+
|
5
|
+
LivingStyleGuide.command :search_box do |arguments, options, content|
|
6
|
+
placeholder = options[:placeholder] || LivingStyleGuide.default_options[:search_box][:placeholder]
|
7
|
+
document.before << LivingStyleGuide.template("search-box.html.erb", binding)
|
8
|
+
document.javascript << LivingStyleGuide.template("scripts/search.js.erb", binding)
|
9
|
+
nil
|
10
|
+
end
|
@@ -1,18 +1,18 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
3
|
+
require "tilt"
|
4
|
+
require "erb"
|
5
|
+
require "digest"
|
6
|
+
require "pathname"
|
7
7
|
|
8
8
|
class LivingStyleGuide::Document < ::Tilt::Template
|
9
|
-
attr_accessor :source, :type, :
|
9
|
+
attr_accessor :source, :type, :commands, :template, :classes, :html
|
10
10
|
attr_accessor :css, :id, :locals
|
11
11
|
attr_accessor :title
|
12
12
|
attr_accessor :syntax
|
13
13
|
attr_reader :scope
|
14
14
|
|
15
|
-
%w(scss head header footer defaults).each do |attr|
|
15
|
+
%w(scss head header footer defaults javascript before after).each do |attr|
|
16
16
|
define_method attr do
|
17
17
|
if options.has_key?(:livingstyleguide)
|
18
18
|
options[:livingstyleguide].send(attr)
|
@@ -32,11 +32,11 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
32
32
|
|
33
33
|
def prepare
|
34
34
|
@type = :lsg
|
35
|
-
@
|
35
|
+
@commands = LivingStyleGuide::Commands.new(self)
|
36
36
|
@template = options.has_key?(:livingstyleguide) ? :default : :layout
|
37
37
|
@classes = []
|
38
|
-
@scss =
|
39
|
-
@css =
|
38
|
+
@scss = ""
|
39
|
+
@css = ""
|
40
40
|
@locals = {}
|
41
41
|
@defaults = {
|
42
42
|
global: {
|
@@ -58,7 +58,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def css
|
61
|
-
scss_with_lsg =
|
61
|
+
scss_with_lsg = %Q(#{scss}; @import "livingstyleguide";)
|
62
62
|
render_scss(scss_with_lsg)
|
63
63
|
end
|
64
64
|
|
@@ -77,7 +77,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def erb
|
80
|
-
@erb ||=
|
80
|
+
@erb ||= parse_commands do |name, arguments, options, block|
|
81
81
|
options = %Q(document.defaults[:global].merge(document.defaults[:@#{name}] || {}).merge(#{options.inspect}))
|
82
82
|
"<%= #{name}(#{arguments.inspect}, #{options}, #{block.inspect}) %>\n"
|
83
83
|
end
|
@@ -85,13 +85,16 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
85
85
|
|
86
86
|
def evaluate(scope, locals, &block)
|
87
87
|
@head = ""
|
88
|
-
@
|
89
|
-
|
90
|
-
|
88
|
+
@javascript = ""
|
89
|
+
%w(copy copy_code copy_colors toggle_code).each do |partial|
|
90
|
+
@javascript << LivingStyleGuide.template("scripts/#{partial}.js.erb", binding)
|
91
|
+
end
|
91
92
|
@header = ""
|
93
|
+
@before = ""
|
94
|
+
@after = ""
|
92
95
|
@footer = ""
|
93
96
|
@scope = scope
|
94
|
-
result = ERB.new(erb).result(@
|
97
|
+
result = ERB.new(erb).result(@commands.get_binding)
|
95
98
|
@source = result
|
96
99
|
@html = render_html(result, locals)
|
97
100
|
@classes.unshift "lsg--#{@type}-example"
|
@@ -183,7 +186,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
183
186
|
|
184
187
|
private
|
185
188
|
def remove_highlights(code)
|
186
|
-
code.gsub(/\*\*\*/,
|
189
|
+
code.gsub(/\*\*\*/, "")
|
187
190
|
end
|
188
191
|
|
189
192
|
private
|
@@ -192,18 +195,18 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
192
195
|
end
|
193
196
|
|
194
197
|
private
|
195
|
-
def
|
196
|
-
data.gsub(
|
198
|
+
def parse_commands
|
199
|
+
data.gsub("<%", "<%%").gsub(/\G(.*?)((```.+?```)|\Z)/m) do
|
197
200
|
content, code_block = $1, $2
|
198
201
|
content.gsub(/^@([\w\d_-]+)(?: ([^\n]*[^\{\n:]))?(?: *\{\n((?:.|\n)*?)\n\}|((?:\n+ .*)+(?=\n|\Z))| *:\n((?:.|\n)*?)(?:\n\n|\Z))?/) do
|
199
|
-
name, arguments_string, block = $1, $2 ||
|
202
|
+
name, arguments_string, block = $1, $2 || "", $3 || $4 || $5
|
200
203
|
options = {
|
201
204
|
block_type: $3 ? :braces : $4 ? :indented : $5 ? :block : :none
|
202
205
|
}
|
203
|
-
name = name.gsub(
|
206
|
+
name = name.gsub("-", "_").to_sym
|
204
207
|
arguments = parse_arguments(arguments_string, options)
|
205
208
|
if options[:block_type] == :indented
|
206
|
-
block.gsub!(/\A\n(\s*)((?:.|\n)+)\Z/){ $2.gsub(/^#{$1}/,
|
209
|
+
block.gsub!(/\A\n(\s*)((?:.|\n)+)\Z/){ $2.gsub(/^#{$1}/, "") }
|
207
210
|
end
|
208
211
|
yield name, arguments, options, block
|
209
212
|
end + code_block
|
@@ -217,7 +220,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
217
220
|
argument.strip!
|
218
221
|
argument.gsub! "\\;", ";"
|
219
222
|
if /^(?<key>[a-zA-Z0-9_\-]+):(?<value>.+)$/ =~ argument
|
220
|
-
options[key.downcase.gsub(
|
223
|
+
options[key.downcase.gsub("-", "_").to_sym] = remove_quots(value.strip)
|
221
224
|
nil
|
222
225
|
else
|
223
226
|
remove_quots(argument)
|
@@ -228,7 +231,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
228
231
|
|
229
232
|
private
|
230
233
|
def remove_quots(string)
|
231
|
-
string.sub(/^"(.*)"$|^
|
234
|
+
string.sub(/^"(.*)"$|^"(.*)"$|^(.*)$/, "\\1\\2\\3").gsub(/\\("|")/, "\\1")
|
232
235
|
end
|
233
236
|
|
234
237
|
private
|
@@ -252,7 +255,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
252
255
|
def generate_id
|
253
256
|
if @file
|
254
257
|
id = Pathname.new(@file).cleanpath.to_s
|
255
|
-
id.sub(
|
258
|
+
id.sub("/_", "/").gsub(/\.\w+/, "")
|
256
259
|
else
|
257
260
|
"section-#{Digest::SHA256.hexdigest(data)[0...6]}"
|
258
261
|
end
|
@@ -260,7 +263,7 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
260
263
|
|
261
264
|
private
|
262
265
|
def scss_template
|
263
|
-
::LivingStyleGuide.default_options[:scss_template] || Tilt[
|
266
|
+
::LivingStyleGuide.default_options[:scss_template] || Tilt["scss"]
|
264
267
|
end
|
265
268
|
|
266
269
|
private
|
@@ -277,4 +280,4 @@ class LivingStyleGuide::Document < ::Tilt::Template
|
|
277
280
|
end
|
278
281
|
end
|
279
282
|
|
280
|
-
Tilt.register
|
283
|
+
Tilt.register "lsg", LivingStyleGuide::Document
|