emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Code with line numbers in HTML export
@ 2009-03-12  0:37 Saptarshi Guha
  2009-03-12  2:29 ` Nick Dokos
  0 siblings, 1 reply; 10+ messages in thread
From: Saptarshi Guha @ 2009-03-12  0:37 UTC (permalink / raw)
  To: emacs-orgmode

Hello,
I assume in the BEGIN_SRC region, I cannot export the code with line
numbers, however I
came across this
 .linenr            the line number in a code example

Does this mean, there is some option to generate line numbers in the
exported BEGIN_SRC?

Thanks for your time

Saptarshi Guha

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  0:37 Code with line numbers in HTML export Saptarshi Guha
@ 2009-03-12  2:29 ` Nick Dokos
  2009-03-12  3:55   ` Saptarshi Guha
  0 siblings, 1 reply; 10+ messages in thread
From: Nick Dokos @ 2009-03-12  2:29 UTC (permalink / raw)
  To: saptarshi.guha; +Cc: emacs-orgmode

Saptarshi Guha <saptarshi.guha@gmail.com> wrote:

> I assume in the BEGIN_SRC region, I cannot export the code with line
> numbers, however I
> came across this
>  .linenr            the line number in a code example
> 
> Does this mean, there is some option to generate line numbers in the
> exported BEGIN_SRC?
> 

Read the section "Literal Examples" in the org manual: evaluate the
following form in emacs by pressing C-x C-e after the closing parenthesis

     (Info-goto-node "(org)Literal Examples")

or on the web

     http://orgmode.org/manual/Literal-examples.html#Literal-examples

HTH,
Nick

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  2:29 ` Nick Dokos
@ 2009-03-12  3:55   ` Saptarshi Guha
  2009-03-12  4:25     ` Manish
  2009-03-12 14:03     ` Nick Dokos
  0 siblings, 2 replies; 10+ messages in thread
From: Saptarshi Guha @ 2009-03-12  3:55 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

Thank you, quite excited I tried this small org file
*Title
Some tex

#+BEGIN_SRC emacs-lisp -n
(save-excursion
(goto-char (point-min))
#+END_SRC

Only to get this in the html file (as copied from my browser):

(save-excursion (goto-char (point-min))

The corresponding html is
<p>(save-excursion
(goto-char (point-min))
</p>

if i remove the -n it works - the exported code is formatted but no
line numbers.
(org version 6.09a)
Saptarshi Guha



On Wed, Mar 11, 2009 at 10:29 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Saptarshi Guha <saptarshi.guha@gmail.com> wrote:
>
>> I assume in the BEGIN_SRC region, I cannot export the code with line
>> numbers, however I
>> came across this
>>  .linenr            the line number in a code example
>>
>> Does this mean, there is some option to generate line numbers in the
>> exported BEGIN_SRC?
>>
>
> Read the section "Literal Examples" in the org manual: evaluate the
> following form in emacs by pressing C-x C-e after the closing parenthesis
>
>     (Info-goto-node "(org)Literal Examples")
>
> or on the web
>
>     http://orgmode.org/manual/Literal-examples.html#Literal-examples
>
> HTH,
> Nick
>
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  3:55   ` Saptarshi Guha
@ 2009-03-12  4:25     ` Manish
  2009-03-12  4:28       ` Saptarshi Guha
  2009-03-12 14:03     ` Nick Dokos
  1 sibling, 1 reply; 10+ messages in thread
From: Manish @ 2009-03-12  4:25 UTC (permalink / raw)
  To: saptarshi.guha; +Cc: emacs-orgmode

On Thu, Mar 12, 2009 at 9:25 AM, Saptarshi Guha wrote:
> Thank you, quite excited I tried this small org file
> *Title
> Some tex
>
> #+BEGIN_SRC emacs-lisp -n
> (save-excursion
> (goto-char (point-min))
> #+END_SRC
>
> Only to get this in the html file (as copied from my browser):
>
> (save-excursion (goto-char (point-min))
>
> The corresponding html is
> <p>(save-excursion
> (goto-char (point-min))
> </p>
>
> if i remove the -n it works - the exported code is formatted but no
> line numbers.
> (org version 6.09a)

Line numbers and references were added in 6.17.

-- 
Manish

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  4:25     ` Manish
@ 2009-03-12  4:28       ` Saptarshi Guha
  2009-03-12  4:41         ` Saptarshi Guha
  0 siblings, 1 reply; 10+ messages in thread
From: Saptarshi Guha @ 2009-03-12  4:28 UTC (permalink / raw)
  To: Manish; +Cc: emacs-orgmode

Ok. I'll update.
Thanks

Saptarshi Guha



On Thu, Mar 12, 2009 at 12:25 AM, Manish <mailtomanish.sharma@gmail.com> wrote:
> On Thu, Mar 12, 2009 at 9:25 AM, Saptarshi Guha wrote:
>> Thank you, quite excited I tried this small org file
>> *Title
>> Some tex
>>
>> #+BEGIN_SRC emacs-lisp -n
>> (save-excursion
>> (goto-char (point-min))
>> #+END_SRC
>>
>> Only to get this in the html file (as copied from my browser):
>>
>> (save-excursion (goto-char (point-min))
>>
>> The corresponding html is
>> <p>(save-excursion
>> (goto-char (point-min))
>> </p>
>>
>> if i remove the -n it works - the exported code is formatted but no
>> line numbers.
>> (org version 6.09a)
>
> Line numbers and references were added in 6.17.
>
> --
> Manish
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  4:28       ` Saptarshi Guha
@ 2009-03-12  4:41         ` Saptarshi Guha
  2009-03-12  7:14           ` Carsten Dominik
  0 siblings, 1 reply; 10+ messages in thread
From: Saptarshi Guha @ 2009-03-12  4:41 UTC (permalink / raw)
  To: emacs-orgmode

Lovely. One last question, is there a way to place the source in a
table of two cols one for the col numbers and one for the code? So
that the reader may easily select the code.
The emacs user does not have a problem what with C-x r k (rectangle
delete) and all, still it would be nice on the reader.

Thanks for amazing org.
Saptarshi Guha



On Thu, Mar 12, 2009 at 12:28 AM, Saptarshi Guha
<saptarshi.guha@gmail.com> wrote:
> Ok. I'll update.
> Thanks
>
> Saptarshi Guha
>
>
>
> On Thu, Mar 12, 2009 at 12:25 AM, Manish <mailtomanish.sharma@gmail.com> wrote:
>> On Thu, Mar 12, 2009 at 9:25 AM, Saptarshi Guha wrote:
>>> Thank you, quite excited I tried this small org file
>>> *Title
>>> Some tex
>>>
>>> #+BEGIN_SRC emacs-lisp -n
>>> (save-excursion
>>> (goto-char (point-min))
>>> #+END_SRC
>>>
>>> Only to get this in the html file (as copied from my browser):
>>>
>>> (save-excursion (goto-char (point-min))
>>>
>>> The corresponding html is
>>> <p>(save-excursion
>>> (goto-char (point-min))
>>> </p>
>>>
>>> if i remove the -n it works - the exported code is formatted but no
>>> line numbers.
>>> (org version 6.09a)
>>
>> Line numbers and references were added in 6.17.
>>
>> --
>> Manish
>>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  4:41         ` Saptarshi Guha
@ 2009-03-12  7:14           ` Carsten Dominik
  2009-03-12 13:41             ` Saptarshi Guha
  0 siblings, 1 reply; 10+ messages in thread
From: Carsten Dominik @ 2009-03-12  7:14 UTC (permalink / raw)
  To: saptarshi.guha; +Cc: emacs-orgmode


On Mar 12, 2009, at 5:41 AM, Saptarshi Guha wrote:

> Lovely. One last question, is there a way to place the source in a
> table of two cols one for the col numbers and one for the code? So
> that the reader may easily select the code.
> The emacs user does not have a problem what with C-x r k (rectangle
> delete) and all, still it would be nice on the reader.

Hi,

how does one select a column in an HTML table?
When I try this, it is always entire rows that are being selected,
so I would not know how to make a table where this works correctly.

- Carsten

>
> Thanks for amazing org.
> Saptarshi Guha
>
>
>
> On Thu, Mar 12, 2009 at 12:28 AM, Saptarshi Guha
> <saptarshi.guha@gmail.com> wrote:
>> Ok. I'll update.
>> Thanks
>>
>> Saptarshi Guha
>>
>>
>>
>> On Thu, Mar 12, 2009 at 12:25 AM, Manish <mailtomanish.sharma@gmail.com 
>> > wrote:
>>> On Thu, Mar 12, 2009 at 9:25 AM, Saptarshi Guha wrote:
>>>> Thank you, quite excited I tried this small org file
>>>> *Title
>>>> Some tex
>>>>
>>>> #+BEGIN_SRC emacs-lisp -n
>>>> (save-excursion
>>>> (goto-char (point-min))
>>>> #+END_SRC
>>>>
>>>> Only to get this in the html file (as copied from my browser):
>>>>
>>>> (save-excursion (goto-char (point-min))
>>>>
>>>> The corresponding html is
>>>> <p>(save-excursion
>>>> (goto-char (point-min))
>>>> </p>
>>>>
>>>> if i remove the -n it works - the exported code is formatted but no
>>>> line numbers.
>>>> (org version 6.09a)
>>>
>>> Line numbers and references were added in 6.17.
>>>
>>> --
>>> Manish
>>>
>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  7:14           ` Carsten Dominik
@ 2009-03-12 13:41             ` Saptarshi Guha
  2009-03-12 15:03               ` Sebastian Rose
  0 siblings, 1 reply; 10+ messages in thread
From: Saptarshi Guha @ 2009-03-12 13:41 UTC (permalink / raw)
  To: emacs-orgmode

Hello,
I got this idea from Google code. An example can be found here (chosen
at random)

http://code.google.com/p/compcache/source/browse/trunk/compcache.c

The code is displayed as a table (albeit with lots of css markup
helping it) yet the source column  is selectable. Hope it helps.

Thanks
Saptarshi Guha



On Thu, Mar 12, 2009 at 3:14 AM, Carsten Dominik <dominik@science.uva.nl> wrote:
>
> On Mar 12, 2009, at 5:41 AM, Saptarshi Guha wrote:
>
>> Lovely. One last question, is there a way to place the source in a
>> table of two cols one for the col numbers and one for the code? So
>> that the reader may easily select the code.
>> The emacs user does not have a problem what with C-x r k (rectangle
>> delete) and all, still it would be nice on the reader.
>
> Hi,
>
> how does one select a column in an HTML table?
> When I try this, it is always entire rows that are being selected,
> so I would not know how to make a table where this works correctly.
>
> - Carsten
>
>>
>> Thanks for amazing org.
>> Saptarshi Guha
>>
>>
>>
>> On Thu, Mar 12, 2009 at 12:28 AM, Saptarshi Guha
>> <saptarshi.guha@gmail.com> wrote:
>>>
>>> Ok. I'll update.
>>> Thanks
>>>
>>> Saptarshi Guha
>>>
>>>
>>>
>>> On Thu, Mar 12, 2009 at 12:25 AM, Manish <mailtomanish.sharma@gmail.com>
>>> wrote:
>>>>
>>>> On Thu, Mar 12, 2009 at 9:25 AM, Saptarshi Guha wrote:
>>>>>
>>>>> Thank you, quite excited I tried this small org file
>>>>> *Title
>>>>> Some tex
>>>>>
>>>>> #+BEGIN_SRC emacs-lisp -n
>>>>> (save-excursion
>>>>> (goto-char (point-min))
>>>>> #+END_SRC
>>>>>
>>>>> Only to get this in the html file (as copied from my browser):
>>>>>
>>>>> (save-excursion (goto-char (point-min))
>>>>>
>>>>> The corresponding html is
>>>>> <p>(save-excursion
>>>>> (goto-char (point-min))
>>>>> </p>
>>>>>
>>>>> if i remove the -n it works - the exported code is formatted but no
>>>>> line numbers.
>>>>> (org version 6.09a)
>>>>
>>>> Line numbers and references were added in 6.17.
>>>>
>>>> --
>>>> Manish
>>>>
>>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Remember: use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12  3:55   ` Saptarshi Guha
  2009-03-12  4:25     ` Manish
@ 2009-03-12 14:03     ` Nick Dokos
  1 sibling, 0 replies; 10+ messages in thread
From: Nick Dokos @ 2009-03-12 14:03 UTC (permalink / raw)
  To: saptarshi.guha; +Cc: emacs-orgmode

Saptarshi Guha <saptarshi.guha@gmail.com> wrote:

> Thank you, quite excited I tried this small org file
> *Title
> Some tex
> 
> #+BEGIN_SRC emacs-lisp -n
> (save-excursion
> (goto-char (point-min))
> #+END_SRC
> 
> Only to get this in the html file (as copied from my browser):
> 
> (save-excursion (goto-char (point-min))
> 
> The corresponding html is
> <p>(save-excursion
> (goto-char (point-min))
> </p>
> 
> if i remove the -n it works - the exported code is formatted but no
> line numbers.
> (org version 6.09a)

I don't know when -n was added, but I use Org-mode version 6.24 and it
worked for me (I did have a transient htmlize error about an unknown
face, but it went away on its own - I have no idea how).

Try upgrading.

Nick

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Code with line numbers in HTML export
  2009-03-12 13:41             ` Saptarshi Guha
@ 2009-03-12 15:03               ` Sebastian Rose
  0 siblings, 0 replies; 10+ messages in thread
From: Sebastian Rose @ 2009-03-12 15:03 UTC (permalink / raw)
  To: saptarshi.guha; +Cc: emacs-orgmode


It's not just putting line numbers and code into two <td> elements.
Putting line-numbers and code into different columns works and is
done everywhere, but in Org's this will not be bullet-proof.

This depends heavily on styles use for the CSS-classes in the code
and the line-numbers.

If one defines bigger (or smaller) fonts for some of the classes on the
code side, line-numbers and code will get out of sync.

1:  line 1, normal font size only
2:  line 2 contains bigger fonts
3:
4:  this is line 3 of code....

Actually, it will even look worse, because the lines will be gradually
get out of sync.

Not sure, if it could even go out of sync when just different fonts are
used. The default line-height is 1.2 em which in turn depends on the
font I believe.


Hence we would have to put every line number and every code line into <div>
elements with a certain height.


The next problem would be, that we suddenly can't copy the example _with_
line numbers anymore ;-)




Saptarshi Guha <saptarshi.guha@gmail.com> writes:
> Hello,
> I got this idea from Google code. An example can be found here (chosen
> at random)
>
> http://code.google.com/p/compcache/source/browse/trunk/compcache.c
>
> The code is displayed as a table (albeit with lots of css markup
> helping it) yet the source column  is selectable. Hope it helps.



Perhaps this is a candidate for org-export-blocks.el or some extension
based on it?



Regards,

   Sebastian



> Thanks
> Saptarshi Guha
>
>
>
> On Thu, Mar 12, 2009 at 3:14 AM, Carsten Dominik <dominik@science.uva.nl> wrote:
>>
>> On Mar 12, 2009, at 5:41 AM, Saptarshi Guha wrote:
>>
>>> Lovely. One last question, is there a way to place the source in a
>>> table of two cols one for the col numbers and one for the code? So
>>> that the reader may easily select the code.
>>> The emacs user does not have a problem what with C-x r k (rectangle
>>> delete) and all, still it would be nice on the reader.
>>
>> Hi,
>>
>> how does one select a column in an HTML table?
>> When I try this, it is always entire rows that are being selected,
>> so I would not know how to make a table where this works correctly.
>>
>> - Carsten
>>
>>>
>>> Thanks for amazing org.
>>> Saptarshi Guha
>>>
>>>
>>>
>>> On Thu, Mar 12, 2009 at 12:28 AM, Saptarshi Guha
>>> <saptarshi.guha@gmail.com> wrote:
>>>>
>>>> Ok. I'll update.
>>>> Thanks
>>>>
>>>> Saptarshi Guha
>>>>
>>>>
>>>>
>>>> On Thu, Mar 12, 2009 at 12:25 AM, Manish <mailtomanish.sharma@gmail.com>
>>>> wrote:
>>>>>
>>>>> On Thu, Mar 12, 2009 at 9:25 AM, Saptarshi Guha wrote:
>>>>>>
>>>>>> Thank you, quite excited I tried this small org file
>>>>>> *Title
>>>>>> Some tex
>>>>>>
>>>>>> #+BEGIN_SRC emacs-lisp -n
>>>>>> (save-excursion
>>>>>> (goto-char (point-min))
>>>>>> #+END_SRC
>>>>>>
>>>>>> Only to get this in the html file (as copied from my browser):
>>>>>>
>>>>>> (save-excursion (goto-char (point-min))
>>>>>>
>>>>>> The corresponding html is
>>>>>> <p>(save-excursion
>>>>>> (goto-char (point-min))
>>>>>> </p>
>>>>>>
>>>>>> if i remove the -n it works - the exported code is formatted but no
>>>>>> line numbers.
>>>>>> (org version 6.09a)
>>>>>
>>>>> Line numbers and references were added in 6.17.
>>>>>
>>>>> --
>>>>> Manish
>>>>>
>>>>
>>>
>>>
>>> _______________________________________________
>>> Emacs-orgmode mailing list
>>> Remember: use `Reply All' to send replies to the list.
>>> Emacs-orgmode@gnu.org
>>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
>>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

-- 
Sebastian Rose, EMMA STIL - mediendesign, Niemeyerstr.6, 30449 Hannover
Tel.:  +49 (0)511 - 36 58 472
Fax:   +49 (0)1805 - 233633 - 11044
mobil: +49 (0)173 - 83 93 417
Email: s.rose@emma-stil.de, sebastian_rose@gmx.de
Http:  www.emma-stil.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-03-12 15:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-12  0:37 Code with line numbers in HTML export Saptarshi Guha
2009-03-12  2:29 ` Nick Dokos
2009-03-12  3:55   ` Saptarshi Guha
2009-03-12  4:25     ` Manish
2009-03-12  4:28       ` Saptarshi Guha
2009-03-12  4:41         ` Saptarshi Guha
2009-03-12  7:14           ` Carsten Dominik
2009-03-12 13:41             ` Saptarshi Guha
2009-03-12 15:03               ` Sebastian Rose
2009-03-12 14:03     ` Nick Dokos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).