emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] index-title in org-publish


From: Sebastian Rose
Subject: Re: [Orgmode] index-title in org-publish
Date: Mon, 17 Nov 2008 12:59:40 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hi Matthew,


sorry, I'm off on weekends currently till I have a new machine at
home. My old omnibook broke lately :-(



> Hi Carsten (and Sebastian),
>
> Yes, so sorry. My post wasn't clear. I was wondering if
> org-publish-org-index could be reverted to the old behavior to produce
> a file in which the first line contains the index-filename (e.g.,
> "Page List") in form "a" below:
>  
> Page List        <------- (a) - old behavior
>
> rather than
>
> * Page List      <------- (b) new behavior
>
> The new behavior (b) causes the filename (e.g., "pagelist") to be
> exported as the title, which results in redundant titles/headings in
> the html. You can see the results new behavior at:
>
> http://faculty.valpo.edu/mlundin/pagelist.html



This is due to the fact, that the structure of the exported index file
now is the same, as for all the other files. We did this partly, to
produce valid XHTML.

As an aside, the file now looks as all the other files. The solution is
not perfect, yes. There is the title, eventually a T.O.C. and a first
section (depends on your global setting), wich just repeats the title.

I will take a look in it - hm, was certainly not the best way to fix
it. It was the easiest way to get rid of thoses XHTML errors. I was not
aware of the index-title option and I don't use it, sorry for that.

The first thing that happens on export, is to produce a Org-file with
index-filename. This file is exported just like any other
Org-file. Since the export to XHTML is more complicated, this won't be
as easy as the (dubious) quick-fix I came up with, I fear.


The index-title should be correct.

In org-publish-org-index:

         (index-title (or (plist-get project-plist :index-title)
                          (concat "Index for project " (car project))))


>>> Thanks! (And sorry to bother you with such a minor issue...)

Is there another way to advance?




OK, this patch would revert the change (I believe):

<<< --->8----------------------------->8----------------------------->8---
diff --git a/lisp/org-publish.el b/lisp/org-publish.el
index 77ccd4f..5a46551 100644
--- a/lisp/org-publish.el
+++ b/lisp/org-publish.el
@@ -626,7 +626,7 @@ Default for INDEX-FILENAME is 'index.org'."
     (if index-buffer
        (kill-buffer index-buffer))
     (with-temp-buffer
-      (insert (concat "* " index-title "\n\n"))
+      (insert (concat "#+TITLE: " index-title "\n\n"))
       (while (setq file (pop files))
        (let ((fn (file-name-nondirectory file))
              (link (file-relative-name file dir))
<<< ---8<-----------------------------8<-----------------------------8<---


Ahh - now as I read this, there is the index-title again, sorry.



The created Org-file now looks like this (for my test data on github):


<<< --->8----------------------------->8----------------------------->8---
#+TITLE: Sitemap

   + Databases
     + [[file:Databases/index.org][Databases]]
     + [[file:Databases/test-level-1.org][test-level-1]]
   + Emacs
     + [[file:Emacs/org-mode.org][Org-mode]]
   + Test-tree
     + Jack London
       + [[file:Test-tree/Jack London/The-white-fang.org][The White Fang]]
     + Paul-Auster
       + [[file:Test-tree/Paul-Auster/Moon-Palace.org][Moon Palace]]
       + [[file:Test-tree/Paul-Auster/test-level-2.org][Test level-2]]
   + [[file:Umlaut-test.org][Umlaut-test]]
   + [[file:footnotes-test.org][footnotes-test]]
   + [[file:index.org][Org export tests - main page]]
   + [[file:test-level-0.org][test-level-0]]
   + [[file:test-slides.org][Comming soon: Slides with Org-Mode and JavaScript]]
   + [[file:test-standard-export-options.org][Test of standard export options 
template]]
   + 
[[file:test-text-before-first-headline.org][test-text-before-first-headline]]
   + xhmtl-tests
     + [[file:xhmtl-tests/horizontal-line.org][horizontal-line]]

<<< ---8<-----------------------------8<-----------------------------8<---



But unfortunately, there is a '</div>' near the end of the resulting
XHTML file, which was never opened. This seems to be the bug I should
have have fixed before (there's a patch below):


sh$ xmllint --dtdvalid http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd 
sitemap.html
sitemap.html:118: parser error : Opening and ending tag mismatch: body line 42 
and div
</div>
      ^
sitemap.html:124: parser error : Opening and ending tag mismatch: html line 3 
and body
</div></body>
             ^
sitemap.html:125: parser error : Extra content at the end of the document
</html>





The </div> element in question is the one after the <ul>:

=> --->8----------------------------->8----------------------------->8---

.....  

<body>
<h1 id="title">Sitemap</h1>

<ul>
<li>
Databases
<ul>

 ...... lots of list items ....

</ul>
</div>              <== HERE <div> never opened.

<= ---8<-----------------------------8<-----------------------------8<---




Carsten, is there an easy way to fix this? I believe it's these lines in
org-exp.el, since they alway insert an '</div>', no matter if we have a
section (which would insert the start tag '<div>'). This one fixes it. I
did my xmllint for all files in my test-repo, and it works.



=> --->8----------------------------->8----------------------------->8---
sh$ git-diff lisp/org-exp.el 
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index 3b9d1c9..88c2225 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -3510,7 +3510,7 @@ lang=\"%s\" xml:lang=\"%s\">
                            (and org-export-with-toc (<= level umax))
                            head-count)
       ;; the </div> to close the last text-... div.
-      (insert "</div>\n")
+      (if have-headings (insert "</div>\n"))
 
       (save-excursion
        (goto-char (point-min))

<= ---8<-----------------------------8<-----------------------------8<---




Regards,

  Sebastian


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




reply via email to

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