emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Problem with HTML_CONTAINER_CLASS property
@ 2010-07-06 20:12 Jan Janak
  2010-07-07  7:20 ` David Maus
  2010-07-29 12:14 ` [PATCH] Add support for multile html container classes David Maus
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Janak @ 2010-07-06 20:12 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I am using the HTML_CONTAINER_CLASS property in one of my documents to
append additional classes to the corresponding <div> in the HTML
document I export to:

* Subsection
:PROPERTIES:
:HTML_CONTAINER_CLASS: span-9 last
:END:

When I publish the document, the resulting HTML code looks like this:
<div id="outline-container-1" class="outline-2 span-9">

The class "last" is missing. I also verified that if I add more
classes to the list, only the first one "span-9" makes it to the HTML
code.

Is this a feature or a bug? I am using the latest org-mode version
from git (6.36trans with HEAD c32d7) and Emacs 23.2.1.

Thanks!

-Jan

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

* Re: Problem with HTML_CONTAINER_CLASS property
  2010-07-06 20:12 Problem with HTML_CONTAINER_CLASS property Jan Janak
@ 2010-07-07  7:20 ` David Maus
  2010-07-29 12:14 ` [PATCH] Add support for multile html container classes David Maus
  1 sibling, 0 replies; 6+ messages in thread
From: David Maus @ 2010-07-07  7:20 UTC (permalink / raw)
  To: Jan Janak; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 998 bytes --]

Jan Janak wrote:
>Hello,

>I am using the HTML_CONTAINER_CLASS property in one of my documents to
>append additional classes to the corresponding <div> in the HTML
>document I export to:

>* Subsection
>:PROPERTIES:
>:HTML_CONTAINER_CLASS: span-9 last
>:END:

>When I publish the document, the resulting HTML code looks like this:
><div id="outline-container-1" class="outline-2 span-9">

>The class "last" is missing. I also verified that if I add more
>classes to the list, only the first one "span-9" makes it to the HTML
>code.

>Is this a feature or a bug? I am using the latest org-mode version
>from git (6.36trans with HEAD c32d7) and Emacs 23.2.1.

Neither a feature nor a bug: A limitation ;) I'll see to provide a
patch to extend usage HTML_CONTAINER_CLASS to support more than one
additional class after the feature freeze[1].

HTH
 -- David

[1] http://thread.gmane.org/gmane.emacs.orgmode/27074
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 6+ messages in thread

* [PATCH] Add support for multile html container classes.
  2010-07-06 20:12 Problem with HTML_CONTAINER_CLASS property Jan Janak
  2010-07-07  7:20 ` David Maus
@ 2010-07-29 12:14 ` David Maus
  2010-07-31  9:31   ` Bastien
  1 sibling, 1 reply; 6+ messages in thread
From: David Maus @ 2010-07-29 12:14 UTC (permalink / raw)
  To: emacs-orgmode

* org-html.el (org-html-level-start): Add multiple container
classes.

* org-exp.el (org-export-remember-html-container-classes):
Parse multiple container classes.
---
 lisp/org-exp.el  |    7 ++++---
 lisp/org-html.el |   11 ++++++++---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index f1cea62..d3da4da 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -1311,11 +1311,12 @@ the current file."
   (goto-char (point-min))
   (let (class)
     (while (re-search-forward
-	    "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t)
-      (setq class (match-string 1))
+	    "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(.+\\)$" nil t)
+      (setq class (org-split-string (match-string 1) "[ \t]+"))
       (save-excursion
 	(org-back-to-heading t)
-	(put-text-property (point-at-bol) (point-at-eol) 'html-container-class class)))))
+	(put-text-property
+	 (point-at-bol) (point-at-eol) 'html-container-class class)))))
 
 (defvar org-export-format-drawer-function nil
   "Function to be called to format the contents of a drawer.
diff --git a/lisp/org-html.el b/lisp/org-html.el
index d972c58..28dd633 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -2177,9 +2177,12 @@ When TITLE is nil, just close all open levels."
   (let* ((target (and title (org-get-text-property-any 0 'target title)))
 	 (extra-targets (and target
 			     (assoc target org-export-target-aliases)))
-	 (extra-class (and title (org-get-text-property-any 0 'html-container-class title)))
+	 (extra-class
+	  (and title
+	       (org-get-text-property-any 0 'html-container-class title)))
 	 (preferred (and target
-			 (cdr (assoc target org-export-preferred-target-alist))))
+			 (cdr
+			  (assoc target org-export-preferred-target-alist))))
 	 (remove (or preferred target))
 	 (l org-level-max)
 	 snumber snu href suffix)
@@ -2244,7 +2247,9 @@ When TITLE is nil, just close all open levels."
 	(setq suffix (or href snu))
 	(setq href (or href (concat "sec-" snu)))
 	(insert (format "\n<div id=\"outline-container-%s\" class=\"outline-%d%s\">\n<h%d id=\"%s\">%s%s</h%d>\n<div class=\"outline-text-%d\" id=\"text-%s\">\n"
-			suffix level (if extra-class (concat " " extra-class) "")
+			suffix level (if extra-class
+					 (concat " "
+					  (mapconcat 'identity extra-class " ")))
 			level href
 			extra-targets
 			title level level suffix))
-- 
1.7.1

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

* Re: [PATCH] Add support for multile html container classes.
  2010-07-29 12:14 ` [PATCH] Add support for multile html container classes David Maus
@ 2010-07-31  9:31   ` Bastien
  2010-08-01  8:58     ` David Maus
  0 siblings, 1 reply; 6+ messages in thread
From: Bastien @ 2010-07-31  9:31 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

Hi David,

David Maus <dmaus@ictsoc.de> writes:

> * org-html.el (org-html-level-start): Add multiple container
> classes.

I don't quite understand this patch.

Can't we use 

  :PROPERTIES:
  :HTML_CONTAINER_CLASS: class1 class2 class3
  :END:

already?

Let me know if I miss something!

PS: Also, please make sure the patch only reflect changes in the code
(avoid refilling), it makes it easier to read ;)

-- 
 Bastien

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

* Re: [PATCH] Add support for multile html container classes.
  2010-07-31  9:31   ` Bastien
@ 2010-08-01  8:58     ` David Maus
  2010-08-01  9:33       ` Bastien
  0 siblings, 1 reply; 6+ messages in thread
From: David Maus @ 2010-08-01  8:58 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 813 bytes --]

Bastien wrote:
>Hi David,

>David Maus <dmaus@ictsoc.de> writes:

>> * org-html.el (org-html-level-start): Add multiple container
>> classes.

>I don't quite understand this patch.

>Can't we use

>  :PROPERTIES:
>  :HTML_CONTAINER_CLASS: class1 class2 class3
>  :END:

>already?

No: Org currently only uses the first class.  E.g.

,----
| (re-search-forward "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t)
| (setq class (match-string 1))
`----

\\S-+ matches only the first sequence of non-space characters.

>PS: Also, please make sure the patch only reflect changes in the code
>(avoid refilling), it makes it easier to read ;)

Okay, I'll try to remember to provide separate patches for this.

Best,
  -- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... dmjena@jabber.org
Email..... dmaus@ictsoc.de

[-- Attachment #1.2: Type: application/pgp-signature, Size: 230 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please 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] 6+ messages in thread

* Re: [PATCH] Add support for multile html container classes.
  2010-08-01  8:58     ` David Maus
@ 2010-08-01  9:33       ` Bastien
  0 siblings, 0 replies; 6+ messages in thread
From: Bastien @ 2010-08-01  9:33 UTC (permalink / raw)
  To: David Maus; +Cc: emacs-orgmode

Hi,

David Maus <dmaus@ictsoc.de> writes:

> No: Org currently only uses the first class.  E.g.
>
> ,----
> | (re-search-forward "^[ \t]*:HTML_CONTAINER_CLASS:[ \t]+\\(\\S-+\\)" nil t)
> | (setq class (match-string 1))
> `----
>
> \\S-+ matches only the first sequence of non-space characters.

Okay - I've checked it a simpler version, allowing sequences with white
chars to be matched as the HTML_CONTAINER_CLASS.

>>PS: Also, please make sure the patch only reflect changes in the code
>>(avoid refilling), it makes it easier to read ;)
>
> Okay, I'll try to remember to provide separate patches for this.

Thanks!

-- 
 Bastien

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

end of thread, other threads:[~2010-08-01 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-06 20:12 Problem with HTML_CONTAINER_CLASS property Jan Janak
2010-07-07  7:20 ` David Maus
2010-07-29 12:14 ` [PATCH] Add support for multile html container classes David Maus
2010-07-31  9:31   ` Bastien
2010-08-01  8:58     ` David Maus
2010-08-01  9:33       ` Bastien

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