Skip to content

Commit

Permalink
Migrate FAQ to YAML
Browse files Browse the repository at this point in the history
* Update script

* Update FAQ JSONc and it'stemplate

* Big update
- Change from JSON(C) to YAML
- Add table-compact CSS style

Co-authored-by: NOT_A_ROBOT <[email protected]>

* Small edit in generate_faq_html file

* Add .nojekyll file

* Update FAQ

* Update FAQ

* Clean up

* Fix monospace font

---------

Co-authored-by: NOT_A_ROBOT <[email protected]>
  • Loading branch information
1 parent 63a1ba7 commit b8fb974
Show file tree
Hide file tree
Showing 11 changed files with 585 additions and 386 deletions.
18 changes: 11 additions & 7 deletions .github/scripts/generate_faq_html.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
import json
import yaml
try:
from yaml import CLoader as _Loader
except ImportError:
from yaml import Loader as _Loader

# Constants
faq_json_location = "data/faq.json"
faq_html_template_location = "data/faq-template.html"
faq_html_output_location = "faq.html"
faq_yaml_location = "data/faq.yaml"
faq_html_template_location = "data/faq-template.html"
faq_html_output_location = "faq.html"
template_insertion_location = "<INSERT_QUESTIONS>"

def faq_html(entry):
Expand All @@ -24,12 +28,12 @@ def faq_html(entry):
</div>
"""

faq = json.load(open(faq_json_location, "r"))
html_template = open(faq_html_template_location, "r").read()
faq = yaml.load(open(faq_yaml_location, "r", encoding="utf-8"),Loader=_Loader)
html_template = open(faq_html_template_location, "r", encoding="utf-8").read()
text_to_insert = ""
for entry in faq:
text_to_insert += faq_html(entry)

html_template = html_template.replace(template_insertion_location, text_to_insert)

open(faq_html_output_location, "w").write(html_template)
open(faq_html_output_location, "w", encoding="utf-8").write(html_template)
1 change: 1 addition & 0 deletions .github/workflows/update_faq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:

- name: Generate FAQ HTML
run: |
python -m pip install pyyaml
python .github/scripts/generate_faq_html.py
- name: Commit updated FAQ HTML
Expand Down
Empty file added .nojekyll
Empty file.
2 changes: 1 addition & 1 deletion data/faq-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
!! !!! WARNING WARNING WARNING WARNING WARNING !!! !!
!! !!
!! PLEASE DO NOT OVERWRITE faq.html! !!
!! It will get overwritten by GitHub Actions when someone edits /data/faq.json. !!
!! It will get overwritten by GitHub Actions when someone edits /data/faq.yaml. !!
!! If you want to make changes to the page, please edit /data/faq-template.html instead. !!
!! If you want to make changes to the question template, edit the faq generator in !!
!! /.github/scripts/generate_faq_html.py instead. !!
Expand Down
294 changes: 0 additions & 294 deletions data/faq.json

This file was deleted.

348 changes: 348 additions & 0 deletions data/faq.yaml

Large diffs are not rendered by default.

Binary file modified data/img/faq/mac-unverified-developer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/img/faq/mac-unverified-developer_backup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
246 changes: 165 additions & 81 deletions faq.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Techmino Hub - Home</title>
<link rel="stylesheet" href="style.css">
<noscript>
Expand Down
60 changes: 58 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* -------- Fonts -------- */
@font-face { font-family: "techmino-proportional"; src: url('fonts/proportional.otf') }
/* Currently unused, if you want to use it then uncomment the below line */
/* @font-face { font-family: "techmino-monospace" ; src: url('fonts/monospace.otf') } */
@font-face { font-family: "techmino-monospace" ; src: url('fonts/monospaced.otf') }

/* -------- Body -------- */
body{
Expand All @@ -13,6 +12,10 @@ body{
z-index: -2;
}

body code {
font-family: "techmino-monospace";
}

/* -------- Background -------- */
canvas#bg{
position: fixed;
Expand Down Expand Up @@ -151,6 +154,59 @@ a:not(header a):hover
height: auto;
margin: 0.5rem 0;
}
.expanded .answer img.center {
max-width: 100%;
height: auto;
display: block;
margin: 0 auto;
}
.expanded .answer table {
border-collapse: collapse;
margin: 20px auto;
width: 100%;

/* For scrolling, if the screen's width is too low */
display: block;
max-width: -moz-fit-content;
max-width: fit-content;
overflow-x: auto;
white-space: nowrap;

th {
border: 1.5px solid #ddd;
padding: 8px;
text-align: center;
};
tr {border: 0.75px solid #ddd}
td {
border: 0.75px solid #ddd;
padding: 8px;
text-align: left;
};
}
.expanded .answer table.compact {
border-collapse: collapse;
margin: 20px auto;
width: 100%;
display: flex;

td {border: 0px solid #ddd}
}
@media only screen and (max-width: 700px) {
.expanded .answer table.compact {
/* Inverting/transposing the table */
tr {
display: block;
float: left;
};
th, td {
width: auto !important;
display: block;
border: 0px;
}

}
}

.answer-source {
font-size: 1rem;
Expand Down

0 comments on commit b8fb974

Please sign in to comment.