Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: vbgamer45 on November 12, 2009, 10:47:57 AM

Title: Entity Tag
Post by: vbgamer45 on November 12, 2009, 10:47:57 AM
Link to Mod (https://custom.simplemachines.org/mods/index.php?mod=2267)

Entity Tag

Original Author: Arantor
SMF Version: 2.0.x
Mod Version: 2.0

Description:
Adds two tags, [ent] and [entn], for specifying a variety of extended characters that may otherwise be difficult to type on the keyboard.

[ent] allows you to use the standard HTML entities, for example ™ is also ™ which can be entered with [ent]trade[/ent]

You can also use the full range of numeric entities from 3 to 6 digits, for example æ is æ, which can be entered with [entn]230[/entn]

Why Not Visit:
http://www.smfhacks.com (http://www.smfhacks.com)
Title: Re: Entity Tag
Post by: Marcus Forsberg on November 12, 2009, 10:55:36 AM
Nice one, Arantor!
Title: Re: Entity Tag
Post by: Arantor on November 12, 2009, 10:56:33 AM
Thanks :)

Took me a little while to figure out that regular expression though... (about two hours solid)
Title: Re: Entity Tag
Post by: darrenbeige on November 12, 2009, 11:07:26 AM
Why is there a need for two tags? Couldn't they be combined into one tag [ent], and use a simple regex to check for all numbers, and run the code of the [entn] tag, otherwise running the default code.
Title: Re: Entity Tag
Post by: Arantor on November 12, 2009, 11:10:06 AM
Partly because the route taken is slightly different, ent issues &[contents]; versus entn issuing &#[contents];. The alternative would be evaluating one/both each call on [ent] which has performance considerations if you have multiple instances on a single page.
Title: Re: Entity Tag
Post by: darrenbeige on November 13, 2009, 12:33:36 PM
Quote from: Arantor on November 12, 2009, 11:10:06 AM
The alternative would be evaluating one/both each call on [ent] which has performance considerations if you have multiple instances on a single page.

True.

Title: Re: Entity Tag
Post by: Apllicmz on December 27, 2011, 10:02:44 AM
when UPDATE dont forget portuguese

<file name="$languagedir/Modifications.portuguese_pt.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
$txt['bbc_code_ent'] = 'Tag de entidade Padr&atilde;o';
$txt['bbc_code_entn'] = 'Tag de entidade num&eacute;rica';
]]></add>
        </operation>
    </file>
   
    <file name="$languagedir/Modifications.portuguese_pt-utf8.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
$txt['bbc_code_ent'] = 'Tag de entidade Padr&atilde;o';
$txt['bbc_code_entn'] = 'Tag de entidade num&eacute;rica';
]]></add>
        </operation>
    </file>
   
    <file name="$languagedir/Modifications.portuguese_brazilian.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
$txt['bbc_code_ent'] = 'Tag de entidade Padr&atilde;o';
$txt['bbc_code_entn'] = 'Tag de entidade num&eacute;rica';
]]></add>
        </operation>
    </file>
   
    <file name="$languagedir/Modifications.portuguese_brazilian-utf8.php" error="skip">
        <operation>
            <search position="end" />
            <add><![CDATA[
$txt['bbc_code_ent'] = 'Tag de entidade Padr&atilde;o';
$txt['bbc_code_entn'] = 'Tag de entidade num&eacute;rica';
]]></add>
        </operation>
    </file>