Skip to content

Commit 66f80ad

Browse files
committed
fix(config): respect quotes in any bracket links
1 parent 0b36c03 commit 66f80ad

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

_data/wiki.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -619,4 +619,4 @@
619619
"comment": "",
620620
"readonly": 0
621621
}
622-
]
622+
]

eleventy.config.tracToHTML.js

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const rasterisks = /^\s*\* /
2-
const rheaders = /^ *(\=+) *([^\n\r]+) *\1? *$/
2+
const rheaders = /^ *(\=+) *([^\n\r]+?)[=\s]*$/
33
let listStarted = false
44

55
function escapeHTML(string) {
@@ -35,31 +35,33 @@ module.exports = function tracToHTML(text) {
3535
})
3636
// Linkify http links in brackets
3737
.replace(
38-
/(^|\s)\[(https?:\/\/[^\s\]]+)(?:\s+([^\]]+))?\]/g,
39-
function (_match, space, url, text) {
40-
return `${
41-
space || ''
42-
}<a href="${url}" class="ext-link"><span class="icon"></span>${
43-
text || url
38+
/(^|\s)(?:\[https?:\/\/([^ ]+) "([^"]+)"\])|(?:\[https?:\/\/([^\s\]]+)(?: ([^\]]+))?\])/g,
39+
function (_match, space, quotedurl, quotedtext, url, text) {
40+
return `${space || ''}<a href="${
41+
quotedurl || url
42+
}" class="ext-link"><span class="icon"></span>${
43+
quotedtext || text || url
4444
}</a>`
4545
}
4646
)
4747
// Linkify hash links in brackets
4848
.replace(
49-
/(^|\s)\[(#[^\s\]]+)(?:\s+([^\]]+))?\]/g,
50-
function (_match, space, url, text) {
51-
return `${
52-
space || ''
53-
}<a href="${url}" class="ext-link"><span class="icon"></span>${
54-
text || url
49+
/(^|\s)(?:\[(#[^ ]+) "([^"]+)"\])|(?:\[(#[^\s\]]+)(?: ([^\]]+))?\])/g,
50+
function (_match, space, quotedurl, quotedtext, url, text) {
51+
return `${space || ''}<a href="${
52+
quotedurl || url
53+
}" class="ext-link"><span class="icon"></span>${
54+
quotedtext || text || url
5555
}</a>`
5656
}
5757
)
5858
// Linkify CamelCase links in brackets
5959
.replace(
60-
/(^|\s)\[([A-Z][a-z]+[A-Z][\w#-]+)(?:\s+([^\]]+))?\]/g,
61-
function (_match, space, page, text) {
62-
return `${space || ''}<a href="/wiki/${page}">${text || page}</a>`
60+
/(^|\s)(?:\[([A-Z][a-z]+[A-Z][^ ]+) "([^"]+)"\])|(?:\[([A-Z][a-z]+[A-Z][^\s\]]+)(?: ([^\]]+))?\])/g,
61+
function (_match, space, quotedpage, quotedtext, page, text) {
62+
return `${space || ''}<a href="/wiki/${quotedpage || page}">${
63+
quotedtext || text || page
64+
}</a>`
6365
}
6466
)
6567
// Linkify trac links
@@ -77,7 +79,7 @@ module.exports = function tracToHTML(text) {
7779
.replace(/#(\d+)(?!<=>)/g, `<a href="/ticket/$1">$&</a>`)
7880
// Linkify CamelCase to wiki
7981
.replace(
80-
/(^|\s)(!)?([A-Z][a-z]+[A-Z]\w+(?:#\w+)?)(?!\w)/g,
82+
/(^|\s)(!)?([A-Z][a-z]+[A-Z][\w:]+(?:#\w+)?)(?!\w)/g,
8183
function (_match, space, excl, page) {
8284
if (excl) {
8385
return `${space || ''}${page}`

public/css/wiki.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
.wiki, .wiki a {
1+
.wiki,
2+
.wiki a {
23
font-size: 0.8125rem;
34
}
45

@@ -27,13 +28,13 @@
2728
.wiki-content h4,
2829
.wiki-content h5,
2930
.wiki-content h6 {
30-
text-transform: uppercase;
3131
font-weight: bold;
3232
margin: 1em 0 0.5em;
3333
}
3434

35-
.wiki-content h1 {
36-
font-size: 1.1rem;
35+
.wiki-content h1,
36+
.wiki-content h1 a {
37+
font-size: 1.1875rem;
3738
}
3839
.wiki-content h2 {
3940
font-size: 1rem;

0 commit comments

Comments
 (0)