Commit 816ec663 authored by Lukas Matt's avatar Lukas Matt

Merge branch 'add_services_page' into 'master'

Add services page to association repo

Closes #44 and #35

See merge request !21
parents 66f0a1e8 02fa9c64
Pipeline #1288 passed with stage
in 55 seconds
......@@ -6,6 +6,10 @@ variables:
MARKDOWNPDF: "node_modules/.bin/markdown-pdf"
before_script:
- npm install markdown-to-html markdown-pdf
- curl -o /usr/local/bin/jq -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
- curl -o /usr/local/bin/gojsontmpl -L https://git.feneas.org/feneas/infrastructure/gojsontmpl/raw/master/dist/gojsontmpl
- chmod +x /usr/local/bin/jq
- chmod +x /usr/local/bin/gojsontmpl
test:
stage: test
script:
......
[
{
"name": "Privacy Policy",
"path": "terms/privacy_policy.md",
"files": [
"privacy_policy.pdf",
"privacy_policy.html"
]
},
{
"name": "Code of Conduct",
"path": "terms/code_of_conduct.md",
"files": [
"code_of_conduct.pdf",
"code_of_conduct.html"
]
},
{
"name": "Feneas Rules (Finnish)",
"path": "rules/feneas_rules.fi.md",
"files": [
"feneas_rules.fi.pdf",
"feneas_rules.fi.html"
]
},
{
"name": "Feneas Rules (English)",
"path": "rules/feneas_rules.en.md",
"files": [
"feneas_rules.en.pdf",
"feneas_rules.en.html"
]
},
{
"name": "Feneas Rules (German)",
"path": "rules/feneas_rules.de.md",
"files": [
"feneas_rules.de.pdf",
"feneas_rules.de.html"
]
}
]
......@@ -5,36 +5,54 @@ if [ ! -x "$MARKDOWN" ] || [ ! -x "$MARKDOWNPDF" ]; then
exit 1
fi
command -v jq > /dev/null
if [ "$?" -ne 0 ]; then
echo "Install jq JSON processor (https://stedolan.github.io/jq/) first!"
exit 1
fi
command -v gojsontmpl > /dev/null
if [ "$?" -ne 0 ]; then
echo "Install gojsontmpl (https://git.feneas.org/feneas/infrastructure/gojsontmpl) first!"
exit 1
fi
stage=$1
if [ -z "$stage" ]; then
stage="test"
fi
mkdir -p $stage
cat templates/header.html.tmpl > ${stage}/index.html
href="https://feneas.git.feneas.org/association"
findOpt="-mindepth 2 -maxdepth 2 -type f -name '*.md' ! -iname 'README.*'"
for path in $(eval "find . $findOpt"); do
basename=$(basename $path .md)
nameArr=($(echo -n $basename |sed 's/[_|\.]/ /g'))
# Generate HTML file
$MARKDOWN $path --title "${nameArr[@]^}" > ${stage}/${basename}.html || exit 1
# Generate PDF file
$MARKDOWNPDF -o ${stage}/${basename}.pdf $path || exit 1
# Generate index page
add() {
extention=$1
timestamp=$(date)
cat templates/partial.html.tmpl >> ${stage}/index.html
sed -i 's|{{link}}|'$href'/'${basename}.$extention'|g' ${stage}/index.html
sed -i 's|{{head}}|'${basename}'.'${extention}'|g' ${stage}/index.html
sed -i "s|{{date}}|$timestamp|g" ${stage}/index.html
}
add pdf
add html
#
# Convert markdown to PDF and HTML
#
for entry in $(cat documents.json | jq -r '.[] | @base64'); do
entry=$(echo $entry | base64 -d)
name=$(echo $entry | jq -r .name)
path=$(echo $entry | jq -r .path)
[[ "$path" == "null" ]] && continue
for file in $(echo $entry | jq -r '.files[]'); do
extension=${file##*.}
if [[ "$extension" == "pdf" ]]; then
$MARKDOWNPDF -o ${stage}/${file} $path || exit 1
else
$MARKDOWN $path --title "${name}" > ${stage}/${file} || exit 1
fi
done
done
cat templates/footer.html.tmpl >> ${stage}/index.html
#
# Render html templates
#
gojsontmpl \
-html-base-file index.html.tmpl \
-html-files templates/index.html.tmpl,templates/header.html.tmpl,templates/footer.html.tmpl \
-json-file documents.json > ${stage}/index.html || exit 1
gojsontmpl \
-html-base-file services.html.tmpl \
-html-files templates/services.html.tmpl,templates/header.html.tmpl,templates/footer.html.tmpl \
-json-file services.json > ${stage}/services.html || exit 1
exit 0
[
{
"url_icon": null,
"fa_icon": "far fa-comments",
"name": "Matrix",
"description": "Matrix is open to everyone! Go to <a href=\"https://chat.feneas.org\">chat.feneas.org</a>, register and put <code>https://feneas.org</code> as the custom homeserver (leave identity server as is).",
"access": 0
},
{
"url_icon": null,
"fa_icon": "fas fa-pencil-alt",
"name": "Friendica",
"description": "Friendica is open to everyone! Visit our instance at <a href=\"https://friendica.feneas.org\">friendica.feneas.org</a>.",
"access": 0
},
{
"url_icon": null,
"fa_icon": "fas fa-pencil-alt",
"name": "GangGo",
"description": "GangGo is open to everyone! Visit our instance at <a href=\"https://ganggo.feneas.org\">ganggo.feneas.org</a>.",
"access": 0
},
{
"url_icon": null,
"fa_icon": "fas fa-file-alt",
"name": "Etherpad",
"description": "Etherpad is open to everyone for easy collaboration on text based content. Find our instance at <a href=\"https://pad.feneas.org\">pad.feneas.org</a>.",
"access": 0
},
{
"url_icon": null,
"fa_icon": "fab fa-gitlab",
"name": "GitLab",
"description": "GitLab is accessible by all but only a <a href=\"https://feneas.org/membership/\">member</a> will be able to enjoy all the features of the <a href=\"https://about.gitlab.com/pricing/self-managed/feature-comparison/\">premium instance</a> (License provided by GitLab Inc <i class=\"fas fa-heart text-danger\"></i>) of ours.",
"access": 1
},
{
"url_icon": null,
"fa_icon": "fas fa-cloud",
"name": "Nextcloud",
"description": "Nextcloud is accessible by <a href=\"https://feneas.org/membership/\">members</a> only.",
"access": 2
}
]
</main>
{{- define "footer"}}
</main>
<footer class="site-footer outer">
<div class="site-footer-content inner">
<section class="copyright"><a href="https://feneas.org">Federated Networks Association</a> © 2019</section>
<nav class="site-footer-nav">
<a href="https://feneas.org">Latest Posts</a>
<a href="https://feneas.org/coc" target="_blank" rel="noopener">Code of conduct</a>
<a href="https://feneas.org/privacy" target="_blank" rel="noopener">Privacy policy</a>
<a href="https://feneas.org/rules" target="_blank" rel="noopener">Association rules</a>
</nav>
</div>
</footer>
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js" integrity="sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T" crossorigin="anonymous"></script>
</body>
</html>
{{- end}}
{{- define "header"}}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Federated Networks Association - Files</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="HandheldFriendly" content="True" />
<title>Federated Networks Association - {{.title}}</title>
<link rel="stylesheet" type="text/css" href="https://feneas.org/assets/built/screen.css" />
<link rel="stylesheet" media="all" href="https://feneas.org/assets/built/share-connect-support.css">
<!-- Font Awesome CSS -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
<a class="navbar-brand" href="#">Feneas Files</a>
</nav>
<main role="main" class="container" style="margin-top:60px">
<body class="post-template tag-feneas tag-meetings">
<div class="site-wrapper">
<header class="site-header outer">
<div class="inner">
<nav class="site-nav">
<div class="site-nav-left">
<a class="site-nav-logo" href="https://feneas.org">Federated Networks Association</a>
<ul class="nav" role="menu">
<li class="nav-home" role="menuitem"><a href="https://feneas.org">Back to blog</a></li>
<li class="nav-mission" role="menuitem"><a href="index.html">Documents</a></li>
<li class="nav-membership" role="menuitem"><a href="services.html">Services</a></li>
</ul>
</div>
<div class="site-nav-right">
<div class="social-links">
</div>
<a class="rss-button" href="https://feneas.org/rss/" target="_blank" rel="noopener"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><circle cx="6.18" cy="17.82" r="2.18"></circle><path d="M4 4.44v2.83c7.03 0 12.73 5.7 12.73 12.73h2.83c0-8.59-6.97-15.56-15.56-15.56zm0 5.66v2.83c3.9 0 7.07 3.17 7.07 7.07h2.83c0-5.47-4.43-9.9-9.9-9.9z"></path></svg></a>
</div>
</nav>
</div>
</header>
<main id="site-main" class="site-main outer">
{{- end}}
{{set . "title" "Documents"}}
{{template "header" .}}
<div class="inner">
<article class="post-full post tag-feneas tag-meetings">
<header class="post-full-header">
<h1 class="post-full-title">{{.title}}</h1>
</header>
<section class="post-full-content">
{{range .JSON}}
{{$root := .}}
{{range .files}}
<p>
<a href="https://feneas.git.feneas.org/association/{{.}}">
{{$root.name}}
</a> - <small>{{.}}</small> - <small>{{date}}</small>
</p>
{{end}}
{{end}}
</section>
</article>
</div>
{{template "footer" .}}
<p><a href="{{link}}">{{head}}</a> - <small>{{date}}</small></p>
{{set . "title" "Service Comparison"}}
{{template "header" .}}
<div class="inner">
<article class="post-full post tag-feneas tag-meetings">
<header class="post-full-header">
<h1 class="post-full-title">{{.title}}</h1>
</header>
<section class="post-full-content">
<table>
<thead>
<tr>
<th>Service</td>
<th>Non-Member</td>
<th>Member</td>
<th>Description</td>
</tr>
</thead>
<tbody>
{{range .JSON}}
<tr>
<th style="white-space:nowrap;">
{{- if .url_icon}}
<img style="max-width:100%;" src="{{.url_icon}}" alt="{{.url_icon}}" />
{{- else}}
{{- if .fa_icon}}
<i class="{{.fa_icon}}"></i>
{{- end}}
{{- end}} <b>{{.name}}</b>
</th>
<td style="text-align:center;">
{{- $level := toint .access}}
{{- if eq $level 0}}
<i class="fas fa-check-circle" style="color:#28a745;"></i>
{{- end}}
{{- if eq $level 1}}
<i class="fas fa-minus-circle"></i>
{{- end}}
{{- if eq $level 2}}
<i class="fas fa-times-circle" style="color:#dc3545;"></i>
{{- end}}
</td>
<td style="text-align:center;">
<i class="fas fa-check-circle text-success" style="color:#28a745;"></i>
</td>
<td style="white-space:normal;">{{raw .description}}</td>
</tr>
{{end}}
</tbody>
</table>
<p>We will extend this list in future! We want to provide many services but we need your help.</p>
<p>
Become a <a href="https://feneas.org/membership">member</a>
or buy some cool swag from our <a href="https://holvi.com/shop/feneas/">shop</a>
so that we can bring more federated and decentralized instances up.
</p>
</section>
</article>
</div>
{{template "footer" .}}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment