mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2026-03-02 02:41:34 +00:00
Clickable usernames and hashtags
Should work well enough. Report edge cases.
This commit is contained in:
parent
1fcdfce868
commit
0ea95d1943
9 changed files with 105 additions and 7 deletions
11
src/site/pug/includes/display_structured.pug
Normal file
11
src/site/pug/includes/display_structured.pug
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
mixin display_structured(parts)
|
||||
each part in parts
|
||||
if part.type === "text"
|
||||
= part.text
|
||||
else if part.type === "user"
|
||||
a(href="/u/"+part.user).link-to-user= part.text
|
||||
else if part.type === "hashtag"
|
||||
//- todo: add link to explore page, when explore page exists.
|
||||
a.link-to-hashtag= part.text
|
||||
else
|
||||
| [UNKNOWN PART TYPE #{part.type}, TEXT:] [#{part.text}]
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
include includes/display_structured
|
||||
|
||||
- const numberFormat = new Intl.NumberFormat().format
|
||||
|
||||
doctype html
|
||||
|
|
@ -20,7 +22,8 @@ html
|
|||
img(src=post.ownerPfpCacheP width=150 height=150 alt="").pfp
|
||||
a.name(href=`/u/${post.getBasicOwner().username}`)= `${post.data.owner.full_name} (@${post.getBasicOwner().username})`
|
||||
if post.getCaption()
|
||||
p.description= post.getCaption()
|
||||
p.structured-text.description
|
||||
+display_structured(post.getStructuredCaption())
|
||||
section.images-gallery
|
||||
for entry in post.children
|
||||
if entry.isVideo()
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
include includes/timeline_page.pug
|
||||
include includes/next_page_button.pug
|
||||
include includes/display_structured
|
||||
|
||||
- const numberFormat = new Intl.NumberFormat().format
|
||||
|
||||
|
|
@ -30,7 +31,8 @@ html
|
|||
else
|
||||
h1.full-name= `@${user.data.username}`
|
||||
if !user.fromReel
|
||||
p.bio= user.data.biography
|
||||
p.structured-text.bio
|
||||
+display_structured(user.getStructuredBio())
|
||||
if user.data.external_url
|
||||
p.website
|
||||
a(href=user.data.external_url)= user.data.external_url
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue