Skip to content

Commit

Permalink
use YASS (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
purajit authored Mar 9, 2023
1 parent faca110 commit 4f11adb
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 126 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Generate statics
run: |
make generate-pages-prod
uses: purajit/YASS@v1
with:
yass-config-path: yass_config_prod.json

- name: Setup Pages
uses: actions/configure-pages@v3

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'docs/'
- name: Deploy to GitHub Pages

- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# YASS generator for local runs
generate_site.py

# since most of docs/ is generated on-the-fly, ignore everything,
docs/*

Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))

get-yass:
curl https://raw.githubusercontent.com/purajit/YASS/main/generate_site.py > generate_site.py

symlink-assets:
rm -f $(ROOT_DIR)/docs/static/assets
ln -s ../../assets $(ROOT_DIR)/docs/static/assets
Expand All @@ -15,11 +18,8 @@ run-server: symlink-assets
enter-server:
docker exec -w /usr/share/nginx/html -it purajit.com sh

generate-pages-local:
./generators/generate "/static/assets"

generate-pages-prod:
./generators/generate "https://assets.purajit.com"
generate-pages-local: get-yass
./generate_site.py yass_config_local.json

clean:
git clean -fd
3 changes: 0 additions & 3 deletions generators/generate

This file was deleted.

113 changes: 0 additions & 113 deletions generators/generate_sites.py

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion templates/head.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<head>
<title>purajit | {{ tab_title or title }}</title>
<title>purajit | {{ tab_title }}</title>
<link rel="stylesheet" href="/static/index.css">
<meta charset="utf-8"/>
<link rel="icon" type="image/x-icon" href="/static/favicon.ico"/>
Expand Down
2 changes: 1 addition & 1 deletion templates/header.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
{% include 'head.html' %}
<body class="bgimg" style="background-image: url({{ static_url }}/images/bg1.jpg);">
<div id="main" class="{{ content_type }}">
<div id="main">
<div id="name">
<a href="{{ previous_page }}"></a>
{{ title }}</div>
Expand Down
4 changes: 4 additions & 0 deletions yass_config_local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"static_url": "/static/assets",
"template_functions_module": "yass_template_functions"
}
4 changes: 4 additions & 0 deletions yass_config_prod.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"static_url": "https://assets.purajit.com",
"template_functions_module": "yass_template_functions"
}
10 changes: 10 additions & 0 deletions yass_template_functions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def yass_romanize(arabic):
conversions = [[1000, 'M'], [900, 'CM'], [500, 'D'], [400, 'CD'],
[ 100, 'C'], [ 90, 'XC'], [ 50, 'L'], [ 40, 'XL'],
[ 10, 'X'], [ 9, 'IX'], [ 5, 'V'], [ 4, 'IV'],
[ 1, 'I']]
result = ''
for denomination, roman_numeral in conversions:
result += roman_numeral * (arabic // denomination)
arabic %= denomination
return result

0 comments on commit 4f11adb

Please sign in to comment.