Skip to content

Commit 192c3c5

Browse files
David Bradysreid
authored andcommitted
Added chapter indexes
1 parent 9533e60 commit 192c3c5

File tree

16 files changed

+228
-6
lines changed

16 files changed

+228
-6
lines changed

_layouts/chapter.html

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>CoffeeScript Cookbook &raquo; {{ page.title }}</title>
5+
<link rel="stylesheet" href="/css/default.css" type="text/css">
6+
</head>
7+
<body>
8+
<div class="header">
9+
<h1><a href="/">CoffeeScript Cookbook</a></h1>
10+
<a href="/chapters">Chapter Index</a> |
11+
<a href="/contributing">Contributing</a> |
12+
<a href="/authors">Authors</a> |
13+
<a href="/license">License</a>
14+
</div>
15+
16+
<h1>Chapter: {{ page.title }}</h1>
17+
18+
{{ content }}
19+
<hr />
20+
<p>Don't see the recipe you want? Add it yourself by reading the <a href="/contributing">Contributor's Guide</a>, or request it by adding it to <a href="/wanted-recipes">Wanted Recipes</a>.</p>
21+
<p><a href="/license"><img border="0" src="/images/cc_by_badge.png"></a></p>
22+
</body>
23+
</html>
24+

_layouts/default.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ <h1><a href="/">CoffeeScript Cookbook</a></h1>
1414
</div>
1515
{{ content }}
1616
<hr />
17-
<a href="/license"><img border="0" src="/images/cc_by_badge.png"></a>
18-
</body>
17+
<p>Don't see a recipe you want? See an entire missing chapter? Add it yourself by reading the <a href="/contributing">Contributor's Guide</a>, or request it by adding it to <a href="/wanted-recipes">Wanted Recipes</a>.</p>
18+
<p><a href="/license"><img border="0" src="/images/cc_by_badge.png"></a></p>
19+
</body>
1920
</html>
2021

_layouts/recipe.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ <h2>
1313
{{ page.title }}</h2>
1414
</div>
1515
{{ content }}
16+
<hr />
17+
<p>Is this recipe wrong, incomplete, or non idiomatic? Help fix it by reading the <a href="/contributing">Contributor's Guide</a>!</p>
18+
<p><a href="/license"><img border="0" src="/images/cc_by_badge.png"></a></p>
1619
</body>
1720
</html>
1821

authors-guide.textile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ h2. General Guidelines
1515
* Try to write well-styled, idiomatic CoffeeScript.
1616
* Try to stay within the Problem/Solution/Discussion format. If you can't think of a good problem for your recipe... hang onto it for a while.
1717
* Sharing code that you think might only be used rarely is fine. Sharing esoteric code tricks is less so. There's a difference between sharing a translator for an obscure format and sharing a weird bit-shifting trick that does fast but inaccurate multiplication.
18+
* Don't forget to add your name to the authors page!
1819

1920
h2. Use Cookbook Problem/Solution/Discussion Format
2021

@@ -89,6 +90,7 @@ h2. How to Add a Chapter
8990

9091
* Open chapters/index.textile and your chapter's name to the yaml list of chapters.
9192
* cd into chapters/ and create the directory for the chapter name. Downcase the name and replace spaces with underscores.
93+
* add an index.textile file that uses <tt>layout: chapter</tt>. For convenience, just copy the index.textile from another chapter and update the yaml frontmatter to reflect the name of your new chapter.
9294

9395
For example, to add a chapter called "Dates and Times", you would add it to the chapters array:
9496

authors.textile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ title: Authors
55

66
h1. Authors
77

8+
_The following people are totally rad and awesome because they have contributed recipes!_
9+
10+
* David Brady [email protected]_
11+
* ...You! What are you waiting for? Check out the <a href="/contributing">contributing</a> section and get cracking!
12+
13+
14+
h1. Developers
15+
16+
_The following people are amazingly rad and awesome because they have helped fix the code for the site!_
17+
818
* David Brady [email protected]_
919
* Mike Moore [email protected]_
1020
* ...You! What are you waiting for? Check out the <a href="/contributing">contributing</a> section and get cracking!
21+
22+
23+
h1. Designers
24+
25+
_The following people are astonishingly rad and awesome because they did great design for the site!_
26+
27+
* Oh please SOMEBODY put their name here! Check out the <a href="/contributing">contributing</a> section and get cracking!
28+

chapters/ajax/index.textile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: chapter
3+
title: Ajax
4+
chapter: Ajax
5+
---
6+
7+
{% capture url %}/chapters/{{ page.chapter | replace: ' ', '_' | downcase }}{% endcapture %}
8+
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
9+
10+
{% for page in site.pages %}
11+
{% if page.url contains url %}
12+
{% unless page.url == indexurl %}
13+
* <a href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a>
14+
{% endunless %}
15+
{% endif %}
16+
{% endfor %}
17+

chapters/arrays/index.textile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: chapter
3+
title: Arrays
4+
chapter: Arrays
5+
---
6+
7+
{% capture url %}/chapters/{{ page.chapter | replace: ' ', '_' | downcase }}{% endcapture %}
8+
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
9+
10+
{% for page in site.pages %}
11+
{% if page.url contains url %}
12+
{% unless page.url == indexurl %}
13+
* <a href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a>
14+
{% endunless %}
15+
{% endif %}
16+
{% endfor %}
17+
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: chapter
3+
title: Dates and Times
4+
chapter: Dates and Times
5+
---
6+
7+
{% capture url %}/chapters/{{ page.chapter | replace: ' ', '_' | downcase }}{% endcapture %}
8+
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
9+
10+
{% for page in site.pages %}
11+
{% if page.url contains url %}
12+
{% unless page.url == indexurl %}
13+
* <a href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a>
14+
{% endunless %}
15+
{% endif %}
16+
{% endfor %}
17+

chapters/functions/index.textile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
layout: chapter
3+
title: Functions
4+
chapter: Functions
5+
---
6+
7+
{% capture url %}/chapters/{{ page.chapter | replace: ' ', '_' | downcase }}{% endcapture %}
8+
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
9+
10+
{% for page in site.pages %}
11+
{% if page.url contains url %}
12+
{% unless page.url == indexurl %}
13+
* <a href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a>
14+
{% endunless %}
15+
{% endif %}
16+
{% endfor %}
17+

chapters/index.textile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ chapters:
1515
---
1616

1717
{% for chapter in page.chapters %}
18-
h2. {{chapter}}
19-
2018
{% capture url %}/chapters/{{ chapter | replace: ' ', '_' | downcase }}{% endcapture %}
21-
{% for page in site.pages %}
19+
{% capture indexurl %}{{ url }}/index.html{% endcapture %}
20+
21+
h2. <a href="{{ url }}">{{ chapter }}</a>
22+
23+
{% for page in site.pages %}
2224
{% if page.url contains url %}
23-
* <a href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a>
25+
{% unless page.url == indexurl %}
26+
* <a href="{{ page.url | replace: '.html', '' }}">{{ page.title }}</a>
27+
{% endunless %}
2428
{% endif %}
2529
{% endfor %}
2630
{% endfor %}

0 commit comments

Comments
 (0)