Skip to content

Create config to provide category and article sort order #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 23, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
output/
tmp/*
tmp
order.json
.DS_Store
43 changes: 18 additions & 25 deletions Rules
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,18 @@ end
Nanoc3::Filter.register 'CodeBlocks', :code_blocks

preprocess do
@chapterOrder = [
"getting-started",
"javascript-101",
"using-jquery-core",
"events",
"effects",
"ajax",
"plugins",
"performance",
"code-organization",
"how-to"
]

@order = YAML.load(File.read("order.yaml"))
@chapter_articles = {}
@chapter_order = @order.map{ |chapter|
@chapter_articles[ chapter.keys.first ] = chapter[ chapter.keys.first ]
chapter.keys.first
}
@chapters = {}

@github_users = {
"jquery" => nil
}

File.open("order.json", "w") {|f| f.write @order.to_json }
@items.each do |item|
item[:chapter] = item[:filename].split('/')[1]
item[:chapter_title] = item[:chapter].gsub(/-/, " ").upcase
Expand All @@ -118,25 +111,25 @@ preprocess do
@github_users[ username ] = JSON.parse(request.body_str)
end

@grouped_items = @items.group_by {|item| item[:chapter]}

@groupedItems = @items.group_by {|item| item[:chapter]}

@orderedItems = []
@ordered_items = []

@chapterOrder.each do |folder|
myitems = @groupedItems[ folder ]
@chapter_order.each do |folder|
@chapters [ folder] = {}
@chapters[ folder ][ :items ] = @groupedItems[folder].sort_by {|i| i[:section] || 0 }
@orderedItems = @orderedItems + @chapters[ folder ][ :items ]
@chapters[ folder ][ :items ] = @grouped_items[folder].sort_by {|i|
p @chapter_articles[ i[ :chapter ] ].index( p i.identifier.split('/')[2] ) || 0
@chapter_articles[ i[ :chapter ] ].index( p i.identifier.split('/')[2] ) || 0
}
@ordered_items = @ordered_items + @chapters[ folder ][ :items ]
@chapters[ folder ][ :title ] = folder.gsub(/-/, " ").upcase
@chapters[ folder ][ :folder ] = folder
end

@items.each do |item|
i = item[:ordinal_index] = @orderedItems.index(item)
i = item[:ordinal_index] = @ordered_items.index(item)
if i
item[:next_item] = @orderedItems[ i+1 ]
item[:previous_item] = @orderedItems[ i-1 ]
item[:next_item] = @ordered_items[ i+1 ]
item[:previous_item] = @ordered_items[ i-1 ]
end
item[:github_user] = @github_users[ item[:github] ]
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Getting Started
index: true
title: About jQuery
---

Getting started with jQuery can be easy or challenging, depending on
Expand Down
5 changes: 1 addition & 4 deletions content/ajax/ajax-and-forms.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
chapter : ajax
section : 4
title : Ajax and Forms
attribution: jQuery Fundamentals

---

jQuery’s ajax capabilities can be especially useful when dealing with forms. There are several advantages, which can range from serialization, to simple client-side validation (e.g. "Sorry, that username is taken"), to [prefilters](http://api.jquery.com/extending-ajax/#Prefilters) (explained below), and even more!
Expand Down Expand Up @@ -88,4 +85,4 @@ You can pass in an optional argument before the callback function that specifies
$.ajaxPrefilter( "json script", function( options, originalOptions, jqXHR ) {
// do all of the prefiltering here, but only for requests that indicate a dataType of "JSON" or "script"
})
</javascript>
</javascript>
2 changes: 0 additions & 2 deletions content/ajax/ajax-events.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : ajax
section : 6
title : Ajax Events
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/ajax/ajax-excercises.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : ajax
section : 7
title : Exercises
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/ajax/jquery-ajax-methods.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : ajax
section : 3
title : jQuery's Ajax-Related Methods
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/ajax/key-concepts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : ajax
section : 2
title : Key Concepts
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/ajax/working-with-jsonp.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : ajax
section : 5
title : Working with JSONP
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/code-organization/beware-anonymous-functions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : code-organization
section: 2
title: Beware Anonymous Functions
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/code-organization/concepts.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : Code Organization
section: 0
title: Code Organization Concepts
attribution: $jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/code-organization/dont-repeat-yourself.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : code-organization
section: 0
title: Keep Things DRY
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/effects/built-in-effects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : effects
section : 2
title : Built-in Effects
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/effects/custom-effects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : effects
section : 3
title : Custom Effects with $.fn.animate
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/effects/effects-exercises.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : effects
section : 5
title : Effect Exercises
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/effects/managing-effects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : effects
section : 4
title : Managing Effects
attribution: jQuery Fundamentals
---
Expand Down
1 change: 0 additions & 1 deletion content/events/dex.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
title: Events
section : 1
attribution: jQuery Fundamentals
---
jQuery provides simple methods for attaching event handlers to selections.
Expand Down
2 changes: 0 additions & 2 deletions content/events/event-delegation.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : events
section : 4
title : Increasing Performance with Event Delegation
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/events/event-exercises.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : events
section : 6
title : Excercises
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/events/event-extensions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : events
section : 7
title : jQuery Event Extensions
attribution: Dave Methvin
github: dmethvin
Expand Down
2 changes: 0 additions & 2 deletions content/events/event-helpers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : events
section : 5
title : Event Helpers
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/events/events-to-elements.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : events
section : 2
title : Connecting Events to Elements
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/events/inside-event-handling-function.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : events
section : 3
title : Inside the Event Handling Function
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/events/introduction-to-custom-events.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : Custom Events
section: 0
title: Introducing Custom Events
attribution: $jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/events/triggering-event-handlers.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : events
section : 4
title : Triggering Event Handlers
attribution: jQuery Fundamentals
---
Expand Down
3 changes: 3 additions & 0 deletions content/faq/dex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: Frequently Asked Questions
---
3 changes: 0 additions & 3 deletions content/how-to/dex.md

This file was deleted.

2 changes: 0 additions & 2 deletions content/javascript-101/arrays.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 6
title: Arrays
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/closures.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 12
title: Closures
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/conditional-code.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 3
title: Conditional Code
attribution: jQuery Fundamentals
---
Expand Down
4 changes: 1 addition & 3 deletions content/javascript-101/dex.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
---
title : JavaScript 101
chapter : javascript-101
section : 1
attribution: jQuery Fundamentals
---

jQuery is built on top of JavaScript, a rich and expressive language in its own right. This means when using jQuery, we are still writing valid JavaScript; it just serves as a framework to make many aspects of writing JavaScript easier and more reliable in the various browser environments. With that said, a basic knowledge of JavaScript will go a long way in understanding, structuring, and debugging our code; jQuery will just help make that basic knowledge go much, much further.

This section covers the basic concepts of JavaScript, as well as some frequent pitfalls many developers fall into during their first foray into the language. While it will be of particular value to people with little to no programming experience, even people who have used other programming languages may benefit from learning about some of the peculiarities of JavaScript.
This section covers the basic concepts of JavaScript, as well as some frequent pitfalls many developers fall into during their first foray into the language. While it will be of particular value to people with little to no programming experience, even people who have used other programming languages may benefit from learning about some of the peculiarities of JavaScript.
2 changes: 0 additions & 2 deletions content/javascript-101/functions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 8
title: Functions
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/loops.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js10
section: 4
title: Loops
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/objects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 7
title: Objects
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/operators.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 2
title: Operators
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/reserved-words.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 5
title: Reserved Words
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/running-code.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter: javascript-101
section: 1
title: Running Code
attribution: jQuery Fundamentals
github: jquery
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/scope.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 11
title: Scope
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/syntax-basics.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter: javascript-101
section: 2
title: Syntax Basics
attribution: jQuery Fundamentals
github: jquery
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/testing-type.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 9
title: Testing Type
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/this-keyword.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : js101
section: 10
title: The "this" Keyword
attribution: jQuery Fundamentals
---
Expand Down
2 changes: 0 additions & 2 deletions content/javascript-101/types.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter: javascript-101
section: 2
title: Types
attribution: jQuery Fundamentals
github: jquery
Expand Down
2 changes: 0 additions & 2 deletions content/performance/append-outside-loop.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : performance
section: 0
title: Append Outside of Loops
attribution: jQuery Fundamentals
tags: performance
Expand Down
2 changes: 0 additions & 2 deletions content/performance/cache-loop-length.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : performance
section: 0
title: Cache Length During Loops
attribution: jQuery Fundamentals
tags: performance
Expand Down
2 changes: 0 additions & 2 deletions content/performance/clever-conditionals.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : performance
section: 0
title: Clever Conditionals
attribution: jQuery Fundamentals
tags: performance
Expand Down
2 changes: 0 additions & 2 deletions content/performance/detach-elements-before-work-with-them.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
---
chapter : performance
section: 0
title: Detach Elements to Work with Them
attribution: jQuery Fundamentals
tags: performance
Expand Down
Loading