Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "html_excerpts" flag to allow Atom <summary> tags to contain HTML #397

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Commits on Nov 14, 2023

  1. Configuration menu
    Copy the full SHA
    8066691 View commit details
    Browse the repository at this point in the history
  2. Added test to verify that whitespace is normalized in post summaries

    The test checks this by verifying that the newlines in the "pre" post are converted to spaces.
    Kronopath committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    a43cf11 View commit details
    Browse the repository at this point in the history
  3. Add "html_summaries" option to allow summaries to output as full HTML

    This allows posts with autogenerated excerpts (that may have images or HTML in them) to keep that HTML intact in the summary portion of the Atom feed. The default remains as having the HTML be stripped and the whitespace normalized.
    
    This has some benefits, because the default value for a post excerpt is for it to be the entire first paragraph of each post. It's not unheard of for it to have plenty of HTML formatting and other tags.
    
    In [my site][1], for example, post excerpts often have images, and I'd very much prefer keeping those images intact in the feed, even if using `excerpt_only` feed generation.
    
    Note that this passes the W3C validator with no warnings, since feed.xml already uses `type="html"` in its `<summary>` tags.
    
    [1]: https://www.kronopath.com/blog/
    Kronopath committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    4776be2 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    080ee6d View commit details
    Browse the repository at this point in the history
  5. Rename the flag to html_excerpts

    This naming is more consistent with the "excerpts_only" flag, though it may be slightly more confusing given that this also applies to the post's "description" option. Still, consistency is key.
    Kronopath committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    a30e2a5 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bf21400 View commit details
    Browse the repository at this point in the history
  7. Attempt to fix tests that are failing due to incorrect post being tested

    Apparently some of the test cases are failing because instead of the "pre" post being tested, it's instead picking up the "liquid" post from just before it.
    
    I suspect that this might be happening because the test machines are maybe configured with a date and time before 2016-04-25, meaning that they don't pick up the "author-reference" post, leading to an off-by-one error. That's my best guess, anyway.
    
    It's not the most robust answer, since it would also likely mean that in these machines the "puts the latest 2 the posts in the feed.xml file" test would also fail. So maybe I'm wrong.
    
    Still, to try to fix this, instead of counting the posts from the most recent, the test now instead counts from the oldest, which should hopefully be more robust to this issue.
    Kronopath committed Nov 14, 2023
    Configuration menu
    Copy the full SHA
    3e6d512 View commit details
    Browse the repository at this point in the history

Commits on Nov 16, 2023

  1. In tests, search for post by title instead of by index

    Apparently the indices just aren't consistent on jekyll-feed's test machines. Neither `feed.items[3]` nor `feed.items[-7]` can be reliably said to be the "pre" post which I use for testing in this PR.
    
    Instead, let's just search through all the posts for whichever one is titled "Pre" and test against that one.
    Kronopath committed Nov 16, 2023
    Configuration menu
    Copy the full SHA
    9ab43a2 View commit details
    Browse the repository at this point in the history