Skip to content

Commit 55a4f11

Browse files
committed
Add Jekyll tag to isolate "production-only" doc components.
Author: Patrick Wendell <[email protected]> Closes apache#56 from pwendell/jekyll-prod and squashes the following commits: 1bdc3a8 [Patrick Wendell] Add Jekyll tag to isolate "production-only" doc components.
1 parent c3f5e07 commit 55a4f11

File tree

4 files changed

+33
-6
lines changed

4 files changed

+33
-6
lines changed

dev/create-release/create-release.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ scp spark* \
120120
# Docs
121121
cd spark
122122
cd docs
123-
jekyll build
123+
PRODUCTION=1 jekyll build
124124
echo "Copying release documentation"
125125
rc_docs_folder=${rc_folder}-docs
126126
rsync -r _site/* $USER_NAME@people.apache.org /home/$USER_NAME/public_html/$rc_docs_folder

docs/README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,22 @@ We include the Spark documentation as part of the source (as opposed to using a
1010

1111
In this directory you will find textfiles formatted using Markdown, with an ".md" suffix. You can read those text files directly if you want. Start with index.md.
1212

13-
To make things quite a bit prettier and make the links easier to follow, generate the html version of the documentation based on the src directory by running `jekyll build` in the docs directory. Use the command `SKIP_SCALADOC=1 jekyll build` to skip building and copying over the scaladoc which can be timely. To use the `jekyll` command, you will need to have Jekyll installed, the easiest way to do this is via a Ruby Gem, see the [jekyll installation instructions](http://jekyllrb.com/docs/installation). This will create a directory called _site containing index.html as well as the rest of the compiled files. Read more about Jekyll at https://github.com/mojombo/jekyll/wiki.
14-
15-
In addition to generating the site as html from the markdown files, jekyll can serve up the site via a webserver. To build and run a local webserver use the command `jekyll serve` (or the faster variant `SKIP_SCALADOC=1 jekyll serve`), which runs the webserver on port 4000, then visit the site at http://localhost:4000.
13+
The markdown code can be compiled to HTML using the
14+
[Jekyll tool](http://jekyllrb.com).
15+
To use the `jekyll` command, you will need to have Jekyll installed.
16+
The easiest way to do this is via a Ruby Gem, see the
17+
[jekyll installation instructions](http://jekyllrb.com/docs/installation).
18+
Compiling the site with Jekyll will create a directory called
19+
_site containing index.html as well as the rest of the compiled files.
20+
21+
You can modify the default Jekyll build as follows:
22+
23+
# Skip generating API docs (which takes a while)
24+
$ SKIP_SCALADOC=1 jekyll build
25+
# Serve content locally on port 4000
26+
$ jekyll serve --watch
27+
# Build the site with extra features used on the live page
28+
$ PRODUCTION=1 jekyll build
1629

1730
## Pygments
1831

docs/_layouts/global.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424

2525
<link rel="stylesheet" href="css/pygments-default.css">
2626

27+
{% production %}
2728
<!-- Google analytics script -->
2829
<script type="text/javascript">
29-
/*
3030
var _gaq = _gaq || [];
3131
_gaq.push(['_setAccount', 'UA-32518208-1']);
3232
_gaq.push(['_trackPageview']);
@@ -36,8 +36,8 @@
3636
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
3737
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
3838
})();
39-
*/
4039
</script>
40+
{% endproduction %}
4141

4242
</head>
4343
<body>

docs/_plugins/production_tag.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module Jekyll
2+
class ProductionTag < Liquid::Block
3+
4+
def initialize(tag_name, markup, tokens)
5+
super
6+
end
7+
8+
def render(context)
9+
if ENV['PRODUCTION'] then super else "" end
10+
end
11+
end
12+
end
13+
14+
Liquid::Template.register_tag('production', Jekyll::ProductionTag)

0 commit comments

Comments
 (0)