Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation Home Page #76

Merged
merged 8 commits into from
Sep 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .github/workflows/pub_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ jobs:
persist-credentials: false
token: ${{ secrets.ALE_DIS_PAT }}
submodules: "true"
- name: Set up Node 🧶
uses: actions/setup-node@v2
with:
node-version: "12"
- name: Set up Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install package and build docs 📦
- name: Install package 📦
run: |
# install pip
python -m pip install --upgrade pip
Expand All @@ -38,9 +42,16 @@ jobs:
run: |
pip install -r doc_requirements.txt
sudo apt-get install graphviz
cd docs/sphinx/
cd docs/home-page
yarn
make
cd ../sphinx/
make html
mv build/html ~/html
- name: Save files 💾
run: |
mv build/html ~
mv ../home-page ~
mv ../_assets ~
- name: Prepare deployment ⌛
run: |
# fetch all branches
Expand All @@ -51,6 +62,8 @@ jobs:
if [ "$dest_dir" = "master" ]; then
dest_dir="stable"
fi
mv ~/home-page/* .
mv ~/_assets .
mv ~/html $dest_dir
- name: Deploy 🚀
#uses: JamesIves/github-pages-deploy-action@releases/v3
Expand All @@ -60,7 +73,7 @@ jobs:
#FOLDER: "docs/sphinx/build/html" # The folder the action should deploy.
uses: EndBug/add-and-commit@v4.4.0
with:
message: "I'm deploying ${{ github.ref }}"
message: "Currently deploying: ${{ github.ref }}"
ref: "gh-pages"
env:
GITHUB_TOKEN: ${{ secrets.ALE_DIS_PAT }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="center">
<a href="https://n3pdf.github.io/yadism/"><img alt="Yadism" src="docs/logo/logo.png" width=600></a>
<a href="https://n3pdf.github.io/yadism/"><img alt="Yadism" src="docs/_assets/logo/logo.png" width=600></a>
</p>

<p align="center">
Expand Down
4 changes: 4 additions & 0 deletions doc_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ sphinx
sphinx_rtd_theme
recommonmark
sphinxcontrib-bibtex
Jinja2
numpy
pygit2
semver
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
papers/
demo/
31 changes: 31 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
DEMODIR=demo/yadism

.PHONY: all, demo, view, clean, home-page, assets, sphinx-html, demo-dir

all: demo

demo: home-page assets sphinx-html

demo-dir:
@mkdir -p $(DEMODIR)

home-page: demo-dir
cd home-page && echo ${PWD} && make
cp -r home-page/build/* $(DEMODIR)

assets: demo-dir
cp -r _assets $(DEMODIR)

sphinx-html: demo-dir
cd sphinx && echo ${PWD} &&make html
cp -r sphinx/build/html $(DEMODIR)
@mv $(DEMODIR)/html $(DEMODIR)/develop

view:
@python3 -m http.server 8000 --directory demo &
${BROWSER} localhost:8000

clean:
cd sphinx && make clean
cd home-page && make clean
rm -rf demo
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
Binary file added docs/_assets/n3pdf_badge.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 docs/_assets/n3pdf_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
116 changes: 116 additions & 0 deletions docs/home-page/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
35 changes: 35 additions & 0 deletions docs/home-page/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SASS="./node_modules/dart-sass/sass.js"

.PHONY: all html css _js view clean

all: html css _js

html: build/index.html

css: build/home.css

_js: build/js

build:
@mkdir -p build

build/index.html: index.html.jinja build
@echo "\e[1m\e[4m\e[35mFilling HTML templates:\e[0m"
python3 compile_template.py $< $@
@echo

build/home.css: home.scss build
@echo "\e[1m\e[4m\e[35mCompiling CSS from SASS:\e[0m"
${SASS} --no-source-map $< $@
@echo

build/js: js build
@echo "\e[1m\e[4m\e[35mProviding Javascript:\e[0m"
cp -r $< $@
@echo

view:
@${BROWSER} build/index.html

clean:
rm -rf build
89 changes: 89 additions & 0 deletions docs/home-page/compile_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import sys
import pathlib
import re

import numpy as np
import pygit2
from jinja2 import Environment, FileSystemLoader
import semver

here = pathlib.Path(__file__)
repo_path = here.absolute().parents[2]
repo = pygit2.Repository(repo_path)

# ==========
# globals
# ==========


here = pathlib.Path(__file__).parent.absolute()
env = Environment(loader=FileSystemLoader(str(here)))


def get_tags():
# semver_regex = "0|[1-9]\d*\.0|[1-9]\d*\.0|[1-9]\d*?:-?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*?:\.?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]**??:\+[0-9a-zA-Z-]+?:\.[0-9a-zA-Z-]+*?$"
semver_regex = "\d+\.\d+\.\d+.*"
tag_pattern = re.compile(f"^refs/tags/v({semver_regex})")

tags = [tag_pattern.fullmatch(x) for x in repo.listall_references()]
tags_num = [semver.VersionInfo.parse(x.groups(1)[0]) for x in tags if x is not None]

return tags_num


def get_deployed_tags():
r"""
if anything more complicated needed to parse the name of directory of
deployed tags look at:
http://
python-semver.readthedocs.io/en/latest/usage.html#dealing-with-invalid-versions
"""
tree = repo.revparse_single("gh-pages").tree
tags_deployed = [e.name for e in tree if e.type == 2]

tags_num = []
for x in tags_deployed:
try:
tags_num.append(semver.VersionInfo.parse(x.groups(1)[0] + ".0"))
except ValueError:
pass

return tags_num


def filter_recent_tags(time_wall, tags_num):
wall = semver.VersionInfo.parse(time_wall)
recent_tags_num = []
for tag in tags_num:
if tag >= wall:
recent_tags_num.append(tag)
return recent_tags_num


def tags_to_dict(tags_num):
versions_tmp = {}
for tag in tags_num:
major = tag.major
minor = tag.minor
if major not in versions_tmp:
versions_tmp[major] = [minor]
else:
versions_tmp[major].append(minor)

versions = {}
for major, minors in versions_tmp.items():
versions[major] = list(np.unique(minors))

return versions


versions = tags_to_dict(filter_recent_tags("0.0.0", get_tags()))

# ==========
# dump
# ==========

data = dict(versions=versions)
template = env.get_template(sys.argv[1])
stream = template.stream(data)
stream.dump(str(here / sys.argv[2]))
41 changes: 41 additions & 0 deletions docs/home-page/home.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
@import "node_modules/bulma/sass/utilities/_all.sass";
@import "node_modules/bulma/sass/elements/button.sass";
@import "node_modules/bulma/sass/components/dropdown.sass";
@import url("https://fonts.googleapis.com/css2?family=Grandstander:ital,wght@0,200;0,500;0,900;1,200;1,500;1,900&display=swap");

* {
text-align: center;
font-family: "Grandstander", cursive;
font-weight: 200;
}

#title {
font-size: 5em;
font-weight: 500;
}

.container {
display: flex;
flex-direction: column;
justify-content: flex-end;
}

.item {
}

.version-row {
@extend .container;
flex-direction: row;
justify-content: center;
}

.docs-version {
@extend .item;
@extend .button;
//border-width: 2;
margin: 1em;
}

.dropdown {
margin: 2em;
}
Loading