elyxer-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [eLyXer-users] Indented, color-coded Code Samples with eLyXer


From: Alex Fernandez
Subject: Re: [eLyXer-users] Indented, color-coded Code Samples with eLyXer
Date: Sat, 12 May 2012 15:44:29 +0200

Hi,

On Sat, May 12, 2012 at 3:38 PM, Jack Desert <address@hidden> wrote:
On Tue, May 8, 2012 at 9:45 AM, Jack Desert <address@hidden> wrote:
>> What's the best way to paste a code sample (Ruby, in my case) into a
>> LyX document and export it to html while
>>
> > A. Preserving the white space indentation
>>
> > B. Color coding the keywords so that strings, variables, and
>> comments are all a different color

Alex responded:
> I remember that some people sent me a sample which did this. I think your best option is to use a syntax
> highlighter in _javascript_ embedded into your HTML document.


Alex,

What about the case of simply getting the indenting whitespace to show
up in html? Does eLyXer support this? If not, what approach would you
recommend:

Sure, eLyXer displays code listings in a <pre> tag.
 
A. Within a <pre> tag, replace two spaces in a row with &nbsp;&nbsp;
B. Within a <pre> tag, replace two spaces in a row with <div
class='two_space' />

Ideally, someone reading my code snippet online should be able to copy
and paste it into their own text editor and also have the indentation
show up properly. This suggests that solution "A" may be better.

Yes, and eLyXer should be able to do this automatically. You can see an example in the user guide.
  http://elyxer.nongnu.org/userguide.html
Look for "Algorithm 1 Example of diff output for functionally identical HTML files". Then you can check out the user guide to see how it is done. But it's simply a listing or a code listing (two confusing features which should both work).

And finally, is this something that would benefit all users of eLyXer?
If so, I'd like to write an eLyXer patch. If not, I'll just build the
functionality into LyXBlogger.

No need to for this particular feature, but contributors are always welcome  :)

Alex.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]