Using {SIMPLETEXT} and {INTTEXT}

Get help developing custom BBCodes or request one.
Post Reply
User avatar
Restless Rancor
Registered User
Posts: 183
Joined: Tue Sep 18, 2018 1:51 pm

Using {SIMPLETEXT} and {INTTEXT}

Post by Restless Rancor » Fri Oct 19, 2018 5:32 pm

Hi, I've added a BBcode to use shields.io badges:

Code: Select all

[shield]{SIMPLETEXT}[/shield]

Code: Select all

<img src="https://img.shields.io/badge/{SIMPLETEXT}.svg?longCache=true&?label=healthinesses">
This works fine, [shield]phpbb-3.2.3-green[/shield] will produce: Image

However, if I try something like this, it doesn't work as >, <, @ and = are not simpletext:
[shield]phpbb->=3.1.9<3.2.0@dev-green[/shield]

Working correctly, it should show: Image

If someone could help me figure out what I should have for my bbcode useage and html replacement, that'd be great. Thanks!
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
Lumpy Burgertushie
Registered User
Posts: 65198
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Using {SIMPLETEXT} and {INTTEXT}

Post by Lumpy Burgertushie » Fri Oct 19, 2018 5:53 pm

wild guess; since those don't work, try unicode for those characters.

https://unicode-table.com/en/

sorry, meant ascii: https://www.asciitable.com/
robert
I am available for custom work on a donation basis. Please send me a PM with your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

OK, so what's the speed of dark?

User avatar
JoshyPHP
Code Contributor
Posts: 963
Joined: Mon Jul 11, 2011 12:28 am

Re: Using {SIMPLETEXT} and {INTTEXT}

Post by JoshyPHP » Fri Oct 19, 2018 5:56 pm

If you want to limit the content to a particular set of characters you can use a regexp like this: {REGEXP=/^[-.<=>@0-9a-z]+$/} in the definition and {REGEXP} in the template.
I wrote the thing that does BBCodes in 3.2.

User avatar
Restless Rancor
Registered User
Posts: 183
Joined: Tue Sep 18, 2018 1:51 pm

Re: Using {SIMPLETEXT} and {INTTEXT}

Post by Restless Rancor » Fri Oct 19, 2018 6:15 pm

Lumpy Burgertushie wrote:
Fri Oct 19, 2018 5:53 pm
wild guess; since those don't work, try unicode for those characters.

https://unicode-table.com/en/

sorry, meant ascii: https://www.asciitable.com/
robert
Hi Robert, sorry I should have explained that the &?label=healthinesses in the src will automatically convert the URL for me so I can use the symbols.
JoshyPHP wrote:
Fri Oct 19, 2018 5:56 pm
If you want to limit the content to a particular set of characters you can use a regexp like this: {REGEXP=/^[-.<=>@0-9a-z]+$/} in the definition and {REGEXP} in the template.
Hi Joshy,
[shield]{REGEXP=/^[-.<=>@0-9a-z]+$/}[/shield]
<img src="https://img.shields.io/badge/{REGEX}.svg?longCache=true&?label=healthinesses">

is now loading a badge, but on their end it's not reading the configuration properly, I suspect because each part has to be seperated by a -
SUBJECT-STATUS-COLOR
phpbb->=3.1.9<3.2.0@dev-green

the image it loads (I've copied the image url) is Image
https://img.shields.io/badge/.svg?longCache=true&?label=healthinesses

I've tried
[shield]{REGEXP=/^[-.<=>@0-9a-z]+$/1}-{REGEXP=/^[-.<=>@0-9a-z]+$/2}-{REGEXP=/^[-.<=>@0-9a-z]+$/3}[/shield]
<img src="https://img.shields.io/badge/{REGEX1}-{REGEX2}-{REGEX3}.svg?longCache=true&?label=healthinesses">

which doesn't load the image at all (I suspect I've assigned them wrong).

Thanks
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

User avatar
JoshyPHP
Code Contributor
Posts: 963
Joined: Mon Jul 11, 2011 12:28 am

Re: Using {SIMPLETEXT} and {INTTEXT}

Post by JoshyPHP » Fri Oct 19, 2018 6:28 pm

You're using {REGEX1 in the template instead of {REGEXP1. In the definition, it should be like this: {REGEXP1=/../}

If you have multiple value, you should give them proper names for forward compatibility.

Code: Select all

[shield project={IDENTIFIER} version={REGEXP=/^[-.<=>@0-9a-z]+$/} color={IDENTIFIER2}]{PARSE=/(?'project'.*?)-(?'version'.*)-(?'color'.*)/}[/shield]

Code: Select all

<img src="https://img.shields.io/badge/{@project}-{@version}-{@color}.svg?longCache=true&?label=healthinesses">
I wrote the thing that does BBCodes in 3.2.

User avatar
Restless Rancor
Registered User
Posts: 183
Joined: Tue Sep 18, 2018 1:51 pm

Re: Using {SIMPLETEXT} and {INTTEXT}

Post by Restless Rancor » Fri Oct 19, 2018 6:31 pm

JoshyPHP wrote:
Fri Oct 19, 2018 6:28 pm
You're using {REGEX1 in the template instead of {REGEXP1. In the definition, it should be like this: {REGEXP1=/../}

If you have multiple value, you should give them proper names for forward compatibility.

Code: Select all

[shield project={IDENTIFIER} version={REGEXP=/^[-.<=>@0-9a-z]+$/} color={IDENTIFIER2}]{PARSE=/(?'project'.*?)-(?'version'.*)-(?'color'.*)/}[/shield]

Code: Select all

<img src="https://img.shields.io/badge/{@project}-{@version}-{@color}.svg?longCache=true&?label=healthinesses">
Perfect, that did the trick. Thank you kindly!
These aren't the droids you're looking for...
My Extensions and Snippets (Ref link)

Post Reply

Return to “Custom BBCode Development and Requests”

Who is online

Users browsing this forum: No registered users and 160 guests