Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved modify line breaks only in certain tags
#1
Not Solved
So we modified a syntax highlighter codebox to do what we want. However there are html linebreaks after each line like so
   
in attempt to fix this in class_parser.php we commented out the section that adds line breaks like this
       //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);
       //}
but then you lose ALL the line breaks in the entire post and its all just mushed together, except the codebox as we want without line breaks
So my question is, is there some template conditional or something else we can do to remove linebreaks from the code box only.

This is the BBCode we made to insert that codebox syntax higlhighter

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

print("test")
[/pre]
IS there a way to not put line breaks in between these pre tags BBCode's but everywhere else?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)