Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
idea for code boxes
#1
for code boxes, especially big ones, how about "_X" in the upper right corner to minimize the box or make it go away entirely?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
I have been trying to figure out a way to auto wrap it in spoiler tags in the event its 50 lines or more. In that way you could shrink it entirely.
Recommended Tutorials:
Reply
#3
Perhaps something like this:
$excode = explode("\n", $code);
if(count($excode) >= 50)
{
// spoiler stuff here
}
Replace with the correct variable name though.
Reply
#4
my problem was that i have not been successful at making spoiler html code. All current spoiler tags are handled by the hazSpoiler plugin. And even after looking at the code, im not sure how to replicate it. 

Ive tried some custom mycodes such as
https://jsfiddle.net/fy452ct3/3/


i tried somehting like this a bit ago
function my2_nl2br($string){
    $cutoff = 250;
    $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);
                if (strlen($b) > $cutoff){
                        $string = "[spoiler]" . $string . "[/spoiler]";
                    }
                }
            }
        }
            
    return $string;

}       
Recommended Tutorials:
Reply
#5
(Nov-03-2016, 01:39 PM)metulburr Wrote: my problem was that i have not been successful at making spoiler html code. All current spoiler tags are handled by the hazSpoiler plugin. And even after looking at the code, im not sure how to replicate it. 

Ive tried some custom mycodes such as
https://jsfiddle.net/fy452ct3/3/


i tried somehting like this a bit ago
function my2_nl2br($string){
    $cutoff = 250;
    $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);
                if (strlen($b) > $cutoff){
                        $string = "[spoiler]" . $string . "[/spoiler]";
                    }
                }
            }
        }
            
    return $string;

}       

Is it working?
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020