Skip to content

Commit

Permalink
Restructure, extract functions to utils with testing. Fix replace wit…
Browse files Browse the repository at this point in the history
…h _ (#2)

* restructure

* update gitignore

* Update build import

* extract function to utils

* update workflow

* move table.css

* select dataset english

* add argparse

* update pandoc commands

* rename example to field

* load spanish dataset

* rename
  • Loading branch information
sogladev authored Mar 26, 2024
1 parent 7f7e0e4 commit 87fcce1
Show file tree
Hide file tree
Showing 83 changed files with 2,640 additions and 14,441 deletions.
46 changes: 21 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ name: Build
on:
workflow_call:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build-english:
Expand All @@ -23,30 +19,30 @@ jobs:
run: |
python -m pip install -r requirements.txt
- name: Create build and output folder
working-directory: ./english
working-directory: ./src
run: |
mkdir -p build output
- name: Upload data as artifact
uses: actions/upload-artifact@v4
with:
name: english-data
path: english/data
path: src/data/english
- name: Create format files with Python
working-directory: ./english
working-directory: ./src
run: |
python format.py oxford_3000
python format.py oxford_5000
python format.py oxford_5000_exclusive
python format_english.py oxford_3000
python format_english.py oxford_5000
python format_english.py oxford_5000_exclusive
- name: Upload html as artifact
uses: actions/upload-artifact@v4
with:
name: english-output-html
path: english/output/*.html
path: src/output/jxford_*.html
- name: Install wkthtmltopdf
run: |
sudo apt-get update && sudo apt-get install -y wkhtmltopdf
- name: Convert html to pdf with wkhtmltopdf
working-directory: ./english
working-directory: ./src
run: |
wkhtmltopdf --user-style-sheet format/table.css output/oxford_3000_alphabetical.html output/oxford_3000_alphabetical.pdf
wkhtmltopdf --user-style-sheet format/table.css output/oxford_3000_by_cefr_shuffle.html output/oxford_3000_by_cefr_shuffle.pdf
Expand All @@ -67,19 +63,19 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: english-output-pdf-from-html
path: english/output/*.pdf
path: src/output/oxford*.pdf
- name: Create pdf with Latex
uses: xu-cheng/latex-action@v3
with:
working_directory: english/format
working_directory: src/format/english
latexmk_use_xelatex: true
root_file: |
*.tex
- name: Upload tex-to-pdf as artifact
uses: actions/upload-artifact@v4
with:
name: english-output-pdf-from-tex
path: english/format/*.pdf
path: src/format/english/*.pdf
build-spanish:
runs-on: ubuntu-22.04
steps:
Expand All @@ -93,29 +89,29 @@ jobs:
run: |
python -m pip install -r requirements.txt
- name: Create build and output folder
working-directory: ./spanish
working-directory: ./src
run: |
mkdir -p build output
- name: Upload data as artifact
uses: actions/upload-artifact@v4
with:
name: spanish-data
path: spanish/data
path: data/spanish
- name: Create format files with Python
working-directory: ./spanish
working-directory: ./src
run: |
python format.py spanish_3000
python format.py spanish_5000
python format_spanish.py spanish_3000
python format_spanish.py spanish_5000
- name: Upload html as artifact
uses: actions/upload-artifact@v4
with:
name: spanish-output-html
path: spanish/output/*.html
path: src/output/spanish*.html
- name: Install wkthtmltopdf
run: |
sudo apt-get update && sudo apt-get install -y wkhtmltopdf
- name: Convert html to pdf with wkhtmltopdf
working-directory: ./spanish
working-directory: ./src
run: |
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_alphabetical.html output/spanish_3000_alphabetical.pdf
wkhtmltopdf --user-style-sheet format/table.css output/spanish_3000_shuffled.html output/spanish_3000_shuffled.pdf
Expand All @@ -133,16 +129,16 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: spanish-output-pdf-from-html
path: spanish/output/*.pdf
path: src/output/spanish*.pdf
- name: Create pdf with Latex
uses: xu-cheng/latex-action@v3
with:
working_directory: spanish/format
working_directory: src/format/spanish
latexmk_use_xelatex: true
root_file: |
*.tex
- name: Upload tex-to-pdf as artifact
uses: actions/upload-artifact@v4
with:
name: spanish-output-pdf-from-tex
path: spanish/format/*.pdf
path: src/format/spanish/*.pdf
25 changes: 9 additions & 16 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
# wip

english/build/
english/upload/
english/audio/*
#english/data/*
english/output/*
english/format/*
!english/format/*.tex
!english/format/*.css
resources/*
src/build/*
src/output/*
src/audio/*
!src/format/**/*.tex
!src/format/**/*.css

resources/
src/data/**/*xhtml

*.zip

spanish/data/*xhtml
spanish/output/*
spanish/format/*
!spanish/format/*.tex
!spanish/format/*.css

# Created by https://www.toptal.com/developers/gitignore/api/latex,visualstudiocode,python,jupyternotebooks
# Edit at https://www.toptal.com/developers/gitignore?templates=latex,visualstudiocode,python,jupyternotebooks
Expand Down
80 changes: 0 additions & 80 deletions english/README.md

This file was deleted.

Loading

0 comments on commit 87fcce1

Please sign in to comment.