diff --git a/_config.yml b/_config.yml index 9dc98a98b..b3e01adb6 100644 --- a/_config.yml +++ b/_config.yml @@ -40,6 +40,8 @@ collections: output: true changelog: output: false + components: + output: true defaults: - @@ -54,6 +56,11 @@ defaults: values: layout: docs nav-position: top + - + scope: + type: components + values: + layout: component colors: diff --git a/build/browsersync.js b/build/browsersync.js index 592c6bc56..c9067ff90 100755 --- a/build/browsersync.js +++ b/build/browsersync.js @@ -16,4 +16,5 @@ bs.init({ ignoreInitial: true, }, notify: false, + open: false }); diff --git a/package.json b/package.json index 1296da015..16e3eb1a7 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.0.0", "description": "Premium and Open Source dashboard template with responsive and high quality UI.", "scripts": { - "start": "npm-run-all clean css-main js-compile-standalone --parallel browsersync watch html-watch", + "start": "npm-run-all clean css-main js-compile-standalone --parallel html-watch browsersync watch", "build": "npm-run-all clean html-build css js fonts", "bundlesize": "bundlesize", "browsersync": "node build/browsersync.js", diff --git a/pages/_components/simple-card.html b/pages/_components/simple-card.html new file mode 100644 index 000000000..46d5aa4f4 --- /dev/null +++ b/pages/_components/simple-card.html @@ -0,0 +1,5 @@ +--- +name: Simple box +--- + +{% include cards/card.html %} diff --git a/pages/_components/widget-sales.html b/pages/_components/widget-sales.html new file mode 100644 index 000000000..ca2a1f2e4 --- /dev/null +++ b/pages/_components/widget-sales.html @@ -0,0 +1,5 @@ +--- +title: Sales widget +--- + +{% include cards/charts/sales.html %} diff --git a/pages/_includes/cards/card.html b/pages/_includes/cards/card.html index b7ab17bcd..5bf44b22c 100644 --- a/pages/_includes/cards/card.html +++ b/pages/_includes/cards/card.html @@ -3,7 +3,7 @@
{% endif %} - {% unless include.hide-header %} + {% if include.show-header %}#{code}\n*/, '") + code.strip +end + module Jekyll - module Tags - class ExampleBlock < Liquid::Block - include Liquid::StandardFilters + class ExampleBlock < Liquid::Block + include Liquid::StandardFilters - SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+[\w-]+(=((\w|[0-9_-])+|"([0-9]+\s)*[0-9]+"))?)*)$/ + SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+[\w-]+(=((\w|[0-9_-])+|"([0-9]+\s)*[0-9]+"))?)*)$/ - def initialize(tag_name, markup, tokens) - super - if markup.strip == "" - markup = 'html' - end + def initialize(tag_name, markup, tokens) + super + if markup.strip == "" + markup = 'html' + end - if markup.strip =~ SYNTAX - @lang = $1.downcase - @options = {} - if defined?($2) && $2 != '' - # Split along 3 possible forms -- key="') + code = code.sub(/\n*<\/pre>/, "", key=value, or key - $2.scan(/(?:[\w-]+(?:=(?:(?:\w|[0-9_-])+|"[^"]*")?)?)/) do |opt| - key, value = opt.split('=') - # If a quoted list, convert to array - if value && value.include?("\"") - value.gsub!(/"/, "") - value = value.split - end - @options[key.to_sym] = value || true + if markup.strip =~ SYNTAX + @lang = $1.downcase + @options = {} + if defined?($2) && $2 != '' + # Split along 3 possible forms -- key=" ", key=value, or key + $2.scan(/(?:[\w-]+(?:=(?:(?:\w|[0-9_-])+|"[^"]*")?)?)/) do |opt| + key, value = opt.split('=') + # If a quoted list, convert to array + if value && value.include?("\"") + value.gsub!(/"/, "") + value = value.split end + @options[key.to_sym] = value || true end - @options[:linenos] = false - else - raise SyntaxError.new <<-eos + end + @options[:linenos] = false + else + raise SyntaxError.new <<-eos Syntax Error in tag 'example' while parsing the following markup: #{markup} Valid syntax: example [id=foo] - eos - end + eos end + end - def render(context) - prefix = context["highlighter_prefix"] || "" - suffix = context["highlighter_suffix"] || "" - code = super.to_s.strip + def render(context) + prefix = context["highlighter_prefix"] || "" + suffix = context["highlighter_suffix"] || "" + code = super.to_s.strip - output = case context.registers[:site].highlighter + output = case context.registers[:site].highlighter - when 'rouge' - render_rouge(code) - end + when 'rouge' + render_rouge(code, @lang, @options[:linenos]) + end - # output = HtmlBeautifier.beautify(output, indent: "\t") + rendered_output = example(code) + add_code_tag(output, @lang) + prefix + rendered_output + suffix + end - rendered_output = example(code) + add_code_tag(output) - prefix + rendered_output + suffix - end + def example(output) + output = output.gsub(/ /, "").gsub(/<\/hide>/, "") - def example(output) - output = output.gsub(/ /, "").gsub(/<\/hide>/, "") + " \n" + (@options[:columns] ? "" + end - "\n" : "") + (@options[:wrapper] ? "" : "") + "\n\n" : "") + (@options[:"max-width"] ? "" : "") + (@options[:"max-width"] ? "\n\n" : "") + "#{output}" + (@options[:wrapper] ? "\n" : "") + (@options[:columns] ? "\n\n" + (@options[:columns] ? "" - end - - def remove_example_classes(code) - # Find `bd-` classes and remove them from the highlighted code. Because of how this regex works, it will also - # remove classes that are after the `bd-` class. While this is a bug, I left it because it can be helpful too. - # To fix the bug, replace `(?=")` with `(?=("|\ ))`. - code = code.gsub(/(?!class=".)\ *?bd-.+?(?=")/, "") - # Find empty class attributes after the previous regex and remove those too. - code = code.gsub(/\ class=""/, "") - end - - def render_rouge(code) - require 'rouge' - formatter = Rouge::Formatters::HTML.new(line_numbers: @options[:linenos], wrap: false) - lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText - code = remove_example_classes(code) - code = code.gsub(/\n" : "") + (@options[:wrapper] ? "" : "") + "\n\n" : "") + (@options[:"max-width"] ? "" : "") + (@options[:"max-width"] ? "\n\n" : "") + "#{output}" + (@options[:wrapper] ? "\n" : "") + (@options[:columns] ? "\n.*?<\/hide>/, "") - code = formatter.format(lexer.lex(code)) - code = code.strip.gsub /^[\t\s]*$\n/, '' - code = code.gsub /\t/, "\s\s" - code = code.gsub "javascript:void(0)", "#" - code = code.gsub "../", "./" - " " - end - - def add_code_tag(code) - # Add nested#{code}tags to code blocks - code = code.sub(/\n*/, '") - code.strip - end + end + module HightlightFilter + def highlight_tidy(code, language = 'html') + code = render_rouge(code, language) + add_code_tag(code, language) end end end -Liquid::Template.register_tag('example', Jekyll::Tags::ExampleBlock) +Liquid::Template.register_tag('example', Jekyll::ExampleBlock) +Liquid::Template.register_filter(Jekyll::HightlightFilter) diff --git a/pages/components.html b/pages/components.html new file mode 100644 index 000000000..3f3e83e4b --- /dev/null +++ b/pages/components.html @@ -0,0 +1,11 @@ +--- +title: Table UI components +--- + +') - code = code.sub(/\n*<\/pre>/, "+diff --git a/scss/ui/_typo.scss b/scss/ui/_typo.scss index eee986c86..1b6c346e6 100644 --- a/scss/ui/_typo.scss +++ b/scss/ui/_typo.scss @@ -83,10 +83,10 @@ pre { hyphens: none; line-height: 1.45; color: $gray-800; - text-shadow: 0 1px #fff; tab-size: 3; background-color: #f8fafc; border-radius: $border-radius; + -webkit-font-smoothing: auto; } img {+ {% for component in site.components %} +
+- {{ component.title }}
+ {% endfor %} +