Skip to content

Commit

Permalink
change comment schema to allow #
Browse files Browse the repository at this point in the history
See discussion in #1

Fixes #1
  • Loading branch information
asdofindia committed Feb 19, 2024
1 parent 6782f61 commit 756ba4c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,19 @@ const buildFolder = path.join(scriptDir, '..', "build");
const buildRawFolder = path.join(buildFolder, "raw");
const atlas = {}
const files = fs.readdirSync(mapsFolder)
const isRule = (line) => {
return line.length < 10 && line.indexOf('=') > -1
}
const isComment = (line) => !isRule(line)
files.forEach((file) => {
const filePath = path.join(mapsFolder, file);

const data = fs.readFileSync(filePath, 'utf8')
const fontName = path.parse(file).name;
const fontMap = {};
data.split('\n').forEach(l => {
if (l.startsWith('#')) return;
l = l.trim();
if (isComment(l)) return;
const [lhs, rhs] = l.split('=').map(w => w.trim());
if (lhs) fontMap[lhs] = rhs;
})
Expand Down
22 changes: 22 additions & 0 deletions scripts/find-longest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const fs = require('fs');
const filename = process.argv[2];
if (!filename) {
console.error("Please specify filename");
process.exit(1);
}
const text = fs.readFileSync(filename, 'utf-8');
const known = {}
let longest = ""
let longestLength = 0
text
.split('\n')
.forEach(l => {
if (l.startsWith('#')) return;
if (l.length > longestLength) {
longest = l;
longestLength = l.length
}
})

console.log(longest)
console.log(longestLength)

0 comments on commit 756ba4c

Please sign in to comment.