diff options
author | Freya Murphy <freya@freyacat.org> | 2024-05-20 18:56:50 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-05-20 18:56:50 -0400 |
commit | 862ff4e52ad52bcf352965c1bafcc48e4ceb643d (patch) | |
tree | 921ea18ed91536e4b804a5728d9b9c10264be963 /src/web/lang/_bin/transpile.sh | |
parent | v2 done (diff) | |
download | xssbook2-862ff4e52ad52bcf352965c1bafcc48e4ceb643d.tar.gz xssbook2-862ff4e52ad52bcf352965c1bafcc48e4ceb643d.tar.bz2 xssbook2-862ff4e52ad52bcf352965c1bafcc48e4ceb643d.zip |
fix simple php errors
Diffstat (limited to '')
-rwxr-xr-x | src/web/lang/_bin/transpile.sh | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/web/lang/_bin/transpile.sh b/src/web/lang/_bin/transpile.sh index 18bb4c4..e6e826c 100755 --- a/src/web/lang/_bin/transpile.sh +++ b/src/web/lang/_bin/transpile.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash lang_part() { echo "$1" | awk "{split(\$0,a,\" = \"); print a[$2]}" @@ -10,7 +10,8 @@ handle_line() { left=$(lang_part "$line" 1) right=$(lang_part "$line" 2) echo "$left" | grep -Ev '_content|_line' > /dev/null - if [ "$?" -eq 0 ]; then + code=$? + if [ $code -eq 0 ]; then right=$(echo "$right" | uwuify) fi; right=${right%;}; @@ -23,7 +24,7 @@ transpile() { out="$2" printf "" > "$out" printf "<?php /* Copyright (c) 2024 Freya Murphy */\n\n" > "$out"; - cat "$file" | grep '$lang' | xargs -d'\n' -I {} bash -c 'handle_line "$@"' _ {} >> "$out" + grep "\$lang" < "$file" | xargs -d'\n' -I{} bash -c 'handle_line "$@"' _ {} >> "$out" } transpile "$1" "$2" |