emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Matthew Lundin <mdl@imapmail.org>
Cc: emacs-orgmode@gnu.org
Subject: Re: index-title in org-publish
Date: Mon, 17 Nov 2008 12:59:40 +0100	[thread overview]
Message-ID: <873ahqd0lv.fsf@kassiopeya.MSHEIMNETZ> (raw)
In-Reply-To: <m2r65bguut.fsf@fastmail.fm> (Matthew Lundin's message of "Sun, 16 Nov 2008 16:38:02 -0600")

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	other threads:[~2008-11-17 11:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-16 16:51 index-title in org-publish Matthew Lundin
2008-11-16 18:50 ` Carsten Dominik
2008-11-16 22:38   ` Matthew Lundin
2008-11-17 11:59     ` Sebastian Rose [this message]
2008-11-17 12:37       ` Carsten Dominik
2008-11-17 13:45     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=873ahqd0lv.fsf@kassiopeya.MSHEIMNETZ \
    --to=sebastian_rose@gmx.de \
    --cc=emacs-orgmode@gnu.org \
    --cc=mdl@imapmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).