Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gh-129873: IDLE: Improve help.py's method of parsing HTML #129859

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

Merged
merged 11 commits into from
Feb 9, 2025

Conversation

StanFromIreland
Copy link
Contributor

@StanFromIreland StanFromIreland commented Feb 8, 2025

In help.copy_strip, only copy the text <section>. In help.HelpParser.handle_starttag and elsewhere, remove code to skip the no longer present html. Add a reminder at the top of idle.rst to run copy_strip after changes.

As discussed with Terry, copy_strip() now only copies desired content instead of skipping lines while parsing.


📚 Documentation preview 📚: https://cpython-previews--129859.org.readthedocs.build/

copy_strip now only copies content between certain tags. This commit also cleans up old logic for dealing with the undesired content. Added note to idle.rst about updating help.html
@StanFromIreland
Copy link
Contributor Author

StanFromIreland commented Feb 8, 2025

This will be failing until the updated html is added. However since #129727 updates the .rst and already has changes to the html it is best to wait till that is merged and then I will update it.

Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete the definition of self.show on line 57

PR 129727 is merged, so add the new help.html.

@StanFromIreland
Copy link
Contributor Author

I have made the requested changes; please review again

@bedevere-app
Copy link

bedevere-app bot commented Feb 8, 2025

Thanks for making the requested changes!

@terryjreedy: please review the changes made to this pull request.

@bedevere-app bedevere-app bot requested a review from terryjreedy February 8, 2025 20:27
Added during testing and forgot to remove.
Added during testing and forgot to remove. Also remove self.show def
@StanFromIreland
Copy link
Contributor Author

StanFromIreland commented Feb 8, 2025

Source of 3 extra spaces is indentation of the <section id="idle"> tag, what should we do, add a long fix or update the test?

I forgot we are working with html and indentation does not matter here.

I forgot indentation is added after :-/
@terryjreedy terryjreedy changed the title IDLE: Improve help.py's method of parsing HTML gh-129873: IDLE: Improve help.py's method of parsing HTML Feb 9, 2025
Copy link
Member

@terryjreedy terryjreedy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am slightly surprised that the trailing newline (the double \n\n) at the end of the file did not trigger an error like trailing spaces. (This at least used to be an error for some other files.) Leave it until the rules change.

EDIT: I prefer the .html with the strange random indent removed.

Otherwise, looks correct. Will download, manually test, make an issue, add news, upload, and presumably merge.

@python python deleted a comment from bedevere-app bot Feb 9, 2025
@python python deleted a comment from bedevere-app bot Feb 9, 2025
@terryjreedy terryjreedy added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes topic-IDLE labels Feb 9, 2025
@terryjreedy terryjreedy enabled auto-merge (squash) February 9, 2025 08:05
@terryjreedy terryjreedy merged commit 6fbf15f into python:main Feb 9, 2025
45 checks passed
@miss-islington-app
Copy link

Thanks @StanFromIreland for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 9, 2025
…onGH-129859)

In `help.copy_strip`, only copy the text `<section>`.  In `help.HelpParser.handle_starttag` and elsewhere, remove code to skip the no longer present html.  Add a reminder at the top of idle.rst to run copy_strip after changes.
---------

(cherry picked from commit 6fbf15f)

Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 9, 2025

GH-129884 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Feb 9, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 9, 2025
…onGH-129859)

In `help.copy_strip`, only copy the text `<section>`.  In `help.HelpParser.handle_starttag` and elsewhere, remove code to skip the no longer present html.  Add a reminder at the top of idle.rst to run copy_strip after changes.
---------

(cherry picked from commit 6fbf15f)

Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 9, 2025

GH-129885 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Feb 9, 2025
@StanFromIreland StanFromIreland deleted the help-idle branch February 9, 2025 08:40
@StanFromIreland
Copy link
Contributor Author

Let me know in the future if they are needed and I can do it for you.

terryjreedy added a commit that referenced this pull request Feb 9, 2025
…129859) (#129884)

gh-129873: IDLE: Improve help.py's method of parsing HTML (GH-129859)

In `help.copy_strip`, only copy the text `<section>`.  In `help.HelpParser.handle_starttag` and elsewhere, remove code to skip the no longer present html.  Add a reminder at the top of idle.rst to run copy_strip after changes.
---------

(cherry picked from commit 6fbf15f)

Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
terryjreedy added a commit that referenced this pull request Feb 9, 2025
…129859) (#129885)

gh-129873: IDLE: Improve help.py's method of parsing HTML (GH-129859)

In `help.copy_strip`, only copy the text `<section>`.  In `help.HelpParser.handle_starttag` and elsewhere, remove code to skip the no longer present html.  Add a reminder at the top of idle.rst to run copy_strip after changes.
---------

(cherry picked from commit 6fbf15f)

Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Terry Jan Reedy <[email protected]>
@terryjreedy
Copy link
Member

They? Nearly everying is backported.

@StanFromIreland
Copy link
Contributor Author

I meant "make an issue, add news".

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

Successfully merging this pull request may close these issues.

2 participants