Python Forum
Syntax Highlighter Codebox Issues - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Forum & Off Topic (https://python-forum.io/forum-23.html)
+--- Forum: Board (https://python-forum.io/forum-26.html)
+--- Thread: Syntax Highlighter Codebox Issues (/thread-287.html)

Pages: 1 2 3 4


Syntax Highlighter Codebox Issues - metulburr - Oct-04-2016

We are testing new code box. This python tag is syntaxhighlighter Version 4.x. which works with a number of langauges.

We converted all original code tags, php tags, etc. to this new python tag. Let us know if you see any problems. 

Current Issues with Syntax Highlighter Codebox:
  • No select all option (you can double click the code to select all)
  • no restriction on length down (For right now you can surround your python code tags with spoiler tags to shorten the code to a link to expand as needed)
  • copy and paste not working correctly (You must paste code as plain text for this codebox to work right CTRL + SHIFT + V or right click "paste as plain text")
  • Sometimes copying from HTML to codebox can add extra things (such as newlines, or switch a link to an <a> tag within the code box (images/links in the code box can break it and post the html instead)
  • hide underscores from within the code box, if it is at the bottom of the box, or a single line (this is only some browsers, and only on the bottom line of the code box)

import os

class Klass:
    '''docstring'''
    def __init__(self):
        self.var = "var"
        pass



RE: testing new codebox - wavic - Oct-04-2016

Rows numeration :) Gooood


RE: testing new codebox - sparkz_alot - Oct-04-2016

At the moment, when I use the python button to post this:

while True:
   number = int(input("enter a number between 1 and 10: "))    # Get a number
   if 0 <= number <= 10:
       print("number = ", number)
       # Go back and get another number
   else:
       print("out of range")
       break    # Break out of 'while' loop and continue with next command

print("Done")


i get this

[/font][/size][/color]
[color=#000000][size=small][font=InputMono][color=#000000][size=small][font=InputMono][color=#000080][b]while True[/b][/color]:
    number = [color=#000080]int[/color]([color=#000080]input[/color]([color=#008080][b]"enter a number between 1 and 10: "[/b][/color]))    [color=#808080][i]# Get a number
[/i][/color]    [color=#000080][b]if [/b][/color][color=#0000ff]0 [/color]<= number <= [color=#0000ff]10[/color]:
        [color=#000080]print[/color]([color=#008080][b]"number = "[/b][/color], number)
        [color=#808080][i]# Go back and get another number
[/i][/color]    [color=#000080][b]else[/b][/color]:
        [color=#000080]print[/color]([color=#008080][b]"out of range"[/b][/color])
        [color=#000080][b]break    [/b][/color][color=#808080][i]# Break out of 'while' loop and continue with next command
[/i][/color]
[color=#000080]print[/color]([color=#008080][b]"Done"[/b][/color])[/font][/size][/color][/font][/size][/color]
[color=#000000][size=small][font=InputMono]


In both Chrome and IE. Are you folks still working on this? 




RE: testing new codebox - metulburr - Oct-04-2016

Where did you copy the code from? For example if you edit your post and select "source" bbcode option you see a ton of text modifcations.

this 
while True:
turns into this
Output:
[color=#000080][size=small][font=InputMono][b]while True[b][font][size][color][color=#000000][size=small][font=InputMono]:[font][size][color]



RE: testing new codebox - snippsat - Oct-04-2016

Quote:In both Chrome and IE. Are you folks still working on this?
It's a feature of MyBB to auto detect tag,so not sure if it's so easy fix.
Just copy from plain text editor and then post code.
There also a view source button far right in sceditor(ctrl+shif+s).

We are just happy to get syntaxhighlighter V4 to work.
I has been a little bumpy road,i have run V4 local and Flask all ok.
Then try to run it on server MyBB,but there where trouble with <br> tag.
metulburr did a really nice last fix,and the it all worked :)

So now we are running on Default theme which fit the forum fine.
There are also darker themes,but dos not fit forum so well.
Also Python inspired as Django theme.
[Image: rFwqhi.jpg]


RE: testing new codebox - sparkz_alot - Oct-04-2016

(Oct-04-2016, 04:09 PM)metulburr Wrote: Where did you copy the code from? For example if you edit your post and select "source" bbcode option you see a ton of text modifcations.

this 
while True:
turns into this
Output:
[color=#000080][size=small][font=InputMono][b]while True[b][font][size][color][color=#000000][size=small][font=InputMono]:[font][size][color]

Copied it from pycharm

Moved it to notepad++, lets see:

while True:
    number = int(input("enter a number between 1 and 10: "))    # Get a number
    if 0 <= number <= 10:
        print("number = ", number)
        # Go back and get another number
    else:
        print("out of range")
        break    # Break out of 'while' loop and continue with next command

print("Done")



RE: testing new codebox - metulburr - Oct-04-2016

@[snippsat]
Quote:Copied it from pycharm
apparently pycharm uses inherited BBCode to highlight their text, in which MyBB interprets back into the editor??


RE: testing new codebox - sparkz_alot - Oct-04-2016

OK, a problem with pycharm? just mine? any other ide's have a problem?


RE: testing new codebox - metulburr - Oct-04-2016

Quote:a problem with pycharm?
apparently so

Quote: any other ide's have a problem?
I only use Vim and Geany, neither have this problem.


RE: testing new codebox - snippsat - Oct-04-2016

(Oct-04-2016, 04:31 PM)sparkz_alot Wrote: OK, a problem with pycharm?
No problem for me when i copy direct from PyCharm.
Have you copied code from net into PyCharm?