diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b268c95..bb14d24 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -15,7 +15,7 @@ on: jobs: test: runs-on: ubuntu-latest - if: github.event_name != 'push' || github.event.pull_request == null + if: github.event_name == 'pull_request' || (github.event_name == 'push' && github.ref == 'refs/heads/main') steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 diff --git a/paper/concat_code.sh b/paper/concat_code.sh index 2503458..abbd676 100755 --- a/paper/concat_code.sh +++ b/paper/concat_code.sh @@ -16,10 +16,11 @@ mkdir -p "$(dirname "$OUTPUT_FILE")" add_file() { local filepath="$1" local relpath="${filepath#$PROJECT_ROOT/}" + local escaped_path="${relpath//_/\\_}" # Add section header and code listing (no language-specific highlighting) - echo "\\subsection{${relpath}}" >> "$OUTPUT_FILE" - echo "\\begin{lstlisting}[caption={${relpath}}]" >> "$OUTPUT_FILE" + echo "\\subsection{${escaped_path}}" >> "$OUTPUT_FILE" + echo "\\begin{lstlisting}[caption={${escaped_path}}]" >> "$OUTPUT_FILE" cat "$filepath" >> "$OUTPUT_FILE" echo "" >> "$OUTPUT_FILE" echo "\\end{lstlisting}" >> "$OUTPUT_FILE"