Skip to content

Commit

Permalink
Modified files and file structure to support multiple rule documents …
Browse files Browse the repository at this point in the history
…in one repo.
  • Loading branch information
ChristianH99 committed Feb 17, 2024
1 parent d7dd835 commit 3a584bd
Show file tree
Hide file tree
Showing 14 changed files with 682 additions and 324 deletions.
3 changes: 2 additions & 1 deletion .ci/adoc-to-tex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ mkdir -p tmp rules_documents
set -euo pipefail

OUTPUT_FILE=$1
cp $1.adoc tmp/$1.adoc

cp $OUTPUT_FILE/rules.adoc tmp/$OUTPUT_FILE.adoc

cd tmp

Expand Down
2 changes: 1 addition & 1 deletion .ci/tex-to-pdf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ dblatex -T db2latex $OUTPUT_FILE.xml -t tex --texstyle=./manual.sty -p ../custom
# (marked by the \mainmatter command) and create a file without it.
cat $OUTPUT_FILE.tex | awk 'f;/\\mainmatter/{f=1}' > $OUTPUT_FILE"_without_preamble.tex"
# Concat the standardized preamble with the "without_preamble" version of the file
cat "../specific_preamble_"$OUTPUT_FILE".tex" ../preamble.tex $OUTPUT_FILE"_without_preamble.tex" > $OUTPUT_FILE.tex
cat "../preamble.tex" "../"$OUTPUT_FILE"/header_footer.tex" "../"$OUTPUT_FILE"/title.tex" "../committee_list.tex" $OUTPUT_FILE"_without_preamble.tex" > $OUTPUT_FILE.tex
texliveonfly $OUTPUT_FILE.tex
pdflatex $OUTPUT_FILE.tex
pdflatex $OUTPUT_FILE.tex
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_entry_rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:

- name: build the rules
run: |
docker run -v $(pwd):/documents asciidoctor/docker-asciidoctor .ci/adoc-to-tex.sh onstage_rules
docker run -v $(pwd):/documents mrshu/texlive-dblatex .ci/tex-to-pdf.sh onstage_rules
docker run -v $(pwd):/documents asciidoctor/docker-asciidoctor .ci/adoc-to-tex.sh onstage_entry_rules
docker run -v $(pwd):/documents mrshu/texlive-dblatex .ci/tex-to-pdf.sh onstage_entry_rules
mkdir -p dist/${GITHUB_REF#refs/heads/}/
cp -R ./media rules_documents/* dist/${GITHUB_REF#refs/heads/}/
Expand Down
88 changes: 75 additions & 13 deletions build_rules_on_windows.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@echo off
setlocal enabledelayedexpansion

REM Set the path to the Git repository dynamically
set REPO_PATH=%CD%
Expand All @@ -9,22 +10,77 @@ set REPO_PATH=%REPO_PATH:\=/%
REM Replace C: with /mnt/c/
set REPO_PATH=%REPO_PATH:C:=/mnt/c%

echo Running commands in WSL...
wsl which dos2unix > NUL 2>&1
if %ERRORLEVEL% NEQ 0 (
goto installdos2unix
) else (
goto selectrules
)

echo dos2unix is required to build the rules. Do you want to check if dos2unix is installed and install if necessary?
set /p performCheck=Type 'y' for yes otherwise press ENTER:
:installdos2unix
echo dos2unix is required to build the rules. Do you want to install it?
set /p performInstallationNew=Type 'y' for yes:
if "%performInstallationNew%"=="y" (
echo Installing dos2unix...
wsl sudo apt-get update
wsl sudo apt-get install dos2unix
echo.
echo.
goto checkinstallation
) else (
echo.
echo.
echo Skipped dos2unix installation. Can not build rules.
goto :end
)

if /i "%performCheck%"=="y" (
wsl /usr/bin/dos2unix --version > /dev/null 2>&1
if %ERRORLEVEL% NEQ 0 (
echo Installing dos2unix...
wsl sudo apt-get update
wsl sudo apt-get install dos2unix
:checkinstallation
wsl which dos2unix > NUL 2>&1
if %ERRORLEVEL% NEQ 0 (
echo Installation failed. Can not build the rules.
goto end
) else goto selectrules

:selectrules
echo Available rule folders:
set "folderIndex=1"
rem Initialize an array to store folder names
setlocal enabledelayedexpansion
set "folderArray="
for /d %%i in (*) do (
set "folderName=%%i"
rem Skip folders starting with a dot or named "icons", "media", or "rules_documents"
if "!folderName:~0,1!" neq "." (
if /i "!folderName!" neq "icons" (
if /i "!folderName!" neq "media" (
if /i "!folderName!" neq "rules_documents" (
echo [!folderIndex!] %%i
rem Store folder name in array with corresponding index
set "folderArray[!folderIndex!]=%%i"
set /a "folderIndex+=1"
)
)
)
)
)

echo.
set /p selection=Enter the number corresponding to the folder you want to select:

rem Get the selected folder name based on user input
set "selectedFolder="
if defined folderArray[%selection%] (
set "selectedFolder=!folderArray[%selection%]!"
) else (
echo Skipped dos2unix check and installation.
echo Invalid selection.
pause
goto :eof
)

echo.
echo You selected: %selectedFolder%
echo.
echo.

REM Create temporary copies of .sh scripts with Linux-style line endings using wsl cp (because Github checkout might automatically change them to Windows style which will stop the scripts from working)
wsl cp %REPO_PATH%/.ci/adoc-to-tex.sh %REPO_PATH%/.ci/adoc-to-tex-temp.sh
Expand All @@ -36,14 +92,20 @@ wsl dos2unix %REPO_PATH%/.ci/tex-to-pdf-temp.sh

REM Run commands in WSL with sudo for Docker
@echo Building rules
wsl sudo docker run -v %REPO_PATH%:/documents asciidoctor/docker-asciidoctor .ci/adoc-to-tex-temp.sh onstage_rules
wsl sudo docker run -v %REPO_PATH%:/documents mrshu/texlive-dblatex .ci/tex-to-pdf-temp.sh onstage_rules
wsl sudo docker run -v %REPO_PATH%:/documents asciidoctor/docker-asciidoctor .ci/adoc-to-tex-temp.sh %selectedFolder%
wsl sudo docker run -v %REPO_PATH%:/documents mrshu/texlive-dblatex .ci/tex-to-pdf-temp.sh %selectedFolder%

REM Clean up temporary files
wsl rm %REPO_PATH%/.ci/adoc-to-tex-temp.sh
wsl rm %REPO_PATH%/.ci/tex-to-pdf-temp.sh

echo WSL commands completed.
echo.
echo.
echo.
echo.

:end
REM Pause the script and wait for any key to be pressed
pause

endlocal
25 changes: 25 additions & 0 deletions committee_list.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
\begin{tabular}{rl}
\resizebox{0.50\textwidth}{!}{
\begin{tabular}{lr}
\multicolumn{2}{l}{\textbf{OnStage League Committee 2024:}}\\
Christian Häußler & Germany (CHAIR)\\
Nicky Hughes & UK\\
Mauricio Gutierrez & Mexico\\
Amy Eguchi & USA\\
Thundluck Sereevoravitgul & Thailand\\
\end{tabular}}
&
\resizebox{0.50\textwidth}{!}{
\begin{tabular}{lr}
\multicolumn{2}{l}{\textbf{OnStage League Committee 2023:}}\\
Christian Häußler & Germany (CHAIR)\\
Nicky Hughes & UK\\
Nicolas Doyon & Canada\\
Amy Eguchi & USA\\
Thundluck Sereevoravitgul & Thailand\\
Koto Sakamoto & Japan\\
\end{tabular}}

\end{tabular}

\vspace{20pt}
18 changes: 18 additions & 0 deletions onstage_entry_rules/header_footer.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
\lhead{}
\chead{}
\rhead{\includegraphics[width=8cm]{media/robocup_header.png}}
\renewcommand{\headrulewidth}{0pt}
%\renewcommand{\topmargin}{-20pt}

\rfoot{Page \textbf{\thepage} of \textbf{\pageref{LastPage}}}
\lfoot{\textit{DRAFT rules as of \today}}
\cfoot{}

% First page
\fancypagestyle{firststyle}{%
\fancyhf{}
\fancyfoot[L]{\textit{DRAFT rules as of \today}}
\fancyfoot[R]{Page \textbf{\thepage} of \textbf{\pageref{LastPage}}}
}

\vspace{20pt}
Loading

0 comments on commit 3a584bd

Please sign in to comment.