home » zplus/dokk.org.git
Author zPlus <zplus@peers.community> 2024-12-27 12:28:13
Committer zPlus <zplus@peers.community> 2024-12-27 12:28:13
Commit e89559e (patch)
Tree 3b4a79d
Parent(s)

Add "Comics" section. - Add XKCD - Move Mimi&Eunice to Comics section


commits diff: e600530..e89559e
7 files changed, 143 insertions, 6 deletionsdownload


Diffstat
-rwxr-xr-x app.py 86
-rw-r--r-- templates/comics/index.html 21
-rw-r--r-- templates/comics/mimi_and_eunice/index.html 0
-rw-r--r-- templates/comics/mimi_and_eunice/strip.html 2
-rw-r--r-- templates/comics/xkcd/index.html 16
-rw-r--r-- templates/comics/xkcd/strip.html 22
-rw-r--r-- templates/index.html 2

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+82/-4 M   app.py
index ad971da..9ad73bb
old size: 14K - new size: 16K
@@ -451,7 +451,28 @@ def manpages_page(distro_name, distro_number, package, page):
451 451 'html': html,
452 452 })
453 453
454 - @bottle.get('/mimi_and_eunice', name='mimi_and_eunice')
454 + @bottle.get('/comics', name='comics')
455 + def comics():
456 + """
457 + Comics index.
458 + """
459 +
460 + data = query("""
461 + PREFIX comics: <dokk:vocab:comicstrip:>
462 +
463 + SELECT DISTINCT ?id ?title
464 + WHERE {
465 + ?id a comics:ComicStrip ;
466 + comics:title ?title
467 + }
468 + ORDER BY ?id
469 + """)
470 +
471 + pages = data['results']['bindings']
472 +
473 + return template('comics/index.html', pages=pages)
474 +
475 + @bottle.get('/comics/mimi_and_eunice', name='mimi_and_eunice')
455 476 def mimi_and_eunice():
456 477 """
457 478 Mimi&Eunice index.
@@ -469,9 +490,9 @@ def mimi_and_eunice():
469 490 ORDER BY ?number
470 491 """)
471 492
472 - return template('mimi_and_eunice/index.html', data=data)
493 + return template('comics/mimi_and_eunice/index.html', data=data)
473 494
474 - @bottle.get('/mimi_and_eunice/<number>', name='mimi_and_eunice_strip')
495 + @bottle.get('/comics/mimi_and_eunice/<number>', name='mimi_and_eunice_strip')
475 496 def mimi_and_eunice_strip(number):
476 497 """
477 498 """
@@ -505,7 +526,64 @@ def mimi_and_eunice_strip(number):
505 526 'blob:at': {}
506 527 })
507 528
508 - return template('mimi_and_eunice/strip.html', data=data['@graph'][0])
529 + return template('comics/mimi_and_eunice/strip.html', data=data['@graph'][0])
530 +
531 + @bottle.get('/comics/xkcd', name='xkcd')
532 + def xkcd():
533 + """
534 + XKCD index.
535 + """
536 +
537 + data = query(f"""
538 + PREFIX comics: <dokk:vocab:comicstrip:>
539 +
540 + SELECT ?id ?number ?title
541 + WHERE {{
542 + ?id comics:series <dokk:xkcd> ;
543 + comics:number ?number ;
544 + comics:title ?title
545 + }}
546 + ORDER BY ?number
547 + """)
548 +
549 + data = data['results']['bindings']
550 +
551 + return template('comics/xkcd/index.html', data=data)
552 +
553 + @bottle.get('/comics/xkcd/<number>', name='xkcd_strip')
554 + def xkcd_strip(number):
555 + """
556 + """
557 +
558 + iri = '<dokk:xkcd_comic_' + number + '>'
559 +
560 + data = query(f'''
561 + prefix blob: <dokk:vocab:blob:>
562 + prefix license: <dokk:vocab:license:>
563 + prefix comics: <dokk:vocab:comicstrip:>
564 +
565 + DESCRIBE {iri} ?license ?blob
566 + WHERE
567 + {{
568 + {iri} a comics:ComicStripPanel ;
569 + comics:license ?license;
570 + blob:at ?blob
571 + }}
572 + ''',
573 + {
574 + '@context': {
575 + 'blob': 'dokk:vocab:blob:',
576 + 'license': 'dokk:vocab:license:',
577 + 'comics': 'dokk:vocab:comicstrip:',
578 + 'comics:tag': { '@container': '@set' },
579 + 'comics:transcript': { '@container': '@set' }
580 + },
581 + '@type': 'comics:ComicStripPanel',
582 + 'comics:license': {},
583 + 'blob:at': {}
584 + })
585 +
586 + return template('comics/xkcd/strip.html', data=data['@graph'][0])
509 587
510 588 @bottle.get('/articles', name='articles')
511 589 def articles():

+21/-0 A   templates/comics/index.html
index 0000000..307b952
old size: 0B - new size: 393B
new file mode: -rw-r--r--
@@ -0,0 +1,21 @@
1 + {% extends "base.html" %}
2 +
3 + {% block title %}Comics{% endblock %}
4 +
5 + {% block body %}
6 +
7 + <div class="comics">
8 +
9 + <div class="path">
10 + <a href="{{ url('homepage') }}">DOKK</a> /
11 + comics
12 + </div>
13 +
14 + {% for page in pages %}
15 + <p>
16 + <a href="/comics/{{ page['id']['value'][5:] }}">{{ page['title']['value'] }}</a>
17 + </p>
18 + {% endfor %}
19 + </div>
20 +
21 + {% endblock %}

+0/-0 R   templates/mimi_and_eunice/index.html -> templates/comics/mimi_and_eunice/index.html
index 04144e8..04144e8
old size: 391B - new size: 391B

+1/-1 R   templates/mimi_and_eunice/strip.html -> templates/comics/mimi_and_eunice/strip.html
index c162f56..184f505
old size: 943B - new size: 944B
@@ -11,7 +11,7 @@
11 11 Published: {{ data['comics:published'] }}
12 12 </p>
13 13 <p>
14 - Liense:
14 + License:
15 15 <a href="{{ url('license', id=data['comics:license']['license:id']) }}">{{ data['comics:license']['license:id'] }}</a>
16 16 </p>
17 17 <p>

+16/-0 A   templates/comics/xkcd/index.html
index 0000000..7a83aa7
old size: 0B - new size: 348B
new file mode: -rw-r--r--
@@ -0,0 +1,16 @@
1 + {% extends "base.html" %}
2 +
3 + {% block title %}XKCD{% endblock %}
4 +
5 + {% block body %}
6 +
7 + <div class="">
8 + {% for comic_strip in data %}
9 + <p>
10 + {{ comic_strip['number']['value'] }} -
11 + <a href="{{ url('xkcd_strip', number=comic_strip['number']['value']) }}">{{ comic_strip['title']['value'] }}</a>
12 + </p>
13 + {% endfor %}
14 + </div>
15 +
16 + {% endblock %}

+22/-0 A   templates/comics/xkcd/strip.html
index 0000000..4ca77b5
old size: 0B - new size: 578B
new file mode: -rw-r--r--
@@ -0,0 +1,22 @@
1 + {% extends "base.html" %}
2 +
3 + {% block title %}XKCD {{ data['comics:number']['@value'] }}: {{ data['comics:title'] }}{% endblock %}
4 +
5 + {% block body %}
6 +
7 + <div class="xkcd_strip">
8 + <h1>{{ data['comics:title'] }}</h1>
9 +
10 + <p>
11 + Published: {{ data['comics:published'] }}
12 + </p>
13 + <p>
14 + License:
15 + <a href="{{ url('license', id=data['comics:license']['license:id']) }}">{{ data['comics:license']['license:id'] }}</a>
16 + </p>
17 +
18 + <img src="https://blob.dokk.org/{{ data['blob:at']['@id'][8:] }}" title="{{ data['comics:xkcd_alt'] }}" />
19 +
20 + </div>
21 +
22 + {% endblock %}

+1/-1 M   templates/index.html
index 83bc128..f0bc8d6
old size: 731B - new size: 702B
@@ -12,7 +12,7 @@
12 12 <p>- <a href="/library">Library</a></p>
13 13 <p>- <a href="/license">Licenses</a></p>
14 14 <p>- <a href="/manpages">Man pages</a></p>
15 - <p>- <a href="/mimi_and_eunice">Mimi & Eunice comic strips</a></p>
15 + <p>- <a href="/comics">Comics</a></p>
16 16
17 17 <br /><br /><br /><br />
18 18