Tools.FormatForWiki History

Hide minor edits - Show changes to output

August 05, 2009, at 05:47 PM by Tom Igoe -
Changed lines 40-41 from:
<p>Use the <strong>Tools-&gt;Copy for Forum</strong> menu selection to put the code into your computer clipboard. Then paste it below!</p>
to:
<p>Use the <strong>Tools-&gt;Copy for Forum</strong> menu selection to put the code into your computer clipboard. Then paste it below:</p>
Changed line 49 from:
See output here!
to:
Copy this output to paste into the wiki
August 05, 2009, at 05:39 PM by Tom Igoe -
Added lines 1-55:
(:html:)
<script language="javascript" type="text/javascript">
<!-- // Hide Javascript from old browsers

function convert(inputfield) {
if (inputfield.inchange) return;
//inputfield.inchange = true;
var thetext = inputfield.value;
thetext = thetext.replace(/\[quote\]/g, '(\:div class=code \:)\n ');

thetext = thetext.replace(/\[color=(#[A-F0-9]+)\]/g, '\%color=$1\%');

thetext = thetext.replace(/\[\/color\]/g, '%%');
// make all the lines start with a blank line, to get the code formatting:
thetext = thetext.replace(/\%\%\n/g, '\n');
thetext = thetext.replace(/\n/g, '\n ');

// divend tag line shouldn't start with a space"
thetext = thetext.replace(/\n\s\[\/quote\]/g, '\n(\:divend\:)');


// lowercase all the hex number matches:
thetext = thetext.replace(/\#([A-F0-9]+)/g, function(w){return w.toLowerCase()});

// replace the bold tags with ''':
thetext = thetext.replace(/\[b\]/g, '\'\'\'');
thetext = thetext.replace(/\[\/b\]/g, '\'\'\'');


document.theform.output.value = thetext;
}


// End -->

</script>

This form converts Arduino code that's formatted for the yaBB forums to code that's formatted for PMwiki, the platform of the Playground and the main Arduino site. It's adapted from Limor Fried's script.

<p>Use the <strong>Tools-&gt;Copy for Forum</strong> menu selection to put the code into your computer clipboard. Then paste it below!</p>

<form method="get" action="#" name="theform">

<textarea name="input" cols="80" rows="25" onChange="convert(this)">
Enter your forum-formatted code here
</textarea>
<p>Click outside the box<p>
<textarea name="output" cols="80" rows="25">
See output here!
</textarea><br>
</form>



(:htmlend:)

Share