From 90883235499d899ce1585ad9d74c9d4e269b538d Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 14:38:32 +0100 Subject: [PATCH 1/9] Add support for externally sorting terms --- .gitignore | 1 - _includes/glossary.html | 6 +- utils/sort-glossary.py | 308 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 312 insertions(+), 3 deletions(-) create mode 100644 utils/sort-glossary.py diff --git a/.gitignore b/.gitignore index b1b6c9f1..6ccf1ea5 100644 --- a/.gitignore +++ b/.gitignore @@ -20,4 +20,3 @@ assets/css/to_delete.css .DS_Store _config.yml _data/ -count.py diff --git a/_includes/glossary.html b/_includes/glossary.html index 51c412f6..66e0fb8e 100644 --- a/_includes/glossary.html +++ b/_includes/glossary.html @@ -1,5 +1,7 @@ -{% assign gloss = site.data.glossary %} {% assign language = page.permalink | replace: '/', '' %} + +{% assign gloss = site.data.[language].glossary %} + {% assign direction = 'ltr' %} {% if page.direction %} {% assign direction = page.direction %} @@ -13,7 +15,7 @@ - 'actual' is a list of slugs sorted by terms. {%- endcomment -%} {%- capture defined -%}{%- for item in gloss -%}{%- if item[language] -%}{{item[language].term | downcase}}IN_ITEM{{item.slug}}BETWEEN_ITEMS{%- endif -%}{%- endfor -%}{%- endcapture -%} -{%- assign sorted = defined | split: 'BETWEEN_ITEMS' | sort -%} +{%- assign sorted = defined | split: 'BETWEEN_ITEMS' -%} {%- capture ordered -%}{%- for item in sorted -%}{{item | split: 'IN_ITEM' | last}}BETWEEN_ITEMS{%- endfor -%}{%- endcapture -%} {%- assign actual = ordered | split: 'BETWEEN_ITEMS' -%} diff --git a/utils/sort-glossary.py b/utils/sort-glossary.py new file mode 100644 index 00000000..299490ce --- /dev/null +++ b/utils/sort-glossary.py @@ -0,0 +1,308 @@ +import pprint +import yaml + +from collections import OrderedDict +from pathlib import Path + +import icu + +languages = [ + ('aa', 'Afar'), + ('ab', 'Abkhazian'), + ('af', 'Afrikaans'), + ('ak', 'Akan'), + ('sq', 'Albanian'), + ('am', 'Amharic'), + ('ar', 'Arabic'), + ('an', 'Aragonese'), + ('hy', 'Armenian'), + ('as', 'Assamese'), + ('av', 'Avaric'), + ('ae', 'Avestan'), + ('ay', 'Aymara'), + ('az', 'Azerbaijani'), + ('ba', 'Bashkir'), + ('bm', 'Bambara'), + ('eu', 'Basque'), + ('be', 'Belarusian'), + ('bn', 'Bengali'), + ('bh', 'Bihari languages'), + ('bi', 'Bislama'), + ('bo', 'Tibetan'), + ('bs', 'Bosnian'), + ('br', 'Breton'), + ('bg', 'Bulgarian'), + ('my', 'Burmese'), + ('ca', 'Catalan; Valencian'), + ('cs', 'Czech'), + ('ch', 'Chamorro'), + ('ce', 'Chechen'), + ('zh', 'Chinese'), + ('cu', 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic'), + ('cv', 'Chuvash'), + ('kw', 'Cornish'), + ('co', 'Corsican'), + ('cr', 'Cree'), + ('cy', 'Welsh'), + ('cs', 'Czech'), + ('da', 'Danish'), + ('de', 'German'), + ('dv', 'Divehi; Dhivehi; Maldivian'), + ('nl', 'Dutch; Flemish'), + ('dz', 'Dzongkha'), + ('el', 'Greek, Modern (1453-)'), + ('en', 'English'), + ('eo', 'Esperanto'), + ('et', 'Estonian'), + ('eu', 'Basque'), + ('ee', 'Ewe'), + ('fo', 'Faroese'), + ('fa', 'Persian'), + ('fj', 'Fijian'), + ('fi', 'Finnish'), + ('fr', 'French'), + ('fy', 'Western Frisian'), + ('ff', 'Fulah'), + ('Ga', 'Georgian'), + ('de', 'German'), + ('gd', 'Gaelic; Scottish Gaelic'), + ('ga', 'Irish'), + ('gl', 'Galician'), + ('gv', 'Manx'), + ('el', 'Greek, Modern (1453-)'), + ('gn', 'Guarani'), + ('gu', 'Gujarati'), + ('ht', 'Haitian; Haitian Creole'), + ('ha', 'Hausa'), + ('he', 'Hebrew'), + ('hz', 'Herero'), + ('hi', 'Hindi'), + ('ho', 'Hiri Motu'), + ('hr', 'Croatian'), + ('hu', 'Hungarian'), + ('hy', 'Armenian'), + ('ig', 'Igbo'), + ('is', 'Icelandic'), + ('io', 'Ido'), + ('ii', 'Sichuan Yi; Nuosu'), + ('iu', 'Inuktitut'), + ('ie', 'Interlingue; Occidental'), + ('ia', 'Interlingua (International Auxiliary Language Association)'), + ('id', 'Indonesian'), + ('ik', 'Inupiaq'), + ('is', 'Icelandic'), + ('it', 'Italian'), + ('jv', 'Javanese'), + ('ja', 'Japanese'), + ('kl', 'Kalaallisut; Greenlandic'), + ('kn', 'Kannada'), + ('ks', 'Kashmiri'), + ('ka', 'Georgian'), + ('kr', 'Kanuri'), + ('kk', 'Kazakh'), + ('km', 'Central Khmer'), + ('ki', 'Kikuyu; Gikuyu'), + ('rw', 'Kinyarwanda'), + ('ky', 'Kirghiz; Kyrgyz'), + ('kv', 'Komi'), + ('kg', 'Kongo'), + ('ko', 'Korean'), + ('kj', 'Kuanyama; Kwanyama'), + ('ku', 'Kurdish'), + ('lo', 'Lao'), + ('la', 'Latin'), + ('lv', 'Latvian'), + ('li', 'Limburgan; Limburger; Limburgish'), + ('ln', 'Lingala'), + ('lt', 'Lithuanian'), + ('lb', 'Luxembourgish; Letzeburgesch'), + ('lu', 'Luba-Katanga'), + ('lg', 'Ganda'), + ('mk', 'Macedonian'), + ('mh', 'Marshallese'), + ('ml', 'Malayalam'), + ('mi', 'Maori'), + ('mr', 'Marathi'), + ('ms', 'Malay'), + ('Mi', 'Micmac'), + ('mk', 'Macedonian'), + ('mg', 'Malagasy'), + ('mt', 'Maltese'), + ('mn', 'Mongolian'), + ('mi', 'Maori'), + ('ms', 'Malay'), + ('my', 'Burmese'), + ('na', 'Nauru'), + ('nv', 'Navajo; Navaho'), + ('nr', 'Ndebele, South; South Ndebele'), + ('nd', 'Ndebele, North; North Ndebele'), + ('ng', 'Ndonga'), + ('ne', 'Nepali'), + ('nl', 'Dutch; Flemish'), + ('nn', 'Norwegian Nynorsk; Nynorsk, Norwegian'), + ('nb', 'Bokmål, Norwegian; Norwegian Bokmål'), + ('no', 'Norwegian'), + ('oc', 'Occitan (post 1500)'), + ('oj', 'Ojibwa'), + ('or', 'Oriya'), + ('om', 'Oromo'), + ('os', 'Ossetian; Ossetic'), + ('pa', 'Panjabi; Punjabi'), + ('fa', 'Persian'), + ('pi', 'Pali'), + ('pl', 'Polish'), + ('pt', 'Portuguese'), + ('ps', 'Pushto; Pashto'), + ('qu', 'Quechua'), + ('rm', 'Romansh'), + ('ro', 'Romanian; Moldavian; Moldovan'), + ('ro', 'Romanian; Moldavian; Moldovan'), + ('rn', 'Rundi'), + ('ru', 'Russian'), + ('sg', 'Sango'), + ('sa', 'Sanskrit'), + ('si', 'Sinhala; Sinhalese'), + ('sk', 'Slovak'), + ('sk', 'Slovak'), + ('sl', 'Slovenian'), + ('se', 'Northern Sami'), + ('sm', 'Samoan'), + ('sn', 'Shona'), + ('sd', 'Sindhi'), + ('so', 'Somali'), + ('st', 'Sotho, Southern'), + ('es', 'Spanish; Castilian'), + ('sq', 'Albanian'), + ('sc', 'Sardinian'), + ('sr', 'Serbian'), + ('ss', 'Swati'), + ('su', 'Sundanese'), + ('sw', 'Swahili'), + ('sv', 'Swedish'), + ('ty', 'Tahitian'), + ('ta', 'Tamil'), + ('tt', 'Tatar'), + ('te', 'Telugu'), + ('tg', 'Tajik'), + ('tl', 'Tagalog'), + ('th', 'Thai'), + ('bo', 'Tibetan'), + ('ti', 'Tigrinya'), + ('to', 'Tonga (Tonga Islands)'), + ('tn', 'Tswana'), + ('ts', 'Tsonga'), + ('tk', 'Turkmen'), + ('tr', 'Turkish'), + ('tw', 'Twi'), + ('ug', 'Uighur; Uyghur'), + ('uk', 'Ukrainian'), + ('ur', 'Urdu'), + ('uz', 'Uzbek'), + ('ve', 'Venda'), + ('vi', 'Vietnamese'), + ('vo', 'Volapük'), + ('cy', 'Welsh'), + ('wa', 'Walloon'), + ('wo', 'Wolof'), + ('xh', 'Xhosa'), + ('yi', 'Yiddish'), + ('yo', 'Yoruba'), + ('za', 'Zhuang; Chuang'), + ('zh', 'Chinese'), + ('zu', 'Zulu') +] + +def _sort_terms(count_dict): + # sort and reassign terms + for lang in count_dict: + # std_lang = standardize_tag(lang) + # print(f"{lang} -> {std_lang} -> {Language.get(std_lang).to_alpha3()}") + + # create a locale from the language code and sort the terms with a collator + icu_locale = icu.Locale(lang) + collator = icu.Collator.createInstance(icu_locale) + + # only create directories for languages with terms + if count_dict[lang]["count"] > 0: + lang_path = data_path.joinpath(lang) + lang_path.mkdir(parents=True, exist_ok=True) + + # sort + sorted_terms = sorted(count_dict[lang]["terms"], key=collator.getSortKey) + count_dict[lang]["sorted_terms"] = sorted_terms + return count_dict + +def _setup_dict(glossary): + count_dict = {} + lang_codes = [] + + for cc in languages: + count_dict[cc[0]] = {} + count_dict[cc[0]]["count"] = 0 + count_dict[cc[0]]["name"] = cc[1] + count_dict[cc[0]]["terms"] = [] + count_dict[cc[0]]["sorted_terms"] = [] + count_dict[cc[0]]["term_entry_map"] = {} + lang_codes.append(cc[0]) + + # total number of glossary terms + # print(len(glos)) + + for slug in glossary: + for lang in slug.keys(): + if lang in lang_codes: + count_dict[lang]["count"] += 1 + count_dict[lang]["terms"].append(slug[lang]["term"]) + count_dict[lang]["term_entry_map"][slug[lang]["term"]] = dict( + { + "slug": slug["slug"], + "def": slug[lang]["def"] + } + ) + return _sort_terms(count_dict) + +def _build_lang_glossary(count_dict): + glossary_by_lang = {} + for lang in count_dict: + sorted_glossary = [] + for sorted_term in count_dict[lang]["sorted_terms"]: + if sorted_term in count_dict[lang]["term_entry_map"]: + term_map = count_dict[lang]["term_entry_map"][sorted_term] + slug = term_map["slug"] + _def = term_map["def"] + + sorted_glossary.append(OrderedDict({ + "slug": slug, + lang: { + "term": sorted_term, + "def": _def + } + })) + if sorted_glossary: + glossary_by_lang[lang] = sorted_glossary + return glossary_by_lang + +def setup_yaml(): + """ https://stackoverflow.com/a/8661021 """ + def represent_dict_order(self, data): + return self.represent_mapping('tag:yaml.org,2002:map', data.items()) + yaml.add_representer(OrderedDict, represent_dict_order) + +# load main glossary file +glos = yaml.safe_load(Path('glossary.yml').read_text()) +data_path = Path("_data/") + +# sort terms +count_dict = _setup_dict(glos) + +# rebuild glossary per language +sorted_glossary_by_lang = _build_lang_glossary(count_dict) + +# setup yaml for outputting +setup_yaml() +for lang in sorted_glossary_by_lang: + pprint.pprint(sorted_glossary_by_lang[lang]) + yaml.dump(sorted_glossary_by_lang[lang], Path(f'_data/{lang}/glossary.yml').open('w')) + +# output counts +# pprint.pprint(count_dict) From 2b7c79fab0b8f52c484f5dc548bd2a675e5bfdff Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 20:41:21 +0100 Subject: [PATCH 2/9] Create sorted glossaries in _data by lang --- .github/workflows/yaml-lint.yaml | 5 ++- Makefile | 21 ++++++---- utils/sort-glossary.py | 71 ++++++++++++++++++++++---------- 3 files changed, 64 insertions(+), 33 deletions(-) diff --git a/.github/workflows/yaml-lint.yaml b/.github/workflows/yaml-lint.yaml index 50a37311..a1b86a46 100644 --- a/.github/workflows/yaml-lint.yaml +++ b/.github/workflows/yaml-lint.yaml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8] + python-version: [3.11] steps: - uses: actions/checkout@v3 @@ -17,8 +17,9 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | + apt-get install -y build-essential libicu-dev python -m pip install --upgrade pip - pip install yamllint + pip install yamllint pycld2 pyicu-binary if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint _config.yml with yamllint run: | diff --git a/Makefile b/Makefile index 9c629cf0..8f1e6e55 100644 --- a/Makefile +++ b/Makefile @@ -5,13 +5,21 @@ all : commands commands : @grep -h -E '^##' ${MAKEFILE_LIST} | sed -e 's/## //g' | column -t -s ':' +_data/glossary.yml : ./glossary.yml + @mkdir -p _data + @cp $< $@ + +sort-glossary : _data/glossary.yml + @yamllint glossary.yml + @python utils/sort-glossary.py + ## site : rebuild GitHub Pages site locally. -site : _data/glossary.yml +site : sort-glossary rm -rf .jekyll-cache .jekyll-metadata _site bundle exec jekyll build ## gh-site : builds the website for GitHub pages (part of the GH Actions workflow) -gh-site : _data/glossary.yml +gh-site : sort-glossary @rm -rf _gh-site @mkdir -p _gh-site @cp -r `ls -A | grep -v '.git' | grep -v '_gh-site' | grep -v '_site'` _gh-site @@ -19,7 +27,7 @@ gh-site : _data/glossary.yml @cp $< _gh-site/$< ## serve : serve GitHub Pages site locally. -serve : _data/glossary.yml +serve : sort-glossary rm -rf _site bundle exec jekyll serve -I @@ -27,7 +35,7 @@ serve : _data/glossary.yml clean : @rm -rf _site @find . -name '*~' -exec rm {} \; - @rm -f _data/glossary.yml + @rm -rf _data/* ## check : check glossary consistency. check : @@ -37,8 +45,3 @@ check : ## checkall : check glossary consistency including missing terms in all languages. checkall : @python utils/check-glossary.py -A _config.yml glossary.yml - -# Create copy of glossary file for GitHub Pages site. -_data/glossary.yml : ./glossary.yml - @mkdir -p _data - @cp $< $@ diff --git a/utils/sort-glossary.py b/utils/sort-glossary.py index 299490ce..f38a6518 100644 --- a/utils/sort-glossary.py +++ b/utils/sort-glossary.py @@ -6,7 +6,8 @@ import icu -languages = [ +# set up supported languages +LANGUAGES = [ ('aa', 'Afar'), ('ab', 'Abkhazian'), ('af', 'Afrikaans'), @@ -212,13 +213,15 @@ ('zu', 'Zulu') ] -def _sort_terms(count_dict): + +def _sort_terms(count_dict, data_path): # sort and reassign terms for lang in count_dict: + # check 2-letter language codes vs 3-letter language codes # std_lang = standardize_tag(lang) # print(f"{lang} -> {std_lang} -> {Language.get(std_lang).to_alpha3()}") - # create a locale from the language code and sort the terms with a collator + # create a locale from the language code and a collator to perform sorting icu_locale = icu.Locale(lang) collator = icu.Collator.createInstance(icu_locale) @@ -227,16 +230,18 @@ def _sort_terms(count_dict): lang_path = data_path.joinpath(lang) lang_path.mkdir(parents=True, exist_ok=True) - # sort + # sort and store sorted terms separate from the original list sorted_terms = sorted(count_dict[lang]["terms"], key=collator.getSortKey) count_dict[lang]["sorted_terms"] = sorted_terms return count_dict -def _setup_dict(glossary): + +def _setup_dict(glossary, data_path): + # data structure to hold counts and terms count_dict = {} - lang_codes = [] - for cc in languages: + lang_codes = [] + for cc in LANGUAGES: count_dict[cc[0]] = {} count_dict[cc[0]]["count"] = 0 count_dict[cc[0]]["name"] = cc[1] @@ -248,6 +253,7 @@ def _setup_dict(glossary): # total number of glossary terms # print(len(glos)) + # count terms and store them in the data structure for slug in glossary: for lang in slug.keys(): if lang in lang_codes: @@ -259,18 +265,24 @@ def _setup_dict(glossary): "def": slug[lang]["def"] } ) - return _sort_terms(count_dict) + + # return the data structure including sorted terms + return _sort_terms(count_dict, data_path) + def _build_lang_glossary(count_dict): glossary_by_lang = {} for lang in count_dict: sorted_glossary = [] + + # process the data structure to create a new sorted glossary per language for sorted_term in count_dict[lang]["sorted_terms"]: if sorted_term in count_dict[lang]["term_entry_map"]: term_map = count_dict[lang]["term_entry_map"][sorted_term] slug = term_map["slug"] _def = term_map["def"] + # use an OrderedDict to retain insertion order sorted_glossary.append(OrderedDict({ "slug": slug, lang: { @@ -278,31 +290,46 @@ def _build_lang_glossary(count_dict): "def": _def } })) + + # only include languages with terms if sorted_glossary: glossary_by_lang[lang] = sorted_glossary return glossary_by_lang + def setup_yaml(): """ https://stackoverflow.com/a/8661021 """ def represent_dict_order(self, data): return self.represent_mapping('tag:yaml.org,2002:map', data.items()) yaml.add_representer(OrderedDict, represent_dict_order) -# load main glossary file -glos = yaml.safe_load(Path('glossary.yml').read_text()) -data_path = Path("_data/") -# sort terms -count_dict = _setup_dict(glos) +def main(): + try: + # get path + current_path = Path(__file__).resolve() + + # load main glossary file + data_path = current_path.parent.parent.joinpath("_data/") + glossary_path = data_path.joinpath("glossary.yml") + glos = yaml.safe_load(glossary_path.read_text()) + + # sort terms + sort_dict = _setup_dict(glos, data_path) + + # rebuild glossary per language + sorted_glossary_by_lang = _build_lang_glossary(sort_dict) + + # setup yaml for outputting + setup_yaml() + for lang in sorted_glossary_by_lang: + yaml.dump(sorted_glossary_by_lang[lang], Path(f'_data/{lang}/glossary.yml').open('w')) -# rebuild glossary per language -sorted_glossary_by_lang = _build_lang_glossary(count_dict) + # output counts + # pprint.pprint(count_dict) + except Exception as e: + print(e) -# setup yaml for outputting -setup_yaml() -for lang in sorted_glossary_by_lang: - pprint.pprint(sorted_glossary_by_lang[lang]) - yaml.dump(sorted_glossary_by_lang[lang], Path(f'_data/{lang}/glossary.yml').open('w')) -# output counts -# pprint.pprint(count_dict) +if __name__ == '__main__': + main() From 35d72187a50cc5a73bd5772e33fe8b60b9c099aa Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 20:50:40 +0100 Subject: [PATCH 3/9] Fix actions --- .github/workflows/build-and-deploy.yaml | 8 +++++++- .github/workflows/yaml-lint.yaml | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-deploy.yaml b/.github/workflows/build-and-deploy.yaml index 217f0c01..5834d04a 100644 --- a/.github/workflows/build-and-deploy.yaml +++ b/.github/workflows/build-and-deploy.yaml @@ -11,7 +11,13 @@ jobs: with: persist-credentials: false - - name: Build site + - name: Install dependencies + run: | + sudo apt-get install -y build-essential libicu-dev + python -m pip install --upgrade pip + pip install pycld2 pyicu-binary + + - name: Build glossary data files and site run: make gh-site - name: Remove _data fromm .gitignore diff --git a/.github/workflows/yaml-lint.yaml b/.github/workflows/yaml-lint.yaml index a1b86a46..6c03398e 100644 --- a/.github/workflows/yaml-lint.yaml +++ b/.github/workflows/yaml-lint.yaml @@ -17,9 +17,8 @@ jobs: python-version: ${{ matrix.python-version }} - name: Install dependencies run: | - apt-get install -y build-essential libicu-dev python -m pip install --upgrade pip - pip install yamllint pycld2 pyicu-binary + pip install yamllint if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Lint _config.yml with yamllint run: | From 77e11a1f48cef9deeafd051563b6dfcb6e31fe72 Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 21:05:08 +0100 Subject: [PATCH 4/9] Fix makefile --- Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 8f1e6e55..616189e1 100644 --- a/Makefile +++ b/Makefile @@ -5,21 +5,25 @@ all : commands commands : @grep -h -E '^##' ${MAKEFILE_LIST} | sed -e 's/## //g' | column -t -s ':' +# Create copy of glossary file for GitHub Pages site. _data/glossary.yml : ./glossary.yml @mkdir -p _data @cp $< $@ +## sort : sort the glossary file and build _data glossary file per language sort-glossary : _data/glossary.yml @yamllint glossary.yml @python utils/sort-glossary.py ## site : rebuild GitHub Pages site locally. -site : sort-glossary +site : + $(MAKE) sort-glossary rm -rf .jekyll-cache .jekyll-metadata _site bundle exec jekyll build ## gh-site : builds the website for GitHub pages (part of the GH Actions workflow) -gh-site : sort-glossary +gh-site : _data/glossary.yml + $(MAKE) sort-glossary @rm -rf _gh-site @mkdir -p _gh-site @cp -r `ls -A | grep -v '.git' | grep -v '_gh-site' | grep -v '_site'` _gh-site @@ -27,7 +31,8 @@ gh-site : sort-glossary @cp $< _gh-site/$< ## serve : serve GitHub Pages site locally. -serve : sort-glossary +serve : + $(MAKE) sort-glossary rm -rf _site bundle exec jekyll serve -I From 2ccfea80fa795fc4381bfe0fdb46770955207b00 Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 21:37:15 +0100 Subject: [PATCH 5/9] Fix typos in action --- .github/workflows/build-and-deploy.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy.yaml b/.github/workflows/build-and-deploy.yaml index 5834d04a..c91882bc 100644 --- a/.github/workflows/build-and-deploy.yaml +++ b/.github/workflows/build-and-deploy.yaml @@ -20,10 +20,10 @@ jobs: - name: Build glossary data files and site run: make gh-site - - name: Remove _data fromm .gitignore + - name: Remove _data from .gitignore run: "grep -v '_data' .gitignore > tmpfile && mv tmpfile .gitignore" - - name: inspect content of folder + - name: Inspect content of folder run: ls -alh _gh-site && ls -alh _gh-site/_data - name: Deploy to site From f3139078a9845a0627a3c7652ee8dd9aad5dc5e2 Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 21:43:04 +0100 Subject: [PATCH 6/9] Add _data/en output check --- .github/workflows/build-and-deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yaml b/.github/workflows/build-and-deploy.yaml index c91882bc..546832d2 100644 --- a/.github/workflows/build-and-deploy.yaml +++ b/.github/workflows/build-and-deploy.yaml @@ -24,7 +24,7 @@ jobs: run: "grep -v '_data' .gitignore > tmpfile && mv tmpfile .gitignore" - name: Inspect content of folder - run: ls -alh _gh-site && ls -alh _gh-site/_data + run: ls -alh _gh-site && ls -alh _gh-site/_data && ls -alh _gh-site/_data/en - name: Deploy to site if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'carpentries/glosario' }} From cc58c8503c5d0621fffa4683aa86eaf57a4dea7b Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 22:31:17 +0100 Subject: [PATCH 7/9] Add netlify build file --- Makefile | 1 + _build_netlify.sh | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 _build_netlify.sh diff --git a/Makefile b/Makefile index 616189e1..03ff2fa2 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,7 @@ serve : ## clean : clean up unneeded files. clean : @rm -rf _site + @rm -rf _gh-site @find . -name '*~' -exec rm {} \; @rm -rf _data/* diff --git a/_build_netlify.sh b/_build_netlify.sh new file mode 100644 index 00000000..ba273e2b --- /dev/null +++ b/_build_netlify.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +URL="$1" + +cat > _config_netlify.yml < Date: Tue, 17 Sep 2024 22:32:36 +0100 Subject: [PATCH 8/9] Add exec permission on netlify build --- _build_netlify.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 _build_netlify.sh diff --git a/_build_netlify.sh b/_build_netlify.sh old mode 100644 new mode 100755 From e37cc33733caf161592342acb1336093b0230511 Mon Sep 17 00:00:00 2001 From: froggleston Date: Tue, 17 Sep 2024 23:02:44 +0100 Subject: [PATCH 9/9] Remove netlify build, remove lang duplicates --- _build_netlify.sh | 38 -------------------------------------- utils/sort-glossary.py | 18 ------------------ 2 files changed, 56 deletions(-) delete mode 100755 _build_netlify.sh diff --git a/_build_netlify.sh b/_build_netlify.sh deleted file mode 100755 index ba273e2b..00000000 --- a/_build_netlify.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/bash - -URL="$1" - -cat > _config_netlify.yml <