[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Html export suggestion (use of <div>)
From: |
Mike Newman |
Subject: |
Re: [Orgmode] Html export suggestion (use of <div>) |
Date: |
Mon, 15 Oct 2007 23:08:38 +0100 |
Here is a more refined suggestion, with links to examples
Mike
<Div> in HTML Export
====================
Table of Contents
=================
1 Proposal
2 Implementation
3 Motivation
3.1 Applying styles via CSS
3.2 Applying transformations via XSLT
4 Drawbacks
5 Additional suggestion
6 Options
7 Examples
8 Acknowledgements
1 Proposal
~~~~~~~~~~
I propose that on html export, sections of the document should be
wrapped in <div> </div> markers, to reflect the outline structure
given by org mode.
2 Implementation
~~~~~~~~~~~~~~~~
I think this should be quite simple to implement. Prior to each
heading, open </div> elements would be closed (if the heading level
was higher than the previous heading level), and a new <div> element
would be opened.
3 Motivation
~~~~~~~~~~~~
There are at least two reasons why this might be useful:
3.1 Applying styles via CSS
===========================
This allows, for example:
- Styles to be applied in a way that makes it clear how the sections
are nested, e.g. by indentation, drawing a border or setting a
background
- Styles could be used to display content in a way that is not
possible without them. Links to examples are given below.
I imagine that in time, a variety of style sheets for displaying the
resulting html could be shared, saving users the trouble of developing
their own.
3.2 Applying transformations via XSLT
=====================================
Selecting sections or subsections of a file should be much easier if
they correspond to a single XML element.
4 Drawbacks
~~~~~~~~~~~
- Increased file size (but only very slightly)
- Possibly increased time for browser to render page? I am not aware
of a problem
5 Additional suggestion
~~~~~~~~~~~~~~~~~~~~~~~
It would also be useful to wrap the Table of Contents and the final
part of the HTML file (Author's name and date) in their own <div>.
6 Options
~~~~~~~~~
Attributes can be added to a <div>, most importantly "class" and
"id". Adding the class attribute (as suggested by Cezar) would allow
different sections of the file to be formatted in different ways.
As a first step, I would suggest adding the <div> without a class or
id.
It was suggested that adding <div> to exported HTML should be
controlled by an option. I would see it as fairly harmless, even to
those who would not use the feature, so in my opinion the option would
be an unnecessary complication.
7 Examples
~~~~~~~~~~
I have added <div> elements as proposed here to an HTML file. This
can be viewed, rendered with different style sheets at:
- [http://www.newmanfamily.me.uk/orgmode/Example-defaultstyle.html]
- [http://www.newmanfamily.me.uk/orgmode/Example-sectioned.html]
- [http://www.newmanfamily.me.uk/orgmode/Example-floated.html]
It should be interesting to see how they behave as the width of the
browser window changes - particularly with the last example. (Only
tested in Firefox).
8 Acknowledgements
~~~~~~~~~~~~~~~~~~
I would like to thank Cezar and William Henney for their suggestions.
(And Carsten, of course).