Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
df3cbd4a5d | ||
![]() |
60621d49f3 | ||
![]() |
689cf7b09d | ||
![]() |
b75e685311 |
7 changed files with 44 additions and 291 deletions
|
@ -1,32 +0,0 @@
|
|||
stages:
|
||||
- build
|
||||
- deploy
|
||||
|
||||
build:
|
||||
image: python:3.6
|
||||
stage: build
|
||||
script:
|
||||
- 'which pip || ( apt-get update -y && apt-get install python3-pip -y )'
|
||||
- pip3 install markdown2
|
||||
- python3 --version
|
||||
- python3 -c "from gitlabCI import build; build()"
|
||||
artifacts:
|
||||
paths:
|
||||
- assets/
|
||||
- images/
|
||||
- templates/
|
||||
- index.html
|
||||
|
||||
deploy:
|
||||
image: ubuntu
|
||||
stage: deploy
|
||||
script:
|
||||
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
|
||||
- mkdir -p ~/.ssh
|
||||
- chmod 700 ~/.ssh
|
||||
- ssh-keyscan proxy.auro.re >> ~/.ssh/known_hosts
|
||||
- chmod 644 ~/.ssh/known_hosts
|
||||
- ssh -o StrictHostKeyChecking=no -J git@proxy.auro.re git@10.128.0.52 "rm -r /var/www/aurore/*"
|
||||
- scp -oProxyJump=git@proxy.auro.re -r assets/ images/ templates/ index.html git@10.128.0.52:/var/www/aurore
|
BIN
doc/ri.pdf
Normal file
BIN
doc/ri.pdf
Normal file
Binary file not shown.
BIN
doc/statuts-projet.pdf
Normal file
BIN
doc/statuts-projet.pdf
Normal file
Binary file not shown.
BIN
doc/statuts.pdf
Normal file
BIN
doc/statuts.pdf
Normal file
Binary file not shown.
238
gitlabCI.py
238
gitlabCI.py
|
@ -1,238 +0,0 @@
|
|||
from markdown2 import markdown_path
|
||||
from typing import List, Tuple
|
||||
from datetime import date
|
||||
from os import walk, system
|
||||
|
||||
|
||||
markdown_dir = 'markdown'
|
||||
html_dir = 'templates'
|
||||
img_dir = 'images'
|
||||
tab = ''
|
||||
|
||||
|
||||
#################################
|
||||
# Build Stage #
|
||||
#################################
|
||||
|
||||
def build() -> None:
|
||||
"""
|
||||
Build all files needed for the web site.
|
||||
|
||||
Build HTML files from Markdown files.
|
||||
Copy images from Markdown directory to HTML directory.
|
||||
Build events template.
|
||||
"""
|
||||
md_files = get_sources()
|
||||
create_html_files(md_files)
|
||||
copy_files(md_files)
|
||||
create_templates(md_files)
|
||||
|
||||
exit(0)
|
||||
|
||||
|
||||
def change_img_url(html: str, html_path: str) -> str:
|
||||
"""
|
||||
Change the URL from each image tag inside the HTML code. The change is done only if it is a local address.
|
||||
|
||||
:param html: The original HTML code
|
||||
:type html: str
|
||||
:param html_path: Path of the HTML code
|
||||
:type html_path: str
|
||||
:return: The modify HTML code
|
||||
:rtype: str
|
||||
|
||||
:Example:
|
||||
|
||||
>>> change_img_url('<img src="images/img.png" />', '13-04-2019-Example')
|
||||
'<img src="templates/13-04-2019-Example/images/img.png" />'
|
||||
>>> change_img_url('<img src="http://example.com" />', '13-04-2019-Example')
|
||||
'<img src="http://example.com" />'
|
||||
"""
|
||||
img_pos = html.find("<img ")
|
||||
if img_pos != -1:
|
||||
new_html = html[:img_pos]
|
||||
else:
|
||||
new_html = html
|
||||
|
||||
while img_pos != -1:
|
||||
src_pos = html.find("src=", img_pos+5)
|
||||
src_end = html.find(html[src_pos + 4], src_pos + 5)
|
||||
src = html[src_pos+5:src_end]
|
||||
if src[:4] != 'http':
|
||||
src = html_path[:html_path.rfind('/')] + '/' + src
|
||||
new_html += html[img_pos:src_pos+5] + src
|
||||
|
||||
img_pos = html.find("<img ", src_end)
|
||||
if img_pos != -1:
|
||||
new_html += html[src_end:img_pos]
|
||||
else:
|
||||
new_html += html[src_end:]
|
||||
|
||||
return new_html
|
||||
|
||||
|
||||
def copy_files(md_files: List[str]) -> None:
|
||||
"""
|
||||
Copy files and directories from Markdown directory to HTML directory.
|
||||
|
||||
:param md_files: List of all Markdown files path in the Markdown directory
|
||||
:type md_files: List[str]
|
||||
"""
|
||||
for md_file in md_files:
|
||||
directory = md_file[:md_file.rfind('/')]
|
||||
system('cp -r ' + directory.replace(' ', '\\ ') + '/* ' + directory.replace(' ', '_').replace(markdown_dir, html_dir))
|
||||
rm_file = md_file.replace(markdown_dir, html_dir).replace(' ', '\\ ')
|
||||
rm_file = rm_file[:rm_file.rfind('/')+1].replace('\\ ', '_') + rm_file[rm_file.rfind('/')+1:]
|
||||
system('rm ' + rm_file)
|
||||
|
||||
|
||||
def create_html_files(md_files: List[str]) -> None:
|
||||
"""
|
||||
Build HTML files from Markdown files.
|
||||
|
||||
:param md_files: List of all Markdown files path in the Markdown directory
|
||||
:type md_files: List[str]
|
||||
"""
|
||||
for md_file in md_files:
|
||||
original_html = markdown_path(md_file) # Conversion from markdown to HTML
|
||||
html_directory = html_dir + '/' + md_file.split('/')[1].replace(' ', '_')
|
||||
html_filename = md_file[:-3].replace(markdown_dir, html_dir).replace(' ', '_') + '.html'
|
||||
system('mkdir ' + html_directory) # Creation of the HTML directory
|
||||
final_html = change_img_url(original_html, html_filename)
|
||||
|
||||
title = md_file[md_file.rfind('/') + 1:].split('-')[3][:-3]
|
||||
event_date = md_file[md_file.rfind('/')+1:][:10].replace('-', '/')
|
||||
final_html = '<h2 class="major"><div class="title">' + title + '</div><div class="date">' + event_date + \
|
||||
'</div></h2>\n' + final_html
|
||||
|
||||
with open(html_filename, 'w', encoding='utf-8') as html_file:
|
||||
html_file.write(final_html) # Write HTML inside the file
|
||||
|
||||
|
||||
def create_templates(md_files: List[str]) -> None:
|
||||
"""
|
||||
Build events and index template.
|
||||
|
||||
:param md_files: List of all Markdown files path in the Markdown directory
|
||||
:type md_files: List[str]
|
||||
"""
|
||||
events_html = '<h2 class="major">Évènements et foyers</h2>\n'
|
||||
index_html = ''
|
||||
if len(md_files) != 0:
|
||||
for md_file in md_files:
|
||||
event_date, title, event = parse_md_filename(md_file.replace(' ', '_'))
|
||||
if (event_date, date, title) == (date.min, '', ''):
|
||||
continue
|
||||
|
||||
events_html += '<a class="event" href="#event-' + event_date.strftime('%d-%m-%Y') + '-' + title + '">\n \
|
||||
<div class="date">' + event_date.strftime('%a %d %b %Y') + '</div>\n \
|
||||
<div class="title">' + title.replace('_', ' ') + '</div>\n \
|
||||
<div class="description">\n' + event + '</div>\n \
|
||||
</a>\n'
|
||||
|
||||
index_html += '<article id="event-' + event_date.strftime(
|
||||
'%d-%m-%Y') + '-' + title + '"></article>\n\t\t\t\t'
|
||||
else:
|
||||
events_html += "<p>Pas d'évènements prévus à ce jour :(</p>\n"
|
||||
|
||||
with open('templates/events.html', 'w', encoding='utf-8') as events_template:
|
||||
events_template.write(events_html)
|
||||
|
||||
initial_index_html = ''
|
||||
with open("index.html", "r", encoding='utf-8') as index_template:
|
||||
for line in index_template:
|
||||
initial_index_html += line
|
||||
|
||||
with open("index.html", "w", encoding='utf-8') as index_template:
|
||||
position = initial_index_html.find('<!-- Events articles -->')
|
||||
index_template.write(initial_index_html[:position] + index_html + initial_index_html[position:])
|
||||
|
||||
|
||||
def del_links(html: str) -> str:
|
||||
"""
|
||||
Delete the link tags (<a>) inside of the HTML code.
|
||||
|
||||
:param html: HTML code with link tags
|
||||
:type html: str
|
||||
:return: HTML code without link tags
|
||||
:rtype: str
|
||||
|
||||
:Example:
|
||||
|
||||
>>> del_links('<p>An <a href="http://example.com">example</a></p>')
|
||||
'<p>An example</p>'
|
||||
"""
|
||||
new_html = ""
|
||||
i = 0
|
||||
opened = False
|
||||
while i < len(html) - 4: # Not going out of range
|
||||
if html[i:i + 3] == "<a ": # Beginning of an opening link tag
|
||||
for j in range(3, len(html) - i - 3):
|
||||
if html[i + j] == ">": # Ending of the opening link tag
|
||||
i += j + 1
|
||||
break
|
||||
opened = True
|
||||
elif html[i:i + 4] == "</a>" and opened: # Closing link tag
|
||||
i += 4
|
||||
opened = False
|
||||
else:
|
||||
new_html += html[i]
|
||||
i += 1
|
||||
|
||||
return new_html
|
||||
|
||||
|
||||
def get_sources() -> List[str]:
|
||||
"""
|
||||
Search and return markdown files path used as sources.
|
||||
|
||||
:return: The markdown files
|
||||
:rtype: List[str]
|
||||
"""
|
||||
md_files = []
|
||||
for (root, dirs, files) in walk(markdown_dir):
|
||||
for file in files:
|
||||
if file[-3:] == '.md': # It is a markdown file
|
||||
md_files.append(root + '/' + file)
|
||||
|
||||
return md_files
|
||||
|
||||
|
||||
def parse_md_filename(filename: str) -> Tuple[date, str, str]:
|
||||
"""
|
||||
Parse the Markdown file to have the event date, the title and the description.
|
||||
|
||||
:param filename: Filename of the Markdown file.
|
||||
Format must be: day-month-year-title.md
|
||||
:type filename: str
|
||||
:return: If the filename format is correct: (Event Date, Title, Description)
|
||||
If it is not correct: (date.min, '', '')
|
||||
:rtype: Tuple[date, str, str]
|
||||
|
||||
:Example:
|
||||
|
||||
>>> parse_md_filename('13-06-2019-Example.md')
|
||||
(date(2019, 06, 13), Example, *Content of the Markdown file without link tags*)
|
||||
>>> parse_md_filename('13-06-2019-BadExample')
|
||||
(date.min, '', '')
|
||||
>>> parse_md_filename('Bad-Example')
|
||||
(date.min, '', '')
|
||||
"""
|
||||
split = filename[filename.rfind('/') + 1:].split('-')
|
||||
if len(split) == 4: # Format is good : day_month_year_title.md
|
||||
day, month, year, title = split
|
||||
title = title[:-3] # Remove the extension
|
||||
event_date = date(int(year), int(month), int(day))
|
||||
else:
|
||||
return date.min, '', ''
|
||||
|
||||
event = ''
|
||||
nb_line = 0
|
||||
with open(filename.replace(markdown_dir, html_dir).replace('.md', '.html'), 'r', encoding='utf-8') as html_file:
|
||||
for line in html_file:
|
||||
if nb_line > 0:
|
||||
event += line
|
||||
nb_line += 1
|
||||
event = del_links(event)
|
||||
|
||||
return event_date, title, event
|
|
@ -21,6 +21,6 @@
|
|||
|
||||
<h4 class="submajor">Liens utiles</h4>
|
||||
<blockquote>
|
||||
Statuts : <a href="https://wiki.auro.re/_media/statuts.pdf">https://wiki.auro.re/_media/statuts.pdf</a> <br />
|
||||
Règlement intérieur : <a href="https://wiki.auro.re/_media/ri.pdf">https://wiki.auro.re/_media/ri.pdf</a>
|
||||
<a href="doc/statuts.pdf">Statuts</a><br />
|
||||
<a href="doc/statuts.pdf">Règlement Intérieur</a>
|
||||
</blockquote>
|
||||
|
|
|
@ -1,48 +1,71 @@
|
|||
<h2 class="major">Services de l'association</h2>
|
||||
|
||||
<p>
|
||||
|
||||
Vous pouvez retrouver une liste mise à jour des services fourni par l'assocation sur <a href="https://re2o.auro.re">l'intranet</a>.
|
||||
|
||||
Vous pouvez retrouver une liste mise à jour des services fourni par
|
||||
l'assocation sur <a href="https://re2o.auro.re">l'intranet</a>.
|
||||
</p>
|
||||
|
||||
<h4 class="submajor">Nextcloud</h4>
|
||||
<blockquote>
|
||||
<a href="https://nextcloud.auro.re">Nextcloud</a> est un service
|
||||
d'hébergement de fichiers que Aurore fournit à ses adhérents à hauteur
|
||||
de 30 Go par personne. Vous pouvez syncrhoniser vos données, votre
|
||||
calendrier et vos contacts sur toutes vos machines (smartphone et
|
||||
ordinateur). Vous pouvez vous y connecter grâce à vos identifiants
|
||||
Aurore.
|
||||
</blockquote>
|
||||
|
||||
<h4 class=submajor>Riot/Matrix</h4>
|
||||
<blockquote>
|
||||
<a href="https://riot.auro.re">Riot</a> est un service de discussion instanée en ligne chiffré et décentralisé. Compatible avec IRC et Discord. Vous pouvez vous y connecter grâce à vos identifiants aurore.
|
||||
<a href="https://riot.auro.re">Riot</a> est un service de discussion
|
||||
instanée en ligne chiffré et décentralisé. Compatible avec IRC et
|
||||
Discord. Vous pouvez vous y connecter grâce à vos identifiants aurore.
|
||||
</blockquote>
|
||||
|
||||
<h4 class=submajor> CodiMD </h4>
|
||||
<blockquote>
|
||||
<a href="https://codimd.auro.re">CodiMD</a> permet la création de document collaboratifs et facilement partageable incluent de nombreuses fonctionnalités dont le support des équations LaTeX.
|
||||
<a href="https://codimd.auro.re">CodiMD</a> permet la création de
|
||||
document collaboratifs et facilement partageable incluent de nombreuses
|
||||
fonctionnalités dont le support des équations LaTeX.
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h4 class=submajor>PrivateBin</h4>
|
||||
<blockquote>
|
||||
<a href="https://privatebin.auro.re">PrivateBin</a> est un service pour partager un contenu avec un lien. Copier-coller, enoyer ! Le lien est sécurisé et peut être à usage unique.
|
||||
<a href="https://privatebin.auro.re">PrivateBin</a> est un service pour
|
||||
partager un contenu avec un lien. Copier-coller, enoyer ! Le lien est
|
||||
sécurisé et peut être à usage unique.
|
||||
</blockquote>
|
||||
|
||||
<h4 class=submajor>Etherpad</h4>
|
||||
<blockquote>
|
||||
<a href="https://pad.auro.re">Etherpad</a> est un éditeur de texte collaboratif en temps réel très simple et léger.
|
||||
<a href="https://pad.auro.re">Etherpad</a> est un éditeur de texte
|
||||
collaboratif en temps réel très simple et léger.
|
||||
</blockquote>
|
||||
|
||||
|
||||
<h4 class="submajor">Nextcloud</h4>
|
||||
<blockquote>
|
||||
<a href="https://nextcloud.auro.re">Nextcloud</a> est un service d'hébergement de fichier que Aurore fournit à ses adhérents à hauteur de 30 Go par personne. Vous pouvez syncrhoniser vos données, votre calendrier et vos contacts sur toutes vos machines (smartphone et ordinateur).
|
||||
Vous pouvez vous y connecter grâce à vos identifiants Aurore.
|
||||
</blockquote>
|
||||
|
||||
<h3 class="submajor">Projets en construction (Comming Soon)</h3>
|
||||
|
||||
<h4 class="submajor">Mail</h4>
|
||||
<blockquote>
|
||||
Vous pouvez obtenir une adresse mail Aurore ainsi que tous les services accompagnant un compte grâce à RoundCube.<br />
|
||||
Afin d'obtenir cette adresse mail il vaut faire l'activer sur votre compte. Il vous suffit pour cela d'aller sur l'<a href="https://intranet.auro.re/">Intranet</a>, vous connectez, cliquez sur votre pseudo puis sur 'Mon profil' > 'Paramètres mail' > 'Modifier les paramètres mail' > 'Utiliser les mails locaux'. Si vous souhaitez que ces mails soient automatiquement reçus sur votre adresse mail principale il vous faut aussi cocher 'Rediriger les mails locaux'.
|
||||
</blockquote>
|
||||
|
||||
<h4 class="submajor">Git</h4>
|
||||
<blockquote>
|
||||
Si vous aimez utiliser git afin de gérer la phase de développement de projets, Aurore met à votre disposition un GitLab / GitTea.
|
||||
Si vous aimez utiliser git afin de gérer la phase de développement de
|
||||
projets, Aurore mettra bientôt à votre disposition un Gitea.
|
||||
</blockquote>
|
||||
|
||||
<h4 class="submajor">Mail</h4>
|
||||
<blockquote>
|
||||
Vous pouvez obtenir une adresse mail Aurore ainsi que tous les services
|
||||
accompagnant un compte grâce à RoundCube.
|
||||
<br/>
|
||||
Afin d'obtenir cette adresse mail il vaut faire l'activer sur votre compte.
|
||||
Il vous suffit pour cela d'aller sur l'<a
|
||||
href="https://intranet.auro.re/">Intranet</a>, vous connectez,
|
||||
cliquez sur votre pseudo puis sur 'Mon profil' > 'Paramètres mail' >
|
||||
'Modifier les paramètres mail' > 'Utiliser les mails locaux'. Si vous
|
||||
souhaitez que ces mails soient automatiquement reçus sur votre adresse mail
|
||||
principale il vous faut aussi cocher 'Rediriger les mails locaux'.
|
||||
</blockquote>
|
||||
|
||||
Bien d'autres projets sont à venirs ! Vous pouvez mêmes en proposer et
|
||||
apprendre à les deployer vous mêmes en devenant technicien.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue