diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..eb9c6ae36 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: ruby +rvm: + - "1.9.3" +script: bundle exec rspec spec && bundle exec middleman build diff --git a/Gemfile b/Gemfile index 0f066a37c..8ac2f0b00 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,7 @@ group :test do gem "rspec" gem "capybara" gem "poltergeist" + gem "hashie" end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem diff --git a/Gemfile.lock b/Gemfile.lock index 67876b255..151040176 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -60,6 +60,7 @@ GEM ffi (1.9.6-x86-mingw32) haml (4.0.6) tilt + hashie (3.4.0) highline (1.6.21) hike (1.2.3) hitimes (1.2.2) @@ -203,6 +204,7 @@ DEPENDENCIES builder capybara coderay! + hashie highline listen middleman (~> 3.0) diff --git a/data/guides.yml b/data/guides.yml index 35be6795d..0a44e7b56 100644 --- a/data/guides.yml +++ b/data/guides.yml @@ -5,6 +5,14 @@ url: "" skip_sidebar: true +- title: "Getting Started" + url: 'ember-cli' + chapters: + - title: "Installing Ember" + url: "index" + - title: "Glossary" + url: "glossary" + - title: "Getting Ember" url: 'getting-ember' chapters: @@ -198,8 +206,6 @@ url: "built-in-views" - title: "Manually Managing View Hierarchy" url: "manually-managing-view-hierarchy" - #- title: "Building Reusable Views" - #url: "building-reusable-views" - title: "Enumerables" url: 'enumerables' @@ -375,12 +381,6 @@ # url: "debugging_and_configuration/setting_ember_global_flags" # skip_sidebar_item: true -- title: "Deprecations" - url: 'deprecations' - chapters: - - title: "Deprecations" - url: "index" - - title: "Understanding Ember.js" url: 'understanding-ember' chapters: diff --git a/lib/highlighter.rb b/lib/highlighter.rb index 921d79181..e7f10e7e7 100644 --- a/lib/highlighter.rb +++ b/lib/highlighter.rb @@ -2,6 +2,7 @@ require "coderay" module Highlighter + class MissingLanguageError < StandardError; end class << self def registered(app) app.helpers Helpers @@ -11,6 +12,11 @@ def registered(app) module Helpers def _highlight(string, language, class_name=nil) + error_message = "Code blocks must be fenced with proper language designated. If you don't know what language to use, specify ```text.\n\n" + error_message << "Offending Code Block:\n\n#{string}" + + raise MissingLanguageError, error_message if language.nil? + language, file_name = _detect_language_and_filename(language) result = %Q{
} @@ -23,6 +29,7 @@ def _highlight(string, language, class_name=nil) end def _detect_language_and_filename(language) + file_name = nil bare_language_regex = /\A\w+\z/ diff --git a/lib/toc.rb b/lib/toc.rb index 4bb73e178..801800e15 100644 --- a/lib/toc.rb +++ b/lib/toc.rb @@ -57,19 +57,13 @@ def toc_for(guides) end def page_title - buffer = "" - - if current_guide - buffer << current_guide.title - if current_chapter - buffer << ": " - buffer << current_chapter.title - end + if current_guide && current_chapter + "#{current_guide.title}: #{current_chapter.title}" + elsif current_guide + current_guide.title else - buffer << "Guides" + "Guides" end - - buffer end def guide_name @@ -78,9 +72,9 @@ def guide_name def chapter_name if current_chapter - return current_chapter.title + current_chapter.title else - return "" + "" end end @@ -111,6 +105,10 @@ def current_guide end end + def current_guide_index + data.guides.find_index(current_guide) + end + def current_chapter return unless current_guide @@ -123,6 +121,11 @@ def current_chapter end end + def current_chapter_index + return unless current_guide + current_guide.chapters.find_index(current_chapter) + end + def chapter_links %Q{