News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

BBCode within [code][/code] tags

Started by bosswhite, January 17, 2019, 08:17:53 AM

Previous topic - Next topic

bosswhite

I want to show certain lines of code within code tags as coloured or bold.
Is this possible at all? Example shows what displays:

  if (periphery>119) then
    override="4xI,M-M,F-F"
  elseif (periphery>60) then
    override="2xL"
[color=green][b]  elseif (periphery>0) and (upper(item.insulation.status)="INSIDE") then
    override="2xL"
  else
    override="1 PART STRAIGHT"[/b][/color]
[color=red][s]item.update()[/s][/color]
  endif
I've been down so long now it's beginning to look like up..

SychO

You mean like this ?

<?php
if (periphery>119then
    override
="4xI,M-M,F-F"
  
elseif (periphery>60then
    override
="2xL"
  
elseif (periphery>0) and (upper(item.insulation.status)="INSIDE"then
    override
="2xL"
  
else
    
override="1 PART STRAIGHT"[/b][/color]
item.update()
  endif


just add <?php at the beginning
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

bosswhite

No, that is not what I am trying to achieve. I am trying to identify added lines of code as color green, and code no longer required as red and strikeout. I want it to display as below:

  if (periphery>119) then
    override="4xI,M-M,F-F"
  elseif (periphery>60) then
    override="2xL"
  elseif (periphery>0) and (upper(item.insulation.status)="INSIDE") then
    override="2xL"
  else
    override="1 PART STRAIGHT"

item.update()
  endif
I've been down so long now it's beginning to look like up..

Illori

the code bbc by default does not support any other bbc within it. you would need a mod, I don't know if any exists to do this.

Shambles

Maybe the 1.1.2 version of Use Color Tags For Code could be upgraded to provide support for 2.0.*

Chen Zhen


You can use the personalized bbc mod to create another code tag.
You will have to name it code2 or something similar but different from the default "code" tag.

example...

name: code2
description: code#2
type: [tag]{content}[/tag]
parsing: content only
trim whitespace: both

HTML:

<div style="width: 40em;padding: 1em 0em 0em 1em;">
<div class="codeheader" style="padding: 0;">
<span class="code floatleft" style="padding: 0em 0em 0em 0.5em;">Code</span>
</div>
<div style="padding: 0;margin: 0;font-size: 2em;clear:both;">
<blockquote style="margin: 0;padding: 0.5em;border: 0;">
<code class="bbc_code">{content}</code>
</blockquote>
</div>
</div>


icon/image: code.png

Then you can use code2 bbcode instead of code.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Arantor

Does that also deal with things like not permitting smileys inside the section (because code tags do so much more than just being formatting and not parsing bbc inside them)?

Chen Zhen


No I forgot about smileys.
If parsing is enabled it will show both bbcodes & smileys.

My SMF Mods & Plug-Ins

WebDev

"Either you repeat the same conventional doctrines everybody is saying, or else you say something true, and it will sound like it's from Neptune." - Noam Chomsky

Advertisement: