Ticket #160 (new enhancement)
Formatter for Superscript / Subscript
| Reported by: | NilsLindenberg | Owned by: | unassigned |
|---|---|---|---|
| Priority: | low | Milestone: | 2.0 |
| Component: | formatters | Version: | 1.1.6.1 |
| Severity: | minor | Keywords: | superscript subscript formatter |
| Cc: |
Description (last modified by JavaWoman) (diff)
Superscript and subscript (<sup>/<sub>)
(text higher or lower in the line than normal)
There are only simple changes needed to add wikka-formatters for superscript and subscript text; the bigger problem is the markup:
Nils:
- for superscript: ^^
- for subscript: vv (would be logical, but perhaps problematic?)
BlueNode: /\superscript/\ (forwardslash,backslash) \/subscript\/ (backslash,forwardslash)
Javawoman: Or what about two commas ,, for subscript?
Code Changes
Anyway, changes necessary to formatters/wakka.php: add to the list of static variables (after trigger_center = 0;)
static $trigger_sup = 0;
static $trigger_sub = 0;
add after if ($trigger_bold % 2) echo('</strong>');
if ($trigger_sup % 2) echo '</sup>';
if ($trigger_sub % 2) echo '</sub>';
change the long line a little below to:
$trigger_bold = $trigger_center = $trigger_floatl = $trigger_inserted = $trigger_deleted = $trigger_italic = $trigger_keys = $trigger_sup = $trigger_sub = 0;
add after the //center block:
// higher text
else if ($thing == " ") // enter the markup
{
return (++$trigger_sup % 2 ? "<sup>" : "</sup>");
}
// lowered text
else if ($thing == " ") // enter the markup
{
return (++$trigger_sub % 2 ? "<sub>" : "</sub>");
}
and finally the line with #Wiki Markup (near the end) needs to have the markup, too: (example with ^^ and vv)
"\*\*|\'\'|\#\#|\#\%|@@|::c::|\>\>|\<\<|££|¥¥|\v\v|\^\^|\+\+|__|<|>|\/\/|". # Wiki markup