[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How to omit h1 title heading in HTML export?
From: |
* |
Subject: |
Re: [O] How to omit h1 title heading in HTML export? |
Date: |
Wed, 5 Jun 2013 13:48:32 -0500 |
On 6/4/13, Rasmus <address@hidden> wrote:
> "*" <address@hidden> writes:
>
>> Hey Basile
>> Thanks for your reply!
>>
>> Yes, the suggestion helps :-)
>> A blank TITLE option seems to produce some empty tags like so:
>> <h1 class="title"></h1>
>>
>> And maybe there are also some jquery fixes, for instance...
>> $("#content h1:first-child").hide();
>>
>> Sometimes tricks are fun,
>> but I guess one of my questions was: Do all documents generated by
>> HTML export contain the <h1 class="title">blabla</h1> markup?
>
> Yes seems like it. check ox-html.el and org-html--build-meta-info.
>
> If you are very unhappy with blank title solution proposed by
> Bastien you could use a filter. Here's a filter I use for headlines;
> you can easily adapt it to your case:
>
> (defun rasmus/org-html-ignore-title-if-present (string backend info)
> "Strip title if it's already there for html."
> (when (and (org-export-derived-backend-p backend 'html)
> (string-match "h1 class=\"mytitle\"" string))
> (replace-regexp-in-string "<h1 class=\"title\">.*?</h1>" "" string)))
>
> (add-to-list 'org-export-filter-final-output-functions
> 'rasmus/org-html-ignore-title-if-present)
>
>
>
>
> --
> I hear there's rumors on the, uh, Internets. . .
>
>
>
Thanks for your reply!
Yes, perhaps this is what I was looking for :-)
See below for the snippet that I added to the publishing configuration file.
Modulo very small tweaks, it's your snippet... errors are mine...
In the configuration file I also have to now explicitly say (require 'ox-html)
I'm new at this, so perhaps I ask more questions: Should filters be
defined in the publishing configuration file, like I've done?
(require 'ox-html)
(defun rasmus/org-html-ignore-title-if-present (string backend info)
"Strip title if it's already there for html."
(when (and (org-export-derived-backend-p backend 'html)
(string-match "h1 class=\"title\"" string))
(replace-regexp-in-string "<h1 class=\"title\">.*?</h1>\n+" "" string)))
(add-to-list 'org-export-filter-final-output-functions
'rasmus/org-html-ignore-title-if-present)