1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2025-12-20 15:57:57 +01:00

Add a :helpall command.

This effectively divides the help into chunked and unchunked subsystems
for clarity.
This commit is contained in:
Doug Kearns
2009-08-04 17:43:04 +10:00
parent 0b60f3ebcc
commit ec4982d50b
19 changed files with 111 additions and 78 deletions

View File

@@ -302,7 +302,7 @@ const liberator = (function () //{{{
registerObserver("load_mappings", function () {
mappings.add(modes.all, ["<F1>"],
"Open help window",
"Open the help page",
function () { liberator.help(); });
if (liberator.has("session"))
@@ -561,21 +561,34 @@ const liberator = (function () //{{{
bang: true
});
commands.add(["h[elp]"],
"Display help",
[
{
name: "h[elp]",
description: "Open the help page"
},
{
name: "helpa[ll]",
description: "Open the single unchunked help page"
}
].forEach(function (command) {
let unchunked = command.name == "helpa[ll]";
commands.add([command.name],
command.description,
function (args)
{
if (args.bang)
return void liberator.echoerr("E478: Don't panic!");
liberator.help(args.literalArg);
liberator.help(args.literalArg, unchunked);
},
{
argCount: "?",
bang: true,
completer: function (context) completion.help(context),
completer: function (context) completion.help(context, unchunked),
literal: 0
});
});
commands.add(["javas[cript]", "js"],
"Run a JavaScript command through eval()",
@@ -823,12 +836,14 @@ const liberator = (function () //{{{
context.completions = liberator.extensions;
};
completion.help = function help(context) {
completion.help = function help(context, unchunked) {
context.title = ["Help"];
context.anchored = false;
context.key = unchunked;
context.generate = function ()
{
let res = config.helpFiles.map(function (file) {
let files = unchunked ? ["all.html"] : config.helpFiles;
let res = files.map(function (file) {
let resp = util.httpGet("chrome://liberator/locale/" + file);
if (!resp)
return [];
@@ -1335,11 +1350,13 @@ const liberator = (function () //{{{
* Returns the URL of the specified help <b>topic</b> if it exists.
*
* @param {string} topic The help topic to lookup.
* @param {boolean} unchunked Whether to search the unchunked help page.
* @returns {string}
*/
findHelp: function (topic)
findHelp: function (topic, unchunked)
{
let items = completion.runCompleter("help", topic);
unchunked = !!unchunked;
let items = completion.runCompleter("help", topic, null, unchunked);
let partialMatch = null;
function format(item) item[1] + "#" + encodeURIComponent(item[0]);
@@ -1363,14 +1380,15 @@ const liberator = (function () //{{{
* exists.
*
* @param {string} topic The help topic to open.
* @param {boolean} unchunked Whether to use the unchunked help page.
* @returns {string}
*/
help: function (topic)
help: function (topic, unchunked)
{
let where = (options["newtab"] && options.get("newtab").has("all", "help"))
? liberator.NEW_TAB : liberator.CURRENT_TAB;
if (!topic)
if (!topic && !unchunked)
{
let helpFile = options["helpfile"];
@@ -1381,7 +1399,7 @@ const liberator = (function () //{{{
return;
}
let page = this.findHelp(topic);
let page = this.findHelp(topic, unchunked);
if (page == null)
return void liberator.echoerr("E149: Sorry, no help for " + topic);
@@ -1915,14 +1933,15 @@ window.addEventListener("liberatorHelpLink", function (event) {
tag = tag.replace(/\[.*?\]/g, "").replace(/!$/, "");
if (tag)
var page = liberator.findHelp(tag);
if (page)
{
let page = liberator.findHelp(tag, /\/all.html($|#)/.test(elem.ownerDocument.location.href));
if (page)
elem.href = "chrome://liberator/locale/" + page;
if (buffer.URL.replace(/#.*/, "") == elem.href.replace(/#.*/, "")) // XXX
setTimeout(function () { content.postMessage("fragmentChange", "*"); }, 0);
}
// TODO: use HashChange event in Gecko 1.9.2
if (elem.href)
setTimeout(function () { content.postMessage("fragmentChange", "*"); }, 0);
}, true, true);
// called when the chrome is fully loaded and before the main window is shown

View File

@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Muttator configuration file
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2009 Jul 22
" Last Change: 2009 Aug 3
" TODO: make this muttator specific - shared liberator config?
@@ -25,8 +25,8 @@ syn keyword muttatorCommand ab[breviate] ab[clear] addo[ns] addr[essbook] bN[ext
\ colo[rscheme] com[mand] comc[lear] con[tact] contacts copy[to] cu[nmap] cuna[bbrev] delc[ommand] delm[arks] delmac[ros]
\ dels[tyle] dia[log] do[autocmd] doautoa[ll] ec[ho] echoe[rr] echom[sg] em[enu] empty[trash] exe[cute] exta[dd] extd[isable]
\ extde[lete] exte[nable] extens[ions] exto[ptions] extp[references] exu[sage] fini[sh] frameo[nly] get[messages] go[to]
\ h[elp] ha[rdcopy] hi[ghlight] ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iu[nmap] iuna[bbrev] javas[cript] js let
\ loadplugins lpl m[ail] ma[rk] macros map mapc[lear] marks mes[sages] messc[lear] mkm[uttatorrc] mm[ap] mmapc[lear]
\ h[elp] helpa[ll] ha[rdcopy] hi[ghlight] ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iu[nmap] iuna[bbrev] javas[cript]
\ js let loadplugins lpl m[ail] ma[rk] macros map mapc[lear] marks mes[sages] messc[lear] mkm[uttatorrc] mm[ap] mmapc[lear]
\ mno[remap] move[to] mu[nmap] nm[ap] nmapc[lear] nno[remap] no[remap] norm[al] nu[nmap] optionu[sage] pa[geinfo] pagest[yle]
\ pas pc[lose] pl[ay] pref[erences] prefs pw[d] q[uit] re[load] res[tart] run runt[ime] sav[eas] scrip[tnames] se[t]
\ setg[lobal] setl[ocal] sil[ent] so[urce] st[op] sty[le] tN[ext] t[open] tab tabN[ext] tabc[lose] tabd[o] tabfir[st]

View File

@@ -49,7 +49,7 @@ it, recommend it and like it :)
section:Help{nbsp}topics[overview]
TO BE WRITTEN...
//TO BE WRITTEN...
For now use [c]:viusage![c], [c]:exusage![c] and [c]:optionusage![c] to find
out about available mappings, commands and options. When in Message mode

View File

@@ -33,7 +33,7 @@
*-liberator* option
* add [m];i[m] and [m];I[m] for opening image location (in new tab)
* add [j]all.html[j] to show all help sections in a single page - available via
[c]:help all[c]
[c]:helpall[c]
* add [m];c[m] extended hint mode - open the context menu
* add [m]@:[m] mapping - repeat the last Ex command
* add [m]\[m] mapping - toggle between rendered and source view

View File

@@ -125,7 +125,7 @@ const config = { //{{{
"pattern.html", "tabs.html", "hints.html", "map.html", "eval.html",
"marks.html", "repeat.html", "autocommands.html", "print.html",
"gui.html", "styling.html", "message.html", "developer.html",
"various.html", "version.html", "index.html", "all.html"
"various.html", "version.html", "index.html"
],
get ignoreKeys() {

View File

@@ -1,7 +1,7 @@
" Vim syntax file
" Language: VIMperator configuration file
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2009 Jul 22
" Last Change: 2009 Aug 3
" TODO: make this vimperator specific - shared liberator config?
@@ -25,16 +25,16 @@ syn keyword vimperatorCommand ab[breviate] ab[clear] addo[ns] bN[ext] b[uffer] b
\ cno[remap] colo[rscheme] com[mand] comc[lear] cu[nmap] cuna[bbrev] delbm[arks] delc[ommand] delm[arks] delmac[ros]
\ delqm[arks] dels[tyle] dia[log] dl do[autocmd] doautoa[ll] downl[oads] e[dit] ec[ho] echoe[rr] echom[sg] em[enu] exe[cute]
\ exta[dd] extd[isable] extde[lete] exte[nable] extens[ions] exto[ptions] extp[references] exu[sage] files fini[sh] fo[rward]
\ frameo[nly] fw h[elp] ha[rdcopy] hi[ghlight] hist[ory] hs ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iu[nmap]
\ iuna[bbrev] javas[cript] js ju[mps] let loadplugins lpl ls ma[rk] macros map mapc[lear] marks mes[sages] messc[lear]
\ mkv[imperatorrc] nm[ap] nmapc[lear] nno[remap] no[remap] noh[lsearch] norm[al] nu[nmap] o[pen] optionu[sage] pa[geinfo]
\ pagest[yle] pas pc[lose] pl[ay] pref[erences] prefs pw[d] q[uit] qa[ll] qma[rk] qmarks quita[ll] re[draw] re[load]
\ reloada[ll] res[tart] run runt[ime] sav[eas] sb[ar] sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal] sideb[ar]
\ sil[ent] so[urce] st[op] stopa[ll] sty[le] tN[ext] t[open] tab tabN[ext] tabc[lose] tabd[o] tabde[tach] tabdu[plicate]
\ tabe[dit] tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew tabo[nly] tabopen tabp[revious] tabr[ewind] tabs tbh[ide] tbs[how]
\ tbt[oggle] time tn[ext] toolbarh[ide] toolbars[how] toolbart[oggle] tp[revious] u[ndo] una[bbreviate] undoa[ll] unl[et]
\ unm[ap] ve[rsion] vie[wsource] viu[sage] vm[ap] vmap[clear] vno[remap] vu[nmap] w[rite] wc[lose] win[open] winc[lose]
\ wine[dit] wo[pen] wq wqa[ll] xa[ll] zo[om]
\ frameo[nly] fw h[elp] helpa[ll] ha[rdcopy] hi[ghlight] hist[ory] hs ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap]
\ iu[nmap] iuna[bbrev] javas[cript] js ju[mps] let loadplugins lpl ls ma[rk] macros map mapc[lear] marks mes[sages]
\ messc[lear] mkv[imperatorrc] nm[ap] nmapc[lear] nno[remap] no[remap] noh[lsearch] norm[al] nu[nmap] o[pen] optionu[sage]
\ pa[geinfo] pagest[yle] pas pc[lose] pl[ay] pref[erences] prefs pw[d] q[uit] qa[ll] qma[rk] qmarks quita[ll] re[draw]
\ re[load] reloada[ll] res[tart] run runt[ime] sav[eas] sb[ar] sb[open] sbcl[ose] scrip[tnames] se[t] setg[lobal] setl[ocal]
\ sideb[ar] sil[ent] so[urce] st[op] stopa[ll] sty[le] tN[ext] t[open] tab tabN[ext] tabc[lose] tabd[o] tabde[tach]
\ tabdu[plicate] tabe[dit] tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew tabo[nly] tabopen tabp[revious] tabr[ewind] tabs
\ tbh[ide] tbs[how] tbt[oggle] time tn[ext] toolbarh[ide] toolbars[how] toolbart[oggle] tp[revious] u[ndo] una[bbreviate]
\ undoa[ll] unl[et] unm[ap] ve[rsion] vie[wsource] viu[sage] vm[ap] vmap[clear] vno[remap] vu[nmap] w[rite] wc[lose] win[open]
\ winc[lose] wine[dit] wo[pen] wq wqa[ll] xa[ll] zo[om]
\ contained
syn match vimperatorCommand "!" contained

View File

@@ -77,7 +77,7 @@ LOGO=<div style="text-align: center;"><span class="vimperator-logo"></span></div
</table>
[help-inlinemacro]
<a href="chrome://liberator/locale/{1}">{target}</a>
<a href="chrome://liberator/locale/{outfile@.*all.html:all.html:{1}}#{2={1}}">{target}</a>
[quotes]
|=tag

View File

@@ -10,7 +10,7 @@ _make doc_. Please refer to the
http://www.methods.co.nz/asciidoc/userguide.html[asciidoc documentation] above
for details. Usually you can just write text as is, and mostly it will be
interpreted correctly. The only difficult part is to write special sections
like for help::help[various.html#online-help].
like for help::help[various.html,online-help].
----------------------------------------------------------------------------------
|<F1>| |:help| |:h| |help|
@@ -64,7 +64,7 @@ Vimperator documentation:
- *$$section:Writing{nbsp}documentation[writing-docs,documentation]$$* Creates
a new section like _Writing Documentation_ in this help file with 2 tags.
- *$$help:developer{nbsp}information[developer.html#documentation]$$* creates
- *$$help:developer{nbsp}information[developer.html,documentation]$$* creates
a link with text _developer information_ to the tag _documentation_ in
the file _developer.html_.
@@ -72,7 +72,7 @@ Vimperator documentation:
If you don't know in which file/section you should put some documentation, ask
on the mailing list or on #vimperator. Usually help should be grouped together
in logically connected subject areas like
help:opening{nbsp}web{nbsp}pages[browsing.html#opening].
help:opening{nbsp}web{nbsp}pages[browsing.html,opening].
section:Generating{nbsp}documentation[generating-docs]

View File

@@ -1,6 +1,6 @@
heading:Expression{nbsp}evaluation[expression,expr,eval]
INTRO TO BE WRITTEN...
//INTRO TO BE WRITTEN...
|:ec| |:echo| +
||:ec[ho] {expr}||

View File

@@ -193,7 +193,8 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
||[c]:forward[c]|| Go forward in the browser history +
||[c]:frameonly[c]|| Show only the current frame's page +
||[c]:hardcopy[c]|| Print current document +
||[c]:help[c]|| Display help +
||[c]:help[c]|| Open the help page +
||[c]:helpall[c]|| Open the single unchunked help page +
||[c]:highlight[c]|| Style Vimperator +
||[c]:history[c]|| Show recently visited URLs +
||[c]:iabbrev[c]|| Abbreviate a key sequence in Insert mode +

View File

@@ -451,7 +451,7 @@ ____
|\'noprivate'| |\'private'|
||'private'|| boolean (default: off)
____
Set the 'private browsing' option. In private browsing mode history, cache
Set the "private browsing" option. In private browsing mode history, cache
files, cookies, form data, passwords, and download list entries are available
only for the duration of the private browsing session and deleted when
returning to normal browsing mode.

View File

@@ -27,9 +27,8 @@ ________________________________________________________________________________
________________________________________________________________________________
The file {rcfile} is used for user initialization commands. If {rcfile} is
"NORC" then no startup initialization is performed except for the loading of
plugins, i.e. steps 1. and 2. in
help:initialization[starting.html#Initialization] are skipped. If {rcfile} is
"NONE" then plugin loading is also skipped.
plugins, i.e. steps 1. and 2. in [j]initialization[j] are skipped. If {rcfile}
is "NONE" then plugin loading is also skipped.
________________________________________________________________________________

View File

@@ -61,11 +61,18 @@ section:Online{nbsp}help[online-help]
||:h[elp] [a][subject][a]|| +
||<F1>||
________________________________________________________________________________
Open help window. The default page, as specified by 'helpfile' is shown unless
[a][subject][a] is specified. If you need help for a specific topic, try
Open the help page. The default page, as specified by 'helpfile' is shown
unless [a][subject][a] is specified. If you need help for a specific topic, try
[c]:help overview[c].
________________________________________________________________________________
All help pages can be viewed in a single page via [c]:help all[c].
|:helpall| |:helpa| |help-all|
||:helpa[ll] [a][subject][a]|| +
________________________________________________________________________________
Open the single unchunked help page.
See [c]:help[c].
________________________________________________________________________________

View File

@@ -1,7 +1,7 @@
" Vim syntax file
" Language: Xulmus configuration file
" Maintainer: Doug Kearns <dougkearns@gmail.com>
" Last Change: 2009 Jul 22
" Last Change: 2009 Aug 3
" TODO: make this xulmus specific - shared liberator config?
@@ -25,18 +25,18 @@ syn keyword xulmusCommand ab[breviate] ab[clear] addo[ns] bN[ext] b[uffer] ba[ck
\ cno[remap] colo[rscheme] com[mand] comc[lear] cu[nmap] cuna[bbrev] delbm[arks] delc[ommand] delm[arks] delmac[ros]
\ delqm[arks] dels[tyle] dia[log] displayp[ane] dl do[autocmd] doautoa[ll] downl[oads] dp[ane] dpcl[ose] dpope[n] e[dit]
\ ec[ho] echoe[rr] echom[sg] em[enu] exe[cute] exta[dd] extd[isable] extde[lete] exte[nable] extens[ions] exto[ptions]
\ extp[references] exu[sage] f[ilter] files fini[sh] fo[rward] frameo[nly] fw h[elp] ha[rdcopy] hi[ghlight] hist[ory] hs
\ ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iu[nmap] iuna[bbrev] javas[cript] js ju[mps] let load loadplugins lpl ls
\ ma[rk] macros map mapc[lear] marks mediav[iew] mes[sages] messc[lear] mkv[imperatorrc] mkx[ulmusrc] nm[ap] nmap[clear]
\ nno[remap] no[remap] noh[lsearch] norm[al] nu[nmap] o[pen] optionu[sage] pa[geinfo] pagest[yle] pas pc[lose] pl[ay]
\ playern[ext] playerp[lay] playerpa[use] playerpr[ev] players[top] pm[ap] pmap[clear] pno[remap] pref[erences] prefs pu[nmap]
\ pw[d] q[uit] qa[ll] qma[rk] qmarks queue quita[ll] re[draw] re[load] reloada[ll] res[tart] run runt[ime] sav[eas] sb[ar]
\ sb[open] sbcl[ose] scrip[tnames] se[t] see[k] setg[lobal] setl[ocal] sideb[ar] sil[ent] sort[view] so[urce] st[op] stopa[ll]
\ sty[le] tN[ext] t[open] tab tabN[ext] tabc[lose] tabd[o] tabde[tach] tabdu[plicate] tabe[dit] tabfir[st] tabl[ast] tabm[ove]
\ tabn[ext] tabnew tabo[nly] tabopen tabp[revious] tabr[ewind] tabs tbh[ide] tbs[how] tbt[oggle] time tn[ext] toolbarh[ide]
\ toolbars[how] toolbart[oggle] tp[revious] u[ndo] una[bbreviate] undoa[ll] unl[et] unm[ap] ve[rsion] vie[wsource] viu[sage]
\ vm[ap] vmap[clear] vno[remap] vol[ume] vu[nmap] w[rite] wc[lose] win[open] winc[lose] wine[dit] wo[pen] wq wqa[ll] xa[ll]
\ zo[om]
\ extp[references] exu[sage] f[ilter] files fini[sh] fo[rward] frameo[nly] fw h[elp] helpa[ll] ha[rdcopy] hi[ghlight]
\ hist[ory] hs ia[bbrev] iabc[lear] im[ap] imapc[lear] ino[remap] iu[nmap] iuna[bbrev] javas[cript] js ju[mps] let load
\ loadplugins lpl ls ma[rk] macros map mapc[lear] marks mediav[iew] mes[sages] messc[lear] mkv[imperatorrc] mkx[ulmusrc]
\ nm[ap] nmap[clear] nno[remap] no[remap] noh[lsearch] norm[al] nu[nmap] o[pen] optionu[sage] pa[geinfo] pagest[yle] pas
\ pc[lose] pl[ay] playern[ext] playerp[lay] playerpa[use] playerpr[ev] players[top] pm[ap] pmap[clear] pno[remap]
\ pref[erences] prefs pu[nmap] pw[d] q[uit] qa[ll] qma[rk] qmarks queue quita[ll] re[draw] re[load] reloada[ll] res[tart] run
\ runt[ime] sav[eas] sb[ar] sb[open] sbcl[ose] scrip[tnames] se[t] see[k] setg[lobal] setl[ocal] sideb[ar] sil[ent] sort[view]
\ so[urce] st[op] stopa[ll] sty[le] tN[ext] t[open] tab tabN[ext] tabc[lose] tabd[o] tabde[tach] tabdu[plicate] tabe[dit]
\ tabfir[st] tabl[ast] tabm[ove] tabn[ext] tabnew tabo[nly] tabopen tabp[revious] tabr[ewind] tabs tbh[ide] tbs[how]
\ tbt[oggle] time tn[ext] toolbarh[ide] toolbars[how] toolbart[oggle] tp[revious] u[ndo] una[bbreviate] undoa[ll] unl[et]
\ unm[ap] ve[rsion] vie[wsource] viu[sage] vm[ap] vmap[clear] vno[remap] vol[ume] vu[nmap] w[rite] wc[lose] win[open]
\ winc[lose] wine[dit] wo[pen] wq wqa[ll] xa[ll] zo[om]
\ contained
syn match xulmusCommand "!" contained

View File

@@ -77,7 +77,7 @@ LOGO=<div style="text-align: center;"><span class="xulmus-logo"></span></div>
</table>
[help-inlinemacro]
<a href="chrome://liberator/locale/{1}">{target}</a>
<a href="chrome://liberator/locale/{outfile@.*all.html:all.html:{1}}#{2={1}}">{target}</a>
[quotes]
|=tag

View File

@@ -1,6 +1,6 @@
heading:Expression{nbsp}evaluation[expression,expr,eval]
INTRO TO BE WRITTEN...
//INTRO TO BE WRITTEN...
|:ec| |:echo| +
||:ec[ho] {expr}||

View File

@@ -232,7 +232,8 @@ section:Ex{nbsp}commands[ex-cmd-index,:index]
||[c]:forward[c]|| Go forward in the browser history +
||[c]:frameonly[c]|| Show only the current frame's page +
||[c]:hardcopy[c]|| Print current document +
||[c]:help[c]|| Display help +
||[c]:help[c]|| Open the help page +
||[c]:helpall[c]|| Open the single unchunked help page +
||[c]:highlight[c]|| Style Xulmus +
||[c]:history[c]|| Show recently visited URLs +
||[c]:iabbrev[c]|| Abbreviate a key sequence in Insert mode +

View File

@@ -27,9 +27,8 @@ ________________________________________________________________________________
________________________________________________________________________________
The file {rcfile} is used for user initialization commands. If {rcfile} is
"NORC" then no startup initialization is performed except for the loading of
plugins, i.e. steps 1. and 2. in
help:initialization[starting.html#Initialization] are skipped. If {rcfile} is
"NONE" then plugin loading is also skipped.
plugins, i.e. steps 1. and 2. in [j]initialization[j] are skipped. If {rcfile}
is "NONE" then plugin loading is also skipped.
________________________________________________________________________________

View File

@@ -61,11 +61,18 @@ section:Online{nbsp}help[online-help]
||:h[elp] [a][subject][a]|| +
||<F1>||
________________________________________________________________________________
Open help window. The default page, as specified by 'helpfile' is shown unless
[a][subject][a] is specified. If you need help for a specific topic, try
Open the help page. The default page, as specified by 'helpfile' is shown
unless [a][subject][a] is specified. If you need help for a specific topic, try
[c]:help overview[c].
________________________________________________________________________________
All help pages can be viewed in a single page via [c]:help all[c].
|:helpall| |:helpa| |help-all|
||:helpa[ll] [a][subject][a]|| +
________________________________________________________________________________
Open the single unchunked help page.
See [c]:help[c].
________________________________________________________________________________