Merge branch 'feature/v2.3.0-style-pass' for v2.3.0 release
Build Container / build (push) Successful in 8s
Build Container / build (push) Successful in 8s
This commit is contained in:
commit
0ae16bd1fc
13 files changed
+285
-183
No files matched your search
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [2.3.0] - 2026-10-31
|
||||
|
||||
### Changed
|
||||
|
||||
- **Public pages restyled**: compact header with the site name from `SITE_NAME`, serif reading font for notes, one-line metadata (date · #tags · Also on …), dark mode via `prefers-color-scheme`, footer pinned to the bottom, "Log in" moved to the footer
|
||||
- Home and tag pages show short notes in full; titled notes show a summary and "Read more"
|
||||
- Author h-card kept for parsers but visually hidden on this single-author site
|
||||
- Page titles use the note text and `SITE_NAME` instead of the slug and "StarPunk"
|
||||
|
||||
### Fixed
|
||||
|
||||
- Every note's metadata was styled as the page footer (centered, ruled, padded)
|
||||
- Previews cut the note's HTML at 300 characters, which could break markup
|
||||
- Bare URLs in notes are now links
|
||||
|
||||
## [2.2.0] - 2026-10-31
|
||||
|
||||
### Added
|
||||
|
||||
@@ -449,5 +449,5 @@ def create_app(config=None):
|
||||
|
||||
# Package version (Semantic Versioning 2.0.0)
|
||||
# See docs/standards/versioning-strategy.md for details
|
||||
__version__ = "2.2.0"
|
||||
__version__ = "2.3.0"
|
||||
__version_info__ = (2, 1, 0)
|
||||
@@ -0,0 +1,42 @@
|
||||
"""
|
||||
Markdown extension: turn bare URLs into links (v2.3.0)
|
||||
|
||||
Python-Markdown only links <https://...>; notes often contain pasted URLs.
|
||||
"""
|
||||
|
||||
import re
|
||||
import xml.etree.ElementTree as etree
|
||||
|
||||
from markdown.extensions import Extension
|
||||
from markdown.inlinepatterns import InlineProcessor
|
||||
from markdown.treeprocessors import Treeprocessor
|
||||
from markdown.util import AtomicString
|
||||
|
||||
# Stop at whitespace and brackets; trailing punctuation is not part of the URL
|
||||
BARE_URL_RE = r"(?<![\w/\"'=])https?://[^\s<>()\[\]\"']*[^\s<>()\[\]\"'.,;:!?…]"
|
||||
|
||||
|
||||
class _BareUrl(InlineProcessor):
|
||||
def handleMatch(self, m, data):
|
||||
url = m.group(0)
|
||||
el = etree.Element("a")
|
||||
el.set("href", url)
|
||||
el.text = AtomicString(url)
|
||||
return el, m.start(0), m.end(0)
|
||||
|
||||
|
||||
class _UnnestLinks(Treeprocessor):
|
||||
"""[https://x](https://x) would put a link inside a link; keep the outer one"""
|
||||
|
||||
def run(self, root):
|
||||
for outer in root.iter("a"):
|
||||
for inner in list(outer.iter("a"))[1:]:
|
||||
inner.tag = "span"
|
||||
inner.attrib.clear()
|
||||
|
||||
|
||||
class BareUrlExtension(Extension):
|
||||
def extendMarkdown(self, md):
|
||||
# Below links (160) and <autolinks> (120), so those win
|
||||
md.inlinePatterns.register(_BareUrl(BARE_URL_RE, md), "bare_url", 105)
|
||||
md.treeprocessors.register(_UnnestLinks(md), "unnest_links", 0)
|
||||
+3
-1
@@ -34,7 +34,9 @@ DEFAULT_AUTH_STATE_EXPIRY_MINUTES = 5
|
||||
DEFAULT_TOKEN_EXPIRY_DAYS = 90
|
||||
|
||||
# Constants - Markdown rendering
|
||||
MARKDOWN_EXTENSIONS = ["extra", "codehilite", "nl2br"]
|
||||
from starpunk.markdown_ext import BareUrlExtension
|
||||
|
||||
MARKDOWN_EXTENSIONS = ["extra", "codehilite", "nl2br", BareUrlExtension()]
|
||||
|
||||
# Constants - Content limits
|
||||
MAX_TITLE_LENGTH = 200
|
||||
|
||||
+85
-25
@@ -1,36 +1,75 @@
|
||||
/* StarPunk CSS - Minimal responsive stylesheet */
|
||||
|
||||
:root {
|
||||
--color-text: #333; --color-text-light: #666; --color-bg: #fff; --color-bg-alt: #f5f5f5;
|
||||
--color-link: #0066cc; --color-link-hover: #004499; --color-border: #ddd;
|
||||
--color-text: #1f2328; --color-text-light: #59636e; --color-bg: #fff; --color-bg-alt: #f4f5f7;
|
||||
--color-link: #0a5cc2; --color-link-hover: #083f85; --color-border: #e3e6ea; --color-accent-soft: #e8f0fb;
|
||||
--color-success: #28a745; --color-error: #dc3545; --color-warning: #ffc107; --color-info: #17a2b8;
|
||||
--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
|
||||
--font-mono: 'SF Mono', Monaco, Consolas, 'Courier New', monospace;
|
||||
--font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||
--font-reading: Charter, 'Bitstream Charter', 'Sitka Text', Cambria, 'Noto Serif', Georgia, serif;
|
||||
--font-mono: ui-monospace, 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace;
|
||||
--spacing-xs: 0.25rem; --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 2rem; --spacing-xl: 4rem;
|
||||
--max-width: 42rem; --border-radius: 4px;
|
||||
--max-width: 40rem; --border-radius: 6px;
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--color-text: #e4e6e9; --color-text-light: #9aa3ad; --color-bg: #121417; --color-bg-alt: #1c1f24;
|
||||
--color-link: #74b0ff; --color-link-hover: #a8ceff; --color-border: #2b3038; --color-accent-soft: #1a2738;
|
||||
}
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font-family: var(--font-body); font-size: 1rem; line-height: 1.6; color: var(--color-text); background: var(--color-bg); padding: var(--spacing-md); }
|
||||
body {
|
||||
font-family: var(--font-body); font-size: 1rem; line-height: 1.6; color: var(--color-text); background: var(--color-bg);
|
||||
padding: var(--spacing-md); min-height: 100vh; display: flex; flex-direction: column;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
h1, h2, h3 { margin-bottom: var(--spacing-md); line-height: 1.2; font-weight: 600; }
|
||||
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; }
|
||||
h1, h2, h3 { margin-bottom: var(--spacing-md); line-height: 1.25; font-weight: 650; letter-spacing: -0.01em; }
|
||||
h1 { font-size: 1.75rem; } h2 { font-size: 1.375rem; } h3 { font-size: 1.125rem; }
|
||||
p { margin-bottom: var(--spacing-md); }
|
||||
a { color: var(--color-link); text-decoration: none; }
|
||||
a:hover { color: var(--color-link-hover); text-decoration: underline; }
|
||||
:focus-visible { outline: 2px solid var(--color-link); outline-offset: 2px; border-radius: 2px; }
|
||||
|
||||
code, pre { font-family: var(--font-mono); background: var(--color-bg-alt); padding: 0.125rem 0.25rem; border-radius: var(--border-radius); font-size: 0.875rem; }
|
||||
code, pre { font-family: var(--font-mono); background: var(--color-bg-alt); padding: 0.125rem 0.3rem; border-radius: var(--border-radius); font-size: 0.875em; }
|
||||
pre { padding: var(--spacing-md); overflow-x: auto; margin-bottom: var(--spacing-md); }
|
||||
pre code { padding: 0; background: none; }
|
||||
|
||||
header, main, footer { max-width: var(--max-width); margin: 0 auto; }
|
||||
header { margin-bottom: var(--spacing-lg); padding-bottom: var(--spacing-md); border-bottom: 2px solid var(--color-border); }
|
||||
header h1 { margin-bottom: var(--spacing-sm); }
|
||||
header h1 a { color: var(--color-text); text-decoration: none; }
|
||||
nav { display: flex; gap: var(--spacing-md); flex-wrap: wrap; }
|
||||
nav a { padding: var(--spacing-sm) var(--spacing-md); border-radius: var(--border-radius); transition: background 0.2s; }
|
||||
nav a:hover { background: var(--color-bg-alt); text-decoration: none; }
|
||||
main { min-height: 60vh; margin-bottom: var(--spacing-lg); }
|
||||
footer { padding-top: var(--spacing-lg); border-top: 1px solid var(--color-border); text-align: center; color: var(--color-text-light); font-size: 0.875rem; }
|
||||
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
|
||||
|
||||
/* Page frame */
|
||||
.site-header, main, .site-footer { width: 100%; max-width: var(--max-width); margin-left: auto; margin-right: auto; }
|
||||
main { flex: 1; margin-bottom: var(--spacing-xl); }
|
||||
|
||||
.site-header {
|
||||
display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--spacing-sm) var(--spacing-lg);
|
||||
padding: var(--spacing-md) 0 var(--spacing-md); margin-bottom: var(--spacing-lg); border-bottom: 1px solid var(--color-border);
|
||||
}
|
||||
.site-title { font-size: 1.375rem; font-weight: 700; letter-spacing: -0.02em; color: var(--color-text); }
|
||||
.site-title:hover { color: var(--color-link); text-decoration: none; }
|
||||
.site-nav { display: flex; align-items: center; flex-wrap: wrap; gap: var(--spacing-md); font-size: 0.9375rem; }
|
||||
.site-nav > a { color: var(--color-text-light); }
|
||||
.site-nav > a:hover { color: var(--color-link); text-decoration: none; }
|
||||
.site-search { display: flex; }
|
||||
.site-search input[type="search"] {
|
||||
width: 10rem; padding: 0.3rem 0.6rem; font: inherit; font-size: 0.875rem; color: var(--color-text);
|
||||
background: var(--color-bg-alt); border: 1px solid var(--color-border); border-right: 0; border-radius: var(--border-radius) 0 0 var(--border-radius);
|
||||
}
|
||||
.site-search button {
|
||||
padding: 0.3rem 0.6rem; font: inherit; font-size: 0.875rem; cursor: pointer; color: var(--color-text-light);
|
||||
background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: 0 var(--border-radius) var(--border-radius) 0;
|
||||
}
|
||||
.site-search button:hover { color: var(--color-link); }
|
||||
|
||||
.site-footer { padding: var(--spacing-md) 0; border-top: 1px solid var(--color-border); color: var(--color-text-light); font-size: 0.8125rem; }
|
||||
.site-footer p { margin: 0; }
|
||||
.site-footer a { color: var(--color-text-light); text-decoration: underline; text-decoration-color: var(--color-border); }
|
||||
.site-footer a:hover { color: var(--color-link); }
|
||||
|
||||
.page-title { font-size: 1.375rem; margin-bottom: var(--spacing-lg); }
|
||||
.tag-name { color: var(--color-link); }
|
||||
.tag-name::before { content: "#"; }
|
||||
|
||||
.dev-mode-warning { background: var(--color-error); color: white; padding: var(--spacing-md); text-align: center; font-weight: bold; margin: calc(-1 * var(--spacing-md)); margin-bottom: var(--spacing-lg); }
|
||||
|
||||
@@ -40,17 +79,35 @@ footer { padding-top: var(--spacing-lg); border-top: 1px solid var(--color-borde
|
||||
.flash-warning { background: #fff3cd; border-color: var(--color-warning); color: #856404; }
|
||||
.flash-info { background: #d1ecf1; border-color: var(--color-info); color: #0c5460; }
|
||||
|
||||
/* Notes */
|
||||
.h-entry { margin-bottom: var(--spacing-lg); padding-bottom: var(--spacing-lg); border-bottom: 1px solid var(--color-border); }
|
||||
.h-entry:last-child { border-bottom: none; }
|
||||
.note-preview .e-content { margin-bottom: var(--spacing-md); }
|
||||
.note-meta { color: var(--color-text-light); font-size: 0.875rem; }
|
||||
.h-entry > .p-name a { color: var(--color-text); }
|
||||
.h-entry > .p-name a:hover { color: var(--color-link); }
|
||||
.e-content, .p-summary { font-family: var(--font-reading); font-size: 1.125rem; line-height: 1.65; overflow-wrap: anywhere; }
|
||||
.e-content > :last-child, .p-summary > :last-child { margin-bottom: 0; }
|
||||
.e-content a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
|
||||
.e-content a:hover { text-decoration-color: currentColor; }
|
||||
.e-content blockquote { margin: 0 0 var(--spacing-md); padding-left: var(--spacing-md); border-left: 3px solid var(--color-border); color: var(--color-text-light); }
|
||||
.e-content ul, .e-content ol { margin: 0 0 var(--spacing-md) 1.25rem; }
|
||||
.e-content img { max-width: 100%; height: auto; }
|
||||
.e-content h1, .e-content h2, .e-content h3 { font-family: var(--font-body); }
|
||||
.read-more { margin: var(--spacing-sm) 0 0; font-size: 0.9375rem; }
|
||||
|
||||
.note-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 0.4rem; margin-top: var(--spacing-sm); color: var(--color-text-light); font-size: 0.8125rem; }
|
||||
.note-meta a { color: var(--color-text-light); }
|
||||
.note-nav { margin-top: var(--spacing-md); }
|
||||
.note-meta a:hover { color: var(--color-link); }
|
||||
.note-meta > :not(.visually-hidden) + :not(.visually-hidden)::before { content: "·"; margin-right: 0.4rem; color: var(--color-text-light); }
|
||||
.note-tags { display: inline-flex; flex-wrap: wrap; gap: 0 0.4rem; }
|
||||
.note-meta > .note-tags::before { margin-right: 0; }
|
||||
.note-tags .p-category::before { content: "#"; opacity: 0.7; }
|
||||
.h-entry:not(.note-preview) .note-meta { margin-top: var(--spacing-md); }
|
||||
.note-nav { margin-top: var(--spacing-lg); font-size: 0.9375rem; }
|
||||
.empty-state { text-align: center; padding: var(--spacing-xl); color: var(--color-text-light); }
|
||||
|
||||
.form-group { margin-bottom: var(--spacing-md); }
|
||||
label { display: block; margin-bottom: var(--spacing-sm); font-weight: 600; }
|
||||
input[type="text"], input[type="url"], input[type="email"], textarea { width: 100%; padding: var(--spacing-sm); border: 1px solid var(--color-border); border-radius: var(--border-radius); font-family: inherit; font-size: 1rem; }
|
||||
input[type="text"], input[type="url"], input[type="email"], input[type="search"], textarea { color: var(--color-text); background: var(--color-bg); width: 100%; padding: var(--spacing-sm); border: 1px solid var(--color-border); border-radius: var(--border-radius); font-family: inherit; font-size: 1rem; }
|
||||
textarea { font-family: var(--font-mono); resize: vertical; min-height: 10rem; }
|
||||
small { display: block; margin-top: var(--spacing-xs); color: var(--color-text-light); font-size: 0.875rem; }
|
||||
.form-checkbox { display: flex; align-items: center; gap: var(--spacing-sm); }
|
||||
@@ -171,11 +228,14 @@ small { display: block; margin-top: var(--spacing-xs); color: var(--color-text-l
|
||||
}
|
||||
|
||||
@media (min-width: 768px) {
|
||||
body { padding: var(--spacing-lg); }
|
||||
h1 { font-size: 2.5rem; } h2 { font-size: 2rem; } h3 { font-size: 1.5rem; }
|
||||
body { padding: var(--spacing-md) var(--spacing-lg); }
|
||||
h1 { font-size: 2rem; } h2 { font-size: 1.5rem; } h3 { font-size: 1.25rem; }
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.site-nav { width: 100%; }
|
||||
.site-search { flex: 1; justify-content: flex-end; }
|
||||
.site-search input[type="search"] { width: 100%; max-width: 12rem; }
|
||||
.note-table { font-size: 0.875rem; }
|
||||
.note-table th, .note-table td { padding: var(--spacing-sm); }
|
||||
.note-actions .button { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
|
||||
@@ -426,7 +486,7 @@ small { display: block; margin-top: var(--spacing-xs); color: var(--color-text-l
|
||||
|
||||
.content-preview {
|
||||
padding: var(--spacing-sm);
|
||||
background: white;
|
||||
background: var(--color-bg);
|
||||
border: 1px solid var(--color-border);
|
||||
border-radius: 4px;
|
||||
margin-top: var(--spacing-xs);
|
||||
|
||||
+14
-21
@@ -3,7 +3,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}StarPunk{% endblock %}</title>
|
||||
<title>{% block title %}{{ config.SITE_NAME }}{% endblock %}</title>
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
|
||||
<link rel="alternate" type="application/rss+xml" title="{{ config.SITE_NAME }} RSS Feed" href="{{ absolute_url_for('public.feed') }}">
|
||||
<link rel="alternate" type="application/xml+opml" title="{{ config.SITE_NAME }} Feed Subscription List" href="{{ absolute_url_for('public.opml') }}">
|
||||
@@ -33,29 +34,18 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<header>
|
||||
<h1><a href="/">StarPunk</a></h1>
|
||||
<nav>
|
||||
<header class="site-header">
|
||||
<a class="site-title" href="/">{{ config.SITE_NAME }}</a>
|
||||
<nav class="site-nav">
|
||||
<a href="/">Home</a>
|
||||
<a href="{{ url_for('public.feed') }}">RSS</a>
|
||||
{% if g.me %}
|
||||
<a href="{{ url_for('admin.dashboard') }}">Dashboard</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('auth.login_form') }}">Login</a>
|
||||
{% endif %}
|
||||
<form action="/search" method="get" role="search" style="margin-left: auto; display: flex; gap: var(--spacing-sm);">
|
||||
<input
|
||||
type="search"
|
||||
name="q"
|
||||
placeholder="Search..."
|
||||
aria-label="Search"
|
||||
value="{{ request.args.get('q', '') }}"
|
||||
minlength="2"
|
||||
maxlength="100"
|
||||
required
|
||||
style="width: 200px; padding: var(--spacing-xs) var(--spacing-sm);"
|
||||
>
|
||||
<button type="submit" class="button button-small" style="padding: var(--spacing-xs) var(--spacing-sm);">🔍</button>
|
||||
<form class="site-search" action="/search" method="get" role="search">
|
||||
<input type="search" name="q" placeholder="Search" aria-label="Search"
|
||||
value="{{ request.args.get('q', '') }}" minlength="2" maxlength="100" required>
|
||||
<button type="submit" aria-label="Search">Search</button>
|
||||
</form>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -72,8 +62,11 @@
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>StarPunk v{{ config.get('VERSION', '0.5.0') }}</p>
|
||||
<footer class="site-footer">
|
||||
<p>
|
||||
Powered by <a href="https://git.thesatelliteoflove.com/phil/StarPunk">StarPunk</a> v{{ config.get('VERSION', '0.5.0') }}
|
||||
{% if not g.me %}· <a href="{{ url_for('auth.login_form') }}">Log in</a>{% endif %}
|
||||
</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
+4
-47
@@ -1,12 +1,12 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "partials/media.html" import display_media %}
|
||||
{% from "partials/note_preview.html" import note_preview %}
|
||||
|
||||
{% block title %}StarPunk - Home{% endblock %}
|
||||
{% block title %}{{ config.SITE_NAME }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="h-feed">
|
||||
{# h-feed required properties per microformats.org/wiki/h-feed #}
|
||||
<h2 class="p-name">{{ config.SITE_NAME or 'Recent Notes' }}</h2>
|
||||
<h1 class="p-name visually-hidden">{{ config.SITE_NAME or 'Recent Notes' }}</h1>
|
||||
|
||||
{# u-url for feed (self-reference) #}
|
||||
<a class="u-url" href="{{ absolute_url_for('public.index') }}" style="display: none;">Feed URL</a>
|
||||
@@ -34,50 +34,7 @@
|
||||
|
||||
{% if notes %}
|
||||
{% for note in notes %}
|
||||
<article class="h-entry note-preview">
|
||||
{# Detect if note has explicit title (starts with # heading) - per Q22 #}
|
||||
{% set has_explicit_title = note.content.strip().startswith('#') %}
|
||||
|
||||
{# p-name only if note has explicit title (per Q22) #}
|
||||
{% if has_explicit_title %}
|
||||
<h3 class="p-name">{{ note.title }}</h3>
|
||||
{% endif %}
|
||||
|
||||
{# Media preview (if available) #}
|
||||
{{ display_media(note.media) }}
|
||||
|
||||
{# e-content: note content (preview) #}
|
||||
<div class="e-content">
|
||||
{{ note.html[:300]|safe }}{% if note.html|length > 300 %}...{% endif %}
|
||||
</div>
|
||||
|
||||
<footer class="note-meta">
|
||||
{# u-url for permalink #}
|
||||
<a class="u-url" href="{{ absolute_url_for('public.note', slug=note.slug) }}">
|
||||
<time class="dt-published" datetime="{{ note.created_at.isoformat() }}">
|
||||
{{ note.created_at.strftime('%B %d, %Y') }}
|
||||
</time>
|
||||
</a>
|
||||
|
||||
{# Tags in preview #}
|
||||
{% if note.tags %}
|
||||
<span class="note-tags">
|
||||
{% for tag in note.tags %}
|
||||
<a class="p-category" rel="tag" href="{{ url_for('public.tag', tag=tag.name) }}">{{ tag.display_name }}</a>
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{# Author h-card nested in each h-entry (per Q20) #}
|
||||
{% if author %}
|
||||
<div class="p-author h-card">
|
||||
<a class="p-name u-url" href="{{ author.url or author.me }}">
|
||||
{{ author.name or author.url or author.me }}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</footer>
|
||||
</article>
|
||||
{{ note_preview(note, author) }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="empty-state">No notes published yet. Check back soon!</p>
|
||||
|
||||
+18
-38
@@ -1,7 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "partials/media.html" import display_media %}
|
||||
|
||||
{% block title %}{{ note.slug }} - StarPunk{% endblock %}
|
||||
{% block title %}{% if note.content.strip().startswith('#') %}{{ note.title }}{% else %}{{ note.excerpt|truncate(60) }}{% endif %} · {{ config.SITE_NAME }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<article class="h-entry">
|
||||
@@ -49,52 +49,32 @@
|
||||
|
||||
<footer class="note-meta">
|
||||
{# u-url and u-uid same for notes (per Q23) #}
|
||||
{% for s in syndications if s.remote_url %}
|
||||
<a class="u-syndication" href="{{ s.remote_url }}" rel="syndication">Also on {{ s.name }}</a>
|
||||
{% endfor %}
|
||||
<a class="u-url u-uid" href="{{ absolute_url_for('public.note', slug=note.slug) }}">
|
||||
<time class="dt-published" datetime="{{ note.created_at.isoformat() }}">
|
||||
{{ note.created_at.strftime('%B %d, %Y at %I:%M %p') }}
|
||||
</time>
|
||||
</a>
|
||||
|
||||
{# dt-updated if note was modified #}
|
||||
<a class="u-url u-uid" href="{{ absolute_url_for('public.note', slug=note.slug) }}"><time class="dt-published" datetime="{{ note.created_at.isoformat() }}">{{ note.created_at.strftime('%B %-d, %Y · %-I:%M %p') }}</time></a>
|
||||
{% if note.updated_at and note.updated_at != note.created_at %}
|
||||
<span class="updated">
|
||||
(Updated: <time class="dt-updated" datetime="{{ note.updated_at.isoformat() }}">{{ note.updated_at.strftime('%B %d, %Y') }}</time>)
|
||||
<span class="updated">Updated <time class="dt-updated" datetime="{{ note.updated_at.isoformat() }}">{{ note.updated_at.strftime('%b %-d, %Y') }}</time></span>
|
||||
{% endif %}
|
||||
{# rel="tag" per microformats2 p-category #}
|
||||
{% if note.tags %}
|
||||
<span class="note-tags">
|
||||
{% for tag in note.tags %}<a class="p-category" rel="tag" href="{{ url_for('public.tag', tag=tag.name) }}">{{ tag.display_name }}</a>{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{# Tags / Categories #}
|
||||
{# rel="tag" per microformats2 p-category specification #}
|
||||
{% if note.tags %}
|
||||
<div class="note-tags">
|
||||
{% for tag in note.tags %}
|
||||
<a class="p-category" rel="tag" href="{{ url_for('public.tag', tag=tag.name) }}">
|
||||
{{ tag.display_name }}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% set synced = (syndications or [])|selectattr('remote_url')|list %}
|
||||
{% if synced %}
|
||||
<span class="syndication">Also on {% for s in synced %}<a class="u-syndication" href="{{ s.remote_url }}" rel="syndication">{{ s.name }}</a>{% if not loop.last %}, {% endif %}{% endfor %}</span>
|
||||
{% endif %}
|
||||
|
||||
{# Author h-card (nested within h-entry per Q20) #}
|
||||
{# Author h-card (nested within h-entry per Q20); hidden on a single-author site #}
|
||||
{% if author %}
|
||||
<div class="p-author h-card">
|
||||
{% if author.photo %}
|
||||
<img class="u-photo" src="{{ author.photo }}" alt="{{ author.name or 'Author' }}" width="48" height="48">
|
||||
{% endif %}
|
||||
<a class="p-name u-url" href="{{ author.url or author.me }}">
|
||||
{{ author.name or author.url or author.me }}
|
||||
</a>
|
||||
{% if author.note %}
|
||||
<span class="p-note" style="display: none;">{{ author.note }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
<span class="p-author h-card visually-hidden">
|
||||
{% if author.photo %}<img class="u-photo" src="{{ author.photo }}" alt="">{% endif %}
|
||||
<a class="p-name u-url" href="{{ author.url or author.me }}">{{ author.name or author.url or author.me }}</a>
|
||||
{% if author.note %}<span class="p-note">{{ author.note }}</span>{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
</footer>
|
||||
|
||||
<nav class="note-nav">
|
||||
<a href="/">Back to all notes</a>
|
||||
<a href="/">← All notes</a>
|
||||
</nav>
|
||||
|
||||
{# Webmentions section (v1.6.0 Phase 5) - only shown if approved webmentions exist #}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
{# One note in a list (home, tag pages). v2.3.0 #}
|
||||
{% from "partials/media.html" import display_media %}
|
||||
{% macro note_preview(note, author) %}
|
||||
<article class="h-entry note-preview">
|
||||
{# Notes starting with a # heading have a title (Q22) #}
|
||||
{% set has_explicit_title = note.content.strip().startswith('#') %}
|
||||
{% if has_explicit_title %}
|
||||
<h2 class="p-name"><a href="{{ absolute_url_for('public.note', slug=note.slug) }}">{{ note.title }}</a></h2>
|
||||
{% endif %}
|
||||
|
||||
{{ display_media(note.media) }}
|
||||
|
||||
{% if has_explicit_title %}
|
||||
{# Titled notes are articles: show a summary and link through #}
|
||||
<div class="p-summary">
|
||||
<p>{{ note.excerpt }}</p>
|
||||
</div>
|
||||
<p class="read-more"><a href="{{ absolute_url_for('public.note', slug=note.slug) }}">Read more →</a></p>
|
||||
{% else %}
|
||||
<div class="e-content">
|
||||
{{ note.html|safe }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<footer class="note-meta">
|
||||
<a class="u-url" href="{{ absolute_url_for('public.note', slug=note.slug) }}"><time class="dt-published" datetime="{{ note.created_at.isoformat() }}">{{ note.created_at.strftime('%b %-d, %Y') }}</time></a>
|
||||
{% if note.tags %}
|
||||
<span class="note-tags">
|
||||
{% for tag in note.tags %}<a class="p-category" rel="tag" href="{{ url_for('public.tag', tag=tag.name) }}">{{ tag.display_name }}</a>{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if author %}
|
||||
{# Single-author site: keep the h-card for parsers, hide it from readers #}
|
||||
<span class="p-author h-card visually-hidden"><a class="p-name u-url" href="{{ author.url or author.me }}">{{ author.name or author.url or author.me }}</a></span>
|
||||
{% endif %}
|
||||
</footer>
|
||||
</article>
|
||||
{% endmacro %}
|
||||
@@ -1,6 +1,6 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}{% if query %}Search: {{ query }}{% else %}Search{% endif %} - StarPunk{% endblock %}
|
||||
{% block title %}{% if query %}Search: {{ query }}{% else %}Search{% endif %} · {{ config.SITE_NAME }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="search-container">
|
||||
|
||||
+5
-48
@@ -1,65 +1,22 @@
|
||||
{% extends "base.html" %}
|
||||
{% from "partials/media.html" import display_media %}
|
||||
{% from "partials/note_preview.html" import note_preview %}
|
||||
|
||||
{% block title %}{{ tag.display_name }} - StarPunk{% endblock %}
|
||||
{% block title %}{{ tag.display_name }} · {{ config.SITE_NAME }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="h-feed">
|
||||
<h1 class="p-name">Notes tagged "{{ tag.display_name }}"</h1>
|
||||
<h1 class="p-name page-title">Notes tagged <span class="tag-name">{{ tag.display_name }}</span></h1>
|
||||
|
||||
{% if notes %}
|
||||
{% for note in notes %}
|
||||
<article class="h-entry note-preview">
|
||||
{# Detect if note has explicit title (starts with # heading) - per Q22 #}
|
||||
{% set has_explicit_title = note.content.strip().startswith('#') %}
|
||||
|
||||
{# p-name only if note has explicit title (per Q22) #}
|
||||
{% if has_explicit_title %}
|
||||
<h3 class="p-name">{{ note.title }}</h3>
|
||||
{% endif %}
|
||||
|
||||
{# Media preview (if available) #}
|
||||
{{ display_media(note.media) }}
|
||||
|
||||
{# e-content: note content (preview) #}
|
||||
<div class="e-content">
|
||||
{{ note.html[:300]|safe }}{% if note.html|length > 300 %}...{% endif %}
|
||||
</div>
|
||||
|
||||
<footer class="note-meta">
|
||||
{# u-url for permalink #}
|
||||
<a class="u-url" href="{{ absolute_url_for('public.note', slug=note.slug) }}">
|
||||
<time class="dt-published" datetime="{{ note.created_at.isoformat() }}">
|
||||
{{ note.created_at.strftime('%B %d, %Y') }}
|
||||
</time>
|
||||
</a>
|
||||
|
||||
{# Tags in preview #}
|
||||
{% if note.tags %}
|
||||
<span class="note-tags">
|
||||
{% for tag in note.tags %}
|
||||
<a class="p-category" rel="tag" href="{{ url_for('public.tag', tag=tag.name) }}">{{ tag.display_name }}</a>
|
||||
{% endfor %}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
{# Author h-card nested in each h-entry (per Q20) #}
|
||||
{% if author %}
|
||||
<div class="p-author h-card">
|
||||
<a class="p-name u-url" href="{{ author.url or author.me }}">
|
||||
{{ author.name or author.url or author.me }}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</footer>
|
||||
</article>
|
||||
{{ note_preview(note, author) }}
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<p class="empty-state">No notes with this tag.</p>
|
||||
{% endif %}
|
||||
|
||||
<nav class="note-nav">
|
||||
<a href="/">Back to all notes</a>
|
||||
<a href="/">← All notes</a>
|
||||
</nav>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -0,0 +1,57 @@
|
||||
"""Public page markup from the v2.3.0 style pass"""
|
||||
|
||||
import markdown
|
||||
import pytest
|
||||
|
||||
from starpunk import create_app
|
||||
from starpunk.models import MARKDOWN_EXTENSIONS
|
||||
from starpunk.notes import create_note
|
||||
|
||||
|
||||
def md(text):
|
||||
return markdown.markdown(text, extensions=MARKDOWN_EXTENSIONS)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("text, expected", [
|
||||
("see https://sqlite.org/x.html.", '<a href="https://sqlite.org/x.html">https://sqlite.org/x.html</a>.'),
|
||||
("(https://a.example/p)", '(<a href="https://a.example/p">https://a.example/p</a>)'),
|
||||
("[label](https://a.example)", '<a href="https://a.example">label</a>'),
|
||||
("`https://code.example`", "<code>https://code.example</code>"),
|
||||
])
|
||||
def test_bare_urls_are_linked(text, expected):
|
||||
assert expected in md(text)
|
||||
|
||||
|
||||
def test_url_as_link_label_is_not_nested():
|
||||
assert md("[https://b.example](https://b.example)").count("<a ") == 1
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def app(tmp_path):
|
||||
data = tmp_path / "data"
|
||||
return create_app({
|
||||
"TESTING": True, "SITE_URL": "https://blog.example.com", "SITE_NAME": "My Notes",
|
||||
"ADMIN_ME": "https://example.com", "SESSION_SECRET": "x",
|
||||
"DATA_PATH": data, "NOTES_PATH": data / "notes", "DATABASE_PATH": data / "starpunk.db",
|
||||
})
|
||||
|
||||
|
||||
def test_home_shows_full_notes_and_site_name(app):
|
||||
long_text = "word " * 120 + "THE-END"
|
||||
with app.app_context():
|
||||
create_note(content=long_text, published=True, tags=["thoughts"])
|
||||
html = app.test_client().get("/").data.decode()
|
||||
assert "THE-END" in html # not cut at 300 characters
|
||||
assert '<a class="site-title" href="/">My Notes</a>' in html
|
||||
assert 'class="p-category" rel="tag"' in html
|
||||
# Notes' metadata is not styled as the page footer
|
||||
assert html.count('<footer class="site-footer">') == 1
|
||||
assert '<footer class="note-meta">' in html
|
||||
|
||||
|
||||
def test_note_page_meta_line(app):
|
||||
with app.app_context():
|
||||
note = create_note(content="Hello", published=True)
|
||||
html = app.test_client().get(f"/note/{note.slug}").data.decode()
|
||||
assert "<title>Hello · My Notes</title>" in html
|
||||
assert 'class="u-url u-uid"' in html
|
||||
@@ -274,7 +274,8 @@ class TestVersionDisplay:
|
||||
"""Test version number appears in footer"""
|
||||
response = client.get("/")
|
||||
assert response.status_code == 200
|
||||
assert b"0.5.0" in response.data or b"StarPunk v" in response.data
|
||||
from starpunk import __version__
|
||||
assert f"v{__version__}".encode() in response.data
|
||||
|
||||
|
||||
# OAuth metadata endpoint tests removed in Phase 1 of IndieAuth server removal
|
||||
|
||||
Reference in new issue
Block a user