google_forms/preprocess-js.sh

15 lines
408 B
Bash
Raw Normal View History

2024-08-09 12:04:48 +00:00
#!/bin/sh
# Preprocess JavaScript files to handle PHP code as placeholders
for FILE in "$@"; do
TEMP_FILE=$(mktemp)
# Replace PHP code blocks with placeholders
sed -E 's/<?php(.*?)(\?>|$)/__PHP_BLOCK_START__\1__PHP_BLOCK_END__/g' "$FILE" > "$TEMP_FILE"
# Handle short PHP tags
sed -E 's/<?(.*?)(\?>|$)/__PHP_BLOCK_START__\1__PHP_BLOCK_END__/g' "$TEMP_FILE" > "$FILE"
rm "$TEMP_FILE"
done