inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Feb 13, 2015 14:08:09 GMT -8
I'm really looking for something that could translate custom bbcode (partly because that way people from other forum hosts can use their 'native' center tag and it wouldn't break things, was wondering if there was a plugin that would add custom bbcode -goes to hunt-
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Feb 13, 2015 18:02:46 GMT -8
A "translator plugin" wouldn't be a stretch since it could live in the shadows intercepting bbcode2html calls and pre-processing the non-native BBCodes into native BBCodes that Proboards could understand before passing them on, the caveat of course being there would need to exist an equivalent Proboards version of that BBCode so no [DOHTML] or anything like that. - Update:v0.1.6 (March 18, 2015): Added additional data bindings (thus more variables) and more string manipulation methods also restructured directives to optionally accept parameters
- Update:v0.1.7 (March 28, 2015): Added ability to create custom bbcodes for the standard shoutbox
- Update:v0.1.8 (April 2, 2015): Added nestable variables (up to eight levels deep) and made any method accessible through prototype chain callable on variables as long as they can accept string args or have a nestable variable that can be coerced into acting as a placeholder for an arg evaluating to a non-string value. Restored ability to detect and reparse changed content (e.g page changed, post deleted, etc.) which was inadvertently disabled in a previous update
- Update:v0.1.9 (April 11, 2015): corrected bug that ignored endtag directives, set endtag detection sequence to the stated priority in documentation, treat "init" as a subset of the "set" phase, will now choose first non-empty value in an attribute allow list so nested vars can be used and dynamically evaluated at runtime(e.g $[directive.attribute-allow-src:$!tag.innerBBC! $!tag.attributes.default!]) making it a bit more efficient than using {if $[tag.innerBBC]}src="$[tag.innerBCBC]"{else}src="$[tag.attributes.default]"{/if}
- Update:v0.1.10 (March 29, 2015): added ability to process html tags as well with the introduction of $[directive.tag-html]
- Update:v0.1.11 (March 30, 2015): added an init mode for wysiwyg with proper detection for html startup
- Update:v0.1.12 (Aug 06, 2015): preserve line feeds by automatically entifying before template processing
- Update:v0.2.0 Aug 11, 2015): Reworked code logic, updated UI to include checkboxes, added default options, fixed many bugs, added better shoutbox support
- Update:v0.3.0 (Aug 15, 2015): Fleshed out an error tracking system for reporting bugs
- v0,4,0 (Aug 28, 2015): terminated project after hearing wysiwyg will be scrapped in v6 and a general lack of feedback necessary for making improvements to the code coupled with a lack of free time.
- v04.2(Apr 11, 2019): revisited code to fix a bug that crashes v5 wysiwyg after trying to add a translation for a "nation" bbcode. Fixed jquery data method no longer pulling from data-* attributes.
Download Plugin v0.4.2 BBCode Factory Usage:
This plugin allows extending the standard Proboards markdown lexicon with additional BBCODE in one of two ways: - Translate foreign BBCODEs into their Proboards equivalent using BBCODE templates. preview:
- Create BBCODE from scratch and render them using HTML templates preview:
Anyone coming from another platform with their own dialect of BBCODEs can now bring along their accumulated BBCODE collection and have a fairly good chance that they can be made recognizable by this plugin. Both methods of extending BBCODEs on your forum utilize a templating system that is very similar to the templating system seen in your admin panel supporting {if}{/if} constructs with variables bound to data that are available to plugins. The following is a list of available data sources so far: Data Sources |
---|
Disclaimer: not all sources will be available on every page. | Data | Description | Example |
---|
tag | Contains data about the BBCODE tag currently being processed such as
- attributes (JS object)
- name
- innerBBC
- outerBBC
- open
- depth
- match
- close
- tagdata (JS Object)
| $[tag.attributes.href] | user | Provides information about the current user and is the alias of current_user. Both can be used interchangeably *supplied by proboards.data("user") | $[user.avatar] | route | Provides information about the route *supplied by proboards.data("route") | $[route.name] | page | Provides information about the current page *supplied by proboards.data("page") | $[page.board.id] | post | Provides information about every post on the page (if any) such as author, time, etc. | $[post.1234.liked] | thread | Provides information about every thread on the page (if any) such as total replies, etc. | $[thread.5678.is_locked] | listman | Provides access to the Proboards List Manager | $[listman.item_type] | plugin | Provides access to the forum plugins | $[plugin._plugin...] | proboards | Provides access to the full data store from which the majority of other data is taken, also aliased as "pb" and "data" | $[pb.register_url] |
Directives |
---|
Directives help to instruct the plugin in the manner of how you want the template to be processed | Example | Description |
---|
$[directive.content-end] | The plugin will try to determine which portion of the template applies to the starting tag and which to the closing tag by first looking for this directive in the template. If not found it then looks for $[tag.close] and finally for any closing tag. If all three searches fail then the plugin assumes you want to replace just the opening tag and delete the closing tag (thus freeing whatever content that tag contained). | $[directive.no-end-tag] | Place this anywhere in a template to tell the plugin that the BBCODE being replaced has no closing tag | $[directive.reuse-for-all-endtags] | Place this anywhere in a template to tell the plugin that the BBCODE being replaced can use the entire template for both the opening and closing tags. In the cases where there are multiple tags attached to a template but not all tags have a closing tag or removing the closer is desirable then a directive that replaces "all" with the name of the tag can instead be constructed, for example $[directive.reuse-for-div-endtags] | $[directive.mode-bbcode] | include this directive in template to signify use only in bbcode mode (including quick reply) | $[directive.mode-preview] | include this directive in template to signify use only in preview mode | $[directive.mode-visual] | include this directive in template to signify use only in html mode (including preview) | $[directive.mode-display] | include this directive in template to signify use only in html mode (excluding preview) | $[directive.mode-quick] | include this directive in template to signify use only when using quick reply | $[directive.phase-get] | include this directive in template to signify use only when content is being retrieved. | $[directive.phase-set] | include this directive in template to signify use only when content is being set. | $[directive.phase-submit] | include this directive in template to signify use only during the submission phase (e.g. quick reply and wysiwyg after submit button has been click) | $[directive.phase-init] | include this directive in template to signify use only during initial page load | $[directive-phase-shoutbox_receive] | include this directive to mark a template for use in the shoutbox during receive. Unlike other phase directives this cannot be inferred and must be explicitly set. | $[directive-phase-shoutbox_send] | include this directive to mark a template for use in the shoutbox during send. Unlike other phase directives this cannot be inferred and must be explicitly set. | $[directive.strict-space] | include this directive in template to remove line feeds, tabs and carriage returns from template before processing |
Methods |
---|
Methods can be used to further process a variable prior to using it so in addition to the native available methods a few additional ones have been defined for convenience. A variable of type string can invoke the native substr method because it inherits it from its string prototype ($[tag,attributes.href.substr(0,5)]), and a variable of type array can do the same for array methods. One limitation though is that all arguments are treated as string type when calling a method so do not use quotation marks since the arguments will be treated as string containing quotation marks. Any method that require arguments other than string will not be directly callable. | Example | Description |
---|
$[tag.content.escape] | Passes the variable through the window.escape method. | $[tag.attributes.href.unescape] | Passes the variable through the window.unescape method. | $[tag.content.encodeURI] | Passes the variable through the window.encodeURI method. | $[tag.attributes.src.decodeURI] | Passes the variable through the window.decodeURI method. | $[tag.content.encodeURIComponent] | Passes the variable through the window.encodeURIComponent method. | $[tag.attributes.src.decodeURIComponent] | Passes the variable through the window.decodeURIComponent method. | $[tag.content.trim] | Removes excess space from the begining and end of a string. | $[post.12345.stringify] | Converts an object into a JSON string. | $[tag.content.entify] | Converts certain characters into their HTML entity so they are not inadvertently parsed by the browser. By default the characters '<', '>', '"' and '&' are used if no parameters are passed in. | $[tag.content.linkify] | Takes an URL and creates an actual link which can then be queried for spare parts. For example, $[tag.content.linkify.hostname] would return the host portion of a link. This is especially useful for relative URLs. | $[tag.attributes.lang.repeat(2)] | Repeats a given string the number of given times | $[post.12345.subject.quot] | Converts any quotes in a string into their HTML entity counterpart. | $[post.12345.subject.amp] | Converts any ampersands in a string into their HTML entity counterpart. | $[tag.innerBBC.eolsave] | Converts any linefeeds and carriage returns into an HTML comment in order to preserve them during the bbcode to html conversion process or to prevent them being converted to "<br>" in situations that may create malformed code (e.g a <br> between a and a ). | $[tag.innerBBC.eolrestore] | Retores linefeeds and carriage returns that were preserved using the eolsave method | $[tag.innerBBC.replace_all(test1,test2)] | Replaces all occurrences of a sub-string within a string with another sub-string. In the example any occurrence of "test1" would be replaced by "test2" | $[tag.innerBBC._normalize] | Replaces all line-feeds, tabs and carriage-returns with a space character. | TIP Variables can be made nestable by replacing the square brackets with another delimiter. Seven additional delimiters are defined allowing for a nestable depth of eight and each replacement delimiter is given a weight value to allow for the innermost variable to be processed prior to the variable that depends on its value. The order of precedence (from least to most) is: ! ==> @ ==> # ==> $ ==> % ==> ^ ==> * A variable with an asterisk as a delimiter (e.g $*tag.content*) would be processed before any other variable then next in line would be the variable that uses a carat (e.g $^tag.content^) and so on... |
The other option would be a full fledged BBCode factory and although functionally possible in the current interface it is limited like so many other plugin ideas by the rigidity of that interface IMO. I've long advocated for some leeway in how one builds the interface, at the very least offer support for light BBCode and a template where one could then design an easy to follow UI instead of writing 3 paragraphs explaining click here, push that and only then can you update that. I recall also suggesting some sort of wizard mode which would also get rid of the 3 paragraphs which nobody ever reads anyway. And of course the holiest of holy grails, the nestable autoform which would effectively allow creating more complicated "guided" custom controls.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Feb 15, 2015 0:19:41 GMT -8
A "translator plugin" wouldn't be a stretch since it could live in the shadows intercepting bbcode2html calls and pre-processing the non-native BBCodes into native BBCodes that Proboards could understand before passing them on, the caveat of course being there would need to exist an equivalent Proboards version of that BBCode so no [DOHTML] or anything like that. The other option would be a full fledged BBCode factory and although functionally possible in the current interface it is limited like so many other plugin ideas by the rigidity of that interface IMO. I've long advocated for some leeway in how one builds the interface, at the very least offer support for light BBCode and a template where one could then design an easy to follow UI instead of writing 3 paragraphs explaining click here, push that and only then can you update that. I recall also suggesting some sort of wizard mode which would also get rid of the 3 paragraphs which nobody ever reads anyway. And of course the holiest of holy grails, the nestable autoform which would effectively allow creating more complicated "guided" custom controls. I'd be happy with a translator type plugin to be fair as its only that bbcode I can think of off hand xD Maybe a translator plugin that you can specify the non-native to look for with the appropriate proboards type
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Feb 23, 2015 0:27:19 GMT -8
I'd be happy with a translator type plugin to be fair as its only that bbcode I can think of off hand xD Maybe a translator plugin that you can specify the non-native to look for with the appropriate proboards type Since I had some free time, I started on this plugin. It operates when the tab switches from bbcode to preview and vice versa as I discussed earlier. I've also included a rudimentary templating variable system so a Proboards compatible bbcode can be constructed even if it is not a one-to-one conversion from the foreign dialect In the above example I added an entry for your [align=center][/align] example Tag Name | Equivalent BBCode |
---|
align | [div align="$[tag.attributes.default]"][/div] |
$[tag.attributes.default] would be a sort of layout variable that you might be familiar with if you edit layout templates in admin panel. The data for the variables are pretty limited now but could be expanded in the future. At the moment it has one top level data branch named "tag" with sub-data for "name", "text", "index" and "attributes". The attributes branch will also contain sub-data corresponding to any attributes pulled off the original bbcode so they can be added as a batch (e.g. [div $[tag.attributes]][/div]) or as individual attributes ((e.g. [div style="$[tag.attributes.style]" title="$[tag.attributes.title]"][/div]). The "$[tag.attributes.default]" is a special case were no attribute name is specified just a value assigned to the tag itself (e.g. [align=right]) so it is assigned to an attribute name of "default". The plugin still needs a lot more work: - recognize foreign tags made inert through the use of [code],[noubbc] or the [noparse] tags
- a system to convert attribute values to their Proboards equivalents if not the same allowed values
- support quick reply
Give it a try and let me know what you think
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Feb 23, 2015 7:43:44 GMT -8
I'd be happy with a translator type plugin to be fair as its only that bbcode I can think of off hand xD Maybe a translator plugin that you can specify the non-native to look for with the appropriate proboards type Since I had some free time, I started on this plugin. It operates when the tab switches from bbcode to preview and vice versa as I discussed earlier. I've also included a rudimentary templating variable system so a Proboards compatible bbcode can be constructed even if it is not a one-to-one conversion from the foreign dialect In the above example I added an entry for your [align=center][/align] example Tag Name | Equivalent BBCode |
---|
align | [div align="$[tag.attributes.default]"][/div] |
$[tag.attributes.default] would be a sort of layout variable that you might be familiar with if you edit layout templates in admin panel. The data for the variables are pretty limited now but could be expanded in the future. At the moment it has one top level data branch named "tag" with sub-data for "name", "text", "index" and "attributes". The attributes branch will also contain sub-data corresponding to any attributes pulled off the original bbcode so they can be added as a batch (e.g. [div $[tag.attributes]][/div]) or as individual attributes ((e.g. [div style="$[tag.attributes.style]" title="$[tag.attributes.title]"][/div]). The "$[tag.attributes.default]" is a special case were no attribute name is specified just a value assigned to the tag itself (e.g. [align=right]) so it is assigned to an attribute name of "default". The plugin still needs a lot more work: - recognize foreign tags made inert through the use of [code],[noubbc] or the [noparse] tags
- a system to convert attribute values to their Proboards equivalents if not the same allowed values
- support quick reply
Give it a try and let me know what you think Its working good - just a quick question as I haven't tried it myself yet, will it also convert when someone hits the post button?
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Feb 23, 2015 18:27:52 GMT -8
Its working good - just a quick question as I haven't tried it myself yet, will it also convert when someone hits the post button? It would indeed convert the text if you added some non-standard bbcode to the bbcode tab then submitted without first switching to preview tab. On the other hand if you wanted to be a problem child and add bbcode to the preview tab for whatever reason and submit without ever switching then it wouldn't get the full spa treatment and definitely would not have a happy ending I've therefore added a hook to the preview side as well and while at it also added recognition and respect for the inert tags (noubbc, noparse and code). Conversion using quick reply should also now be possible with the release of version 0.0.3 (same link)
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Feb 23, 2015 20:18:54 GMT -8
Cheers!!
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Feb 28, 2015 22:19:09 GMT -8
I just had a brief thought on another addon when you have time! As I just realised this would be great for custom bbcoding for scavenger hunts! Would there be any way that you could create an option that if a box was ticked rather then having to say use [surv1][/surv1] I could just use [surv1] and it'd translate to the appropriate image tag with the link already inserted?
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Mar 1, 2015 12:35:38 GMT -8
I just had a brief thought on another addon when you have time! As I just realised this would be great for custom bbcoding for scavenger hunts! Would there be any way that you could create an option that if a box was ticked rather then having to say use [surv1][/surv1] I could just use [surv1] and it'd translate to the appropriate image tag with the link already inserted? That should already be possible providing I am correctly interpreting what you are saying. Boy_Wonder. The inclusion of an ending tag is only necessary if inner content has to be determined before being used as a variable in the layout (e.g. $[tag.innerBBC]). Tag Name: surv1 Equivalent BBCode*: [a href="http://google.com"][img src="http://images.proboards.com/v5/badges/small_icons/pbplus.png"] *note: The plugin determines the ending tag in the layout it is given (Equivalent BBCode) by looking for the first instance of "[/" and uses that as a closing when it encounters an ending tag for an open non-native tag, if no ending tag is specified then it doesn't look for one. Since your intent is to convert a non-native tag that has no ending tag into a Proboards equivalent that has an ending tag then one way to do that would be making sure the [/a] is intentionally omitted in the layout then the plugin would no longer be looking for a corresponding ending tag and auto-completion would instead rely on the known Proboards behavior of fixing up malformed BBCode (which in this case would be adding the missing closing [/a]).If I am way off in my interpretation of what is being asked then please try to further clarify with actual examples.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Mar 1, 2015 12:46:11 GMT -8
So if I was telling it to replace something into an img tag then no closing tag would need am I right?
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Mar 1, 2015 13:08:37 GMT -8
Proboards supports both the legacy format (before V5) of the image tag ([img width=x height=y]URL_HERE[/img]) and the newer V5 version which more closely matches HTML ([img src="URL_HERE" width="x" height="y"]). If you use the V5 version then you do not need an ending tag.
I'm still a bit unclear on exactly what you are wishing to accomplish without a concrete example to look at so if you are still having problems then an example would help greatly
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Mar 1, 2015 23:19:27 GMT -8
Updated to version 0.0.5 now with proper support for the following variables: $[tag.text], $[tag.content], $[tag.innerBBC] and $[tag.outerBBC] The first three are basically equivalent for now but will be parsed differently in future versions. The $[tag.outerBBC] variable returns start tag plus content plus end tag. These new variable depend on an ending tag in order to determine content and if present in the layout the actual content will be removed so it can be repositioned or otherwise manipulated by one of these variables. An very common use case for this new feature would be a tag such as [img]URL_HERE[/img] where the content ("URL_HERE") is used to build the replacement tag [img src="$[tag.content]" alt="foo" ] EDIT: updated to version 0.1.1 with bug fixes and some new features (see below) BBCode Converter Usage:
This plugin allows extending the standard Proboards BBCODE lexicon with additional markdowns in one of two ways: - Translate foreign BBCODEs into their Proboards equivalent or modify existing ones.
preview:
- Create BBCODE and render them using the HTML template that is provided
preview:
Someone coming from another forum can now bring along their accumulated BBCODE collection and have a fairly good chance they will work out of the box. Both methods of adding BBCODEs to your forum utilize a templating system that is very similar to the templating system seen in the structure layouts of your admin panel and are bound to data available to plugins. The following is a list of available data sources Data Sources |
---|
Disclaimer: not all sources will be available on every page. | Data | Description | Example |
---|
tag | Contains data about the tag currently being processed such as- attributes (object)
- tag name
- innerBBC (if it has a closing tag)
- outerBBC
- match
- depth
- open
- close (if available)
- tagdata (from plugin settings)
| $[tag.attributes.href] | user
| Provides information about the current user and is the alias of current_user. Both can be used interchangeably and is supplied by proboards.data("user")
| $[user.avatar] | route | Provides information about the route and is supplied by proboards.data("route")
| $[route.name] | page | Provides information about the current page and is supplied by proboards.data("page")
| $[page.board.id] | post | Provides information about every post on the page (if any) such as author, time, etc.
| $[post.1234.liked] | thread | Provides information about every thread on the page (if any) such as total replies, etc. | $[thread.5678.is_locked] | listman | Provides access to the Proboards List Manager
| $[listman.item_type] | plugin | Provides access to the forum plugins
| $[plugin._plugin...]
| proboards | Provides access to the full data store from which the majority of other data is taken, also aliased as "pb" and "data"
| $[pb.register_url] |
Directives |
---|
Directives help to instruct the plugin in the manner of how you want the template to be processed
| Example | Description |
---|
$[directive.content-end] | The plugin will try to determine which portion of the template applies to the starting tag and which to the closing tag by first looking for this directive in the template. If not found it then looks for $[tag.close] and finally for any closing tag. If all three searches fail then the plugin assumes you want to replace just the opening tag and delete the closing tag (thus freeing whatever content that tag contained). | $[directive.no-end-tag] | Place this anywhere in a template to tell the plugin that the BBCODE being replaced has no closing tag | $[directive.reuse-for-all-endtags] | Place this anywhere in a template to tell the plugin that the BBCODE being replaced can use the entire template for both the opening and closing tags. In the cases where there are multiple tags attached to a template but not all tags have a closing tag or removing the closer is desirable then a directive that replaces "all" with the name of the tag can instead be constructed, for example $[directive.reuse-for-div-endtags]
| $[directive.mode-bbcode] | include this directive in template to signify use only in bbcode mode (including quick reply) | $[directive.mode-preview] | include this directive in template to signify use only in preview mode | $[directive.mode-visual] | include this directive in template to signify use only in html mode (including preview) | $[directive.mode-display] | include this directive in template to signify use only in html mode (excluding preview) | $[directive.mode-quick] | include this directive in template to signify use only when using quick reply | $[directive.phase-get] | include this directive in template to signify use only during READ operations | $[directive.phase-set] | include this directive in template to signify use only during WRITE operations | $[directive.phase-submit] | include this directive in template to signify use only during the submission phase (quick reply and wysiwyg after button click) | $[directive.phase-init] | include this directive in template to signify use only during initial load | $[directive-phase-shoutbox_receive] | include this directive to mark a template for use in the shoutbox during receive. Unlike other phase directives this cannot be inferred and must be explicitly set. | $[directive-phase-shoutbox_send] | include this directive to mark a template for use in the shoutbox during send. Unlike other phase directives this cannot be inferred and must be explicitly set. | $[directive.strict-space] | include this directive in template to remove line feeds, tabs and carriage returns from template before processing |
Methods |
---|
Methods can be used to further process a variable prior to using it so in addition to the native available methods a few additional ones have been defined for convenience.
A variable of type string can invoke the native substr method because it inherits it from its string prototype ($[tag,attributes.href.substr(0,5)]), and a variable of type array can do the same for array methods. One limitation though is that all arguments are treated as string type when calling a method so do not use quotation marks since the arguments will be treated as string containing quotation marks. Any method that require arguments other than string will not be directly callable.
| Example | Description |
---|
$[tag.content.escape] | Passes the variable through the window.escape method. | $[tag.attributes.href.unescape] | Passes the variable through the window.unescape method. | $[tag.content.encodeURI] | Passes the variable through the window.encodeURI method. | $[tag.attributes.src.decodeURI] | Passes the variable through the window.decodeURI method. | $[tag.content.encodeURIComponent] | Passes the variable through the window.encodeURIComponent method. | $[tag.attributes.src.decodeURIComponent] | Passes the variable through the window.decodeURIComponent method. | $[tag.content.trim] | Removes excess space from the begining and end of a string. | $[post.12345.stringify] | Converts an object into a JSON string. | $[tag.content.entify] | Converts certain characters into their HTML entity so they are not inadvertently parsed by the browser. By default the characters '<', '>', '"' and '&' are used if no parameters are passed in. | $[tag.content.linkify] | Takes an URL and creates an actual link which can then be queried for spare parts. For example, $[tag.content.linkify.hostname] would return the host portion of a link. This is especially useful for relative URLs. | $[tag.attributes.lang.repeat(2)] | Repeats a given string the number of given times | $[post.12345.subject.quot] | Converts any quotes in a string into their HTML entity counterpart. | $[post.12345.subject.amp] | Converts any ampersands in a string into their HTML entity counterpart. | $[tag.innerBBC.eolsave] | Converts any linefeeds and carriage returns into an HTML comment in order to preserve them during the bbcode to html conversion process or to prevent them being converted to "<br>" in situations that may create malformed code (e.g a <br> between a <tbody> and a <tr>). | $[tag.innerBBC.eolrestore] | Retores linefeeds and carriage returns that were preserved using the eolsave method | $[tag.innerBBC.replace_all(test1,test2)] | Replaces all occurrences of a sub-string within a string with another sub-string. In the example any occurrence of "test1" would be replaced by "test2" | $[tag.innerBBC._normalize] | Replaces all line-feeds, tabs and carriage-returns with a space character. | TIP Variables can be made nestable by replacing the square brackets with another delimiter. Seven additional delimiters are defined allowing for a nestable depth of eight and each replacement delimiter is given a weight value to allow for the innermost variable to be processed prior to the variable that depends on its value. The order of precedence (from least to most) is: ! ==> @ ==> # ==> $ ==> % ==> ^ ==> * A variable with an asterisk as a delimiter (e.g $*tag.content*) would be processed before any other variable then next in line would be the variable that uses a carat (e.g $^tag.content^) and so on...
|
Update (March 18, 2015):
Added additional data bindings (thus more variables) and more string manipulation methods also restructured directives to optionally accept parameters Update (April 2, 2015):
Added nestable variables (up to eight levels deep) and made any method accessible through prototype chain callable on variables as long as they can accept string args or have a nestable variable that can be coerced into acting as a placeholder for an arg evaluating to a non-string value.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Mar 13, 2015 0:49:26 GMT -8
Awesome!
|
|
inherit
206056
0
Apr 27, 2024 4:16:47 GMT -8
adminabp
378
February 2014
adminabp
|
Post by adminabp on Mar 20, 2015 4:48:42 GMT -8
Yes!!! I'll start playing around with this in the next few days when I have more time. Thanks Eton.
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Mar 28, 2015 0:55:21 GMT -8
Updated to v0.1.7 with bbcode that can now be created for shoutbox usage
Please report back with any bugs you may have encountered
|
|