Skip to content

Excerpt Possibly Incorrect #12

Description

@andrew-d

Hello,

The "excerpt" feature seems to be not working as I would expect - not sure if this is intended or not. Specifically, it seems to only work if the first <p> tag starts at the very beginning of the post. Here's an example - if you take the regex here here's what you get:

>>> re.search(r'\A.*?(?:<p>(.+?)</p>)?', "<p>Excerpt at beginning</p> more text <p>blah</p>", re.M | re.S).groups()
('Excerpt at beginning',)
>>> re.search(r'\A.*?(?:<p>(.+?)</p>)?', "Stuff before the <p>Excerpt at beginning</p> more text <p>blah</p>", re.M | re.S).groups()
(None,)

If this isn't intended, I can try and fix it, if you want.

Also, a bit of a side-note: the regex is case-sensitive, so it doesn't work with upper-case <p> tags. This isn't so important, though.

>>> re.search(r'\A.*?(?:<p>(.+?)</p>)?', "<P>Excerpt at beginning</P> more text <p>blah</p>", re.M | re.S).groups()
(None,)

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions