Skip to content

Commit

Permalink
Add Prettier config, run on repo
Browse files Browse the repository at this point in the history
  • Loading branch information
dhower-qc committed Dec 11, 2024
1 parent 5691a30 commit 8bb3b95
Show file tree
Hide file tree
Showing 10 changed files with 862 additions and 817 deletions.
11 changes: 11 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
gen
.home
.singularity
node_modules
.asciidoctor
.bundle
.git
.github
.vscode
docs/ruby
ext
1 change: 1 addition & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1,141 changes: 577 additions & 564 deletions backends/cfg_html_doc/ui/highlight.js

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions backends/indexer/index-unifieddb.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env node
'use strict';
"use strict";

const process = require('process');
const path = require('path');
const fs = require('fs');
const process = require("process");
const path = require("path");
const fs = require("fs");

const { readdir, stat } = fs.promises;

Expand All @@ -16,8 +16,8 @@ const rec = async (branch, root) => {
const fileExt = path.extname(el);
const baseName = path.basename(el, fileExt);
if (isFile) {
if (['.yaml', '.json'].includes(fileExt)) {
node[baseName] = {$ref: path.join(...branch, el)};
if ([".yaml", ".json"].includes(fileExt)) {
node[baseName] = { $ref: path.join(...branch, el) };
}
} else {
node[el] = await rec([...branch, el], root);
Expand All @@ -29,10 +29,12 @@ const rec = async (branch, root) => {
const main = async () => {
const [, , root] = process.argv;
if (root === undefined) {
console.error('usage: ./index-unifieddb.js <path-to-unifieddb-arch-folder>');
console.error(
"usage: ./index-unifieddb.js <path-to-unifieddb-arch-folder>",
);
return;
}
const rootPath = path.resolve('.', root);
const rootPath = path.resolve(".", root);
const tree = await rec([], rootPath);
console.log(JSON.stringify(tree, null, 2));
};
Expand Down
4 changes: 1 addition & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">

<body>
<h2>Arch specification schemas</h2>
<ul>
Expand All @@ -12,5 +11,4 @@ <h2>Ruby documentation</h2>
<li><a href="ruby/index.html">lib</a></li>
</ul>
</body>

</html>
6 changes: 3 additions & 3 deletions lib/asciidoc_extensions.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
const asciidoctor = require('asciidoctor')()
const registry = asciidoctor.Extensions.create()
require('./asciidoc_when_extension.js')(registry)
const asciidoctor = require("asciidoctor")();
const registry = asciidoctor.Extensions.create();
require("./asciidoc_when_extension.js")(registry);
41 changes: 24 additions & 17 deletions lib/asciidoc_when_extension.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
module.exports.register = function (registry, context = {}) {
registry.block('when', function () {
var self = this
self.named('when')
self.onContexts('paragraph', 'open')
self.positionalAttributes(['condition'])
self.process(function (parent, reader, attributes) {
var condition = attributes.condition
let new_block_attrs = {}
new_block_attrs.role = "when"
new_block_attrs.name = "when"
new_block_attrs["textlabel"] = `When ${condition}`
let content_model = attributes["cloaked-context"] == "paragraph" ? "simple" : "compound"
return self.createBlock(parent, 'admonition', reader.getLines(), new_block_attrs, {"content_model": content_model})
})
})
return registry
}
registry.block("when", function () {
var self = this;
self.named("when");
self.onContexts("paragraph", "open");
self.positionalAttributes(["condition"]);
self.process(function (parent, reader, attributes) {
var condition = attributes.condition;
let new_block_attrs = {};
new_block_attrs.role = "when";
new_block_attrs.name = "when";
new_block_attrs["textlabel"] = `When ${condition}`;
let content_model =
attributes["cloaked-context"] == "paragraph" ? "simple" : "compound";
return self.createBlock(
parent,
"admonition",
reader.getLines(),
new_block_attrs,
{ content_model: content_model },
);
});
});
return registry;
};
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"@antora/site-generator": "3.1.7",
"asciidoctor-kroki": "0.17.0",
"@asciidoctor/tabs": "v1.0.0-beta.6",
"prettier": "3.4.2",
"wavedrom-cli": "^3.1.1"
}
}
Loading

0 comments on commit 8bb3b95

Please sign in to comment.