Skip to content

Commit 8723417

Browse files
committedApr 25, 2014
Release 0.8.1
1 parent f9fbd62 commit 8723417

14 files changed

+1452
-19
lines changed
 

‎History.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## v0.8.1 - unreleased
1+
## v0.8.1 - April 25, 2014
22

33
* Add support for tables. (#22, #5, @huangyq23)
44
* Add bitbucket support. (#16, @palday)

‎Notes.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ To build .styl from .css
1818

1919
npm install
2020

21+
# update prescribed versions
22+
perl -p -i -e "s/0\.8\.0/0\.8\.1/g" templates/*.html Readme.md
23+
git diff
24+
2125
# build files
2226
make
2327
make v/0.8.1
2428

2529
# update version
2630
bump package.json
2731

28-
# update versions
29-
perl -p -i -e "s/0\.8\.0/0\.8\.1/g" templates/*.html Readme.md
30-
3132
# add release date
3233
vim History.md
33-
git release
34+
git release 0.8.1

‎Readme.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ way to make open source documentation from *Readme* files.
1212
* Gorgeous default theme (and it's responsive)
1313
* Just create an HTML file and deploy!
1414

15-
*Current version: [0.8.0][dist]*
15+
*Current version: [0.8.1][dist]*
1616

1717
[![Build Status](https://travis-ci.org/rstacruz/flatdoc.png?branch=gh-pages)](https://travis-ci.org/rstacruz/flatdoc)
1818

@@ -32,12 +32,12 @@ you're all good to go.
3232
<html>
3333
<head>
3434
<!-- Flatdoc -->
35-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/legacy.js'></script>
36-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/flatdoc.js'></script>
35+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/legacy.js'></script>
36+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/flatdoc.js'></script>
3737

3838
<!-- Flatdoc theme (optional) -->
39-
<link href='http://rstacruz.github.io/flatdoc/v/0.8.0/theme-white/style.css' rel='stylesheet'>
40-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/theme-white/script.js'></script>
39+
<link href='http://rstacruz.github.io/flatdoc/v/0.8.1/theme-white/style.css' rel='stylesheet'>
40+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/theme-white/script.js'></script>
4141

4242
<!-- Initializer -->
4343
<script>
@@ -232,7 +232,7 @@ the blank template and customize as you see fit.
232232
<html>
233233
<head>
234234
<script src='jquery.js'></script>
235-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/flatdoc.js'></script>
235+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/flatdoc.js'></script>
236236
<!-- Initializer -->
237237
<script>
238238
Flatdoc.run({
@@ -275,7 +275,7 @@ licensed under Creative Commons.
275275
Changelog
276276
---------
277277

278-
#### v0.8.0 - May 26, 2013
278+
#### v0.8.1 - May 26, 2013
279279

280280
First version.
281281

@@ -310,4 +310,4 @@ License](http://www.opensource.org/licenses/mit-license.php).
310310
[project]: https://github.com/rstacruz/flatdoc
311311
[template]: https://github.com/rstacruz/flatdoc/raw/gh-pages/templates/template.html
312312
[blank]: https://github.com/rstacruz/flatdoc/raw/gh-pages/templates/blank.html
313-
[dist]: https://github.com/rstacruz/flatdoc/tree/gh-pages/v/0.8.0
313+
[dist]: https://github.com/rstacruz/flatdoc/tree/gh-pages/v/0.8.1

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "",
44
"keywords": [""],
55
"author": "Rico Sta. Cruz <hi@ricostacruz.com>",
6-
"version": "0.8.0",
6+
"version": "0.8.1",
77
"repository": {
88
"type": "git",
99
"url": "https://github.com/rstacruz/flatdoc.git"

‎templates/blank.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
<!-- Flatdoc -->
1313
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
14-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/flatdoc.js'></script>
14+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/flatdoc.js'></script>
1515

1616
<!-- Initializer -->
1717
<script>

‎templates/template.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222

2323
<!-- Flatdoc -->
2424
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
25-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/legacy.js'></script>
26-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/flatdoc.js'></script>
25+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/legacy.js'></script>
26+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/flatdoc.js'></script>
2727

2828
<!-- Flatdoc theme -->
29-
<link href='http://rstacruz.github.io/flatdoc/v/0.8.0/theme-white/style.css' rel='stylesheet'>
30-
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/theme-white/script.js'></script>
29+
<link href='http://rstacruz.github.io/flatdoc/v/0.8.1/theme-white/style.css' rel='stylesheet'>
30+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/theme-white/script.js'></script>
3131

3232
<!-- Meta -->
3333
<meta content="Your Project" property="og:title">

‎v/0.8.1/flatdoc.js

+24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎v/0.8.1/legacy.js

+23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎v/0.8.1/templates/blank.html

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!doctype html>
2+
<!--
3+
4+
This is a blank template containing the barest structure that Flatdoc needs.
5+
Customize this as you see fit: add CSS and some markup to get the look that you need.
6+
7+
-->
8+
<html>
9+
<head>
10+
<meta charset='utf-8'>
11+
12+
<!-- Flatdoc -->
13+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
14+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/flatdoc.js'></script>
15+
16+
<!-- Initializer -->
17+
<script>
18+
Flatdoc.run({
19+
fetcher: Flatdoc.github('USER/REPO')
20+
});
21+
</script>
22+
</head>
23+
<body role='flatdoc'>
24+
<div role='flatdoc-menu'></div>
25+
<div role='flatdoc-content'></div>
26+
</body>
27+
</html>

‎v/0.8.1/templates/template.html

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<!doctype html>
2+
<!--
3+
4+
Instructions:
5+
6+
- Save this file.
7+
- Replace "USER" with your GitHub username.
8+
- Replace "REPO" with your GitHub repo name.
9+
- Replace "Your Project" with your project name.
10+
- Upload this file (or commit to GitHub Pages).
11+
12+
Customize as you see fit!
13+
14+
-->
15+
<html>
16+
<head>
17+
<meta charset='utf-8'>
18+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
19+
<meta name="viewport" content="width=device-width">
20+
21+
<title>Your Project</title>
22+
23+
<!-- Flatdoc -->
24+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
25+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/legacy.js'></script>
26+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/flatdoc.js'></script>
27+
28+
<!-- Flatdoc theme -->
29+
<link href='http://rstacruz.github.io/flatdoc/v/0.8.0/theme-white/style.css' rel='stylesheet'>
30+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.0/theme-white/script.js'></script>
31+
32+
<!-- Meta -->
33+
<meta content="Your Project" property="og:title">
34+
<meta content="Your Project description goes here." name="description">
35+
36+
<!-- Initializer -->
37+
<script>
38+
Flatdoc.run({
39+
fetcher: Flatdoc.github('USER/REPO')
40+
});
41+
</script>
42+
</head>
43+
<body role='flatdoc'>
44+
45+
<div class='header'>
46+
<div class='left'>
47+
<h1>Your Project</h1>
48+
<ul>
49+
<li><a href='https://github.com/USER/REPO'>View on GitHub</a></li>
50+
<li><a href='https://github.com/USER/REPO/issues'>Issues</a></li>
51+
</ul>
52+
</div>
53+
<div class='right'>
54+
<!-- GitHub buttons: see http://ghbtns.com -->
55+
<iframe src="http://ghbtns.com/github-btn.html?user=USER&amp;repo=REPO&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
56+
</div>
57+
</div>
58+
59+
<div class='content-root'>
60+
<div class='menubar'>
61+
<div class='menu section' role='flatdoc-menu'></div>
62+
</div>
63+
<div role='flatdoc-content' class='content'></div>
64+
</div>
65+
66+
</body>
67+
</html>
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!doctype html>
2+
<!--
3+
4+
This is a blank template containing the barest structure that Flatdoc needs.
5+
Customize this as you see fit: add CSS and some markup to get the look that you need.
6+
7+
-->
8+
<html>
9+
<head>
10+
<meta charset='utf-8'>
11+
12+
<!-- Flatdoc -->
13+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
14+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/flatdoc.js'></script>
15+
16+
<!-- Initializer -->
17+
<script>
18+
Flatdoc.run({
19+
fetcher: Flatdoc.github('USER/REPO')
20+
});
21+
</script>
22+
</head>
23+
<body role='flatdoc'>
24+
<div role='flatdoc-menu'></div>
25+
<div role='flatdoc-content'></div>
26+
</body>
27+
</html>
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<!doctype html>
2+
<!--
3+
4+
Instructions:
5+
6+
- Save this file.
7+
- Replace "USER" with your GitHub username.
8+
- Replace "REPO" with your GitHub repo name.
9+
- Replace "Your Project" with your project name.
10+
- Upload this file (or commit to GitHub Pages).
11+
12+
Customize as you see fit!
13+
14+
-->
15+
<html>
16+
<head>
17+
<meta charset='utf-8'>
18+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
19+
<meta name="viewport" content="width=device-width">
20+
21+
<title>Your Project</title>
22+
23+
<!-- Flatdoc -->
24+
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
25+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/legacy.js'></script>
26+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/flatdoc.js'></script>
27+
28+
<!-- Flatdoc theme -->
29+
<link href='http://rstacruz.github.io/flatdoc/v/0.8.1/theme-white/style.css' rel='stylesheet'>
30+
<script src='http://rstacruz.github.io/flatdoc/v/0.8.1/theme-white/script.js'></script>
31+
32+
<!-- Meta -->
33+
<meta content="Your Project" property="og:title">
34+
<meta content="Your Project description goes here." name="description">
35+
36+
<!-- Initializer -->
37+
<script>
38+
Flatdoc.run({
39+
fetcher: Flatdoc.github('USER/REPO')
40+
});
41+
</script>
42+
</head>
43+
<body role='flatdoc'>
44+
45+
<div class='header'>
46+
<div class='left'>
47+
<h1>Your Project</h1>
48+
<ul>
49+
<li><a href='https://github.com/USER/REPO'>View on GitHub</a></li>
50+
<li><a href='https://github.com/USER/REPO/issues'>Issues</a></li>
51+
</ul>
52+
</div>
53+
<div class='right'>
54+
<!-- GitHub buttons: see http://ghbtns.com -->
55+
<iframe src="http://ghbtns.com/github-btn.html?user=USER&amp;repo=REPO&amp;type=watch&amp;count=true" allowtransparency="true" frameborder="0" scrolling="0" width="110" height="20"></iframe>
56+
</div>
57+
</div>
58+
59+
<div class='content-root'>
60+
<div class='menubar'>
61+
<div class='menu section' role='flatdoc-menu'></div>
62+
</div>
63+
<div role='flatdoc-content' class='content'></div>
64+
</div>
65+
66+
</body>
67+
</html>

‎v/0.8.1/theme-white/script.js

+318
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,318 @@
1+
(function($) {
2+
var $window = $(window);
3+
var $document = $(document);
4+
5+
/*
6+
* Scrollspy.
7+
*/
8+
9+
$document.on('flatdoc:ready', function() {
10+
$("h2, h3").scrollagent(function(cid, pid, currentElement, previousElement) {
11+
if (pid) {
12+
$("[href='#"+pid+"']").removeClass('active');
13+
}
14+
if (cid) {
15+
$("[href='#"+cid+"']").addClass('active');
16+
}
17+
});
18+
});
19+
20+
/*
21+
* Anchor jump links.
22+
*/
23+
24+
$document.on('flatdoc:ready', function() {
25+
$('.menu a').anchorjump();
26+
});
27+
28+
/*
29+
* Title card.
30+
*/
31+
32+
$(function() {
33+
var $card = $('.title-card');
34+
if (!$card.length) return;
35+
36+
var $header = $('.header');
37+
var headerHeight = $header.length ? $header.outerHeight() : 0;
38+
39+
$window
40+
.on('resize.title-card', function() {
41+
var windowWidth = $window.width();
42+
43+
if (windowWidth < 480) {
44+
$card.css('height', '');
45+
} else {
46+
var height = $window.height();
47+
$card.css('height', height - headerHeight);
48+
}
49+
})
50+
.trigger('resize.title-card');
51+
52+
$card.fillsize('> img.bg');
53+
});
54+
55+
/*
56+
* Sidebar stick.
57+
*/
58+
59+
$(function() {
60+
var $sidebar = $('.menubar');
61+
var elTop;
62+
63+
$window
64+
.on('resize.sidestick', function() {
65+
elTop = $sidebar.offset().top;
66+
$window.trigger('scroll.sidestick');
67+
})
68+
.on('scroll.sidestick', function() {
69+
var scrollY = $window.scrollTop();
70+
$sidebar.toggleClass('fixed', (scrollY >= elTop));
71+
})
72+
.trigger('resize.sidestick');
73+
});
74+
75+
})(jQuery);
76+
/*! jQuery.scrollagent (c) 2012, Rico Sta. Cruz. MIT License.
77+
* https://github.com/rstacruz/jquery-stuff/tree/master/scrollagent */
78+
79+
// Call $(...).scrollagent() with a callback function.
80+
//
81+
// The callback will be called everytime the focus changes.
82+
//
83+
// Example:
84+
//
85+
// $("h2").scrollagent(function(cid, pid, currentElement, previousElement) {
86+
// if (pid) {
87+
// $("[href='#"+pid+"']").removeClass('active');
88+
// }
89+
// if (cid) {
90+
// $("[href='#"+cid+"']").addClass('active');
91+
// }
92+
// });
93+
94+
(function($) {
95+
96+
$.fn.scrollagent = function(options, callback) {
97+
// Account for $.scrollspy(function)
98+
if (typeof callback === 'undefined') {
99+
callback = options;
100+
options = {};
101+
}
102+
103+
var $sections = $(this);
104+
var $parent = options.parent || $(window);
105+
106+
// Find the top offsets of each section
107+
var offsets = [];
108+
$sections.each(function(i) {
109+
var offset = $(this).attr('data-anchor-offset') ?
110+
parseInt($(this).attr('data-anchor-offset'), 10) :
111+
(options.offset || 0);
112+
113+
offsets.push({
114+
top: $(this).offset().top + offset,
115+
id: $(this).attr('id'),
116+
index: i,
117+
el: this
118+
});
119+
});
120+
121+
// State
122+
var current = null;
123+
var height = null;
124+
var range = null;
125+
126+
// Save the height. Do this only whenever the window is resized so we don't
127+
// recalculate often.
128+
$(window).on('resize', function() {
129+
height = $parent.height();
130+
range = $(document).height();
131+
});
132+
133+
// Find the current active section every scroll tick.
134+
$parent.on('scroll', function() {
135+
var y = $parent.scrollTop();
136+
y += height * (0.3 + 0.7 * Math.pow(y/range, 2));
137+
138+
var latest = null;
139+
140+
for (var i in offsets) {
141+
if (offsets.hasOwnProperty(i)) {
142+
var offset = offsets[i];
143+
if (offset.top < y) latest = offset;
144+
}
145+
}
146+
147+
if (latest && (!current || (latest.index !== current.index))) {
148+
callback.call($sections,
149+
latest ? latest.id : null,
150+
current ? current.id : null,
151+
latest ? latest.el : null,
152+
current ? current.el : null);
153+
current = latest;
154+
}
155+
});
156+
157+
$(window).trigger('resize');
158+
$parent.trigger('scroll');
159+
160+
return this;
161+
};
162+
163+
})(jQuery);
164+
/*! Anchorjump (c) 2012, Rico Sta. Cruz. MIT License.
165+
* http://github.com/rstacruz/jquery-stuff/tree/master/anchorjump */
166+
167+
// Makes anchor jumps happen with smooth scrolling.
168+
//
169+
// $("#menu a").anchorjump();
170+
// $("#menu a").anchorjump({ offset: -30 });
171+
//
172+
// // Via delegate:
173+
// $("#menu").anchorjump({ for: 'a', offset: -30 });
174+
//
175+
// You may specify a parent. This makes it scroll down to the parent.
176+
// Great for tabbed views.
177+
//
178+
// $('#menu a').anchorjump({ parent: '.anchor' });
179+
//
180+
// You can jump to a given area.
181+
//
182+
// $.anchorjump('#bank-deposit', options);
183+
184+
(function($) {
185+
var defaults = {
186+
'speed': 500,
187+
'offset': 0,
188+
'for': null,
189+
'parent': null
190+
};
191+
192+
$.fn.anchorjump = function(options) {
193+
options = $.extend({}, defaults, options);
194+
195+
if (options['for']) {
196+
this.on('click', options['for'], onClick);
197+
} else {
198+
this.on('click', onClick);
199+
}
200+
201+
function onClick(e) {
202+
var $a = $(e.target).closest('a');
203+
if (e.ctrlKey || e.metaKey || e.altKey || $a.attr('target')) return;
204+
205+
e.preventDefault();
206+
var href = $a.attr('href');
207+
208+
$.anchorjump(href, options);
209+
}
210+
};
211+
212+
// Jump to a given area.
213+
$.anchorjump = function(href, options) {
214+
options = $.extend({}, defaults, options);
215+
216+
var top = 0;
217+
218+
if (href != '#') {
219+
var $area = $(href);
220+
// Find the parent
221+
if (options.parent) {
222+
var $parent = $area.closest(options.parent);
223+
if ($parent.length) { $area = $parent; }
224+
}
225+
if (!$area.length) { return; }
226+
227+
// Determine the pixel offset; use the default if not available
228+
var offset =
229+
$area.attr('data-anchor-offset') ?
230+
parseInt($area.attr('data-anchor-offset'), 10) :
231+
options.offset;
232+
233+
top = Math.max(0, $area.offset().top + offset);
234+
}
235+
236+
$('html, body').animate({ scrollTop: top }, options.speed);
237+
$('body').trigger('anchor', href);
238+
239+
// Add the location hash via pushState.
240+
if (window.history.pushState) {
241+
window.history.pushState({ href: href }, "", href);
242+
}
243+
};
244+
})(jQuery);
245+
/*! fillsize (c) 2012, Rico Sta. Cruz. MIT License.
246+
* http://github.com/rstacruz/jquery-stuff/tree/master/fillsize */
247+
248+
// Makes an element fill up its container.
249+
//
250+
// $(".container").fillsize("> img");
251+
//
252+
// This binds a listener on window resizing to automatically scale down the
253+
// child (`> img` in this example) just so that enough of it will be visible in
254+
// the viewport of the container.
255+
//
256+
// This assumes that the container has `position: relative` (or any 'position',
257+
// really), and `overflow: hidden`.
258+
259+
(function($) {
260+
$.fn.fillsize = function(selector) {
261+
var $parent = this;
262+
var $img;
263+
264+
function resize() {
265+
if (!$img) $img = $parent.find(selector);
266+
267+
$img.each(function() {
268+
if (!this.complete) return;
269+
var $img = $(this);
270+
271+
var parent = { height: $parent.innerHeight(), width: $parent.innerWidth() };
272+
var imageRatio = $img.width() / $img.height();
273+
var containerRatio = parent.width / parent.height;
274+
275+
var css = {
276+
position: 'absolute',
277+
left: 0, top: 0, right: 'auto', bottom: 'auto'
278+
};
279+
280+
// If image is wider than the container
281+
if (imageRatio > containerRatio) {
282+
css.left = Math.round((parent.width - imageRatio * parent.height) / 2) + 'px';
283+
css.width = 'auto';
284+
css.height = '100%';
285+
}
286+
287+
// If the container is wider than the image
288+
else {
289+
css.top = Math.round((parent.height - (parent.width / $img.width() * $img.height())) / 2) + 'px';
290+
css.height = 'auto';
291+
css.width = '100%';
292+
}
293+
294+
$img.css(css);
295+
});
296+
}
297+
298+
// Make it happen on window resize.
299+
$(window).resize(resize);
300+
301+
// Allow manual invocation by doing `.trigger('fillsize')` on the container.
302+
$(document).on('fillsize', $parent.selector, resize);
303+
304+
// Resize on first load (or immediately if called after).
305+
$(function() {
306+
// If the child is an image, fill it up when image's real dimensions are
307+
// first determined. Needs to be .bind() because the load event will
308+
// bubble up.
309+
$(selector, $parent).bind('load', function() {
310+
setTimeout(resize, 25);
311+
});
312+
313+
resize();
314+
});
315+
316+
return this;
317+
};
318+
})(jQuery);

‎v/0.8.1/theme-white/style.css

+879
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.