emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daniel Clemente <n142857@gmail.com>
To: Matt Price <moptop99@gmail.com>
Cc: org-mode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: collapsing some headings on html export?
Date: Fri, 26 Aug 2011 18:04:16 +0200	[thread overview]
Message-ID: <87ippkkvlr.wl%n142857@gmail.com> (raw)
In-Reply-To: <CAN_Dec_Svf_DpsNxr0cUpwq=bvHcWm8uDUq5a6cqVqmm5JCA2Q@mail.gmail.com>

El Fri, 26 Aug 2011 09:41:38 -0400 Matt Price va escriure:
> 
> On Fri, Aug 26, 2011 at 4:58 AM, Daniel Clemente <n142857@gmail.com> wrote:
> >  I did it with this code:
> > http://www.danielclemente.com/pagina/esquemadorg.js
> > http://www.danielclemente.com/pagina/esquemadorg.css
> >
> > Demo: http://www.danielclemente.com/hacer/emacs.html
>
> ah, that's pretty cool,daniel.  any suggestions for how I might
> implement this selectively, only for certain headings or heading
> levels?  My javascript is I think even worse than my elisp...

You should start by adding jQuery to your page. Then take this code fragment:

		// handle the click event for each header
		for(var i=2;i<=7;++i) {
			$("h"+i).each(
				function(){
					$(this).css({cursor: "pointer"});
					$(this).bind('click', function(){ toggleForOrg_whenclicked( $(this).parent().children("div").eq(0) ); });
				});
		}

It searches all h2, h3, h4, h5, h6, h7 elements. You can remove the loop and use another jQuery selector which finds the headers you want. They are like CSS selectors. For instance this should work: $("h2.myclass") or $("h2, h4")

For that code to work, you should copy at least these functions from esquemadorg.js: toggleForOrg_whenclicked, hideForOrg_whenclicked, showForOrg_whenclicked. Then add some CSS and custom behaviours.


-- Daniel

> 
> Thanks everyone for the suggestions, I am keeping them filed away for
> when I actually finish this project...
> Matt

  parent reply	other threads:[~2011-08-26 16:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 15:41 collapsing some headings on html export? Matt Price
2011-08-25 20:19 ` Christian Moe
2011-08-26  5:08   ` Christian Moe
2011-08-26  8:58   ` Daniel Clemente
     [not found]     ` <CAN_Dec_Svf_DpsNxr0cUpwq=bvHcWm8uDUq5a6cqVqmm5JCA2Q@mail.gmail.com>
2011-08-26 16:04       ` Daniel Clemente [this message]
2011-08-26 16:08         ` Matt Price

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=87ippkkvlr.wl%n142857@gmail.com \
    --to=n142857@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=moptop99@gmail.com \
    /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).