<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Recent Posts in 'Replace dashes with other text' | Pragmatic Forums</title>
    <link>http://fora.pragprog.com/forums/45/topics/345</link>
    <language>en-us</language>
    <ttl>60</ttl>
    <description></description>
    <item>
      <title>Replace dashes with other text posted by Mike E. @ Fri, 02 May 2008 15:08:47 -0000</title>
      <description>&lt;p&gt;Thank you so much for the demo. That is just what I need to get me started.&lt;/p&gt;


	&lt;p&gt;I really appreciate your help.&lt;/p&gt;


	&lt;p&gt;Excellent!&lt;/p&gt;


	&lt;p&gt;Mike&lt;/p&gt;</description>
      <pubDate>Fri, 02 May 2008 15:08:47 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:345:2708</guid>
      <author>Mike E.</author>
      <link>http://fora.pragprog.com/forums/45/topics/345</link>
    </item>
    <item>
      <title>Replace dashes with other text posted by Christophe Porteneuve @ Thu, 01 May 2008 09:31:46 -0000</title>
      <description>&lt;p&gt;Hey Mike,&lt;/p&gt;


	&lt;p&gt;I put a minimalistic demo page for it up at &lt;a href="http://tddsworld.com/questions/"&gt;http://tddsworld.com/questions/&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Let me know if that makes it.&lt;/p&gt;</description>
      <pubDate>Thu, 01 May 2008 09:31:46 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:345:2701</guid>
      <author>Christophe Porteneuve</author>
      <link>http://fora.pragprog.com/forums/45/topics/345</link>
    </item>
    <item>
      <title>Replace dashes with other text posted by Mike E. @ Thu, 01 May 2008 01:49:39 -0000</title>
      <description>&lt;p&gt;Hello Christophe,&lt;/p&gt;


	&lt;p&gt;I realize it&amp;#8217;s been a while since I posted this message. I&amp;#8217;ve been unavoidably busy and I&amp;#8217;m just getting back to this project this week.&lt;/p&gt;


	&lt;p&gt;I tried to implement your suggestion but I wasn&amp;#8217;t able to figure out how to set it up properly. Please remember that I&amp;#8217;m a javascript ultra-newbie. I have no idea what you mean by &amp;#8220;I&#8217;d go gsub with a replacement function and a lexical closure to iterate over an array of answers from one replacement to the next.&amp;#8221; Sounds good and I&amp;#8217;m sure it will work. I&amp;#8217;m just not sure how to set it up.&lt;/p&gt;


	&lt;p&gt;Would it be too much to ask if you could walk me through your solution or just show me how to set it up?&lt;/p&gt;


	&lt;p&gt;Thank you so much for your help.&lt;/p&gt;


	&lt;p&gt;Mike&lt;/p&gt;</description>
      <pubDate>Thu, 01 May 2008 01:49:39 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:345:2697</guid>
      <author>Mike E.</author>
      <link>http://fora.pragprog.com/forums/45/topics/345</link>
    </item>
    <item>
      <title>Replace dashes with other text posted by Christophe Porteneuve @ Mon, 31 Mar 2008 20:54:33 -0000</title>
      <description>&lt;p&gt;I&amp;#8217;d go gsub with a replacement function and a lexical closure to iterate over an array of answers from one replacement to the next.&lt;/p&gt;


	&lt;p&gt;Say your underscore-bearing &lt;span class="caps"&gt;HTML&lt;/span&gt; is in a &lt;code&gt;id="questionsContainer"&lt;/code&gt; DOM node.  You&amp;#8217;d go:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;var container = $('questionsContainer');
var answers = ['drive', 'drove', 'driven'], index = 0;
container.update(container.innerHTML.gsub('_', function() { return answers[index++].escapeHTML(); }));&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;That does the trick neatly :-)&lt;/p&gt;</description>
      <pubDate>Mon, 31 Mar 2008 20:54:33 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:345:2518</guid>
      <author>Christophe Porteneuve</author>
      <link>http://fora.pragprog.com/forums/45/topics/345</link>
    </item>
    <item>
      <title>Replace dashes with other text posted by Mike E. @ Mon, 31 Mar 2008 12:07:47 -0000</title>
      <description>&lt;p&gt;I&amp;#8217;m trying to replace a dashed line with an answer after a &amp;#8220;click here&amp;#8221; prompt. Here&amp;#8217;s an example:&lt;/p&gt;


	&lt;p&gt;1) Find the principal parts of the verb &amp;#8220;drive&amp;#8221; by filling in the blanks below. Click here to check your answer.&lt;/p&gt;


	&lt;p&gt;I &lt;i&gt;&lt;em&gt;_&lt;/i&gt; now. (Present tense)&lt;br /&gt;I &lt;i&gt;_&lt;/em&gt;&lt;/i&gt; in the past ( past tense)&lt;br /&gt;I have &lt;i&gt;&lt;em&gt;_&lt;/i&gt;_&lt;/em&gt; every day. (Past participle)&lt;/p&gt;


	&lt;p&gt;After &amp;#8220;Click here&amp;#8221; is clicked, the above will be changed to:&lt;/p&gt;


	&lt;p&gt;I drive now. (Present tense)&lt;br /&gt;I drove in the past ( past tense)&lt;br /&gt;I have driven every day. (Past participle)&lt;/p&gt;


	&lt;p&gt;Is there a way to do this with javascript/scriptaculous? I&amp;#8217;m building an instuctional site on English grammar. I&amp;#8217;d appreciate some help.&lt;/p&gt;


	&lt;p&gt;Thanks,&lt;br /&gt;Mike&lt;/p&gt;</description>
      <pubDate>Mon, 31 Mar 2008 12:07:47 -0000</pubDate>
      <guid isPermaLink="false">fora.pragprog.com:45:345:2515</guid>
      <author>Mike E.</author>
      <link>http://fora.pragprog.com/forums/45/topics/345</link>
    </item>
  </channel>
</rss>
