Overview
Comment:Formatage des liens correct
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c5737366bf30901fae747a61e1f78d032b383bcd
User & Date: bohwaz on 2015-02-17 17:47:13
Other Links: manifest | tags
Context
2015-02-17
17:47
Utilisation notation courte et nouvelles méthodes check-in: df3b9a0cea user: bohwaz tags: trunk
17:47
Formatage des liens correct check-in: c5737366bf user: bohwaz tags: trunk
17:46
Notation raccourcie check-in: 564e72ba27 user: bohwaz tags: trunk
Changes

Modified src/www/admin/static/scripts/wiki-encryption.js from [04dce9ff8b] to [2ac75e40c2].

7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

28
29
30
31
32
33
34
35
36
37
38

















39
40
41
42
43
44
45
46
47
48
	function loadAESlib()
	{
		if (aesEnabled)
		{
			return;
		}

		garradin.script('scripts/gibberish-aes.min.js');
		aesEnabled = true;
	}

	function formatContent(content)
	{
		// htmlspecialchars ENT_QUOTES
		content = content.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
			.replace(/'/g, '&#039;').replace(/"/g, '&quot');

		// Intertitres
		content = content.replace(/==([^\n]*)==/g, '<h2>$1</h2>');
		content = content.replace(/===([^\n]*)===/g, '<h3>$1</h3>');
		content = content.replace(/====([^\n]*)====/g, '<h4>$1</h4>');


		// Gras
		content = content.replace(/\*{2}([^\n]*)\*{2}/g, '<strong>$1</strong>');

		// Italique
		content = content.replace(/''([^\n]*)''/g, '<em>$1</em>');

		// Espaces typograhiques
		content = content.replace(/\h*([?!;:»])(\s+|$)/g, '&nbsp;$1$2');
		content = content.replace(/(^|\s+)([«])\h*/g, '$1$2&nbsp;');


















		// Liens
		content = content.replace(/\[\[([^|]+)|([^\]]+)\]\]/g, '<a href="$2">$1</a>');
		content = content.replace(/\[\[([^\]]+)\]\]/g, '<a href="$1">$1</a>');

		// nl2br
		content = content.replace(/\r/g, '').replace(/\n/g, '<br />');

		return content;
	}








|










|
|
|
>











>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>

|
|







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
	function loadAESlib()
	{
		if (aesEnabled)
		{
			return;
		}

		g.script('scripts/gibberish-aes.min.js');
		aesEnabled = true;
	}

	function formatContent(content)
	{
		// htmlspecialchars ENT_QUOTES
		content = content.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;')
			.replace(/'/g, '&#039;').replace(/"/g, '&quot');

		// Intertitres
		content = content.replace(/(=+)\s*([^\n=]*)\s*(\1\s*)*/g, function (match, h, content) {
			h = h.length;
			return '<h'+h+'>'+content+'</h'+h+'>';
		});

		// Gras
		content = content.replace(/\*{2}([^\n]*)\*{2}/g, '<strong>$1</strong>');

		// Italique
		content = content.replace(/''([^\n]*)''/g, '<em>$1</em>');

		// Espaces typograhiques
		content = content.replace(/\h*([?!;:»])(\s+|$)/g, '&nbsp;$1$2');
		content = content.replace(/(^|\s+)([«])\h*/g, '$1$2&nbsp;');

		function linkTag(match, url, label) {
			if (url.match(/^https?:/))
			{
			}
			else if (url.match(/@/) && !url.match(/^mailto:/))
			{
				url = 'mailto:' + url;
			}
			else
			{
				// Local wiki link
				url = '?' + url;
			}

			return '<a href="' + url + '">' + label + '</a>';
		}

		// Liens
		content = content.replace(/\[{2}([^\|\]\n]+?)\|([^\]\n]+?)\]{2}/g, linkTag);
		content = content.replace(/\[{2}(([^\]]+?))\]{2}/g, linkTag);

		// nl2br
		content = content.replace(/\r/g, '').replace(/\n/g, '<br />');

		return content;
	}