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

Navigation items missing when run against Discourse 2.8.14 #172

Closed
sparkiegeek opened this issue Oct 20, 2023 · 0 comments · Fixed by #173
Closed

Navigation items missing when run against Discourse 2.8.14 #172

sparkiegeek opened this issue Oct 20, 2023 · 0 comments · Fixed by #173

Comments

@sparkiegeek
Copy link
Contributor

sparkiegeek commented Oct 20, 2023

    def _get_section(self, soup, title_text):
        """
        Given some HTML soup and the text of a title within it,
        get the content between that title and the next title
        of the same level, and return it as another soup object.

        E.g. if `soup` contains is:

        <p>Pre</p>
        <h2>My heading</h2>
        <p>Content</p>
        <h2>Next heading</h2>

        and `title_text` is "My heading", then it will return:

        <p>Content</p>
        """
        heading = soup.find(HEADER_REGEX, string=title_text)

This is used to find a section, by looking for a header, e.g. "Navigation"

the soup.find(HEADER_REGEX, string=title_text) will find something for e.g. <h2>Navigation</h2> but in 2.8.14, Discourse now renders

<h2>
<a class="anchor" href="#navigation-3" name="navigation-3"></a>Navigation</h2>

note the extra <a/>

sparkiegeek added a commit to sparkiegeek/canonicalwebteam.discourse that referenced this issue Oct 20, 2023
sparkiegeek added a commit to sparkiegeek/canonicalwebteam.discourse that referenced this issue Oct 20, 2023
sparkiegeek added a commit to sparkiegeek/canonicalwebteam.discourse that referenced this issue Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant