Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 syntax highlighting
Made a regex for pre tag in MyCode and deactivated HTML in post.
Still the same problem.

HTML is off witch is better for security.

[pre class="brush: python"]
print('hello world')

[pre class="brush: python"]
print('hello world')

Found this info.

Quote:Note that in MyBB, you have to be careful with style tags because linebreaks are automatically converted into <br />
and so your style will have <br /> tags inside it
Not to happy about this automatic stuff :@
So maybe a post to MyBB staff and ask if there is a way to turn it off.
See that in php of v3 they have some cleaning $text = str_replace ( "\n", "", $text).
So maybe have to clean it in some way.
Nice job.
Will do.
So i have looked more into this.

echo nl2br("foo isn't\n bar");

foo isn't<br />
Link MyCode.
$options['nl2br'] Each line break will be transformed into a html line break (<br />), if this option is set to 1
So it's set to 1.

It's defined in class_parser.php
What i am unsure about is that options = array( is comment out.
Tried only to un-uncomment  nl2br,but that lock forum down :-/
In line 212 i tried to set 1,but did't help.

Think maybe i have to un-uncomment whole array and set values for each  :s
[pre class="brush: python"]
print('hello world')


To keep changelog.
I commented that entire if condition out. It appears to have worked. Im not sure of any unwanted side effects that might of caused (if any) 

        //if(!isset($this->options['nl2br']) || $this->options['nl2br'] != 0)
        //  $message = nl2br($message);
            // Fix up new lines and block level elements
        //  $message = preg_replace("#(</?(?:                                                            html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)\s*  <br />#i", "$1", $message);
        //  $message = preg_replace("#(&nbsp;)+(</?(?:                                                   html|head|body|div|p|form|table|thead|tbody|tfoot|tr|td|th|ul|ol|li|div|p|blockquote|cite|hr)[^>]*>)#i", "$2", $message);
EDIT: I get it, then you lose ALL newlines. Ill revert back for the time being
Im crappy at regex, but what if we added a condition that replace newlines with breaks if not within pre tag?
I tried cleaning inside of pre tags only. It keeps the rest of the post fixed, and removes the newlines from within the pre tags. However the break tags still remain

function my_nl2br($string){
$string = str_replace("\n", "<br />", $string);
if(preg_match_all('/\<pre\>(.*?)\<\/pre\>/', $string, $match)){
    foreach($match as $a){
        foreach($a as $b){
        $string = str_replace('<pre>'.$b.'</pre>', "<pre>".str_replace("<br />", "", $b)."</pre>",       $string);
return $string;
apparently other people have the same problem
Oh wait i think i might of got it. How does that look? Anything wrong? All newlines correct and as expected?

First line
second line

fourth line

sixth line

import pygame as pg
import sys
class States(object):
    def __init__(self):
        self.done = False = None
        self.quit = False
        self.previous = None
class Menu(States):
    def __init__(self):
        States.__init__(self) = 'game'
    def cleanup(self):
        print("cleaning up Menu state stuff")
Although it still does not copy from the codebox correctly. But only in the advanced editor. You can copy and paste it into the quick reply no problem. So whats different?
Very good what did you do :cool:

Quote:Although it still does not copy from the codebox correctly.
That should be an easier fix,maybe just use the button from V3 and make it insert.
[pre class="brush: python"]

Shall look more into it later today,it's midnight theme i have build with here.
[pre class="brush: python"]
print('hello world')


[pre class="brush: python"]
import dataset

player_lst = [
    {'name': 'Superman', 'score': 9999999},
    {'name': 'Hulk', 'score': 2000001},
    {'name': 'Batman', 'score': 500055}

db = dataset.connect('sqlite:///heroes.db')
table = db['Score_table']
for item in player_lst:

[pre class="brush: python"]
from collections import deque
from itertools import islice

def window(iterable, size=2):
   iterable = iter(iterable)
   d = deque(islice(iterable, size), size)
   yield d
   for x in iterable:
       yield d
I made a BBCode for that so we dont have to keep typing in the class brush python etc.
it should be

[python]CODE HERE[/python]
The actual button for it is currently in the new drop down BBcode Button
Okay good.
But now it's 4 click to insert code,should be 2 as other.
Maybe look at own button for this.

Really nice to see it work :)
Have not time now shall look more into it later.

print('hello world')


Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Undo (Ctrl+z) doesn't work on highlighting CynthiaMoore 8 1,093 Apr-25-2020, 05:00 AM
Last Post: buran
  feature request: highlighting Skaperen 9 2,504 Jan-26-2017, 04:13 PM
Last Post: Kebap

Forum Jump:

Users browsing this thread: 1 Guest(s)