Skip to content

Commit 1f09ac2

Browse files
committed
fix(wiki): wiki formatting and continued buildout
1 parent 7d1b6ac commit 1f09ac2

12 files changed

Lines changed: 422 additions & 2831 deletions

File tree

_data/tickets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@
386386
"summary": "changed from input/radio/checkbox, etc. break too much",
387387
"description": "They're great shortcuts for some, but they seem to break too much code for too many people. Either they need to be removed entirely, or completely refactored.",
388388
"keywords": "",
389-
"closedtime": 1255269874000000,
389+
"closedtime": 1151769265000000,
390390
"changes": [
391391
{
392392
"time": 1151769265000000,
@@ -1177343,4 +1177343,4 @@
11773431177343
}
11773441177344
]
11773451177345
}
1177346-
]
1177346+
]

_data/wiki.json

Lines changed: 260 additions & 2820 deletions
Large diffs are not rendered by default.

_includes/layouts/wiki.njk

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
layout: layouts/base.njk
33
---
44

5-
{%- css %}{% include "public/css/wiki.css" %}{% endcss %}
5+
<link rel="stylesheet" href="/css/wiki.css" />
66

77
<div class="wiki flex-column">
88
<div class="breadcrumbs-nav flex-row">
99
<a href="/" class="breadcrumbs-nav-first">wiki:</a>
10+
{% if breadcrumb %}
11+
<a href="{{ page.url }}">{{ breadcrumb }}</a>
12+
{% endif %}
1013
</div>
1114
<nav class="content-nav">
1215
<ul class="flex-row">

content/index.njk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
layout: layouts/wiki.njk
3+
breadcrumb: WikiStart
34
---
45

56
<p>

content/prefs.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
layout: layouts/base.njk
3+
---
4+
5+
# Preferences
6+
7+
---
8+
9+
jQuery issues have moved to [GitHub](https://github.com/jquery/jquery/issues). This site is now a static version of the old trac bugs site. There are no longer any preferences to set.
10+
11+
If you know the ticket number you are looking for, use the following URL format to go directly to the ticket:
12+
13+
`https://bugs.jquery.com/ticket/<ticket number>`
14+
15+
Or, search the full archive of tickets using the search box above.

content/wiki.njk

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---js
2+
{
3+
pagination: {
4+
data: 'wiki',
5+
size: 1,
6+
alias: 'wiki',
7+
addAllPagesToCollections: true
8+
},
9+
layout: 'layouts/wiki.njk',
10+
eleventyComputed: {
11+
breadcrumb: '{{ wiki.name }}',
12+
title: '{{ wiki.name }}'
13+
},
14+
permalink: '/wiki/{{ wiki.name }}/',
15+
tags: ['wiki']
16+
}
17+
---
18+
19+
{{ wiki.text | tracToHTML | safe }}

content/wiki/RecentChanges.njk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
layout: 'layouts/wiki.njk'
3+
breadcrumb: 'RecentChanges'
4+
eleventyImport:
5+
collections: ['wiki']
6+
---
7+
8+
<p>jQuery issues have moved to <a href="https://github.com/jquery/jquery/issues">GitHub</a>. This site is now a static version of the old trac bugs site. Version history for wiki pages is no longer available.</p>
9+
10+
<p>Below is an index of all the wikie pages that were available on the old site.</p>
11+
12+
<div class="flex-column">
13+
{% for wiki in collections.wiki %}
14+
<a href="{{ wiki.url }}" class="wiki-index-link">{{ wiki.data.title }}</a>
15+
{% endfor %}
16+
</div>

content/wiki/TitleIndex.njk

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
layout: 'layouts/wiki.njk'
3+
breadcrumb: 'TitleIndex'
4+
eleventyImport:
5+
collections: ['wiki']
6+
---
7+
8+
<p>jQuery issues have moved to <a href="https://github.com/jquery/jquery/issues">GitHub</a>. This site is now a static version of the old trac bugs site. Version history for wiki pages is no longer available.</p>
9+
10+
<p>Below is an index of all the wiki pages that were available on the old site.</p>
11+
12+
<div class="flex-column">
13+
{% for wiki in collections.wiki %}
14+
<a href="{{ wiki.url }}" class="wiki-index-link">{{ wiki.data.title }}</a>
15+
{% endfor %}
16+
</div>

eleventy.config.js

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ module.exports = function (eleventyConfig) {
119119
// })
120120
// })
121121

122-
const rheaders = /^\s*(\=+)\s*([^=]+)\s*\1\s*$/
122+
const rheaders = /^ *(\=+) *([^\n\r]+) *\1? *$/
123+
let listStarted = false
123124
eleventyConfig.addFilter('tracToHTML', (text) => {
124125
const codes = []
125126
const pres = []
@@ -149,10 +150,38 @@ module.exports = function (eleventyConfig) {
149150
/\[?(https?:\/\/[^\s,\]]+)\]?/g,
150151
`<a href="$1" class="ext-link"><span class="icon"></span>$1</a>`
151152
)
152-
// Linkify ticket references
153-
.replace(/#(\d+)/g, `<a href="/ticket/$1">$&</a>`)
153+
// Linkify trac links
154+
.replace(
155+
/(?:\[trac:([^ ]+) "([^"]+)"\])|(?:\[trac:([^ ]+) ([^\]]+)\])/g,
156+
function (_match, quotepage, quotedtext, page, text) {
157+
return `<a href="https://trac.edgewall.org/intertrac/${encodeURIComponent(
158+
quotepage || page
159+
)}" class="ext-link"><span class="icon"></span>${
160+
quotedtext || text
161+
}</a>`
162+
}
163+
)
164+
// Linkify bracket links
165+
.replace(
166+
/\[([^ ]+) (?:(?:"([^"]+)")|([^\]]+))\]/g,
167+
`<a href="/wiki/$1">$2$3</a>`
168+
)
169+
// Linkify ticket references (avoid trac ticket links)
170+
.replace(/#(\d+)(?<=y)</g, `<a href="/ticket/$1">$&</a>`)
171+
// Linkify CamelCase to wiki
172+
.replace(
173+
/(^|\s)(!)?([A-Z][a-z]+[A-Z]\w+)(?!\w)/g,
174+
function (_match, space, excl, page) {
175+
if (excl) {
176+
return `${space}${page}`
177+
}
178+
return `${space}<a href="/wiki/${page}">${page}</a>`
179+
}
180+
)
181+
// Convert ---- to <hr>
182+
.replace(/^--+$/gm, '<hr />')
154183
// Replace double newlines with paragraphs
155-
.split(/(?:\r?\n){2}/g)
184+
.split(/(?:\r?\n)/g)
156185
.map((line) => {
157186
if (!line.trim()) {
158187
return ''
@@ -171,7 +200,20 @@ module.exports = function (eleventyConfig) {
171200
return `<h${level}>${content}</h${level}>`
172201
})
173202
}
174-
return `<p>${line}</p>`
203+
if (/^\s*\* /.test(line)) {
204+
line = line.replace(
205+
/(^|\s+)\* ([^\n]+)/g,
206+
`$1${listStarted ? '' : '<ul>'}<li>$2</li>`
207+
)
208+
listStarted = true
209+
return line
210+
}
211+
if (listStarted) {
212+
listStarted = false
213+
return `</ul><p>${line}</p>`
214+
} else {
215+
return `<p>${line}</p>`
216+
}
175217
})
176218
.join('')
177219
// Reinsert code

public/css/index.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ main a[href]:active {
362362
}
363363
#jq-content {
364364
position: relative;
365+
padding: 2em 1em;
365366
}
366367

367368
/* Side navigation */
@@ -429,7 +430,6 @@ footer a[href]:visited {
429430

430431
/* Utility classes */
431432
.white-box {
432-
padding: 1em;
433433
background-color: var(--content-background-color);
434434
border-radius: var(--border-radius);
435435
border: 1px solid var(--border-color);
@@ -507,6 +507,7 @@ a.ext-link .icon {
507507
#jq-content {
508508
flex-grow: 1;
509509
max-width: 622px;
510+
min-height: 520px;
510511
font-size: 0.875rem;
511512
}
512513
}

0 commit comments

Comments
 (0)