first commit, with fully functining page

This commit is contained in:
HackerNCoder 2023-06-11 00:04:07 +00:00
commit 0fd0423349
16 changed files with 270 additions and 0 deletions

21
.woodpecker.yml Normal file
View file

@ -0,0 +1,21 @@
pipeline:
build:
image: python:3.8-bullseye
commands:
- apt-get update
- apt-get install -y git gettext ca-certificates wget python3-pip
- wget https://gitlab.torproject.org/tpo/web/lego/-/raw/main/lektor-requirements.txt -O requirements.txt
- python3 -m pip install --require-hashes -r requirements.txt
- lektor build --output-path public
- rm -r public
- lektor build --output-path public
- lektor build --output-path public
publish:
image: debian
commands:
- rm -r /var/www/comlib/*
- cp -r public/* /var/www/comlib/
volumes:
- /var/www/comlib/:/var/www/comlib/
when:
branch: main

85
assets/static/style.css Normal file
View file

@ -0,0 +1,85 @@
body {
font-family: 'Verdana', sans-serif;
margin: 0;
background: #f1fbfe;
}
a {
color: #2a99b6;
}
a:hover {
color: #33bbdf;
}
header, footer, div.page {
margin: 0 auto;
padding: 20px 30px;
}
header {
background: #D62828;
padding: 2rem 0 0;
}
header h1 {
text-align: center;
color: #eae2b7;
margin: 1rem 0 2rem;
font-weight: normal;
font-size: 42px;
width: 100vw;
}
header nav ul {
list-style: none;
margin: 0;
padding: 0 0 0 1rem;
}
header nav ul li {
display: inline;
margin: 0 8px 0 0;
padding: 0;
}
header nav ul li a {
font-size: 1.05em;
color: #EAE2B7;
text-decoration: none;
padding: 3px 3px 0;
background: black;
border-width: 1px 1px 0 1px;
border-style: solid;
border-color: black;
border-radius: 5px 5px 0 0;
}
header nav ul li a:hover {
color: #ADD7F6;
}
.list-none {
list-style: none;
}
.bib {
margin: 10px 0;
}
.bib-title {
font-weight: bold;
}
.bib-author {
font-size: 0.9em;
}
.bib-pubdate {
font-size: 0.9em;
font-style: italic;
}
.bib-publisher {
font-size: 0.9em;
font-style: italic;
}

2
comlib.lektorproject Normal file
View file

@ -0,0 +1,2 @@
[project]
name = comlib

11
content/contents.lr Normal file
View file

@ -0,0 +1,11 @@
title: Welcome to the Comrades Library!
---
body:
This is a website dedicated to helping comrades find and access books valuable in their journey towards understanding the world and politics. While somewhat overlapping with other projects, e.g. the Marxist Internet Archive (marxists.org), it is not meant to duplicate their efforts, and anything that fits there should go there.
This project originally started because I wanted to create an EPUB of "Is the Red Flag Flying?" for my own use, but recognised that it would be a good idea to publish it online for others too.
 
I would very much like to thank and highlight the work done by MYRALIS ⌬ ALZAPHARYX ([@zandapheri](https://twitter.com/zandapheri)), who has been gathering and scanning many books on Korea. Which has been the source of the entire initial library.

View file

@ -0,0 +1,3 @@
_model: bib
---
title: Korea

View file

@ -0,0 +1,11 @@
title: Facts Tell
---
author: Foreign Ministry of the Democratic Peoples Republic of Korea
---
publisher: Foreign Languages Publishing House, Pyongyang
---
pub_date: 1960
---
orig: https://disk.yandex.com/i/yhOQiEZ9GNdgyg
---
cache: facts-tell.pdf

View file

@ -0,0 +1,9 @@
title: History Will Judge The Hangmen
---
publisher: Foreign Languages Publishing House, Pyongyang
---
pub_date: 1979
---
orig: https://archive.org/details/history-will-judge-the-hangmen
---
cache: history-will-judge-the-hangman.pdf

View file

@ -0,0 +1,9 @@
title: To The People Of The Whole World: On US Army Atrocities In South Korea
---
author: Korean Democratic Lawyers Association, Korean National Peace Committee, Korean Committee for Asian-African Solidarity, General Federation of Trade Unions of Korea, Korean Democratic Youth League, Korean Democratic Women's Union, Korean Journalists Union, and Korean Students Committee
---
pub_date: 1961-04-15
---
orig: https://archive.org/details/to-the-people-of-the-whole-world
---
cache: to-the-people-of-the-whole-world.pdf

11
models/bib.ini Normal file
View file

@ -0,0 +1,11 @@
[model]
name = Bib
label = {{ this.title }}
[fields.title]
label = Title
type = string
[children]
model = book
order_by = title

35
models/book.ini Normal file
View file

@ -0,0 +1,35 @@
[model]
name = Book
label = {{ this.title }}
[fields.title]
label = Title
type = string
[fields.author]
label = Author
type = string
[fields.publisher]
label = Publisher
type = string
[fields.pub_date]
label = Publication date
type = string
[fields.ebook]
label = Ebook file name
type = string
[fields.image]
label = Image name
type = string
[fields.orig]
label = Origin URL
type = url
[fields.cache]
label = Cached file name
type = string

11
models/page.ini Normal file
View file

@ -0,0 +1,11 @@
[model]
name = Page
label = {{ this.title }}
[fields.title]
label = Title
type = string
[fields.body]
label = Body
type = markdown

15
templates/bib.html Normal file
View file

@ -0,0 +1,15 @@
{% extends "layout.html" %}
{% block title %}{{ this.title }}{% endblock %}
{% block body %}
<h2>{{ this.title }}</h2>
<ul class="list-none">
{% for post in this.children %}
<li class="bib">
<span class="bib-title">{{ post.title }}</span>
<span class="bib-orig">(<a href="{{ post.orig }}">{{ post.orig.host }}</a>{% if post.cache %}, <a href="/lib/cache{{ post.parent.path }}/{{ post.cache }}">cached</a>{% endif %})</span><br>
{% if post.author %}<span class="bib-author">by {{ post.author }}</span><br>{% endif %}
{% if post.publisher %}<span class="bib-publisher">{{ post.publisher}}, </span>{% endif %}<span class="bib-pubdate">{{ post.pub_date }}</span>
</li>
{% endfor %}
</ul>
{% endblock %}

15
templates/layout.html Normal file
View file

@ -0,0 +1,15 @@
<!doctype html>
<meta charset="utf-8">
<link rel="stylesheet" href="{{ '/static/style.css'|url }}">
<title>{% block title %}Welcome{% endblock %} — Comrades Library</title>
<body>
<header>
<h1>Comrades Library</h1>
{% include 'nav.html' %}
</header>
<div class="page">
{% block body %}{% endblock %}
</div>
<footer>
</footer>
</body>

View file

@ -0,0 +1,15 @@
{% macro render_pagination(pagination) %}
<div class="pagination">
{% if pagination.has_prev %}
<a href="{{ pagination.prev|url }}">&laquo; Previous</a>
{% else %}
<span class="disabled">&laquo; Previous</span>
{% endif %}
| {{ pagination.page }} |
{% if pagination.has_next %}
<a href="{{ pagination.next|url }}">Next &raquo;</a>
{% else %}
<span class="disabled">Next &raquo;</span>
{% endif %}
</div>
{% endmacro %}

11
templates/nav.html Normal file
View file

@ -0,0 +1,11 @@
<nav>
<ul class="nav navbar-nav">
<li{% if this._path == '/' %} class="active"{% endif%}><a href="{{ '/'|url }}">Home</a></li>
{% for href, title in [
['/korea', 'Korea'],
] %}
<li{% if this.is_child_of(href) %} class="active"{% endif
%}><a href="{{ href|url }}">{{ title }}</a></li>
{% endfor %}
</ul>
</nav>

6
templates/page.html Normal file
View file

@ -0,0 +1,6 @@
{% extends "layout.html" %}
{% block title %}{{ this.title }}{% endblock %}
{% block body %}
<h2>{{ this.title }}</h2>
{{ this.body }}
{% endblock %}