Python Forum
syntax highlighting - 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 highlighting (/thread-15.html)

Pages: 1 2 3 4 5 6


RE: syntax highlighting - metulburr - Oct-04-2016

It has its own button now. REmoved it from drop down BBCode Buttons
Quote:Have not time now shall look more into it later.
Me neither...At least its progress  :D


RE: syntax highlighting - metulburr - Oct-04-2016

Quote:Very good what did you do
Oh i jsut saw this.

I replace PHP's nl2br function with a modified function to replace pre tags with the pytohn brush (since that is what we are using to insert codeboxes).

in class_parser.php ->
function my2_nl2br($string){
    $string = str_replace("\n", "<br />", $string);
    if(preg_match_all('/\<pre class="brush: python"\>(.*?)\<\/pre\>/', $string, $match)){
        foreach($match as $a){
            foreach($a as $b){
                $string = str_replace('<pre class="brush: python">'.$b.'</pre>','<pre class="brush:      python">'.str_replace("<br />", "\n", $b)."</pre>", $string);
                        }
                    }
                }

                return $string;

}
and used that in the post bit instead


RE: syntax highlighting - snippsat - Oct-04-2016

Quote:I replace PHP's nl2br function with a modified function to replace pre tags with the pytohn brush (since that is what we are using to insert codeboxes).
Yeah nice i was messing around with class_parser.php,but could not figure it out.

Some more test,all using Python tag.
Now it's theme midnight,which i think look good.
Different theme is on Page-2,
i am gone change theme to see how it look in forum.
Theme on page-2 did i run in Flask.
Looking for a nice 16x16 icon we can use for button SyntaxHighlighter v4.

Python:
import re

class Hardware(object):
    def __init__(self, name, hardware_id):
        self.name = name
        self.hardware_id = hardware_id

    @property
    def show_info(self):
        '''Show hardwareinfo'''
        print 'Name: {} | hardware_id: {}'.format(self.name, self.hardware_id)

class Cpu(Hardware):
    max_temp = 72
    def __init__(self, name, hardware_id, socket, speed):
        Hardware.__init__(self, name, hardware_id)
        self.socket = socket
        self.speed = speed

    @classmethod
    def heat_advice(cls, current_temp):
        '''Give heat advice to user'''
        if current_temp < cls.max_temp:
            return 'Current temp: {} is ok,under Intel recommended  max temp of: {}'\
        .format(current_temp, cls.max_temp)
        return 'Current temp : {} is over Intel recommended max temp of: {}'\
       .format(current_temp, cls.max_temp)
Html:
<html>
<body>
  <div id='images'>
    <a href='image1.html'>My image 1 <br /><img src='image1_thumb.jpg' /></a>
  </div>
  <div>
    <p class="car">
      <a class="bmw" href="Link to bmw"></a>
      <a class="opel" href="Link to opel"></a>
    </p>
    <p class="end">
      all cars are great
    </p>
  </div>
</body>
</html>
Css:
.all {
    width: 100px;
    height: 100px;
    position: absolute;
    top:0px;
    bottom: 200px;
    left: 0px;
    right: 300px;
    margin: auto;
}

body {
  background: linear-gradient(to left, #616161, #9bc5c3);
}

.parent {
  width: 450px;
  height: 150px;
  text-align: center;
  padding: 20px 17px;
}
Js:
$("#delay input").click(function(e) {
  e.preventDefault();
  setTimeout(function() {
    $("#delay").submit();
  }, 2000);
});



RE: syntax highlighting - metulburr - Oct-04-2016

Quote:Now it's theme midnight,which i think look good.
I actually like the default theme better. The whole layout of the forum is light, and that codebox seems more for a dark theme. The one thing dislike though is there is no perimeter box on it though.


RE: syntax highlighting - metulburr - Oct-04-2016

I think we should remove the php code button as it makes it more confusing.


RE: syntax highlighting - snippsat - Oct-04-2016

(Oct-04-2016, 01:14 PM)metulburr Wrote:
Quote:Now it's theme midnight,which i think look good.
I actually like the default theme better. The whole layout of the forum is light, and that codebox seems more for a dark theme. The one thing dislike though is there is no perimeter box on it though.
Yes i can agree with this,have change to default theme now.
Look ok?


RE: syntax highlighting - metulburr - Oct-04-2016

Its still showing up as midnight to me. 

def func:
    pass



RE: syntax highlighting - metulburr - Oct-04-2016

So just to get this straight...when we had the plugin, there was an option in aCP to switch between themes for the codebox. Now using V4, wiht no plugin, how are you switching between them?

and yes i see it now  :D


RE: syntax highlighting - snippsat - Oct-04-2016

(Oct-04-2016, 01:27 PM)metulburr Wrote: I think we should remove the php code button as it makes it more confusing.
Yes agree,should be the main button for code tag.
Maybe we could remove both,seem work fine for all cases.
¨¨ `.,/*-+ just some sign test "#@£ 12999 <hello> """fine""" or '----'
Just some text 1234
print('hello world')
Quote:Now using V4, wiht no plugin, how are you switching between them?
I have build all Theme local,so now it's direct change to CSS file on server.


RE: syntax highlighting - metulburr - Oct-04-2016

Quote:Maybe we could remove both,seem work fine for all cases.
we could try it. Disabled both original codebox and php scheditor buttons.