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

need to hide numbers of code line when copy pasting example from site web #896

Closed
pyweeker opened this issue Jun 7, 2021 · 7 comments
Closed

Comments

@pyweeker
Copy link

pyweeker commented Jun 7, 2021

Hello,
from this example page:
https://arcade.academy/examples/sprite_collect_rotating.html#sprite-collect-rotating

if you want to copy and paste examples from site web, you get this:

1"""
  2Sprite Collect Rotating Coins
  3
  4Simple program to show basic sprite usage.
  5
  6Artwork from http://kenney.nl
  7
  8If Python and Arcade are installed, this example can be run from the command line with:
  9python -m arcade.examples.sprite_collect_rotating
 10"""
 11
 12import random
 13import arcade
 14import os
 15
 16# --- Constants ---
 17SPRITE_SCALING_PLAYER = 0.5
 18SPRITE_SCALING_COIN = 0.2
 19COIN_COUNT = 50
 20
 21SCREEN_WIDTH = 800
 22SCREEN_HEIGHT = 600
 23SCREEN_TITLE = "Sprite Collect Rotating Coins Example"
 24
 25
 26class Coin(arcade.Sprite):
@pvcraven
Copy link
Member

pvcraven commented Jun 7, 2021 via email

@ghost
Copy link

ghost commented Jun 8, 2021

@pvcraven yes, clicking that also keeps the line numbers when it shouldn't

edit: and i believe it is for everything

@pyweeker
Copy link
Author

pyweeker commented Jun 8, 2021 via email

@MisoMosiSpy
Copy link
Contributor

Yes, the line number are included with copy button as well. I studied this code, the copy button targets the whole cell which contains code, I think it will be difficult to fix this to separate line numbers from the file contents here.

However, I did find option to remove the line numbers using regex in Sphinx copy button configuration (it is tested and working). Let me know if you want me to raise the pull request.

Otherwise we can remove the line numbers as I didn't find any references to them in the associated text.

@pvcraven
Copy link
Member

pvcraven commented Jun 18, 2021

This is odd. Seems starting with Sphinx 4.0.0 this is how it works. Sphinx 3.5.7 still copies w/o line numbers. I couldn't find a bug report, yet feel like there HAS to be one out there for it. I listed it as:

sphinx-doc/sphinx#9363

Unfortunately, 4.0.0 also required us to update the css, and building with 3.5.7 means we'll need to go back css versions I think.

@einarf
Copy link
Member

einarf commented Jun 18, 2021

We should stick to Sphinx 3.x for now I think. 4.x do add a lot of issues,

@pvcraven
Copy link
Member

See:
sphinx-doc/sphinx#9363
readthedocs/sphinx_rtd_theme#1168

I reverted to 3.5.4 and uploaded fixed files. We'll keep with 3.5.4 for a while. The cloud should update withing 24 hours.

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

No branches or pull requests

4 participants