PageSourceSearch

https://bp-i18n-specdev.netlify.app/make_checklist.js

js bp-i18n-specdev.netlify.app collected 2026-10-03 10:31:42 UTC 8,023 bytes, 208 lines download raw bytes

1function createSectionChecklist (section) {
2	// fills a textarea element with markdown for a given section
3    // the markdown can be transferred to a github issue
4    
5    // section: id ending in _checklist
6		
7	// find the h2 level sections
8	var checklist = document.getElementById(section)
9	
10	var out = `# Detailed internationalisation review checklist\nCheck marks indicate requirements that are fulfilled by this spec. Add comments to describe conformance.\n\nThis checklist was created <a href="https://www.w3.org/TR/international-specs/#${ section }">here</a>.\n\n`
11	    
12    out += '## '+checklist.parentNode.querySelector('h2').textContent+'\n'
13    
14    // get the mustard from the checklist
15    var h3s = checklist.querySelectorAll('.checklistDiv')
16    
17    console.log(h3s.length)
18
19    for (var j=0;j<h3s.length;j++) {
20        // get the subsection title
21        var h3 = h3s[j].querySelector('p').textContent
22        out += '### '+h3+'\n'
23
24        // get the guidelines
25        var guidelines = h3s[j].querySelectorAll('li')
26        for (var k=0;k<guidelines.length;k++) {
27            var checked = ''
28            var relevant = guidelines[k].querySelector('.relevance')
29            
30            if (relevant.checked) {
31                var checkbox = guidelines[k].querySelector('.ok')
32                if (checkbox.checked) checked = 'x'
33                var temp = guidelines[k].innerHTML
34                temp = temp.replace(/<input type="checkbox"> /,'')
35                if (checked) out += `1. [x] ${ temp }<br>    _Comments_go_here_\n`
36                else out += `1. [ ] ${ temp }<br>    _Comments_go_here_\n`
37                }
38            }
39
40        out += '\n'
41        }
42
43	
44	return out
45	}
46
47
48
49
50
51
52
53function createIssueText () {
54	// outputs to a textarea markdown for just the checklist items that can be used to create an interactive checklist in a github issue
55		
56	// find the h2 level sections
57	var h2s = document.querySelectorAll('.topic')
58	
59	var out = '# Internationalisation review checklist\nCheck marks indicate relevant issues. Add comments to describe conformance.\n\nThis checklist was created <a href="https://www.w3.org/TR/international-specs/#ghChecklist">here</a>.\n\n'
60	
61	// process each h2 level section
62	for (var i=0;i<h2s.length;i++) {
63		var h2 = h2s[i].querySelector('h2').textContent
64		var re = /[0-9]+\. /
65		h2 = h2.replace(re, '')
66		console.log(h2)
67		out += '## '+h2+'\n'
68
69		// get the mustard from the checklist
70        var checklist = h2s[i].querySelector('.summaryC')
71		var h3s = checklist.querySelectorAll('details')	
72        
73		for (var j=0;j<h3s.length;j++) {
74			var h3 = h3s[j].querySelector('summary').textContent
75			re = /[0-9]+\.[0-9]+ /
76			h3 = h3.replace(re, '')
77			console.log(h3)
78			out += '### '+h3+'\n'
79            
80			// get the guidelines
81			var guidelines = h3s[j].querySelectorAll('li')
82			for (var k=0;k<guidelines.length;k++) {
83                var checked = ''
84                var checkbox = guidelines[k].querySelector('input')
85                if (checkbox.checked) checked = 'x'
86				var temp = guidelines[k].innerHTML
87				temp = temp.replace(/<input type="checkbox"> /,'')
88				if (checked) out += `1. [x] ${ temp }<br>    _Comments_go_here_\n`
89				else out += `1. [ ] ${ temp }<br>    _Comments_go_here_\n`
90				}
91			
92			out += '\n'
93			}
94
95		}
96	
97	return out
98	}
99
100
101
102
103
104
105
106function showChecklistsOLD (section, listLocation) {
107    // called after the page is loaded; sets up section by section lists of contents
108    // click on the contents list to see the recommendations in checklist form
109    
110    var out = ''
111    var checks, h3s
112    
113    h3s = section.querySelectorAll('h3')
114    for (var h=0;h<h3s.length;h++) {
115        out += `<details><summary>${ h3s[h].innerHTML }</summary>`
116        checks = h3s[h].parentNode.querySelectorAll('.advisement')
117        out += `<ul class="checklistGroup">`
118        for (var c=0;c<checks.length; c++) out += `<li><input type="checkbox"> ${ checks[c].innerHTML } <a href="https://www.w3.org/TR/international-specs/#${ checks[c].parentNode.id }" class="checklistMore" target="_blank">more</a></li>`
119        out += `</ul>`
120        out += `</details>`
121        }
122    
123    
124    document.getElementById(listLocation).innerHTML = out
125    }
126
127
128
129
130
131
132
133function showChecklists (section) {
134    // called after the page is loaded; sets up section by section lists of contents
135    // click on the contents list to see the recommendations in checklist form
136    // section: pointer to level 2 section node
137    // listLocation: id of div that will contain the checklist (<sectionID>+_checklist)
138    
139    
140    var out = ''
141    var checks, h3s
142    var listLocation = section.id+'_checklist'
143    var textarea = section.id+'_dump'
144    
145    h3s = section.querySelectorAll('h3')
146    out += `<details><summary>Show checklist</summary>\n`
147    for (var h=0;h<h3s.length;h++) {
148        out += `<p>${ h3s[h].innerHTML }</p>`
149        checks = h3s[h].parentNode.querySelectorAll('.advisement')
150        out += `<ul class="checklistGroup">`
151        for (var c=0;c<checks.length; c++) out += `<li><input type="checkbox" class="relevance" title="Check if this requirement is relevant to your spec."><input type="checkbox" class="ok" title="Check if your spec meets this requirement." onclick="this.previousSibling.checked=true"> ${ checks[c].innerHTML } <a href="https://www.w3.org/TR/international-specs/#${ checks[c].parentNode.id }" class="checklistMore" target="_blank">more</a></li>`
152        out += `</ul>`
153        }
154    out += `<p><button onClick="document.getElementById('${ textarea }').value = createSectionChecklist('${ listLocation }'); document.getElementById('${ textarea }').select();">Create markdown for GitHub</button></p>`
155    out += `<div><textarea id="${ textarea }" class="dumpBox"></textarea></div>`
156    out += `</details>`
157    
158    
159    document.getElementById(listLocation).innerHTML = out
160    }
161
162
163
164
165
166
167
168function showChecklists (section) {
169    // called after the page is loaded; sets up section by section lists of contents
170    // click on the contents list to see the recommendations in checklist form
171    // section: pointer to level 2 section node
172    // listLocation: id of div that will contain the checklist (<sectionID>+_checklist)
173    
174    
175    var out = ''
176    var checks, h3s
177    var listLocation = section.id+'_checklist'
178    var textarea = section.id+'_dump'
179    
180    h3s = section.querySelectorAll('h3')
181    out += `<details><summary>Show the self-review checklist</summary>\n`
182    
183    out += `<p>This is a list of just the requirements in this section, which can be used for self-reviews. Select the first checkbox on a line for all requirements relevant to your spec. Select the second checkbox if your spec meets the requirement. Then click on the button "Create markdown for GitHub", and copy the result to a GitHub issue list. See <a href="#ghChecklist">more details</a>.`
184    
185    for (var h=0;h<h3s.length;h++) {
186        out += `<div class="checklistDiv">`
187        out += `<p>${ h3s[h].innerHTML }</p>`
188        checks = h3s[h].parentNode.querySelectorAll('.advisement')
189        out += `<ul class="checklistGroup">`
190        for (var c=0;c<checks.length; c++) out += `<li><input type="checkbox" class="relevance" title="Check if this requirement is relevant to your spec."><input type="checkbox" class="ok" title="Check if your spec meets this requirement." onclick="this.previousSibling.checked=true"> ${ checks[c].innerHTML } <a href="https://www.w3.org/TR/international-specs/#${ checks[c].parentNode.id }" class="checklistMore" target="_blank">more</a></li>`
191        out += `</ul>`
192        out += `</div>`
193        }
194    out += `<p><button onClick="document.getElementById('${ textarea }').value = createSectionChecklist('${ listLocation }'); document.getElementById('${ textarea }').select();">Create markdown for GitHub</button></p>`
195    out += `<div><textarea id="${ textarea }" class="dumpBox"></textarea></div>`
196    out += `</details>`
197    
198    
199    document.getElementById(listLocation).innerHTML = out
200    }
201
202
203
204
205
206
207
208

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.