Merge pull request #17 from stevedylandev/chore/posts-formatting-improvements
804f3a78
chore/posts formatting improvements
7 file(s) · +43 −26
chore/posts formatting improvements
| 3104 | 3104 | ||
| 3105 | 3105 | [[package]] |
|
| 3106 | 3106 | name = "posts" |
|
| 3107 | - | version = "0.1.3" |
|
| 3107 | + | version = "0.1.4" |
|
| 3108 | 3108 | dependencies = [ |
|
| 3109 | 3109 | "andromeda-auth", |
|
| 3110 | 3110 | "askama 0.15.6", |
| 1 | 1 | [package] |
|
| 2 | 2 | name = "posts" |
|
| 3 | - | version = "0.1.3" |
|
| 3 | + | version = "0.1.4" |
|
| 4 | 4 | edition = "2024" |
|
| 5 | 5 | description = "CMS blog with admin interface" |
|
| 6 | 6 | license = "MIT" |
| 316 | 316 | options.insert(Options::ENABLE_STRIKETHROUGH); |
|
| 317 | 317 | options.insert(Options::ENABLE_TABLES); |
|
| 318 | 318 | options.insert(Options::ENABLE_TASKLISTS); |
|
| 319 | + | options.insert(Options::ENABLE_FOOTNOTES); |
|
| 319 | 320 | let parser = Parser::new_ext(content, options); |
|
| 320 | 321 | let mut html_output = String::new(); |
|
| 321 | 322 | html::push_html(&mut html_output, parser); |
| 737 | 737 | opacity: 0.7; |
|
| 738 | 738 | } |
|
| 739 | 739 | ||
| 740 | + | /* Footnotes */ |
|
| 741 | + | ||
| 742 | + | .markdown-body .footnote-definition { |
|
| 743 | + | font-size: 12px; |
|
| 744 | + | opacity: 0.7; |
|
| 745 | + | margin-bottom: 0.5rem; |
|
| 746 | + | display: flex; |
|
| 747 | + | gap: 0.5rem; |
|
| 748 | + | } |
|
| 749 | + | ||
| 750 | + | .markdown-body .footnote-definition-label { |
|
| 751 | + | font-size: 11px; |
|
| 752 | + | opacity: 0.5; |
|
| 753 | + | flex-shrink: 0; |
|
| 754 | + | } |
|
| 755 | + | ||
| 756 | + | .markdown-body .footnote-definition p { |
|
| 757 | + | margin-bottom: 0; |
|
| 758 | + | } |
|
| 759 | + | ||
| 760 | + | .markdown-body sup.footnote-reference a { |
|
| 761 | + | font-size: 11px; |
|
| 762 | + | text-decoration: none; |
|
| 763 | + | opacity: 0.6; |
|
| 764 | + | } |
|
| 765 | + | ||
| 766 | + | .markdown-body sup.footnote-reference a:hover { |
|
| 767 | + | opacity: 1; |
|
| 768 | + | } |
|
| 769 | + | ||
| 740 | 770 | .hidden { |
|
| 741 | 771 | display: none; |
|
| 742 | 772 | } |
| 39 | 39 | <footer class="footer"> |
|
| 40 | 40 | {{ footer_html|safe }} |
|
| 41 | 41 | </footer> |
|
| 42 | + | <script> |
|
| 43 | + | document.querySelectorAll('.post-date').forEach(el => { |
|
| 44 | + | const d = new Date(el.textContent.trim()); |
|
| 45 | + | if (!isNaN(d)) { |
|
| 46 | + | const day = String(d.getDate()).padStart(2, '0'); |
|
| 47 | + | const mon = d.toLocaleString('en-US', { month: 'short' }); |
|
| 48 | + | el.textContent = `${day} ${mon}, ${d.getFullYear()}`; |
|
| 49 | + | } |
|
| 50 | + | }); |
|
| 51 | + | </script> |
|
| 42 | 52 | </body> |
|
| 43 | 53 | </html> |
| 26 | 26 | <a href="/posts/{{ post.slug }}" class="post-item"> |
|
| 27 | 27 | <div class="post-item-info"> |
|
| 28 | 28 | <span class="post-title">{{ post.title }}</span> |
|
| 29 | - | {% if post.tags.is_some() %} |
|
| 30 | - | <span class="post-tags"> |
|
| 31 | - | {% for tag in post.tags.as_deref().unwrap_or_default().split(',') %} |
|
| 32 | - | {% if !tag.trim().is_empty() %} |
|
| 33 | - | <span class="tag">{{ tag.trim() }}</span> |
|
| 34 | - | {% endif %} |
|
| 35 | - | {% endfor %} |
|
| 36 | - | </span> |
|
| 37 | - | {% endif %} |
|
| 38 | 29 | </div> |
|
| 39 | 30 | {% if post.published_date.is_some() %} |
|
| 40 | 31 | <time class="post-date">{{ post.published_date.as_deref().unwrap_or_default() }}</time> |
| 18 | 18 | <a href="/posts/{{ post.slug }}" class="post-item post-item-enhanced"> |
|
| 19 | 19 | <div class="post-item-info"> |
|
| 20 | 20 | <span class="post-title">{{ post.title }}</span> |
|
| 21 | - | {% if post.meta_description.is_some() %} |
|
| 22 | - | {% let desc = post.meta_description.as_deref().unwrap_or_default() %} |
|
| 23 | - | {% if !desc.is_empty() %} |
|
| 24 | - | <span class="post-excerpt">{{ desc }}</span> |
|
| 25 | - | {% endif %} |
|
| 26 | - | {% endif %} |
|
| 27 | - | {% if post.tags.is_some() %} |
|
| 28 | - | <span class="post-tags"> |
|
| 29 | - | {% for tag in post.tags.as_deref().unwrap_or_default().split(',') %} |
|
| 30 | - | {% if !tag.trim().is_empty() %} |
|
| 31 | - | <span class="tag">{{ tag.trim() }}</span> |
|
| 32 | - | {% endif %} |
|
| 33 | - | {% endfor %} |
|
| 34 | - | </span> |
|
| 35 | - | {% endif %} |
|
| 36 | 21 | </div> |
|
| 37 | 22 | {% if post.published_date.is_some() %} |
|
| 38 | 23 | <time class="post-date">{{ post.published_date.as_deref().unwrap_or_default() }}</time> |