Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Reintroduce copybutton to all code examples#26

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
theacodes merged 1 commit intopython:masterfromccwang002:fix-copybutton
Feb 16, 2019
Merged

Reintroduce copybutton to all code examples#26

theacodes merged 1 commit intopython:masterfromccwang002:fix-copybutton
Feb 16, 2019

Conversation

ccwang002
Copy link
Contributor

Many code examples on the official Python documentation do not have a>>> copy button. For example, the code snippets in the currentcollections module. Those examples were excluded since Sphinx assigns a different highlight language to those code-blocks.

In the past, Sphinx usedpython3 to highlight all the doctest and malformed code blocks (started with: instead of::). Those blockes had thehighlight-python3 CSS class in the generated HTML. For example, see thecollections module in Python 3.3.

However, with the recent change in Sphinx (sphinx-doc/sphinx#4137), the doctest blocks are highlighted bypycon, and malformed blocks becomedefault for unknown reason. Therefore, those blocks are not captured bycopybutton.js due to a different CSS class name. There are in total 185 doctests and 382 malformed(?) code blocks highlighted bypycon anddefault language in the latest Python official documentation. Note that thedefault language has a similar behavior topython3.

This pull request lets code blocks of two additional languages (pycon anddefault) to add the copybutton.

All occurrences of hightlight-pycon in current Python master:
install/index.html:1faq/windows.html:2faq/extending.html:2faq/programming.html:2whatsnew/3.2.html:1whatsnew/2.7.html:11extending/embedding.html:1extending/extending.html:1extending/newtypes_tutorial.html:5library/shlex.html:1library/re.html:4library/urllib.parse.html:2library/multiprocessing.html:7howto/sorting.html:1howto/logging-cookbook.html:2library/turtle.html:72library/decimal.html:12library/unittest.mock.html:4library/http.cookies.html:1library/statistics.html:19library/secrets.html:3library/ssl.html:1library/email.compat32-message.html:2library/email.policy.html:1library/traceback.html:1library/collections.html:7library/email.message.html:2library/datetime.html:2library/difflib.html:1library/email.iterators.html:1library/configparser.html:13
All occurrences of hightlight-default in current Python master:
tutorial/floatingpoint.html:1faq/programming.html:8whatsnew/3.2.html:32whatsnew/2.7.html:2library/getopt.html:2library/shlex.html:3library/hashlib.html:10library/re.html:3library/unicodedata.html:1library/urllib.parse.html:3library/functions.html:10library/weakref.html:6library/base64.html:1library/ftplib.html:1library/reprlib.html:1library/turtle.html:3library/inspect.html:1library/pprint.html:4library/operator.html:5library/unittest.mock-examples.html:55library/decimal.html:23library/unittest.mock.html:72library/copyreg.html:1library/ssl.html:3library/time.html:1library/fractions.html:3library/functools.html:1library/ipaddress.html:19library/pathlib.html:2library/fnmatch.html:1library/collections.html:18library/stdtypes.html:12library/datetime.html:10library/difflib.html:17library/nntplib.html:6howto/ipaddress.html:3howto/functional.html:15howto/sorting.html:22reference/lexical_analysis.html:1

@theacodes
Copy link
Collaborator

Thank you,@ccwang002!

@theacodestheacodes merged commit6487f56 intopython:masterFeb 16, 2019
@ccwang002
Copy link
ContributorAuthor

Sorry about this, but I just realized that in the next Sphinx release, we might need to includepycon3 language as well (ref:sphinx-doc/sphinx#5770).

@JulienPalard
Copy link
Member

JulienPalard commentedFeb 18, 2019
edited
Loading

On the contrary, you're finding an issuebefore it happen, I think this is great ^^

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

@theacodestheacodestheacodes approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@ccwang002@theacodes@JulienPalard

[8]ページ先頭

©2009-2025 Movatter.jp