34 Commits

Author SHA1 Message Date
4e3af32f41 fix: link to sources
All checks were successful
Build and Deploy to MinIO / build (push) Successful in 1m19s
Build and Deploy to MinIO / deploy (push) Successful in 59s
2025-09-06 09:03:47 +02:00
bcd9480e66 fix: same for download-artifact
All checks were successful
Build and Deploy to MinIO / build (push) Successful in 1m17s
Build and Deploy to MinIO / deploy (push) Successful in 38s
2025-09-06 06:35:24 +02:00
4c22c889bf build: change version of upload-artifact
Some checks failed
Build and Deploy to MinIO / build (push) Successful in 1m53s
Build and Deploy to MinIO / deploy (push) Failing after 24s
2025-09-06 06:30:14 +02:00
fbd7a0ce54 build: add gostscrip to ci
Some checks failed
Build and Deploy to MinIO / build (push) Failing after 1m10s
Build and Deploy to MinIO / deploy (push) Has been skipped
2025-09-06 06:24:24 +02:00
5e5a40eebe build: split workflow in 2 jobs
Some checks failed
Build and Deploy to MinIO / build (push) Failing after 1m11s
Build and Deploy to MinIO / deploy (push) Has been skipped
2025-09-06 06:17:32 +02:00
5d81ca35c5 build: try other syntax
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 51s
2025-09-06 05:52:04 +02:00
1aede656fa build: remove $
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 41s
2025-09-06 05:48:13 +02:00
3c9feb0cf5 build: fix variable syntax
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 43s
2025-09-06 05:44:06 +02:00
ec8d4d23b7 build: use vars.***
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 43s
2025-09-05 22:55:58 +02:00
7577854064 build: add debugger for variables
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 43s
2025-09-05 22:52:29 +02:00
9e8d523de1 build: add debugger
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 42s
2025-09-05 22:47:43 +02:00
03290ee848 build: add echo $BRANCH_NAME
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 42s
2025-09-05 22:40:58 +02:00
be17a9952c build: fix content source
Some checks failed
Build and Deploy to MinIO / build-and-deploy (push) Failing after 42s
2025-09-05 22:34:31 +02:00
251d637a7b build: mc
All checks were successful
Build and Deploy to MinIO / build-and-deploy (push) Successful in 6m20s
2025-09-05 22:25:18 +02:00
711fbb12d5 build: add deployment 2025-09-05 22:09:43 +02:00
cadbaa163e feat: update version and refs 2025-09-05 22:09:32 +02:00
29a9a51543 import .drone.yml from master
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-25 16:51:17 +02:00
e6642eaeaa change source for pelican
All checks were successful
continuous-integration/drone/push Build is passing
2023-07-25 16:27:51 +02:00
8674186937 fix: variable substition
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 16:25:59 +02:00
61bf2af24c fix: variable...
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 16:25:03 +02:00
ae080680ad Fix: variable syntax
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 16:22:14 +02:00
b87388939f feat: drone for 2022-2023 branch
Some checks failed
continuous-integration/drone/push Build is failing
2023-07-25 16:20:06 +02:00
340f10a023 Fix: change source-link base url 2023-04-15 05:57:15 +02:00
435c787b2e Fix: pelicanconf import
All checks were successful
continuous-integration/drone/push Build is passing
2023-04-14 14:44:55 +02:00
cb9820afa5 Fix: add __init__.py
Some checks failed
continuous-integration/drone/push Build is failing
2023-04-14 14:43:10 +02:00
5f7dea074e Fix: formating
Some checks failed
continuous-integration/drone/push Build is failing
2023-04-14 14:41:25 +02:00
0194eb763e Fix: years 2023-04-14 14:40:51 +02:00
0d4e4d74b0 Feat(core): update .drone.yml
All checks were successful
continuous-integration/drone/push Build is passing
2023-04-14 14:29:07 +02:00
1ae89f63d0 Feat(plugin): enable source-link plugin 2023-04-14 14:26:11 +02:00
d90ed8149d Feat(plugin): add link to sources in template 2023-04-14 14:25:52 +02:00
dab40dddd0 Fix: " et ' 2023-04-14 13:57:39 +02:00
9a2d687434 Feat(core): add css build command 2023-04-14 13:56:58 +02:00
7ea7fba87c Feat(plugin): add source-link plugin 2023-04-14 13:56:29 +02:00
ae45ff7d42 Feat: add pre-commit config 2023-04-14 13:56:14 +02:00
15 changed files with 271 additions and 53 deletions

View File

@@ -1,30 +0,0 @@
kind: pipeline
name: Opytex 2021-2022
type: docker
trigger:
branch:
- 2021-2022
steps:
- name: Deploy
image: python:3.8-alpine
commands:
- apk add --no-cache openssh-client ca-certificates bash rsync git imagemagick-dev imagemagick
- git submodule init
- git submodule update
- git clone https://git.opytex.org/lafrite/2021-2022.git content
- pip install --no-cache-dir -r requirements.txt
- export MAGICK_HOME=/usr
- pelican ./content/ -o output -s publishconf.py --relative-urls
- eval `ssh-agent -s`
- echo "$SSH_KEY" | ssh-add -
- mkdir -p ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- ssh sshcontent@91.121.90.228 'mkdir -p ~/opytex.org/www/enseignements/2021-2022/'
- rsync -rv --delete -e "ssh -p 22" ./output/ sshcontent@91.121.90.228:~/opytex.org/www/enseignements/2021-2022/ --checksum
environment:
SSH_KEY:
from_secret: sshcontent-key

107
.gitea/workflows/deploy.yml Normal file
View File

@@ -0,0 +1,107 @@
name: Build and Deploy to MinIO
on:
push:
branches:
# - master
- 2025-2026
jobs:
build:
runs-on: ubuntu-latest
outputs:
branch-type: ${{ steps.branch-info.outputs.branch-type }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Set branch type
id: branch-info
run: |
if [ "${{ gitea.ref }}" = "refs/heads/master" ]; then
echo "branch-type=master" >> $GITEA_OUTPUT
else
echo "branch-type=year" >> $GITEA_OUTPUT
fi
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.13"
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y imagemagick libmagickwand-dev ghostscript
- name: Install Python dependencies
run: |
pip install --no-cache-dir -r requirements.txt
- name: Setup content directory for year branches
env:
BRANCH_NAME: ${{ gitea.ref_name }}
if: gitea.ref != 'refs/heads/master'
run: |
echo "Branch name: $BRANCH_NAME"
echo "Testing URL: https://git.opytex.org/Cours/${BRANCH_NAME}.git"
curl -I "https://git.opytex.org/Cours/${BRANCH_NAME}.git" || echo "URL not accessible"
rm -rf content
git clone https://git.opytex.org/Cours/${BRANCH_NAME}.git content
- name: Build site
run: |
export MAGICK_HOME=/usr
pelican ./content/ -o ./output -s publishconf.py --relative-urls
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: site-build
path: output/
retention-days: 1
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifact
uses: actions/download-artifact@v3
with:
name: site-build
path: output/
- name: Install MinIO client
run: |
wget https://dl.min.io/client/mc/release/linux-amd64/mc
chmod +x mc
sudo mv mc /usr/local/bin/
- name: Configure MinIO client
env:
MINIO_REPOSITORY: ${{ secrets.MINIO_REPOSITORY }}
MINIO_ACCESS_KEY: ${{ secrets.MINIO_ACCESS_KEY }}
MINIO_SECRET_KEY: ${{ secrets.MINIO_SECRET_KEY }}
run: |
mc alias set storage $MINIO_REPOSITORY $MINIO_ACCESS_KEY $MINIO_SECRET_KEY
- name: Deploy to MinIO - Master branch
env:
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
if: needs.build.outputs.branch-type == 'master'
run: |
mc mirror --overwrite --exclude "enseignements/*" ./output/ storage/$MINIO_BUCKET
- name: Deploy to MinIO - Year branches
env:
MINIO_BUCKET: ${{ secrets.MINIO_BUCKET }}
BRANCH_NAME: ${{ gitea.ref_name }}
if: needs.build.outputs.branch-type == 'year'
run: |
mc mirror --overwrite --remove ./output/ storage/$MINIO_BUCKET/enseignements/${BRANCH_NAME}/

15
.pre-commit-config.yaml Normal file
View File

@@ -0,0 +1,15 @@
---
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black

View File

@@ -49,8 +49,10 @@ help:
@echo 'Set the RELATIVE variable to 1 to enable relative urls ' @echo 'Set the RELATIVE variable to 1 to enable relative urls '
@echo ' ' @echo ' '
html: css:
lessc $(BASEDIR)/theme/static/stylesheet/style.less $(BASEDIR)/theme/static/stylesheet/style.min.css -x lessc $(BASEDIR)/theme/static/stylesheet/style.less $(BASEDIR)/theme/static/stylesheet/style.min.css -x
html: css
$(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS) $(PELICAN) $(INPUTDIR) -o $(OUTPUTDIR) -s $(CONFFILE) $(PELICANOPTS)
clean: clean:

0
__init__.py Normal file
View File

View File

@@ -7,10 +7,11 @@ import sys
sys.path.append(os.curdir) sys.path.append(os.curdir)
from globalconf import * from globalconf import *
YEAR = "2025-2026"
AUTHOR = "Benjamin Bertrand" AUTHOR = "Benjamin Bertrand"
SITENAME = "OpyTex" SITENAME = "OpyTex"
SITETITLE = "OpyTex" SITETITLE = "OpyTex"
SITESUBTITLE = "2022-2023" SITESUBTITLE = YEAR
SITEURL = "" SITEURL = ""
CC_LICENSE_COMMERCIAL = True CC_LICENSE_COMMERCIAL = True
@@ -44,12 +45,13 @@ PLUGINS = [
"tag_cloud", "tag_cloud",
"pdf-img", "pdf-img",
"big-button", "big-button",
"source-link",
] ]
ALWAYS_MODIFIED = True ALWAYS_MODIFIED = True
# Mirror source structure # Mirror source structure
PATH_METADATA = "(?P<path_no_ext>.*)\..*" PATH_METADATA = r"(?P<path_no_ext>.*)\..*"
ARTICLE_URL = ARTICLE_SAVE_AS = PAGE_URL = PAGE_SAVE_AS = "{path_no_ext}.html" ARTICLE_URL = ARTICLE_SAVE_AS = PAGE_URL = PAGE_SAVE_AS = "{path_no_ext}.html"
# USE_FOLDER_AS_CATEGORY = True # USE_FOLDER_AS_CATEGORY = True
@@ -90,3 +92,7 @@ CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None AUTHOR_FEED_RSS = None
# SOURCE LINK
GIT_SOURCE_BASE_URL = f"https://git.opytex.org/Cours/{YEAR}/src/branch/main"
SOURCE_ICON_URL = "https://git.opytex.org/assets/img/logo.svg"

View File

@@ -5,16 +5,18 @@ If "modified" date/time is not defined in article metadata, fall back to the "cr
from pelican import signals from pelican import signals
from pelican.contents import Content, Article from pelican.contents import Content, Article
def add_modified(content): def add_modified(content):
if not isinstance(content, Article): if not isinstance(content, Article):
return return
if not content.settings.get('ALWAYS_MODIFIED', False): if not content.settings.get("ALWAYS_MODIFIED", False):
return return
if hasattr(content, 'date') and not hasattr(content, 'modified'): if hasattr(content, "date") and not hasattr(content, "modified"):
content.modified = content.date content.modified = content.date
content.locale_modified = content.locale_date content.locale_modified = content.locale_date
def register(): def register():
signals.content_object_init.connect(add_modified) signals.content_object_init.connect(add_modified)

View File

@@ -0,0 +1,31 @@
# Pelican source link plugin
This plugin for [Pelican](https://github.com/getpelican/pelican/) generate two attributes for articles:
- `source_link`: link to the source of the article from your forge
- `path_source_link`: link to the path of the article from your forge
## Installation
Then, add the plugin to your pelicanconf.py file:
```python
PLUGINS = [
# other plugins...
"source_link",
]
```
## Usage
To use the plugin, define a constant named `GIT_SOURCE` in your pelicanconf.py file:
```python
GIT_SOURCE_BASE_URLL = "https://github.com/your-username/your-repo"
```
This constant should contain the base URL of your Git repository where your source code is stored.
Once the constant is defined, the plugin will generate a `source_link` and a `path_source_link` attributes for each article in your Pelican project.
Those links are generated based on the article's source path relative to the root directory of your Pelican project. If the constant PATH is defined in pelicanconf.py, the plugin will use this value as the root directory. Otherwise, it will use the default value of "", which assumes that your Pelican project is located in the same directory as your pelicanconf.py file.

View File

@@ -0,0 +1 @@
from .source_link import *

View File

@@ -0,0 +1,37 @@
from pelican import signals
import logging
import os
logger = logging.getLogger(__name__)
from pelican.settings import DEFAULT_CONFIG
def set_default_settings(settings):
settings.setdefault("GIT_SOURCE_BASE_URL", None)
def init_default_config(pelican):
set_default_settings(DEFAULT_CONFIG)
if pelican:
set_default_settings(pelican.settings)
def source_link_generator(article_generator):
git_source = article_generator.settings.get(
"GIT_SOURCE_BASE_URL", DEFAULT_CONFIG["GIT_SOURCE_BASE_URL"]
)
root_path = article_generator.settings.get("PATH", DEFAULT_CONFIG.get("PATH", ""))
for article in article_generator.articles:
article_path = os.path.abspath(os.path.join(root_path, article.source_path))
relative_path = os.path.relpath(article_path, root_path)
if git_source.endswith("/"):
article.source_link = f"{git_source}{relative_path}"
else:
article.source_link = f"{git_source}/{relative_path}"
article.path_source_link = "/".join(article.source_link.split("/")[:-1])
def register():
signals.initialized.connect(init_default_config)
signals.article_generator_finalized.connect(source_link_generator)

View File

@@ -7,19 +7,21 @@ from __future__ import unicode_literals
import os import os
import sys import sys
sys.path.append(os.curdir) sys.path.append(os.curdir)
from pelicanconf import * from pelicanconf import *
# If your site is available via HTTPS, make sure SITEURL begins with https:// # If your site is available via HTTPS, make sure SITEURL begins with https://
SITEURL = 'https://opytex.org/enseignements/2022-2023/' SITEURL = "https://opytex.org/enseignements/2025-2026/"
RELATIVE_URLS = False RELATIVE_URLS = False
FEED_ALL_ATOM = 'feeds/all.atom.xml' FEED_ALL_ATOM = "feeds/all.atom.xml"
CATEGORY_FEED_ATOM = 'feeds/{slug}.atom.xml' CATEGORY_FEED_ATOM = "feeds/{slug}.atom.xml"
DELETE_OUTPUT_DIRECTORY = True DELETE_OUTPUT_DIRECTORY = True
# Following items are often useful when publishing # Following items are often useful when publishing
#DISQUS_SITENAME = "" # DISQUS_SITENAME = ""
#GOOGLE_ANALYTICS = "" # GOOGLE_ANALYTICS = ""

View File

@@ -1,15 +1,23 @@
anyio==4.10.0
beautifulsoup4==4.9.1 beautifulsoup4==4.9.1
blinker==1.4 blinker==1.9.0
bs4==0.0.1 bs4==0.0.1
docutils==0.16 docutils==0.22
feedgenerator==1.9.1 feedgenerator==2.2.1
Jinja2==2.11.2 idna==3.10
MarkupSafe==1.1.1 Jinja2==3.1.6
pelican==4.2.0 markdown-it-py==4.0.0
Pygments==2.6.1 MarkupSafe==3.0.2
python-dateutil==2.8.1 mdurl==0.1.2
ordered-set==4.1.0
pelican==4.11.0
Pygments==2.18.0
python-dateutil==2.9.0.post0
pytz==2020.1 pytz==2020.1
six==1.15.0 rich==14.1.0
six==1.17.0
sniffio==1.3.1
soupsieve==2.0.1 soupsieve==2.0.1
Unidecode==1.1.1 Unidecode==1.4.0
Wand==0.6.2 Wand==0.6.2
watchfiles==1.1.0

View File

@@ -350,6 +350,33 @@ main {
padding-top: 1em; padding-top: 1em;
} }
.source {
text-align: center;
padding-top: 1em;
img {
border: 0;
box-shadow: none;
}
a {
background-color: @tag-bg;
padding: .2em .6em .2em;
font-size: .74em;
line-height: 1;
color: @tag-text-color;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: .25em;
}
a:hover {
background-color: @tag-hover-color;
}
}
.tag-cloud { .tag-cloud {
text-align: center; text-align: center;
a { a {

File diff suppressed because one or more lines are too long

View File

@@ -48,6 +48,16 @@
mod=article.locale_modified, mod=article.locale_modified,
category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }} category='<a href="%s/%s">%s</a>'|format(SITEURL, article.category.url, article.category)|safe) }}
</div> </div>
{% if 'GIT_SOURCE_BASE_URL' %}
<div class="source">
<a href="{{ article.path_source_link}}">
<img src={{ SOURCE_ICON_URL }} alt="source icon" ario>
source et documents
</a>
</div>
{% endif %}
<div class="tag-cloud"> <div class="tag-cloud">
<p> <p>
{% if 'post_stats' in PLUGINS %} {% if 'post_stats' in PLUGINS %}