Add build.sh that auto-discovers kramdown-rfc2629 and xml2rfc regardless of PATH configuration, generates XML, TXT, and HTML in one step. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
Bash
Executable File
45 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
DRAFT="draft-nennemann-wimse-execution-context-00"
|
|
DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
|
|
# Resolve tool paths
|
|
KDRFC="$(find /usr/local/lib/ruby/gems /opt/homebrew -name kdrfc -path "*/bin/*" 2>/dev/null | head -1)"
|
|
KRAMDOWN="$(find /usr/local/lib/ruby/gems /opt/homebrew -name kramdown-rfc2629 -path "*/bin/*" 2>/dev/null | head -1)"
|
|
XML2RFC="$(find "$HOME/Library/Python" /usr/local /opt/homebrew -name xml2rfc -path "*/bin/*" 2>/dev/null | head -1)"
|
|
|
|
if [ -z "$KRAMDOWN" ]; then
|
|
echo "Error: kramdown-rfc2629 not found. Install with: gem install kramdown-rfc" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$XML2RFC" ]; then
|
|
echo "Error: xml2rfc not found. Install with: pip install xml2rfc" >&2
|
|
exit 1
|
|
fi
|
|
|
|
export PYTHONWARNINGS="ignore::UserWarning"
|
|
|
|
echo "Using kramdown-rfc2629: $KRAMDOWN"
|
|
echo "Using xml2rfc: $XML2RFC"
|
|
echo ""
|
|
|
|
# Step 1: Markdown -> XML
|
|
echo "Converting markdown to XML..."
|
|
"$KRAMDOWN" "$DIR/$DRAFT.md" > "$DIR/$DRAFT.xml"
|
|
|
|
# Step 2: XML -> TXT
|
|
echo "Generating text output..."
|
|
"$XML2RFC" "$DIR/$DRAFT.xml" --text --quiet 2>/dev/null
|
|
|
|
# Step 3: XML -> HTML
|
|
echo "Generating HTML output..."
|
|
"$XML2RFC" "$DIR/$DRAFT.xml" --html --quiet 2>/dev/null
|
|
|
|
echo ""
|
|
echo "Build complete:"
|
|
echo " $DRAFT.xml (submit this to datatracker)"
|
|
echo " $DRAFT.txt"
|
|
echo " $DRAFT.html"
|