Convert pinout info to JSON while building pages (#2775)

* try converting to json first

* fix command

* try

* try

* convert to json in js
This commit is contained in:
David Holdeman 2021-05-30 18:19:26 -05:00 committed by GitHub
parent c1ca8166b1
commit 1a55e563ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 10 deletions

View File

@ -15,9 +15,9 @@ for c in $CONNECTORS; do
echo "NAME "$NAME echo "NAME "$NAME
mkdir -p $DIR mkdir -p $DIR
if [ -f $DIR/index.html ]; then if [ -f $DIR/index.html ]; then
bash misc/pinout-gen/append.sh $c $DIR/index.html bash misc/pinout-gen/append.sh "$(yq -j r $c)" $DIR/index.html
else else
bash misc/pinout-gen/gen.sh $c $DIR/index.html bash misc/pinout-gen/gen.sh "$(yq -j r $c)" $DIR/index.html
fi fi
file $DIR/index.html file $DIR/index.html
IMG=$(yq r $c 'info.image.file') IMG=$(yq r $c 'info.image.file')
@ -29,8 +29,6 @@ for c in $CONNECTORS; do
cp $(dirname $c)/$IMG $DIR cp $(dirname $c)/$IMG $DIR
fi fi
ls $DIR ls $DIR
cp misc/pinout-gen/yaml.min.js $DIR
ls $DIR
done done
if [ -n "$RUSEFI_FTP_SERVER" ]; then if [ -n "$RUSEFI_FTP_SERVER" ]; then

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/" DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/"
TEXT=$(sed -e "/\/\/\/DATA\/\/\//{a \ \`" -e "r $1" -e "a \ \`,\n///DATA///" -e "d}" $2) TEXT=$(sed -e "/\/\/\/DATA\/\/\//{a \ \`$1\ \`,\n///DATA///" -e "d}" $2)
echo "$TEXT" > $2 echo "$TEXT" > $2

View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/" DIR=$(cd -P -- "$(dirname -- "$0")" && pwd -P)"/"
TEXT=$(sed -e "/###CSS###/{r ${DIR}style.css" -e 'd}' -e "/###JS###/{r ${DIR}script.js" -e 'd}' ${DIR}pinout.html | sed -e "/\/\/\/DATA\/\/\//{a \ \`" -e "r $1" -e "a \ \`,\n///DATA///" -e "d}") TEXT=$(sed -e "/###CSS###/{r ${DIR}style.css" -e 'd}' -e "/###JS###/{r ${DIR}script.js" -e 'd}' ${DIR}pinout.html | sed -e "s/\/\/\/DATA\/\/\//`$(echo ${1//\//\\/} | tr -d '\n')`,\n\/\/\/DATA\/\/\//")
echo "$TEXT" > $2 echo "$TEXT" > $2

View File

@ -1,4 +1,4 @@
var connectorYaml = [ var connectorData = [
///DATA/// ///DATA///
]; ];
@ -43,8 +43,8 @@ function clickPin(table, pin, pdiv) {
} }
window.addEventListener('load', function() { window.addEventListener('load', function() {
for (var c = 0; c < connectorYaml.length; c++) { for (var c = 0; c < connectorData.length; c++) {
var connector = YAML.parse(connectorYaml[c]); var connector = JSON.parse(connectorData[c]);
var template = document.getElementById("connector-template"); var template = document.getElementById("connector-template");
var clone = template.content.cloneNode(true); var clone = template.content.cloneNode(true);
document.body.appendChild(clone); document.body.appendChild(clone);

File diff suppressed because one or more lines are too long