Merge branch 'claude/relaxed-faraday-h4zd09' of https://github.com/pablovolenski/vienalatina
This commit is contained in:
commit
62904a8c35
@ -48,11 +48,13 @@ bp = Blueprint("content", __name__)
|
||||
# structure, and changing "Acerca de" is an administrator's job.
|
||||
COLLECTIONS = {
|
||||
"post": {
|
||||
"label": "Artículos", "singular": "Artículo",
|
||||
"label": "Artículos", "singular": "Artículo", "new_label": "Nuevo artículo",
|
||||
"folder": "content/post", "dated": True, "role": "moderator",
|
||||
},
|
||||
"page": {
|
||||
"label": "Páginas", "singular": "Página",
|
||||
# `new_label` spelled out rather than "Nuevo " + the singular: Spanish
|
||||
# gives the article a gender, and the button read "Nuevo página".
|
||||
"label": "Páginas", "singular": "Página", "new_label": "Nueva página",
|
||||
"folder": "content/page", "dated": False, "role": "admin",
|
||||
},
|
||||
}
|
||||
@ -69,6 +71,11 @@ BODY_MAX = 100_000
|
||||
# file in the repository — the pipeline and the Caddyfile included.
|
||||
SAFE_NAME = re.compile(r"^[A-Za-z0-9][A-Za-z0-9._-]*\.es\.md$")
|
||||
|
||||
# A byline links to a profile on this site or to nothing. Same shape as a
|
||||
# username, with the leading slash, so no form can turn an author link into a
|
||||
# link somewhere else.
|
||||
AUTHOR_URL = re.compile(r"^/[A-Za-z0-9][A-Za-z0-9._-]{0,38}$")
|
||||
|
||||
|
||||
# --- the contract with translate.py --------------------------------------
|
||||
|
||||
@ -114,6 +121,19 @@ def frontmatter_for(collection: str, form: dict) -> dict:
|
||||
fields["description"] = form["description"]
|
||||
if form["image"]:
|
||||
fields["image"] = form["image"]
|
||||
# Who wrote it, for the page rather than for git. The commit has named
|
||||
# the author since the editor was built; the article did not, so a
|
||||
# reader could not tell whose it was or click through to them.
|
||||
#
|
||||
# `author_url` is only ever set when that member has published their
|
||||
# page — a byline linking to a 404 is worse than a byline that does not
|
||||
# link. translate.py copies both into the German and Portuguese
|
||||
# siblings by itself: it carries the whole frontmatter and translates
|
||||
# only title and description, and a name is not translated.
|
||||
if form.get("author"):
|
||||
fields["author"] = form["author"]
|
||||
if form.get("author_url"):
|
||||
fields["author_url"] = form["author_url"]
|
||||
return fields
|
||||
|
||||
|
||||
@ -211,6 +231,16 @@ def _read_form(collection: str) -> tuple[dict, str, list[str]]:
|
||||
errors.append("La fecha debe tener el formato AAAA-MM-DD.")
|
||||
|
||||
categories = [c for c in request.form.getlist("categories") if c in CATEGORIES]
|
||||
|
||||
# Carried through the form as hidden fields, the way the date and the image
|
||||
# path are: they belong to the document being edited, not to whoever is
|
||||
# editing it, so saving a correction must not re-sign the post. Checked on
|
||||
# the way back in because a hidden field is only a convention — the URL has
|
||||
# to be a path on this site and nothing else.
|
||||
author = request.form.get("author", "").strip()[:80]
|
||||
author_url = request.form.get("author_url", "").strip()
|
||||
if author_url and not AUTHOR_URL.match(author_url):
|
||||
author_url = ""
|
||||
image = request.form.get("image", "").strip()
|
||||
if image and not re.match(r"^/uploads/[A-Za-z0-9._-]+$", image):
|
||||
errors.append("La imagen no es válida.")
|
||||
@ -226,6 +256,7 @@ def _read_form(collection: str) -> tuple[dict, str, list[str]]:
|
||||
"description": request.form.get("description", "").strip(),
|
||||
"image": image,
|
||||
"manual_translation": request.form.get("manual_translation") == "on",
|
||||
"author": author, "author_url": author_url,
|
||||
}
|
||||
return fields, body, errors
|
||||
|
||||
@ -271,6 +302,40 @@ def _upload_image() -> str:
|
||||
return commit_picture(upload.read(), upload.filename)
|
||||
|
||||
|
||||
def _field(row, name, default=None):
|
||||
"""One lookup that works on a sqlite3.Row and on a plain dict.
|
||||
|
||||
They disagree about what a missing key is — IndexError for one, KeyError for
|
||||
the other — and `approve` hands this a dict built from a row, so both arrive
|
||||
here.
|
||||
"""
|
||||
try:
|
||||
return row[name]
|
||||
except (KeyError, IndexError):
|
||||
return default
|
||||
|
||||
|
||||
def byline(author) -> dict:
|
||||
"""The two frontmatter keys naming a writer, from their member row.
|
||||
|
||||
Takes the row (or the plain dict `submissions.approve` builds from one), so
|
||||
that a post published through the editor and a proposal approved by somebody
|
||||
else produce the same two keys from the same code — and in the second case
|
||||
they name the member, not the moderator who pressed the button.
|
||||
"""
|
||||
if author is None:
|
||||
return {}
|
||||
login = _field(author, "gitea_login", "")
|
||||
name = _field(author, "display_name", "") or login
|
||||
if not name:
|
||||
return {}
|
||||
published = _field(author, "profile_published", 0)
|
||||
return {
|
||||
"author": name,
|
||||
"author_url": f"/{login}" if published and login else "",
|
||||
}
|
||||
|
||||
|
||||
def publish(collection: str, fields: dict, body: str, author) -> str:
|
||||
"""Write one post or page into the repository and return its path.
|
||||
|
||||
@ -280,6 +345,7 @@ def publish(collection: str, fields: dict, body: str, author) -> str:
|
||||
the button: `gitea.write_file` sends author and committer per commit, so an
|
||||
approved submission keeps the member's name in git history.
|
||||
"""
|
||||
fields = dict(fields, **byline(author))
|
||||
name = filename_for(collection, fields["title"], fields["date"])
|
||||
path = f"{COLLECTIONS[collection]['folder']}/{name}"
|
||||
document = build_document(frontmatter_for(collection, fields), body)
|
||||
@ -357,6 +423,12 @@ def edit(collection: str, name: str):
|
||||
"description": fm.get("description", ""),
|
||||
"image": fm.get("image", ""),
|
||||
"manual_translation": bool(fm.get("manual_translation")),
|
||||
# Carried through the form untouched. Correcting a typo in somebody
|
||||
# else's post must not re-sign it with the name of whoever is
|
||||
# fixing it — the same rule the board has about editing other
|
||||
# people's words, applied to the byline.
|
||||
"author": fm.get("author", ""),
|
||||
"author_url": fm.get("author_url", ""),
|
||||
}
|
||||
return render_template("content_form.html", collection=collection, meta=meta,
|
||||
categories=CATEGORIES, item={"name": name, "sha": sha},
|
||||
@ -373,6 +445,8 @@ def edit(collection: str, name: str):
|
||||
picture = _upload_image()
|
||||
if picture:
|
||||
fields["image"] = picture
|
||||
# Deliberately not through publish(): that stamps the byline of whoever
|
||||
# is publishing, and an edit keeps the author the file already names.
|
||||
document = build_document(frontmatter_for(collection, fields), body)
|
||||
gitea.write_file(path, document.encode("utf-8"),
|
||||
f"content: actualizar «{fields['title']}»",
|
||||
|
||||
@ -112,6 +112,9 @@ button, input, select, textarea { font: inherit; }
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
.feed-head h1 { margin: 0; }
|
||||
/* Two things on the right of a heading — a link and a button — kept on one
|
||||
line and aligned to each other rather than to the heading's baseline. */
|
||||
.feed-head__actions { display: flex; align-items: center; gap: 1rem; }
|
||||
|
||||
.card {
|
||||
background: var(--surface);
|
||||
|
||||
@ -298,7 +298,11 @@ def approve(submission_id: int):
|
||||
return redirect(url_for("submissions.index"))
|
||||
|
||||
author = {"display_name": row["author"], "email": row["author_email"],
|
||||
"gitea_login": row["author_login"]}
|
||||
"gitea_login": row["author_login"],
|
||||
# For the byline on the published page: it links to their profile
|
||||
# only if they have one, so an approved post never carries a link
|
||||
# to a 404.
|
||||
"profile_published": row["author_published"]}
|
||||
fields = {
|
||||
"title": row["title"],
|
||||
# The day it is published, not the day it was written: Hugo sorts by
|
||||
|
||||
@ -20,8 +20,14 @@
|
||||
<input type="hidden" name="sha" value="{{ item.sha }}">
|
||||
<input type="hidden" name="name" value="{{ item.name }}">
|
||||
{% endif %}
|
||||
{# The byline travels with the document, like the date and the image path.
|
||||
An edit keeps whoever wrote it; only publishing sets it. #}
|
||||
{% if f and f.author %}
|
||||
<input type="hidden" name="author" value="{{ f.author }}">
|
||||
<input type="hidden" name="author_url" value="{{ f.author_url or '' }}">
|
||||
{% endif %}
|
||||
|
||||
<h1>{{ 'Editar' if item else 'Nuevo' }} {{ meta.singular|lower }}</h1>
|
||||
<h1>{{ ('Editar ' ~ meta.singular|lower) if item else meta.new_label }}</h1>
|
||||
|
||||
<label for="title">Título</label>
|
||||
<input id="title" name="title" maxlength="140" required value="{{ f.title or '' }}">
|
||||
|
||||
@ -4,9 +4,7 @@
|
||||
{% block main %}
|
||||
<div class="feed-head">
|
||||
<h1>Contenido</h1>
|
||||
<a class="btn" href="{{ url_for('content.new', collection=collection) }}">
|
||||
Nuevo {{ meta.singular|lower }}
|
||||
</a>
|
||||
<a class="btn" href="{{ url_for('content.new', collection=collection) }}">{{ meta.new_label }}</a>
|
||||
</div>
|
||||
|
||||
<nav class="tabs" aria-label="Tipo de contenido">
|
||||
@ -34,14 +32,22 @@
|
||||
</td>
|
||||
{% if meta.dated %}<td>{{ item.date }}</td>{% endif %}
|
||||
<td>{{ item.categories }}</td>
|
||||
<td class="actions actions--row">
|
||||
<a class="linkish" href="{{ url_for('content.edit', collection=collection, name=item.name) }}">Editar</a>
|
||||
<form method="post"
|
||||
action="{{ url_for('content.delete', collection=collection, name=item.name) }}"
|
||||
data-confirm="Se eliminará «{{ item.title }}» del sitio público. ¿Seguro?">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button class="linkish linkish--danger" type="submit">Eliminar</button>
|
||||
</form>
|
||||
{# The flex row goes INSIDE the cell, never on it. `.actions` is
|
||||
display:flex, and a <td> told to be a flex container stops being a
|
||||
table cell: it leaves the row's layout and draws its bottom border
|
||||
at its own height, so the columns' lines no longer meet. The page
|
||||
still renders, which is why this survived two rounds of looking at
|
||||
it. test_templates.py now fails if it comes back. #}
|
||||
<td>
|
||||
<div class="actions actions--row">
|
||||
<a class="linkish" href="{{ url_for('content.edit', collection=collection, name=item.name) }}">Editar</a>
|
||||
<form method="post"
|
||||
action="{{ url_for('content.delete', collection=collection, name=item.name) }}"
|
||||
data-confirm="Se eliminará «{{ item.title }}» del sitio público. ¿Seguro?">
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
||||
<button class="linkish linkish--danger" type="submit">Eliminar</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@ -26,6 +26,18 @@
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel__head">
|
||||
<h2>Artículos publicados</h2>
|
||||
<a class="linkish" href="{{ url_for('content.index', collection='post') }}">Abrir</a>
|
||||
</div>
|
||||
<p class="muted small">
|
||||
Lo que ya está en vienalatina.com: editar, corregir o retirar. Para
|
||||
publicar algo nuevo, o para revisar lo que proponen los miembros, está
|
||||
<a href="{{ url_for('submissions.index') }}">Publicaciones</a>.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="panel__head">
|
||||
<h2>Páginas del sitio</h2>
|
||||
|
||||
@ -6,7 +6,13 @@
|
||||
<div class="feed-head">
|
||||
<h1>Publicaciones</h1>
|
||||
{% if can_moderate %}
|
||||
<a class="btn" href="{{ url_for('content.new', collection='post') }}">Publicar</a>
|
||||
{# A moderator cannot open Gestión, so this is their only route to what is
|
||||
already on the site. It was a clause inside a paragraph below, which is
|
||||
the same as not being there. #}
|
||||
<div class="feed-head__actions">
|
||||
<a class="linkish" href="{{ url_for('content.index', collection='post') }}">Ya publicado</a>
|
||||
<a class="btn" href="{{ url_for('content.new', collection='post') }}">Publicar</a>
|
||||
</div>
|
||||
{% else %}
|
||||
<a class="btn" href="{{ url_for('submissions.propose') }}">Proponer</a>
|
||||
{% endif %}
|
||||
@ -16,7 +22,6 @@
|
||||
{% if can_moderate %}
|
||||
Lo que publicas aquí sale al sitio en cuanto lo guardas. Lo que proponen los
|
||||
miembros espera en esta cola hasta que tú u otro moderador lo apruebe.
|
||||
<a href="{{ url_for('content.index') }}">Ver lo ya publicado</a>.
|
||||
{% else %}
|
||||
Esto va a vienalatina.com, donde lo lee cualquiera. Un moderador lo lee
|
||||
primero: si hace falta cambiar algo te lo devuelve con el motivo.
|
||||
|
||||
@ -429,3 +429,90 @@ def test_an_unexpected_error_renders_the_site_is_own_page(app, client, make_memb
|
||||
body = response.get_data(as_text=True)
|
||||
assert "Algo falló de nuestro lado" in body
|
||||
assert "Viena Latina" in body # the site's chrome, not Flask's
|
||||
|
||||
|
||||
# --- the byline ----------------------------------------------------------
|
||||
#
|
||||
# The commit has named the author since the editor was built; the page did not,
|
||||
# so a reader could not tell whose article they were reading. These check the
|
||||
# three places it can go wrong: publishing, approving somebody else's proposal,
|
||||
# and editing — where re-signing the post with the editor's name would be worse
|
||||
# than having no byline at all.
|
||||
|
||||
def test_a_published_post_names_its_author(repo, db, post, make_member, sign_in):
|
||||
import yaml
|
||||
author = make_member("luisa", role="moderator")
|
||||
db.execute("UPDATE members SET display_name = ?, profile_published = 1 WHERE id = ?",
|
||||
("Luisa Fernández", author))
|
||||
sign_in(author)
|
||||
|
||||
publish(post)
|
||||
|
||||
path, = repo.files
|
||||
front = yaml.safe_load(repo.files[path].decode().split("---")[1])
|
||||
assert front["author"] == "Luisa Fernández"
|
||||
assert front["author_url"] == "/luisa"
|
||||
|
||||
|
||||
def test_without_a_published_page_the_byline_does_not_link(
|
||||
repo, db, post, make_member, sign_in):
|
||||
import yaml
|
||||
author = make_member("luisa", role="moderator")
|
||||
db.execute("UPDATE members SET profile_published = 0 WHERE id = ?", (author,))
|
||||
sign_in(author)
|
||||
|
||||
publish(post)
|
||||
|
||||
path, = repo.files
|
||||
front = yaml.safe_load(repo.files[path].decode().split("---")[1])
|
||||
assert front["author"] == "Luisa"
|
||||
assert "author_url" not in front # a byline linking to a 404 is worse
|
||||
|
||||
|
||||
def test_editing_a_post_keeps_the_author_it_already_had(
|
||||
repo, editor, post, client):
|
||||
"""The one that matters. An admin fixing a typo in somebody's article must
|
||||
not end up signing it — the same rule the board has about editing other
|
||||
people's words."""
|
||||
import yaml
|
||||
repo.files["content/post/2026-09-25-de-otro.es.md"] = (
|
||||
"---\ntitle: De otro\ndate: 2026-09-25\nlang: es\n"
|
||||
"manual_translation: false\nauthor: Salvador Dalí\nauthor_url: /salvador\n"
|
||||
"---\n\nTexto.\n").encode("utf-8")
|
||||
|
||||
page = client.get("/comunidad/contenido/post/editar/2026-09-25-de-otro.es.md")
|
||||
body = page.get_data(as_text=True)
|
||||
assert 'name="author" value="Salvador Dalí"' in body
|
||||
assert 'name="author_url" value="/salvador"' in body
|
||||
|
||||
post("/comunidad/contenido/post/editar/2026-09-25-de-otro.es.md",
|
||||
{"title": "De otro", "body": "Texto corregido.", "date": "2026-09-25",
|
||||
"sha": repo._sha(repo.files["content/post/2026-09-25-de-otro.es.md"]),
|
||||
"author": "Salvador Dalí", "author_url": "/salvador"})
|
||||
|
||||
front = yaml.safe_load(
|
||||
repo.files["content/post/2026-09-25-de-otro.es.md"].decode().split("---")[1])
|
||||
assert front["author"] == "Salvador Dalí"
|
||||
assert front["author_url"] == "/salvador"
|
||||
|
||||
|
||||
def test_an_author_url_cannot_point_off_the_site(repo, editor, post):
|
||||
"""It arrives as a hidden field, which is a convention and not a promise."""
|
||||
import yaml
|
||||
post("/comunidad/contenido/post/nuevo",
|
||||
{"title": "Aviso", "body": "Texto.", "date": "2026-09-25",
|
||||
"author": "Alguien", "author_url": "https://ejemplo.invalid/premio"})
|
||||
|
||||
path, = repo.files
|
||||
front = yaml.safe_load(repo.files[path].decode().split("---")[1])
|
||||
assert "author_url" not in front
|
||||
|
||||
|
||||
def test_a_page_carries_no_byline(repo, editor, post):
|
||||
"""Acerca de and Contacto are the site speaking, not a person."""
|
||||
import yaml
|
||||
post("/comunidad/contenido/page/nuevo", {"title": "Acerca de", "body": "Texto."})
|
||||
|
||||
path, = repo.files
|
||||
front = yaml.safe_load(repo.files[path].decode().split("---")[1])
|
||||
assert "author" not in front
|
||||
|
||||
@ -116,3 +116,38 @@ def test_signed_out_visitors_get_no_navigation(client):
|
||||
body = client.get("/comunidad/login").get_data(as_text=True)
|
||||
for label in list(SECTIONS) + list(ADMIN_ONLY):
|
||||
assert f'>{label}<' not in body, label
|
||||
|
||||
|
||||
# --- reaching the published articles --------------------------------------
|
||||
#
|
||||
# The screen worked and nothing linked to it: Gestión offered only the static
|
||||
# pages, and the Artículos tab exists only once you are already on that screen.
|
||||
# A moderator, who cannot open Gestión at all, had no route to it.
|
||||
|
||||
def test_an_admin_reaches_the_articles_from_gestion(client, make_member, sign_in):
|
||||
sign_in(make_member("admina", role="admin"))
|
||||
|
||||
body = client.get("/comunidad/gestion").get_data(as_text=True)
|
||||
|
||||
assert "/comunidad/contenido/post" in body
|
||||
assert "Artículos publicados" in body
|
||||
|
||||
|
||||
def test_a_moderator_reaches_them_from_publicaciones(client, make_member, sign_in):
|
||||
"""Their only way in, so it is a link in the heading rather than a clause in
|
||||
a paragraph."""
|
||||
sign_in(make_member("luisa", role="moderator"))
|
||||
|
||||
body = client.get("/comunidad/publicaciones").get_data(as_text=True)
|
||||
|
||||
assert "/comunidad/contenido/post" in body
|
||||
assert "Ya publicado" in body
|
||||
|
||||
|
||||
def test_a_plain_member_is_offered_neither(client, make_member, sign_in):
|
||||
sign_in(make_member("maria"))
|
||||
|
||||
body = client.get("/comunidad/publicaciones").get_data(as_text=True)
|
||||
|
||||
assert "/comunidad/contenido" not in body
|
||||
assert "Ya publicado" not in body
|
||||
|
||||
@ -448,3 +448,24 @@ def test_a_genuinely_missing_picture_still_says_so(
|
||||
assert "imagen en el disco" in response.get_data(as_text=True)
|
||||
assert repo.files == {}
|
||||
assert only_submission(db)["state"] == "pending"
|
||||
|
||||
|
||||
def test_an_approved_post_is_signed_by_the_member_not_the_moderator(
|
||||
repo, db, post, maria, luisa, sign_in):
|
||||
"""Both halves of attribution now: the commit names María, and so does the
|
||||
page — `author` in the frontmatter, with a link only if she has published
|
||||
her profile."""
|
||||
import yaml
|
||||
db.execute("UPDATE members SET profile_published = 1 WHERE id = ?", (maria,))
|
||||
sign_in(maria)
|
||||
propose(post)
|
||||
submission_id = only_submission(db)["id"]
|
||||
|
||||
sign_in(luisa)
|
||||
post(f"/comunidad/publicaciones/{submission_id}/aprobar")
|
||||
|
||||
path, = repo.files
|
||||
front = yaml.safe_load(repo.files[path].decode().split("---")[1])
|
||||
assert front["author"] == "Maria"
|
||||
assert front["author_url"] == "/maria"
|
||||
assert repo.authors == [{"name": "Maria", "email": "maria@example.com"}]
|
||||
|
||||
@ -52,6 +52,24 @@ def test_no_inline_style_blocks(template):
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("template", TEMPLATES, ids=lambda p: p.name)
|
||||
def test_no_table_cell_is_told_to_be_a_flex_container(template):
|
||||
"""`.actions` is display:flex, and a <td> given it stops being a table cell.
|
||||
|
||||
It leaves the row's layout, so its bottom border is drawn at its own content
|
||||
height rather than the row's and the columns' rules no longer meet. Nothing
|
||||
errors, nothing logs, the page just looks subtly broken — which is how it
|
||||
survived two rounds of somebody looking straight at it. The flex row belongs
|
||||
in a <div> inside the cell.
|
||||
"""
|
||||
html = JINJA_COMMENT.sub("", template.read_text(encoding="utf-8"))
|
||||
offenders = re.findall(r"<td[^>]*class=[\"'][^\"']*\bactions\b[^\"']*[\"']", html)
|
||||
assert not offenders, (
|
||||
f"{template.name} puts a flex class on a <td>: {offenders}. "
|
||||
"Wrap the buttons in <div class=\"actions\"> inside the cell instead."
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("template", TEMPLATES, ids=lambda p: p.name)
|
||||
def test_every_post_form_carries_a_csrf_token(template):
|
||||
"""The hook in app.py rejects a POST without one, so a form that forgets it
|
||||
|
||||
@ -773,6 +773,12 @@ visit. The navigation is the same for everybody except the last entry:
|
||||
| **Publicaciones** | `/comunidad/publicaciones` | everybody, with two different pages behind it |
|
||||
| **Gestión** | `/comunidad/gestion` | admins and the owner |
|
||||
|
||||
Gestión holds three things: Miembros, the published **Artículos**, and the
|
||||
site's static **Páginas**. A moderator cannot open it, so their route to the
|
||||
published articles is the *Ya publicado* link on Publicaciones — the only one
|
||||
they have, which is why it sits beside the button rather than inside a
|
||||
paragraph.
|
||||
|
||||
*Mi perfil*, *Descargar mis datos* and *Salir* are in the menu under the member's
|
||||
own name, top right. They are not sections of the site, and while they were in the
|
||||
navigation three of the five entries were admin-only — which meant an ordinary
|
||||
@ -811,6 +817,14 @@ Editing a returned proposal puts it back in the queue automatically. An approved
|
||||
one can no longer be edited from there — the file is in the repository, and that
|
||||
is what *Contenido* is for.
|
||||
|
||||
**Published posts carry a byline.** The editor writes `author` into the
|
||||
frontmatter, and `author_url` only when that member has published their own page
|
||||
— so the article says *por Fulana* and the name links through when there is
|
||||
somewhere to go. `scripts/translate.py` copies both into the German and
|
||||
Portuguese siblings by itself: it carries the whole frontmatter and translates
|
||||
only the title and the description. Editing a post keeps the author it already
|
||||
had, so correcting somebody's typo never re-signs their article.
|
||||
|
||||
**On the wall itself**: one 👍 per member per post or comment, which clicking
|
||||
again takes back, and every name is a link to that person's page — but only when
|
||||
they have published one, so nobody is sent to a 404. Both rules live in one place
|
||||
|
||||
@ -1090,6 +1090,18 @@ a.group-pill:hover {
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
|
||||
/* The byline on an article. It sits in the same meta row as the category and
|
||||
the date, so it inherits their colour and size; only the link needs saying. */
|
||||
.article-card__by a {
|
||||
color: var(--brand-dark, #9a2a0f);
|
||||
text-decoration: none;
|
||||
border-bottom: 1px dotted currentColor;
|
||||
}
|
||||
|
||||
.article-card__by a:hover {
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
.article-card__title {
|
||||
margin: 0 0 10px;
|
||||
font-size: 1.35rem;
|
||||
|
||||
@ -13,6 +13,23 @@
|
||||
<time datetime="{{ .Date.Format "2006-01-02T15:04:05-07:00" }}">
|
||||
{{ .Date.Format "2 Jan 2006" }}
|
||||
</time>
|
||||
{{/* Who wrote it. The members area writes `author` into the
|
||||
frontmatter when it publishes, and `author_url` only when
|
||||
that person has published their own page — so the name is
|
||||
a link when there is somewhere to go and plain text when
|
||||
there is not. Posts written before this, and anything
|
||||
migrated from WordPress, simply have neither and show
|
||||
nothing. */}}
|
||||
{{ with .Params.author }}
|
||||
<span class="article-card__by">
|
||||
por
|
||||
{{ with $.Params.author_url }}
|
||||
<a href="{{ . | relURL }}">{{ $.Params.author }}</a>
|
||||
{{ else }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user