mirror of
https://github.com/samsonjs/samhuri.net.git
synced 2026-03-25 09:05:47 +00:00
Replace the Swift site generator with a Ruby and Phlex implementation. Loads site and projects from TOML, derive site metadata from posts. Migrate from make to bake and add standardrb and code coverage tasks. Update CI and docs to match the new workflow, and remove unused assets/dependencies plus obsolete tooling.
46 lines
1,005 B
Ruby
46 lines
1,005 B
Ruby
require "phlex"
|
|
require "pressa/views/icons"
|
|
|
|
module Pressa
|
|
module Views
|
|
class PostView < Phlex::HTML
|
|
def initialize(post:, site:, article_class: nil)
|
|
@post = post
|
|
@site = site
|
|
@article_class = article_class
|
|
end
|
|
|
|
def view_template
|
|
article(**article_attributes) do
|
|
header do
|
|
h2 do
|
|
if @post.link_post?
|
|
a(href: @post.link) { "→ #{@post.title}" }
|
|
else
|
|
a(href: @post.path) { @post.title }
|
|
end
|
|
end
|
|
time { @post.formatted_date }
|
|
a(href: @post.path, class: "permalink") { "∞" }
|
|
end
|
|
|
|
raw(safe(@post.body))
|
|
end
|
|
|
|
div(class: "row clearfix") do
|
|
p(class: "fin") do
|
|
raw(safe(Icons.code))
|
|
end
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def article_attributes
|
|
return {} unless @article_class
|
|
|
|
{class: @article_class}
|
|
end
|
|
end
|
|
end
|
|
end
|