Skip to content

Commit

Permalink
Using Glosario via file copying (for now).
Browse files Browse the repository at this point in the history
1.  Merge utility files in `./bin`.
1.  Modify build targets to force rebuild of bibliography and glossary.
1.  Rename `_` files and directories.
  • Loading branch information
gvwilson committed Sep 19, 2020
1 parent 97307b8 commit 84589e0
Show file tree
Hide file tree
Showing 52 changed files with 815 additions and 820 deletions.
12 changes: 12 additions & 0 deletions CONTRIBUTING.md
Expand Up @@ -92,3 +92,15 @@ This project uses [Martha's Rules](https://journals.sagepub.com/doi/10.1177/0886

1. Run `npm run build` to build the the website in `_site`
and `npm run serve` to serve it locally on port 4000.

1. Rebuilding the glossary takes a bit of work---we hope it will be easier once `glosario-js` is installable.
In the meantime:
1. Clone <https://github.com/carpentries/glosario/> somewhere (not in this repository).
1. Run

```
bin/gloss-keys.js index.md */index.md | ~/glosario/utils/merge-glossaries.py -w - ~/glosario/glossary.yml > _glosario.yml
```

to create a local slice of the Glosario data.
1. Run `npm run gloss` to regenerate `gloss.md` by comining the glossaries.
File renamed without changes.
212 changes: 0 additions & 212 deletions bin/bib.js

This file was deleted.

20 changes: 20 additions & 0 deletions bin/gloss-keys.js
@@ -0,0 +1,20 @@
#!/usr/bin/env node

import fs from 'fs'

/**
* Extract all glossary keys from files for using in merging glossary.
*/
const main = () => {
const unique = new Set(
process.argv.slice(2).map(filename => {
const text = fs.readFileSync(filename, 'utf-8')
return [...text.matchAll(/<g\s+key="(.+?)">/g)]
.map(match => match[1])
}).flat()
)
console.log([...unique].sort().join('\n'))
}

// Run program.
main()
70 changes: 0 additions & 70 deletions bin/gloss.js

This file was deleted.

0 comments on commit 84589e0

Please sign in to comment.