Fossil SCM

Improved interwiki link documentation. Enhance the /intermap page so that it shows the current intermap (read-only) to non-setup users, rather than completely exluding such users.

drh 2020-10-10 16:32 trunk
Commit baeab56efff03545bd894e127b5508ef30e0e02d9e0b67b9b855824484a2650a
2 files changed +8 -2 +10 -5
+8 -2
--- src/interwiki.c
+++ src/interwiki.c
@@ -310,15 +310,15 @@
310310
const char *zHash = "";
311311
const char *zWiki = "";
312312
char *zErr = 0;
313313
314314
login_check_credentials();
315
- if( !g.perm.Setup ){
315
+ if( !g.perm.Read && !g.perm.RdWiki && ~g.perm.RdTkt ){
316316
login_needed(0);
317317
return;
318318
}
319
- if( P("submit")!=0 && cgi_csrf_safe(1) ){
319
+ if( g.perm.Setup && P("submit")!=0 && cgi_csrf_safe(1) ){
320320
zTag = PT("tag");
321321
zBase = PT("base");
322322
zHash = PT("hash");
323323
zWiki = PT("wiki");
324324
if( zTag==0 || zTag[0]==0 || !interwiki_valid_name(zTag) ){
@@ -381,10 +381,16 @@
381381
if( n ){
382382
@ </ol>
383383
}else{
384384
@ No mappings are currently defined.
385385
}
386
+
387
+ if( !g.perm.Setup ){
388
+ /* Do not show intermap editing fields to non-setup users */
389
+ style_footer();
390
+ return;
391
+ }
386392
387393
@ <p>To add a new mapping, fill out the form below providing a unique name
388394
@ for the tag. To edit an exist mapping, fill out the form and use the
389395
@ existing name as the tag. To delete an existing mapping, fill in the
390396
@ tag field but leave the "Base URL" field blank.</p>
391397
--- src/interwiki.c
+++ src/interwiki.c
@@ -310,15 +310,15 @@
310 const char *zHash = "";
311 const char *zWiki = "";
312 char *zErr = 0;
313
314 login_check_credentials();
315 if( !g.perm.Setup ){
316 login_needed(0);
317 return;
318 }
319 if( P("submit")!=0 && cgi_csrf_safe(1) ){
320 zTag = PT("tag");
321 zBase = PT("base");
322 zHash = PT("hash");
323 zWiki = PT("wiki");
324 if( zTag==0 || zTag[0]==0 || !interwiki_valid_name(zTag) ){
@@ -381,10 +381,16 @@
381 if( n ){
382 @ </ol>
383 }else{
384 @ No mappings are currently defined.
385 }
 
 
 
 
 
 
386
387 @ <p>To add a new mapping, fill out the form below providing a unique name
388 @ for the tag. To edit an exist mapping, fill out the form and use the
389 @ existing name as the tag. To delete an existing mapping, fill in the
390 @ tag field but leave the "Base URL" field blank.</p>
391
--- src/interwiki.c
+++ src/interwiki.c
@@ -310,15 +310,15 @@
310 const char *zHash = "";
311 const char *zWiki = "";
312 char *zErr = 0;
313
314 login_check_credentials();
315 if( !g.perm.Read && !g.perm.RdWiki && ~g.perm.RdTkt ){
316 login_needed(0);
317 return;
318 }
319 if( g.perm.Setup && P("submit")!=0 && cgi_csrf_safe(1) ){
320 zTag = PT("tag");
321 zBase = PT("base");
322 zHash = PT("hash");
323 zWiki = PT("wiki");
324 if( zTag==0 || zTag[0]==0 || !interwiki_valid_name(zTag) ){
@@ -381,10 +381,16 @@
381 if( n ){
382 @ </ol>
383 }else{
384 @ No mappings are currently defined.
385 }
386
387 if( !g.perm.Setup ){
388 /* Do not show intermap editing fields to non-setup users */
389 style_footer();
390 return;
391 }
392
393 @ <p>To add a new mapping, fill out the form below providing a unique name
394 @ for the tag. To edit an exist mapping, fill out the form and use the
395 @ existing name as the tag. To delete an existing mapping, fill in the
396 @ tag field but leave the "Base URL" field blank.</p>
397
+10 -5
--- www/interwiki.md
+++ www/interwiki.md
@@ -34,21 +34,21 @@
3434
3535
## Details
3636
3737
Fossil supports interwiki links in both the
3838
[Fossil Wiki](/wiki_rules) and [Markdown](/md_rules) markup
39
-styles. An interwiki link consists of a tag followed a colon
39
+styles. An interwiki link consists of a tag followed by a colon
4040
and the link target:
4141
4242
> <i>Tag</i><b>:</b><i>PageName</i>
4343
4444
The Tag must consist of ASCII alphanumeric characters only - no
4545
punctuation or whitespace or characters greater than U+007A.
4646
The PageName is the link notation on the target wiki.
4747
Three different classes of PageNames are recognized by Fossil:
4848
49
- 1. <b>Path Links</b> &rarr; the PageName is begins with the "/" character
49
+ 1. <b>Path Links</b> &rarr; the PageName begins with the "/" character
5050
or is an empty string.
5151
5252
2. <b>Hash Links</b> &rarr; the PageName is a hexadecimal number with
5353
at least four digits.
5454
@@ -62,14 +62,19 @@
6262
<a name="intermap"></a>
6363
## Intermap
6464
6565
The intermap defines a mapping from interwiki Tags to full URLs. The
6666
Intermap can be viewed and managed using the [fossil interwiki][iwiki]
67
-command or the [/intermap][imap] webpages.
67
+command or the [/intermap][imap] webpages.
6868
6969
[iwiki]: /help?cmd=interwiki
70
-[imap]: /help?cmd=/intermap
70
+[imap]: /intermap
71
+
72
+The current intermap for a server is seen on the [/intermap][imap] page
73
+(which is read-only for non-Setup users) and at the bottom of the built-in
74
+[Fossil Wiki rules](/wiki_rules) and [Markdown rules](/md_rules)
75
+documentation pages.
7176
7277
Each intermap entry stores, at a minimum, the base URL for the remote
7378
wiki. The intermap entry might also store additional path text that
7479
is used for Hash and Wiki links. If only the base URL is provided,
7580
then the intermap will only allow Path style interwiki links. The
@@ -92,11 +97,11 @@
9297
check-in as part of a comment of another check-in, that new check-in
9398
shows up in the "References" section of the target check-in.
9499
([example](31af805348690958). In other words, Fossil tracks not just
95100
"_source&rarr;target_", but it also tracks "_target&rarr;source_".
96101
But backtracking do not work for interwiki links, since the Fossil
97
- running on the target has no way of knowing scanning the source and
102
+ running on the target has no way of scanning the source text and
98103
hence has no way of knowing that it is a target of a link from the source.
99104
100105
[fcfg]: /help?cmd=config
101106
102107
## Intermap Storage Details
103108
--- www/interwiki.md
+++ www/interwiki.md
@@ -34,21 +34,21 @@
34
35 ## Details
36
37 Fossil supports interwiki links in both the
38 [Fossil Wiki](/wiki_rules) and [Markdown](/md_rules) markup
39 styles. An interwiki link consists of a tag followed a colon
40 and the link target:
41
42 > <i>Tag</i><b>:</b><i>PageName</i>
43
44 The Tag must consist of ASCII alphanumeric characters only - no
45 punctuation or whitespace or characters greater than U+007A.
46 The PageName is the link notation on the target wiki.
47 Three different classes of PageNames are recognized by Fossil:
48
49 1. <b>Path Links</b> &rarr; the PageName is begins with the "/" character
50 or is an empty string.
51
52 2. <b>Hash Links</b> &rarr; the PageName is a hexadecimal number with
53 at least four digits.
54
@@ -62,14 +62,19 @@
62 <a name="intermap"></a>
63 ## Intermap
64
65 The intermap defines a mapping from interwiki Tags to full URLs. The
66 Intermap can be viewed and managed using the [fossil interwiki][iwiki]
67 command or the [/intermap][imap] webpages.
68
69 [iwiki]: /help?cmd=interwiki
70 [imap]: /help?cmd=/intermap
 
 
 
 
 
71
72 Each intermap entry stores, at a minimum, the base URL for the remote
73 wiki. The intermap entry might also store additional path text that
74 is used for Hash and Wiki links. If only the base URL is provided,
75 then the intermap will only allow Path style interwiki links. The
@@ -92,11 +97,11 @@
92 check-in as part of a comment of another check-in, that new check-in
93 shows up in the "References" section of the target check-in.
94 ([example](31af805348690958). In other words, Fossil tracks not just
95 "_source&rarr;target_", but it also tracks "_target&rarr;source_".
96 But backtracking do not work for interwiki links, since the Fossil
97 running on the target has no way of knowing scanning the source and
98 hence has no way of knowing that it is a target of a link from the source.
99
100 [fcfg]: /help?cmd=config
101
102 ## Intermap Storage Details
103
--- www/interwiki.md
+++ www/interwiki.md
@@ -34,21 +34,21 @@
34
35 ## Details
36
37 Fossil supports interwiki links in both the
38 [Fossil Wiki](/wiki_rules) and [Markdown](/md_rules) markup
39 styles. An interwiki link consists of a tag followed by a colon
40 and the link target:
41
42 > <i>Tag</i><b>:</b><i>PageName</i>
43
44 The Tag must consist of ASCII alphanumeric characters only - no
45 punctuation or whitespace or characters greater than U+007A.
46 The PageName is the link notation on the target wiki.
47 Three different classes of PageNames are recognized by Fossil:
48
49 1. <b>Path Links</b> &rarr; the PageName begins with the "/" character
50 or is an empty string.
51
52 2. <b>Hash Links</b> &rarr; the PageName is a hexadecimal number with
53 at least four digits.
54
@@ -62,14 +62,19 @@
62 <a name="intermap"></a>
63 ## Intermap
64
65 The intermap defines a mapping from interwiki Tags to full URLs. The
66 Intermap can be viewed and managed using the [fossil interwiki][iwiki]
67 command or the [/intermap][imap] webpages.
68
69 [iwiki]: /help?cmd=interwiki
70 [imap]: /intermap
71
72 The current intermap for a server is seen on the [/intermap][imap] page
73 (which is read-only for non-Setup users) and at the bottom of the built-in
74 [Fossil Wiki rules](/wiki_rules) and [Markdown rules](/md_rules)
75 documentation pages.
76
77 Each intermap entry stores, at a minimum, the base URL for the remote
78 wiki. The intermap entry might also store additional path text that
79 is used for Hash and Wiki links. If only the base URL is provided,
80 then the intermap will only allow Path style interwiki links. The
@@ -92,11 +97,11 @@
97 check-in as part of a comment of another check-in, that new check-in
98 shows up in the "References" section of the target check-in.
99 ([example](31af805348690958). In other words, Fossil tracks not just
100 "_source&rarr;target_", but it also tracks "_target&rarr;source_".
101 But backtracking do not work for interwiki links, since the Fossil
102 running on the target has no way of scanning the source text and
103 hence has no way of knowing that it is a target of a link from the source.
104
105 [fcfg]: /help?cmd=config
106
107 ## Intermap Storage Details
108

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button