Re: example with source code

On 14/07/2008, Dailey, David P. <david.dailey@sru.edu> wrote:
> Hi folks.

Hi David,

> Is there some way to just write the source code (or wysiwyg plaintext) just once inside the appropriate tag(s), instead of having to parrot onesself?
>
> I'm thinking of something like <sourceAndDisplay><p><b>Hello World</b></p></sourceAndDisplay>
> which would allow the author to maintain only one sequence of characters (rather than markup and appearance being maintained separately and in parallel).

I've done this recently using script, by using XHR to get the current
page into a JS variable and extract the snippets.  DOM or innerHTML
methods were not consistent cross-browser, or just not simple enough.

<!-- snippetStart --><p><b>Hello World</b></p><!-- snippetEnd -->

This also makes it possible for a fallback to a server-side
implementation, if requried.

-- 
Lee

Received on Tuesday, 15 July 2008 09:17:01 UTC