![]() |
idea for code boxes - 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: idea for code boxes (/thread-752.html) |
idea for code boxes - Skaperen - Nov-03-2016 for code boxes, especially big ones, how about "_X" in the upper right corner to minimize the box or make it go away entirely? RE: idea for code boxes - metulburr - Nov-03-2016 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. RE: idea for code boxes - Dragonexpert - Nov-03-2016 Perhaps something like this: $excode = explode("\n", $code); if(count($excode) >= 50) { // spoiler stuff here }Replace with the correct variable name though. RE: idea for code boxes - metulburr - Nov-03-2016 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; } RE: idea for code boxes - Root13 - Nov-03-2016 (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. Is it working? |