Skip to content

Commit

Permalink
Merge branch 'release/0.2.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
pbock committed Dec 25, 2017
2 parents f81f495 + 875e253 commit 1aea67d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ $ npm install -g c3t-pad
Once installed, you can get the most recent schedule and turn it into Etherpad files:

```sh
$ curl https://events.ccc.de/congress/2016/Fahrplan/schedule.xml | c3t-pad
$ curl https://events.ccc.de/congress/2017/Fahrplan/schedule.xml | c3t-pad
```

Of course, the XML doesn't have to come from curl; you can just as well pipe in a local file.
Expand Down
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const program = require('commander');
function logExamples() {
console.log(' Examples:');
console.log('');
console.log(' $ curl https://events.ccc.de/congress/2016/Fahrplan/schedule.xml | c3t-pad');
console.log(' $ curl https://events.ccc.de/congress/2017/Fahrplan/schedule.xml | c3t-pad');
console.log(' $ c3t-pad -o myoutdir/ < schedule.xml');
console.log('');
}
Expand All @@ -35,7 +35,7 @@ if (process.stdin.isTTY) {

streamToPromise(process.stdin)
.then(parse)
.then(({ title, version, days, acronym }) => {
.then(({ title, version, days, acronym, baseUrl }) => {
// Find the most common event type.
// It will get ignored in the template (this is useful because
// nearly all events at CCC are set to "lecture").
Expand All @@ -47,7 +47,7 @@ streamToPromise(process.stdin)
.maxBy(1)[0];

// Initialise the template
const dayTemplate = Template({ ignoreEventTypes: [ mostCommonEventType ], title, version, acronym });
const dayTemplate = Template({ ignoreEventTypes: [ mostCommonEventType ], title, version, acronym, baseUrl });

try {
fs.mkdirSync(program.outputDir);
Expand Down
3 changes: 2 additions & 1 deletion lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = function parse(xml) {
const version = $('schedule version').text();
const title = $('conference title').text();
const acronym = $('conference acronym').text();
const baseUrl = $('conference base_url').text();

const days = $('day').map((i, day) => {
const $day = $(day);
Expand Down Expand Up @@ -58,5 +59,5 @@ module.exports = function parse(xml) {
}
}).get();

return { days, title, version, acronym };
return { days, title, version, acronym, baseUrl };
}
6 changes: 3 additions & 3 deletions lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ module.exports = function Template(options) {
const type = o.ignoreEventTypes.includes(event.type) ? '' : ` (${_.upperFirst(event.type)})`;

const targetLanguages = ({
en: '→ de ',
de: '→ en ',
en: '→ de: ',
de: '→ en: ',
})[language] || '→ ';

// Yes, this is awful HTML, but its only job is to be parsed by EtherPad,
Expand All @@ -55,7 +55,7 @@ module.exports = function Template(options) {
[${language}] <strong>${start}</strong> +${duration}, ${room}<br>
<strong>${title}</strong>${type}<br>
${speakers}<br>
Fahrplan: https://fahrplan.events.ccc.de/congress/2016/Fahrplan/events/${id}.html<br>
Fahrplan: ${options.baseUrl}events/${id}.html<br>
Slides (if available): https://speakers.c3lingo.org/talks/${guid}/<br>
${targetLanguages}<br>
<br>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "c3t-pad",
"version": "0.2.0",
"version": "0.2.1",
"description": "Convert Chaos Communication Congress schedule into pads for the translation team",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 1aea67d

Please sign in to comment.