[Top][All Lists]

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

Re: Single key navigation for texinfos HTML

From: Sebastian Rose
Subject: Re: Single key navigation for texinfos HTML
Date: Thu, 22 Jan 2009 12:43:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

address@hidden (Karl Berry) writes:
> Hi Sebastian,
>     > http://orgmode.org/worg/code/org-info-js/
>     ...
>     >     http://wiki.github.com/SebastianRose/org-info-js/org-keys
>     ...
>     >     
> http://github.com/SebastianRose/org-info-js/blob/ef18719be875f0dd7c352ddc55d277493150ea69/org-keys.js
>     Did you recognize the `occur' and search features? 
> No -- that's fantastic!  I suggest adding them to the doc.  By trial and
> error, I found occur is on "o", but I tried doing occur on "name", I
> couldn't make sense of the result.  What does it do?  Highlight
> occurrences I guess? 

In the docs, just type `?' for keyboard help ;-)

What it does is to simulate OrgModes occur behaviour:

1.) Switch the view-mode from 'info-view-mode' to 'plain-view-mode'
    (i.e. not the info-like displaying, but just the HTML as it is. Look at
    the HTML-source and you'll find, that it's just one big HTML
    file. This is what `m' does.).
2.) Fold everything to display level 1 headlines only.
3.) Search for the string.
4.) Fold out every section that contains a match and highlight the match.

Example for occur usage:
go to http://orgmode.org/Changes.html

type `o'
type `todo RET'

now you may jump to the next section with a match by pressing `SHIFT-s'
(repeatedly if you like).

You may go back in navigation history using `b', foreward in navigation
history by `B'.

To see what the folding feature is, press `m'. In `plain-view-mode', you
may also click the headlines to (un-)fold the sections. Try `F' and `f'
to get a feeling for the folding feature. Note also, that `l' and `L'
let you create an HTML or OrgMode link respectively. For texinfo files,
we could as well change `L' to create a \ref{} link.

Hm - this would mean to transform the whole org-info.js to a texinfo
version. The exporter could offer some kind of option to include the big
script, or just the few lines needed for navigation.

> As for search, does it work across nodes?

No. The script can only access the document itself. It's completly
client side.

>     The javascript code is a bit more than needed (there is the `console'
>     which is not used yet and some more).
> It is the console stuff which I was worried about.  Anything that says
> stuff like "40px" and "1px solid #cccccc" seems problematic to me.  If
> it's not really needed, can you just take it out?  What's it for?  Is it
> somehow related to the text box formatting (which is weird -- the top of
> the heading is cut off for me).

It's just, that the only way to read input cross-browser is to have a
<input type="text"> somewhere. The input will not work, if that input
field is hidden. So I hide it by placing it outside the visible area of
the browser window.

> Also, forgive my ignorance of JavaScript, but I can't figure out how the
> code works.  I can vaguely see you're hooking into the access keys, but
> where is occur/search implement?

The occur code is not included in org-keys.js. It's just in
org-info.js. I've cut that out to get a first compact version (which
could be a little bit more compact even). In info files, we can't search
all the files that way.

We _could_ search accross documents actually. The script only knows
about the `previous' and `next' documents, but nothing about their
contents. This would mean, to load the next document when searching
foreward (SHIFT-s in org-info.js) and pass some URL-params to let the
script know about the search. I nothing is found, ask the user what to
do (go back, stay, search next document if any).

>     Note also: the code and functionality of the HTML is not changed at
>     all. Access keys keep working.
> I did notice that, and that is cool :).
> Thanks,
> Karl

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
Http:  www.emma-stil.de

reply via email to

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