emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "*" <viki.veeks@gmail.com>
To: Rasmus <rasmus@gmx.us>
Cc: emacs-orgmode@gnu.org
Subject: Re: How to omit h1 title heading in HTML export?
Date: Wed, 5 Jun 2013 13:48:32 -0500	[thread overview]
Message-ID: <CAEZhbHjrnfGMiSPhZihpx4PwvdzJepFF+UXrRfOtEpwYCsQwwg@mail.gmail.com> (raw)
In-Reply-To: <87ppw13i2x.fsf@pank.eu>

On 6/4/13, Rasmus <rasmus@gmx.us> wrote:
> "*" <viki.veeks@gmail.com> 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)

      reply	other threads:[~2013-06-05 18:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03 17:20 How to omit h1 title heading in HTML export? *
2013-06-04  8:12 ` flammable project
2013-06-04 17:16   ` *
2013-06-04 17:24     ` Rasmus
2013-06-05 18:48       ` * [this message]

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=CAEZhbHjrnfGMiSPhZihpx4PwvdzJepFF+UXrRfOtEpwYCsQwwg@mail.gmail.com \
    --to=viki.veeks@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=rasmus@gmx.us \
    /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).