Advertisement:

Author Topic: BBCode within [code][/code] tags  (Read 488 times)

Offline bosswhite

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
BBCode within [code][/code] tags
« on: January 17, 2019, 08:17:53 AM »
I want to show certain lines of code within code tags as coloured or bold.
Is this possible at all? Example shows what displays:

Code: [Select]
  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..

Online SychO

  • Customizer
  • Sr. Member
  • *
  • Posts: 857
  • Gender: Male
    • SychO9 on GitHub
    • SychO
Re: BBCode within [code][/code] tags
« Reply #1 on: January 17, 2019, 08:28:41 AM »
You mean like this ?

Code: [Select]
<?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

Imazighen

Offline bosswhite

  • Jr. Member
  • **
  • Posts: 204
  • Gender: Male
Re: BBCode within [code][/code] tags
« Reply #2 on: January 17, 2019, 09:07:58 AM »
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..

Offline Illori

  • Project Manager
  • SMF Legend
  • *
  • Posts: 50,318
Re: BBCode within [code][/code] tags
« Reply #3 on: January 17, 2019, 09:12:09 AM »
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.

Offline Shambles

  • SMF Hero
  • ******
  • Posts: 5,055
  • Gender: Male
    • i30 Owners Club
Re: BBCode within [code][/code] tags
« Reply #4 on: January 17, 2019, 09:41:07 AM »
Maybe the 1.1.2 version of Use Color Tags For Code could be upgraded to provide support for 2.0.*

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,170
  • Gender: Male
  • If you're going through hell, keep going!
    • Underdog-01 on GitHub
    • WebDev.ca
Re: BBCode within [code][/code] tags
« Reply #5 on: January 17, 2019, 10:54:19 AM »

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:
Code: [Select]
<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
Simple Portal Support

Request politely & demand nothing.

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 70,181
    • StoryBB/StoryBB on GitHub
Re: BBCode within [code][/code] tags
« Reply #6 on: January 17, 2019, 10:56:17 AM »
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)?
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline Chen Zhen

  • Sophist Member
  • *****
  • Posts: 1,170
  • Gender: Male
  • If you're going through hell, keep going!
    • Underdog-01 on GitHub
    • WebDev.ca
Re: BBCode within [code][/code] tags
« Reply #7 on: January 17, 2019, 11:03:31 AM »

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

My SMF Mods & Plug-Ins

WebDev
Simple Portal Support

Request politely & demand nothing.