Compare commits

...

8 Commits

Author SHA1 Message Date
gauthiier bf4c1e0cab css media 2024-08-23 10:16:24 +02:00
gauthiier e3801fdb8c header 2023-09-12 08:38:24 +02:00
gauthiier 265cbb4e70 txt-md 2023-09-12 08:36:35 +02:00
gauthiier 9d84b99449 allo (bis) 2023-08-03 11:31:30 +02:00
gauthiier 01d08880dc allo (bis) 2023-08-03 11:27:57 +02:00
gauthiier 07e2e50124 allo 2023-08-03 11:24:25 +02:00
gauthiier 7ec2394871 cleanup 2023-08-03 11:23:55 +02:00
gauthiier 038b5a6bf1 imgconv for lod 2023-08-03 11:14:49 +02:00
9 changed files with 292 additions and 142 deletions
+1 -8
View File
@@ -1,11 +1,4 @@
.static/settings.json .static/settings.json
venv/ venv/
+++/*.jpg
+++/*.jpeg
+++/*.pdf
+++/Screen-Shot-2014-05-26-at-20.40.24-b.png
+++/bb15.png
+++/533201N0032129W_from_the_Sea_poster.png
+++/key.asc
+++/index.html
.DS_Store .DS_Store
__pycache__
+5
View File
@@ -1,2 +1,7 @@
__sssstatic __sssstatic __sssstatic __sssstatic __sssstatic __sssstatic __sssstatic __sssstatic
<center><img src="https://git.le-club-des-sans-sujets.org/gauthiier/__sssstatic/raw/commit/038b5a6bf18aba7f5998d00077ce567b87cbe699/styles/+++/david-gauthier.jpg" /></center>
[directory/file-based generation of static www pages for https://davidgauthier.info]
+57 -30
View File
@@ -1,50 +1,67 @@
#!/usr/bin/env python #!/usr/bin/env python
import argparse, json, sys, markdown, shutil, json, re, pathlib, shutil import argparse, json, sys, markdown, shutil, json, re, pathlib, shutil
import utils.imgconv
input_dir = None input_dir = None
output_dir = None output_dir = None
style = None style = None
(W, H, FMT) = (None, None, None)
codebase = pathlib.Path(__file__).parent.absolute() codebase = pathlib.Path(__file__).parent.absolute()
def translate_index_header(txt, dirname): def translate_index_header(txt, dirname):
href = None sections = txt.count('- - -')
sections = txt.count('- - -');
if sections == 0: if sections == 0:
# not following the normal template -> direct html # not following the normal template -> direct html
txt = txt.replace('data/', dirname + '/'); #<--- replace reference to data/ txt = txt.replace('data/', dirname + '/') #<--- replace reference to data/
return txt return txt
elif sections == 1: elif sections == 1:
[text, link] = txt.split('- - -'); [text, link] = txt.split('- - -')
elif sections == 2:
[text, link, href] = txt.split('- - -');
text_md = markdown.markdown(text); text_md = markdown.markdown(text)
link_md = markdown.markdown(link); link_info = json.loads(link)
# revise this - perhaps with a better dirpath = pathlib.Path(dirname)
link_md = link_md.replace('data/', dirname + '/'); img_name = pathlib.Path(link_info['img']).name
img_path = dirpath / img_name
img_resize_path = dirpath / "img-resize" / img_name
picture_el = emit_picture(str(img_path), str(img_resize_path))
table = codebase / "templates/<table>" table = codebase / "templates/<table>"
with table.open(encoding="utf-8") as fp: with table.open(encoding="utf-8") as fp:
out = fp.read() out = fp.read()
out = out.replace('[[text_md]]', text_md); out = out.replace('[[text_md]]', text_md);
out = out.replace('[[link_md]]', link_md); out = out.replace('[[link_md]]', picture_el);
if href: if link_info['href']:
href = href.replace('data/', dirname + '/'); if link_info['href'] == "data":
out = "<a " + href + ">" + out + "</a>"; href = dirname + "/"
else:
href = link_info['href']
out = "<a href='" + href + "'>" + out + "</a>";
return out return out
def escape_date(dirname): def escape_date(dirname):
return re.sub('^20\d{2}?.', '', dirname) return re.sub('^20\d{2}?.', '', dirname)
def emit_picture(src_full, src_resize):
return f'''<picture>
<source media="(max-width: 799px)" srcset="{src_resize}" />
<source media="(min-width: 800px)" srcset="{src_full}" />
<img src="{src_full}" />
</picture>'''
def emit_img(file: pathlib.Path, data_dir: pathlib.Path): def emit_img(file: pathlib.Path, data_dir: pathlib.Path):
## this is where LOD can be applied ## this is where LOD can be applied
resize_dir = data_dir / "img-resize"
resize_dir.mkdir(parents=True, exist_ok=True)
filepath = data_dir / file
resize_file = utils.imgconv.convert(filepath, (W, H, FMT), resize_dir)
return f'<a href="{file}"><img src="{file}" /></a>' return f'<a href="{file}">' + emit_picture(str(file), "img-resize/" + resize_file.name) + '</a>'
def emit_video_mp4(file: pathlib.Path, data_dir: pathlib.Path): def emit_video_mp4(file: pathlib.Path, data_dir: pathlib.Path):
return f'<video controls><source src="{file}" type="video/mp4"</video>' return f'<video controls><source src="{file}" type="video/mp4"</video>'
@@ -53,7 +70,9 @@ def emit_audio(file: pathlib.Path, data_dir: pathlib.Path, full=False):
# an '.audio' file is a json file with a list of audio elements # an '.audio' file is a json file with a list of audio elements
# which need to be bundles as a type of list in a single <li> # which need to be bundles as a type of list in a single <li>
if not file.is_file():
file = data_dir / file; file = data_dir / file;
if file.is_file(): if file.is_file():
with file.open() as fp: with file.open() as fp:
audio = json.loads(fp.read()) audio = json.loads(fp.read())
@@ -93,6 +112,7 @@ def default(file, data_dir):
content_map = { content_map = {
'.png': emit_img, '.png': emit_img,
'.jpg': emit_img, '.jpg': emit_img,
'.jpeg': emit_img,
'.m4v': emit_video_mp4, '.m4v': emit_video_mp4,
'.mov': emit_video_mp4, '.mov': emit_video_mp4,
'.mp4': emit_video_mp4, '.mp4': emit_video_mp4,
@@ -123,10 +143,11 @@ def index_content(dir_name: str, data_dir: pathlib.Path, index_txt: pathlib.Path
if desc_md is None and content_index is None: if desc_md is None and content_index is None:
return; return;
content_desc = ""
content = "" content = ""
if desc_md: if desc_md:
content += "<li>" + "<desc>" + "\n" + desc_md + "</desc>" + "</li>" + "\n"; content_desc += "<li>" + "<desc>" + "\n" + desc_md + "</desc>" + "</li>" + "\n";
if content_index: if content_index:
@@ -134,7 +155,7 @@ def index_content(dir_name: str, data_dir: pathlib.Path, index_txt: pathlib.Path
for i in content_index: for i in content_index:
f = data_dir / i f = data_dir / i
if f.is_file(): if f.is_file():
files.append(i); files.append(data_dir / i);
else: else:
files += [pathlib.Path(a.name) for a in list(data_dir.glob(i))] files += [pathlib.Path(a.name) for a in list(data_dir.glob(i))]
@@ -148,7 +169,10 @@ def index_content(dir_name: str, data_dir: pathlib.Path, index_txt: pathlib.Path
if element: if element:
content += "<li>" + element + "</li>" + "\n"; content += "<li>" + element + "</li>" + "\n";
html = template.replace('[[content]]', content).replace('[[dir]]', str(dir_name));
# check if there is an html file existing already. if so use that one.
html = template.replace('[[content_desc]]', content_desc).replace('[[content]]', content).replace('[[dir]]', str(dir_name));
try: try:
out = data_dir / 'index.html' out = data_dir / 'index.html'
@@ -180,6 +204,7 @@ if __name__ == '__main__':
p.add_argument('--output', "-o", help='output directory'); p.add_argument('--output', "-o", help='output directory');
p.add_argument('--style', "-y", default="+++", help='css style, ico, etc.'); p.add_argument('--style', "-y", default="+++", help='css style, ico, etc.');
p.add_argument("--settings", "-s", default=".static/settings.json", help="Settings file (default: .static/settings.json") p.add_argument("--settings", "-s", default=".static/settings.json", help="Settings file (default: .static/settings.json")
p.add_argument('--format', '-f', default="1000x1000", help='img output formats (ex. 1000x)');
p.add_argument('--clean', help='cleans the output directory'); p.add_argument('--clean', help='cleans the output directory');
args = p.parse_args(); args = p.parse_args();
@@ -201,15 +226,20 @@ if __name__ == '__main__':
if inputdir is not None: if inputdir is not None:
input_dir = inputdir; input_dir = inputdir;
else: else:
print(f"Input directory {args.input} is not a directory... Aborting.") sys.exit(f"Input directory {args.input} is not a directory... Aborting.")
sys.exit(1)
if args.output: if args.output:
outputdir = check_dir_exists(args.output, create=True) outputdir = check_dir_exists(args.output, create=True)
if outputdir is not None: if outputdir is not None:
output_dir = outputdir; output_dir = outputdir;
else: else:
print(f"Output directory {args.output} is not a directory... Aborting.") sys.exit(f"Output directory {args.output} is not a directory... Aborting.")
sys.exit(1)
if args.format:
(W, H, FMT) = utils.imgconv.parse_format(args.format)
if not FMT:
sys.exit(f"Format {str(args.format)} is not valid. Aborting.")
if style is not None: if style is not None:
style_dir = codebase / f"styles/{style}" style_dir = codebase / f"styles/{style}"
@@ -217,8 +247,7 @@ if __name__ == '__main__':
style = args.style style = args.style
if input_dir is None: if input_dir is None:
print(f"Error with input directory... Aborting.") sys.exit(f"Error with input directory... Aborting.")
sys.exit(1)
if output_dir is None: if output_dir is None:
print(f"No output directory.") print(f"No output directory.")
@@ -236,7 +265,6 @@ if __name__ == '__main__':
except: except:
print(f"error erasing {output_dir}. Continuing.") print(f"error erasing {output_dir}. Continuing.")
print('1/3 - Configuring'); print('1/3 - Configuring');
# main index template # main index template
@@ -271,13 +299,11 @@ if __name__ == '__main__':
datadir = d / "data" datadir = d / "data"
if datadir.is_dir(): if datadir.is_dir():
section_indx_txt = datadir / "index.txt" section_indx_txt = datadir / "index.txt"
section_desc_txt = datadir / "desc.txt" section_desc_txt = datadir / "desc.md"
out_index = None
if section_indx_txt.is_file() or section_desc_txt.is_file(): if section_indx_txt.is_file() or section_desc_txt.is_file():
out_index = index_content(dirname, d, section_indx_txt, section_desc_txt, section_indx_template_str); out_index = index_content(dirname, datadir, section_indx_txt, section_desc_txt, section_indx_template_str)
if out_index is None:
continue
if output_dir is not None: if output_dir is not None:
out_datadir = output_dir / dirname out_datadir = output_dir / dirname
@@ -298,6 +324,7 @@ if __name__ == '__main__':
continue continue
# copy index after (since index.html might be lurking in content dirs) # copy index after (since index.html might be lurking in content dirs)
if out_index:
try: try:
shutil.copy2(out_index, out_datadir) shutil.copy2(out_index, out_datadir)
except: except:
+2 -1
View File
@@ -21,7 +21,8 @@ case $1 in
;; ;;
run) run)
echo "running" echo "running"
# source venv/bin/activate source venv/bin/activate
export MAGICK_HOME=/opt/homebrew/Cellar/imagemagick/7.1.1-15_1
# exec python $2 "${@:3}" # exec python $2 "${@:3}"
esac esac
+13 -51
View File
@@ -20,57 +20,19 @@
<pre> <pre>
-----BEGIN PGP PUBLIC KEY BLOCK----- -----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFwRHKQBEACm4RTJEAvqrczYPNDtu08mB7PQ6mouSgWNLxPIY0QWNEhZJKLE mDMEZLoz/RYJKwYBBAHaRw8BAQdAsuOzLRb5SR4kJKpiFcP3XhPYyrcm8lqJQCzq
bPj8eE5sG6gSaNTePC0RVBZDhNC9YXHJiMPaa2Av4LBK+xQSi4oMxB3qaWzRpNm1 Kgq0cau0RURhdmlkIEdhdXR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s32L+lI157vLvzWhCy9O+Q74Gm2aNP65Bjg684x0Uq3/Cn+
5zSxWcmlrqqmkNgSsRrU9Ke9R/7uLr7pGcOqOcFS95Gc6b8eT8JXnkNyqrdDp2Yu
G9LtWOQKf+k+3qZtJruWng+NybYZuPmudaILqiNZCBJuqMXztkW5DDRueq5MghMZ
xmrCe+5x2QKCypd0DgjPjAMRRbWzXuEpsxmZz4bPTNTrtNASfZ461s14LRCb94yq
Ba1Wq5ZcXWdBqOQ6WPfdm535Hey3Pj+7YYsoq+kKcPprq6PiKh/S7h7VC7mUxo9R
Oak/kJqwXpfo92Kg2kzSYw6El4jcNjvEvlH0EvZaq40jp6Kjh3JENjqxDUyWeN0=
=rlRS
-----END PGP PUBLIC KEY BLOCK-----
</pre>
<br> <br>
</div> </div>
</body> </body>
+112 -33
View File
@@ -5,70 +5,106 @@ body {
padding: 0; padding: 0;
} }
.tableau { hd {
border: 10px grey ridge; display: flex;
margin: 5em; flex-direction: column;
margin-bottom: 1em; max-width: 45em;
min-width: 250px;
} }
hd img {
width: 80%;
border: 10px grey ridge;
margin-bottom: 1em;
margin-top: 5em;
}
h1 { font-size: 2.7vw; }
h2 { font-size: 2.2vw;}
h3 { font-size: 1.7vw;}
h4 { font-size: 1.3vw;}
table { table {
display: block;
margin: 1em; margin: 1em;
border: 10px grey ridge; border: 10px grey ridge;
font-size: small;
text-align: left; text-align: left;
width: 55em; max-width: 55em;
min-width: 250px;
} }
table td { table tr {
border: 2px grey ridge; display: flex;
flex-direction: column;
text-align: center;
}
table tr td {
padding: 1em; padding: 1em;
/* width: 75em;*/
} }
table td h1 { table td h1 {
bborder: 1px red solid;
margin-top: 0.4em; margin-top: 0.4em;
margin-bottom: 0.2em; margin-bottom: 0.2em;
} }
table tr td img {
width: 100%;
height: auto;
border: 2px grey ridge;
}
table tr td video {
width: 100%;
height: auto;
border: 2px grey ridge;
}
table td p { table td p {
bborder: 1px red solid;
margin-top: 0.1em; margin-top: 0.1em;
margin-bottom: 0.4em; margin-bottom: 0.4em;
} }
h1 a:hover, h1 a:active {
table tr { text-decoration: none;
text-align: center;
} }
table td img { a:hover p, a:active p {
width: 100%; text-decoration: none;
border: 2px grey ridge;
} }
.lst { .lst {
display: flex;
flex-direction: column;
margin-right: 3em; margin-right: 3em;
margin-left: 3em;
} }
.lst p mat { .lst p mat {
margin-left: : 2em; margin-left: : 2em;
} }
.lst ul li { display: inline; }
.lst ul li desc { .lst ul li desc {
margin: 2em; margin-left: 1em;
margin-right: 1em;
margin-bottom: 1em; margin-bottom: 1em;
width: 985; min-width: 250px;
max-width: 1024px;
display: block; display: block;
} }
.lst ul li desc img { .lst ul li desc img {
border: 10px grey ridge; border: 10px grey ridge;
margin: 0em; margin: 0em;
margin-bottom: 2em; margin-bottom: 2em;
width: 985; width: 98%;
display: block; display: block;
} }
@@ -76,36 +112,42 @@ table td img {
border: 10px grey ridge; border: 10px grey ridge;
margin: 0em; margin: 0em;
margin-bottom: 2em; margin-bottom: 2em;
width: 985; width: 98%;
display: block; display: block;
} }
.lst ul li { display: inline-block; }
.lst ul li img { .lst ul li img {
border: 10px grey ridge; border: 10px grey ridge;
margin: 2em; margin: 0.5em;
margin-bottom: 1em; margin-bottom: 1em;
width: 450; resize: both;
overflow: auto;
width: 488px;
} }
.lst ul li video { .lst ul li video {
border: 10px grey ridge; border: 10px grey ridge;
margin: 2em; margin: 0.5em;
margin-bottom: 1em; margin-bottom: 1em;
width: 450; width: 488px;
} }
.lst ul li sound { .lst ul li sound {
display: inline-block; display: block;
border: 10px grey ridge; border: 10px grey ridge;
margin: 2em; margin-left: 1em;
width: 440; margin-right: 1em;
padding: 10; padding: 10;
min-width: 250px;
max-width: 990px;
} }
.lst ul li sound track { .lst ul li sound track {
display: block;
margin-top: 0.3em; margin-top: 0.3em;
margin-bottom: 0.3em; margin-bottom: 0.3em;
width: 100%;
} }
.lst ul li sound info { .lst ul li sound info {
@@ -117,19 +159,19 @@ table td img {
margin-top: 0.5em; margin-top: 0.5em;
} }
.lst ul li lo img { .lst ul li desc lo img {
border: none; border: none;
margin: 1em; margin: 1em;
margin-top: 0.5em; margin-top: 0.5em;
max-width: 300; max-width: 300;
} }
.lst ul li la img { .lst ul li desc la img {
border: none; border: none;
margin: 1em; margin: 1em;
margin-top: 0.5em; margin-top: 0.5em;
max-width: 100; max-width: 100;
max-height: 100; min-width: 100;
} }
address { address {
@@ -140,4 +182,41 @@ address {
margin: 20px; margin: 20px;
} }
@media screen and (max-width: 1200px) {
h1 { font-size: 6vw; }
h2 { font-size: 5.3vw;}
h3 { font-size: 5vw;}
h4 { font-size: 4vw;}
p { font-size: 3.7vw;}
pre { font-size: 3.5vw;}
table {
max-width: 65em;
}
.lst ul li { display: block; }
.lst ul li img {
border: 10px grey ridge;
margin: 0.5em;
margin-bottom: 1em;
width: 96%;
min-width: 250px;
}
.lst ul li video {
border: 10px grey ridge;
margin: 0.5em;
margin-bottom: 1em;
width: 96%;
min-width: 250px;
}
}
+3
View File
@@ -14,6 +14,9 @@
</div> </div>
<div class="lst"> <div class="lst">
<ul>
[[content_desc]]
</ul>
<ul> <ul>
[[content]] [[content]]
</ul> </ul>
+6 -8
View File
@@ -1,22 +1,20 @@
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="keywords" content="david gauthier, gauthiier, davidgauthier, dviid"> <meta name="keywords" content="david gauthier, gauthiier, davidgauthier">
<meta name="description" content="David Gauthier (b.1979, CA) - selected index of works"> <meta name="description" content="David Gauthier (b.1979, CA) - selected index of works">
<link rel="icon" href="+++/jules-henri.ico" type="image/x-icon"> <link rel="icon" href="+++/jules-henri.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="+++/lestyle.css"/> <link rel="stylesheet" type="text/css" href="+++/lestyle.css"/>
<link rel="pgpkey" href="+++/key.asc"/>
<link rel="openid.delegate" href="http://gauthiier.info/" />
<link rel="openid.server" href="https://indieauth.com/openid" />
<title>David Gauthier</title> <title>David Gauthier</title>
</head> </head>
<body> <body>
<div align="center"> <div align="center">
<a href="+++/"><img src="+++/yeux.png" width="500" class="tableau"></a> <hd>
<h4>David Gauthier</h4> <a href="+++/"><img src="+++/yeux.png" class="tableau"></a>
<h3>David Gauthier</h3>
<h1><i>(Selected) Index of works</i></h1> <h1><i>(Selected) Index of works</i></h1>
<h4><a href="https://www.uu.nl/medewerkers/DGauthier">index of academic work</a></h4> <h3><a href="https://www.uu.nl/staff/DGauthier">index of academic work</a></h3>
<h4>d[at]gauthiier.info</h4> </hd>
[[content]] [[content]]
</div> </div>
</body> </body>
+82
View File
@@ -0,0 +1,82 @@
import argparse, pathlib, subprocess, sys
from wand.image import Image
supported_glob = "[jpJP][npNP][egEG]"
def sanity_check_system():
r = subprocess.call("magick -version", shell=True) == 0
if not r:
sys.exit("ImageMagick not installed. Aborting...")
def parse_format(format_str):
fmt = format_str.lower()
if 'x' in fmt:
w_h = fmt.split('x')
w = int(w_h[0]) if w_h[0] != '' else 0
h = int(w_h[1]) if w_h[1] != '' else 0
return(w, h, fmt)
return (None, None, None)
def convert(filepath : pathlib.Path, fmt : tuple, output_dir: pathlib.Path):
(w, h, f) = fmt
# img exists?
output = output_dir / filepath.name
if output.exists() and output.is_file():
with Image(filename=str(output)) as img:
if w > 0 and img.width == w or h > 0 and img.height == h:
return output
with Image(filename=str(filepath)) as img:
print(f". converting {filepath}")
print(f" > {img.size}")
img.resolution = (72, 72)
if w > 0 and img.width > w or h > 0 and img.height > h:
img.transform(resize=f)
print(f" > {img.size}")
img.save(filename=str(output))
return output
def convert_all(input_dir: pathlib.Path, fmt : tuple, output_dir: pathlib.Path):
img_files = input_dir.glob("*." + supported_glob + "*")
for i in img_files:
convert(i, fmt, output_dir)
if __name__ == '__main__':
p = argparse.ArgumentParser(description='Converts images files to other formats (using wand/ImageMagick)');
p.add_argument('-i', '--input', help='input directory');
p.add_argument('-o', '--output', help='output directory');
p.add_argument('-f', '--format', help='output formats (ex. 1000x)');
sanity_check_system()
args = p.parse_args()
if not args.format:
sys.exit("No formats specified. Aborting.")
input_dir = pathlib.Path(".")
if args.input:
input_dir = pathlib.Path(args.input)
if not input_dir.exists() or not input_dir.is_dir():
sys.exit(f"Input {str(input_dir)} is not a directory. Aborting.")
output_dir = input_dir / "img-resize"
if args.output:
output_dir = pathlib.Path(args.output)
output_dir.mkdir(parents=True, exist_ok=True)
(w, h, fmt) = parse_format(args.format)
if not fmt:
sys.exit(f"Format {str(args.format)} is not valid. Aborting.")
img_files = input_dir.glob("*." + supported_glob + "*")
for i in img_files:
convert(i, (w, h, fmt), output_dir)