Simple Machines Community Forum

General Community => Scripting Help => Topic started by: bosswhite on January 17, 2019, 08:17:53 AM

Title: BBCode within [code][/code] tags
Post by: bosswhite 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:

  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
Title: Re: BBCode within [code][/code] tags
Post by: SychO on January 17, 2019, 08:28:41 AM
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
Title: Re: BBCode within [code][/code] tags
Post by: bosswhite 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
Title: Re: BBCode within [code][/code] tags
Post by: Illori 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.
Title: Re: BBCode within [code][/code] tags
Post by: Shambles on January 17, 2019, 09:41:07 AM
Maybe the 1.1.2 version of Use Color Tags For Code (https://custom.simplemachines.org/mods/index.php?mod=510) could be upgraded to provide support for 2.0.*
Title: Re: BBCode within [code][/code] tags
Post by: Chen Zhen 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:

<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.
Title: Re: BBCode within [code][/code] tags
Post by: Arantor 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)?
Title: Re: BBCode within [code][/code] tags
Post by: Chen Zhen on January 17, 2019, 11:03:31 AM

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