Skip to content

Commit c045269

Browse files
roperymaxauthority
authored andcommitted
Change option 'previouspattern' to 'prevpattern'. (#570)
* Change option 'previouspattern' to 'prevpattern'. For backward compatibility, 'previouspattern' remains valid. The reason for this change: "prev" is the standard LINK TYPE, while "previous" is an often supported (but incorrect) synonym. Therefore, followDocumentRelationship("prev") is preferred. Reference: https://www.w3.org/TR/html4/types.html#type-links https://www.w3.org/TR/html5/links.html#sequential-link-types https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types * Support LINK TYPE synonyms, e.g. rel="previous".
1 parent 40df07b commit c045269

File tree

7 files changed

+15
-13
lines changed

7 files changed

+15
-13
lines changed

common/content/buffer.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -556,15 +556,17 @@ const Buffer = Module("buffer", {
556556
* "pattern", and finds the last link matching that
557557
* RegExp.
558558
*/
559-
followDocumentRelationship: function (rel) {
559+
followDocumentRelationship: function (rel, ...synonyms) {
560560
let regexes = options.get(rel + "pattern").values
561561
.map(function (re) RegExp(re, "i"));
562+
synonyms.unshift(rel);
562563

563564
function followFrame(frame) {
564565
function iter(elems) {
565566
for (let i = 0; i < elems.length; i++)
566-
if (elems[i].rel.toLowerCase() == rel || elems[i].rev.toLowerCase() == rel)
567-
yield elems[i];
567+
for (let rel of synonyms)
568+
if (elems[i].rel.toLowerCase() == rel || elems[i].rev.toLowerCase() == rel)
569+
yield elems[i];
568570
}
569571

570572
// <link>s have higher priority than normal <a> hrefs
@@ -1648,7 +1650,7 @@ const Buffer = Module("buffer", {
16481650

16491651
mappings.add(myModes, ["[["],
16501652
"Follow the link labeled 'prev', 'previous' or '<' if it exists",
1651-
function (count) { buffer.followDocumentRelationship("previous"); },
1653+
function (count) { buffer.followDocumentRelationship("prev", "previous"); },
16521654
{ count: true });
16531655

16541656
mappings.add(myModes, ["gf"],
@@ -1789,7 +1791,7 @@ const Buffer = Module("buffer", {
17891791
"Patterns to use when guessing the 'next' page in a document sequence",
17901792
"stringlist", "\\bnext\\b,^>$,^(>>|\u00BB)$,^(>|\u00BB),(>|\u00BB)$,\\bmore\\b");
17911793

1792-
options.add(["previouspattern"], // \u00AB is « (<< in a single char)
1794+
options.add(["prevpattern", "previouspattern"], // \u00AB is « (<< in a single char)
17931795
"Patterns to use when guessing the 'previous' page in a document sequence",
17941796
"stringlist", "\\bprev|previous\\b,^<$,^(<<|\u00AB)$,^(<|\u00AB),(<|\u00AB)$");
17951797

common/locale/en-US/buffer.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@
327327
Follow the link labeled <str>prev</str>,
328328
<str>previous</str> or <str>&lt;</str> if it exists. Useful
329329
when browsing forums or documentation. Change
330-
<o>previouspattern</o> to modify its behavior. It
330+
<o>prevpattern</o> to modify its behavior. It
331331
follows relations between files too.
332332
</p>
333333
</description>

common/locale/en-US/options.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,8 +937,8 @@
937937

938938

939939
<item>
940-
<tags>'previouspattern'</tags>
941-
<spec>'previouspattern'</spec>
940+
<tags>'prevpattern' 'previouspattern'</tags>
941+
<spec>'prevpattern' 'previouspattern'</spec>
942942
<type>stringlist</type>
943943
<default><![CDATA[\bprev|previous\b,^<$,^(<<|«)$,^(<|«),(<|«)$]]></default>
944944
<description>

common/locale/ja/buffer.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@
338338
<p>
339339
<str>prev</str> 、<str>previous</str> や <str>&lt;</str> という名前のリンクが存在する場合、それを辿ります。
340340
掲示板や説明書を読むときに便利です。
341-
<o>previouspattern</o> オプションで挙動を変更できます。
341+
<o>prevpattern</o> オプションで挙動を変更できます。
342342
ファイル間の関連も辿ることができます。
343343
</p>
344344
</description>

common/locale/ja/index.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@
414414
<dt><o>online</o></dt> <dd>'オフライン作業' にするかどうかを設定します</dd>
415415
<dt><o>pageinfo</o></dt> <dd><ex>:pageinfo</ex> で表示したい情報を設定します</dd>
416416
<dt><o>popups</o></dt> <dd>ポップアップウィンドウを表示する場所を設定します</dd>
417-
<dt><o>previouspattern</o></dt> <dd>現在のページの '前' のページを推測するためのパターンを設定します</dd>
417+
<dt><o>prevpattern</o></dt> <dd>現在のページの '前' のページを推測するためのパターンを設定します</dd>
418418
<dt><o>private</o></dt> <dd>'プライベートブラウジング'に設定します</dd>
419419
<dt><o>runtimepath</o></dt> <dd>ランタイムファイルが存在するディレクトリの一覧を設定します</dd>
420420
<dt><o>sanitizeitems</o></dt> <dd>個人データを削除するアイテムを設定します</dd>

common/locale/ja/options.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -917,8 +917,8 @@
917917

918918

919919
<item>
920-
<tags>'previouspattern'</tags>
921-
<spec>'previouspattern'</spec>
920+
<tags>'prevpattern' 'previouspattern'</tags>
921+
<spec>'prevpattern' 'previouspattern'</spec>
922922
<type>stringlist</type>
923923
<default><![CDATA[\bprev|previous\b,^<$,^(<<|«)$,^(<|«),(<|«)$]]></default>
924924
<description>

muttator/contrib/vim/syntax/muttator.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ syn region muttatorSet matchgroup=muttatorCommand start="\%(^\s*:\=\)\@<=\<\%(se
4848

4949
syn keyword muttatorOption archivefolder autocomplete ac cdpath cd complete cpt editor eventignore ei extendedhinttags eht fileencoding fenc
5050
\ followhints fh guioptions go helpfile hf hintinputs hin hintmatching hm hinttags ht hinttimeout hto history hi
51-
\ layout maxitems messages msgs nextpattern pageinfo pa previouspattern runtimepath rtp scroll scr shell sh shellcmdflag shcf
51+
\ layout maxitems messages msgs nextpattern pageinfo pa prevpattern previouspattern runtimepath rtp scroll scr shell sh shellcmdflag shcf
5252
\ showstatuslinks ssli status smtpserver smtp suggestengines titlestring urlseparator verbose vbs
5353
\ wildmode wim wop wordseparators wsp
5454
\ contained nextgroup=muttatorSetMod

0 commit comments

Comments
 (0)