-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example thumbnails to README (#116)
- Loading branch information
Showing
14 changed files
with
173 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
= Shuffle | ||
= Stable Segments | ||
:doctype: book | ||
:asciihero-shuffle-style: random | ||
:asciihero-shuffle-seed: 1 | ||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs') | ||
const { execFileSync } = require('child_process') | ||
const pdf2img = require('pdf-img-convert') | ||
const looksSame = require('looks-same') | ||
const path = require('path') | ||
const chai = require('chai') | ||
const { example } = require('yargs') | ||
const expect = chai.expect | ||
|
||
const thumbnailPages = { | ||
"attributes": [2], | ||
"dice_footer": [3], | ||
"dice_table": [2], | ||
"images": [2], | ||
"input": [3], | ||
"manual_segment_number": [3], | ||
"shuffle": [3], | ||
"simple": [3], | ||
"stable_segments": [3], | ||
"stylesheet": [7], | ||
} | ||
|
||
const examplesDir = './examples' | ||
fs.readdirSync(examplesDir).forEach(async (exampleDir) => { | ||
const basePath = path.join(examplesDir, exampleDir) | ||
const adocFile = path.join(basePath, `${exampleDir}.adoc`) | ||
const pdfFile = path.join(basePath, `${exampleDir}.pdf`) | ||
const thumbnailFile = path.join(basePath, `${exampleDir}.png`) | ||
|
||
const pdf2imgOpts = { | ||
width: 620, | ||
height: 877, | ||
page_numbers: thumbnailPages.hasOwnProperty(exampleDir) ? thumbnailPages[exampleDir] : [2] | ||
} | ||
const expectedOutputImgs = await pdf2img.convert(pdfFile, pdf2imgOpts) | ||
for (expectedOutputImg of expectedOutputImgs) { | ||
fs.writeFile(thumbnailFile, expectedOutputImg, (error) => { | ||
if (error) { | ||
console.log(`Error: ${error}`) | ||
} | ||
}) | ||
} | ||
}) |