Skip to content

Commit b423a12

Browse files
committed
Add development doc
1 parent f9391fb commit b423a12

File tree

2 files changed

+83
-2
lines changed

2 files changed

+83
-2
lines changed

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,84 @@ publications: >
126126
---
127127
Here goes the section summary.
128128
```
129+
130+
## Developing
131+
132+
Overall, the source code follows the usual [jekyll](http://jekyllrb.com/)
133+
structure. We use a few additional custom scripts/plugins to work with data
134+
files like `_data/team.yml`. This section documents the peripheral tooling
135+
involved.
136+
137+
## Plugins
138+
139+
Plugins in `./_plugins` read in the data from `./_data`, `./_research` and
140+
`./_teaching` and provide them as variables in the corresponding pages (like
141+
`./teaching.html` for `_teaching`).
142+
143+
Since the plugin and html file for research and teaching look very similar, we
144+
generate both of them from a single source file using
145+
[ribosome](https://github.com/sustrik/ribosome). We call these pages (research
146+
and teaching) _thematic_ pages. The ruby plugin file is generated from
147+
`./_scripts/theme-gen-gen.rb.dna` and the html file from
148+
`./_scripts/theme-page.html.dna`. The process is scripted in the rakefile and is
149+
described in the next section.
150+
151+
## rake
152+
153+
We use [rake](https://github.com/ruby/rake) for specifying and running tasks..
154+
The main tasks are `collect` and `build`.
155+
156+
### `collect`
157+
Before building the website, we need to collect some metadata (last commit
158+
information etc.) about github repositories listed in the files
159+
`./_research/*.md` and `./_teaching/*.md`. This involves using the github api
160+
and running the script `./_scripts/collect-repos.rb`. The following command runs
161+
this task and produces an updated `._data/repositories.yml` file with all the
162+
metadata required:
163+
164+
```sh
165+
bundle exec rake collect
166+
```
167+
168+
Since github api has limits, we need to pass [a
169+
token](https://github.com/settings/tokens) so that the task can finish
170+
successfully:
171+
172+
```sh
173+
env GH_TOKEN='<token-here>' bundle exec rake collect
174+
```
175+
176+
### `build`
177+
This is the main build task which just wraps around jekyll's own build.
178+
179+
```sh
180+
bundle exec rake build
181+
```
182+
183+
### `tpgen`
184+
185+
This task generates a thematic page template (the html file). It needs two extra
186+
arguments,
187+
188+
1. The name of the theme page (like 'research' or 'teaching')
189+
2. Short text (divider text) which goes over the list of projects (like 'LINKS'
190+
in teaching and 'PROJECTS' in research)
191+
192+
The command below will produce a page `./teaching.html` with a divider text
193+
'ITEMS'.
194+
195+
```sh
196+
bundle exec rake tpen[teaching,items]
197+
```
198+
199+
### `ggen`
200+
201+
This produces a ruby plugin for corresponding (html of the same name) thematic
202+
page. It needs one extra argument which is the name of the theme page.
203+
204+
The command below produces a plugin `./_plugins/teaching.rb` and works with the
205+
template page `./teaching.html` using data from `_/teaching` directory.
206+
207+
```sh
208+
bundle exec rake ggen[teaching]
209+
```

Rakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ task :clean do
44
File.delete('_data/repositories.yml')
55
end
66

7-
desc "Generate a thematic page generator in _plugins"
7+
desc "Generate a thematic page plugin in _plugins"
88
task :ggen, [:page] do |t, args|
99
sh "bundle exec ruby ./_scripts/ribosome.rb ./_scripts/theme-gen-gen.rb.dna "\
1010
"#{args["page"]} > ./_plugins/#{args["page"]}.rb"
1111
end
1212

13-
desc "Generate a thematic page in root"
13+
desc "Generate a thematic page html in root"
1414
task :tpgen, [:page, :divider] do |t, args|
1515
sh "bundle exec ruby ./_scripts/ribosome.rb ./_scripts/theme-page.html.dna "\
1616
"#{args["page"]} #{args["divider"]} > #{args["page"]}.html"

0 commit comments

Comments
 (0)