Skip to content

Commit

Permalink
first actual conversion test
Browse files Browse the repository at this point in the history
  • Loading branch information
Perfect5th committed Jan 21, 2024
1 parent f73c370 commit f363ac1
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,16 @@ jobs:
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Generate HTML
run: |
sudo apt update
sudo apt install markdown
./convert.sh
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload html directory
path: './html'
# Upload _site directory
path: './_site'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.DS_Store
.idea
*.log
tmp/

_site
14 changes: 14 additions & 0 deletions convert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env sh

# A simple-site converted. Wraps the html produced from markdown in a few tags
# to make it web-servable.

FILES=$(find ./markdown -type f -name '*.md')

for FILE in $FILES; do
HTML_PATH=$(echo "$FILE" | sed -e 's/\.md$/\.html/' | sed -e 's/^\.\/markdown/\.\/_site/')
echo "Creating $HTML_PATH"
cat ./templates/base.html > "$HTML_PATH"
markdown --html4tags "$FILE" >> "$HTML_PATH"
cat ./templates/close.html >> "$HTML_PATH"
done
4 changes: 4 additions & 0 deletions markdown/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Homepage

Welcome to the homepage!

11 changes: 11 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Simple Site</title>
<meta name="description" content="A simple, markdown-derived website.">
<link rel="stylesheet" href="/css/base.css">
<script src="/js/main.js"></script>
</head>
<body>
<!-- intentionally unterminated -->
3 changes: 3 additions & 0 deletions templates/close.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
</body>
</head>
<!-- closes unclosed tags in ./base.html -->

0 comments on commit f363ac1

Please sign in to comment.