emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [Patch] HTML export -- Allow to change the name of the global DIV
@ 2011-03-10 13:07 Sébastien Vauban
  2011-03-11  8:37 ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: Sébastien Vauban @ 2011-03-10 13:07 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

Hello,

Here is a patch which allows one to change the (currently) hard-coded DIV name
in which the page contents is being inserted.

It currently is "content", but some prefer "container" or "wrapper".

If accepted, my next patch will be to make this a per-project variable.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: add-variable-for-container-div.patch --]
[-- Type: text/x-patch, Size: 1130 bytes --]

diff --git a/lisp/org-html.el b/lisp/org-html.el
index c60c90d..772e9d0 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -1,6 +1,6 @@
 ;;; org-html.el --- HTML export for Org-mode
 
-;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
@@ -583,6 +583,11 @@ with a link to this URL."
 	  (const :tag "Keep internal css" nil)
 	  (string :tag "URL or local href")))
 
+(defcustom org-export-content-div "content"
+  "The name of the container DIV that holds all the page contents."
+  :group 'org-export-htmlize
+  :type 'string)
+
 ;;; Hooks
 
 (defvar org-export-html-after-blockquotes-hook nil
@@ -1251,7 +1256,7 @@ lang=\"%s\" xml:lang=\"%s\">
 %s
 </head>
 <body>
-<div id=\"content\">
+<div id=\"%s\">
 %s
 "
 		 (format
@@ -1268,6 +1273,7 @@ lang=\"%s\" xml:lang=\"%s\">
 		 date author description keywords
 		 style
 		 mathjax
+		 org-export-content-div
 		 (if (or link-up link-home)
 		     (concat
 		      (format org-export-html-home/up-format

[-- Attachment #3: Type: text/plain, Size: 50 bytes --]


Best regards,
  Seb

-- 
Sébastien Vauban

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

* Re: [Patch] HTML export -- Allow to change the name of the global DIV
  2011-03-10 13:07 [Patch] HTML export -- Allow to change the name of the global DIV Sébastien Vauban
@ 2011-03-11  8:37 ` Bastien
  2011-03-11  9:09   ` Sébastien Vauban
  2011-03-14 13:11   ` Matt Lundin
  0 siblings, 2 replies; 6+ messages in thread
From: Bastien @ 2011-03-11  8:37 UTC (permalink / raw)
  To: Sébastien Vauban; +Cc: emacs-orgmode

Hi Sébastien,

Sébastien Vauban <wxhgmqzgwmuf@spammotel.com> writes:

> Here is a patch which allows one to change the (currently) hard-coded
> DIV name in which the page contents is being inserted.
>
> It currently is "content", but some prefer "container" or "wrapper".
>
> If accepted, my next patch will be to make this a per-project
> variable.

Are there other hardcoded HTML classes/ids that the user might want to
customize?  If so, can we think about a simple way to define all of them
at once?

Thanks!

-- 
 Bastien

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

* Re: [Patch] HTML export -- Allow to change the name of the global DIV
  2011-03-11  8:37 ` Bastien
@ 2011-03-11  9:09   ` Sébastien Vauban
  2011-03-14 13:11   ` Matt Lundin
  1 sibling, 0 replies; 6+ messages in thread
From: Sébastien Vauban @ 2011-03-11  9:09 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Bastien,

Bastien wrote:
> Sébastien Vauban <wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
>
>> Here is a patch which allows one to change the (currently) hard-coded DIV
>> name in which the page contents is being inserted.
>>
>> It currently is "content", but some prefer "container" or "wrapper".
>>
>> If accepted, my next patch will be to make this a per-project
>> variable.
>
> Are there other hardcoded HTML classes/ids that the user might want to
> customize? If so, can we think about a simple way to define all of them at
> once?

I did not find any other element -- yet -- that should be un-hardcoded. Maybe
other people will have more info about this.

Anyway, next step is to allow such element(s) to be specifiable per project,
so that one can manage different projects with different CSS sources
(remember the question about CSS blueprint, a couple of days ago).

Best regards,
  Seb

-- 
Sébastien Vauban

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

* Re: [Patch] HTML export -- Allow to change the name of the global DIV
  2011-03-11  8:37 ` Bastien
  2011-03-11  9:09   ` Sébastien Vauban
@ 2011-03-14 13:11   ` Matt Lundin
  2011-03-14 15:22     ` Jambunathan K
  1 sibling, 1 reply; 6+ messages in thread
From: Matt Lundin @ 2011-03-14 13:11 UTC (permalink / raw)
  To: Bastien; +Cc: Sébastien Vauban, emacs-orgmode

Bastien <bzg@altern.org> writes:

> Are there other hardcoded HTML classes/ids that the user might want to
> customize?  If so, can we think about a simple way to define all of them
> at once?

The id/class values are hardcoded in several different places and
generated in different ways in org-html.el, so I think the only
practical solution, for now, would be to create variables for each one
(or perhaps an alist that encompasses all of them).

[Slightly OT dreaming]

Over the long-term, it would be nice to give the user a simple way to
control not only classes and ids, but also the placement of structural
divs and other tags. Perhaps we could develop some sort of templating
system, allowing the user to create an custom html skeleton which is
then fleshed out with data from the org file. The user might then
customize which tags, if any, should enclose, say, a level one outline
tree. Properties and tags in an org file might be used to specify the
use of alternate templates within particular sections of the document.

This would have several benefits:

1. It would allow users to export html to an arbitrary tag structure.
   One might, for instance, create static pages that conform to the
   structure/styling of an existing web site. Or one might have
   different types of pages within a single, org-generated website.

2. It would allow simple, clean html when exporting small snippets.
   Currently, when calling C-u M-x org-export-region-as-html, the output
   contains a number of hard-coded divs, classes, and ids. This makes it
   difficult to integrate such snippets into another html file.

          <div id="outline-container-1" class="outline-2">
          <h2 id="sec-1">A section </h2>
          <div class="outline-text-2" id="text-1">

          <p>
          Some text.
          </p></div>
          </div>

3. It would allow users to try out the new html5 tags (<section>,
   <article>, <nav>, etc.).

4. It would offer more consistent customization. At the moment, certain
   tags can be customized (e.g., table tags) but other elements (e.g.,
   lists) cannot be.

5. It would make it easier to create html that works with existing
   scripts (such as the s5 presentation system [1]). 

My guess is that such configuration would depend on your rewrite of the
exporting parser. It would indeed be wonderful if at some point the
export engine returned a generic data structure that could then be
plugged into a modular templating system.

That said, an org file is a *complex* thing, and the exporter already
produces very nice html. :)

Best,
Matt

Footnotes:

[1] http://meyerweb.com/eric/tools/s5/

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

* Re: Re: [Patch] HTML export -- Allow to change the name of the global DIV
  2011-03-14 13:11   ` Matt Lundin
@ 2011-03-14 15:22     ` Jambunathan K
  2011-03-14 15:25       ` Jambunathan K
  0 siblings, 1 reply; 6+ messages in thread
From: Jambunathan K @ 2011-03-14 15:22 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Bastien, emacs-orgmode, Sébastien Vauban


(On a related note)

As part of my odt exporter, I have factored out a generic exporter to
 which org-html.el and org-odt.el plugs in.

The generic exporter is callback driven. I have included the typical
callback that the odt exporter registers down below. 

The generic infrastructure is in place and very usable.  Adding new
callbacks or increasing the granularity of the 'entity' should only be a
matter of time.

I have probably jumped the queue here. Anyways, my formal patch for
integration in to core is only few hours or atmost 1 day away and I am
not kidding ...

For more info checkout out my `staging' branch.

Jambunathan K.

(defvar org-odt-entity-control-callbacks-alist
  `((EXPORT
     . (org-odt-begin-export org-odt-end-export))
    (DOCUMENT-CONTENT
     . (org-odt-begin-document-content org-odt-end-document-content))
    (DOCUMENT-BODY
     . (org-odt-begin-document-body org-odt-end-document-body))
    (ENVIRONMENT
     . (org-odt-begin-environment org-odt-end-environment))
    (LEVEL
     . (org-html-begin-level org-html-end-level))
    (FOOTNOTE-DEFINITION
     . (org-odt-begin-footnote-definition org-odt-end-footnote-definition))
    (TABLE
     . (org-odt-begin-table org-odt-end-table))
    (TABLE-ROWGROUP
     . (org-odt-begin-table-rowgroup org-odt-end-table-rowgroup))
    (LIST
     . (org-odt-begin-list org-odt-end-list))
    (LIST-ITEM
     . (org-odt-begin-list-item org-odt-end-list-item))
    (SECTION
     . (org-odt-begin-section org-odt-end-section))
    (PARAGRAPH
     . (org-odt-begin-paragraph org-odt-end-paragraph)))
  "")

(defvar org-odt-entity-format-callbacks-alist
  `((EXTRA-TARGETS . org-html-format-extra-targets)
    (ORG-TAGS . org-html-format-org-tags)
    (SECTION-NUMBER . org-html-format-section-number)
    (HEADLINE . org-html-format-headline)
    (TOC-ENTRY . org-html-format-toc-entry)
    (TOC-ITEM . org-html-format-toc-item)
    (TAGS . org-odt-format-tags)
    (SPACES . org-odt-format-spaces)
    (TABS . org-odt-format-tabs)
    (LINE-BREAK . org-odt-format-line-break)
    (FONTIFY . org-odt-format-fontify)
    (TODO . org-html-format-todo)
    (LINK . org-odt-format-link)
    (INLINE-IMAGE . org-odt-format-inline-image)
    (ORG-LINK . org-odt-format-org-link)
    (HEADING . org-odt-format-heading)
    (ANCHOR . org-odt-format-anchor)
    (TABLE-ROW . org-odt-format-table-row)
    (TABLE-CELL . org-odt-format-table-cell)
    (FOOTNOTES-SECTION . ignore)
    (FOOTNOTE-REFERENCE . org-odt-format-footnote-reference)
    (HORIZONTAL-LINE . org-odt-format-horizontal-line)
    (COMMENT . org-html-format-comment)
    (PLAIN . org-odt-format-plain))
  "")

Jambunthan K.

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

* Re: Re: [Patch] HTML export -- Allow to change the name of the global DIV
  2011-03-14 15:22     ` Jambunathan K
@ 2011-03-14 15:25       ` Jambunathan K
  0 siblings, 0 replies; 6+ messages in thread
From: Jambunathan K @ 2011-03-14 15:25 UTC (permalink / raw)
  To: Matt Lundin; +Cc: Bastien, emacs-orgmode, Sébastien Vauban


> For more info checkout out my `staging' branch.

Forgot the link. Here it is:

http://repo.or.cz/w/org-mode/org-jambu.git/tree/staging

Jambunathan K.

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

end of thread, other threads:[~2011-03-14 15:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-10 13:07 [Patch] HTML export -- Allow to change the name of the global DIV Sébastien Vauban
2011-03-11  8:37 ` Bastien
2011-03-11  9:09   ` Sébastien Vauban
2011-03-14 13:11   ` Matt Lundin
2011-03-14 15:22     ` Jambunathan K
2011-03-14 15:25       ` Jambunathan K

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).