Skip to content

Commit 9003bbd

Browse files
authored
Merge pull request #64 from Leaflet/modernize
Modernize the library
2 parents c4e13d5 + f181765 commit 9003bbd

21 files changed

Lines changed: 1570 additions & 461 deletions

.github/workflows/ci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [gh-pages]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6
13+
- uses: actions/setup-node@v6
14+
with:
15+
node-version: 24
16+
cache: npm
17+
- run: npm ci
18+
- run: npm test

Leafdoc.html

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
}
2020
body {
2121
font-family: Sans;
22+
max-width: 50em;
23+
margin: auto;
2224
}
2325
</style>
2426
</head>
@@ -35,8 +37,8 @@ <h3 id='leafdoc-example'>Usage example</h3>
3537

3638

3739
<p>Output Leafdoc's own documentation to the console with:</p>
38-
<pre><code>var LeafDoc = require('./src/leafdoc.js');
39-
var doc = new LeafDoc();
40+
<pre><code>import Leafdoc from 'leafdoc';
41+
const doc = new Leafdoc();
4042
doc.addFile('src/leafdoc.js');
4143

4244
console.log( doc.outputStr() );
@@ -268,19 +270,48 @@ <h3 id='command-line-usage-option'>Options</h3>
268270
<td><code><b>o</b></code></td>
269271
<td><code></code>
270272
<td><code></code></td>
271-
<td>Alias of <code>output</code>
272-
Alias of <code>output</code></td>
273+
<td>Alias of <code>output</code></td>
273274
</tr>
274275
<tr id='command-line-usage-json'>
275276
<td><code><b>json</b></code></td>
276277
<td><code>Boolean</code>
277278
<td><code>false</code></td>
278279
<td>Write the internal JSON representation of the documentation instead of a templated HTML file.</td>
279280
</tr>
281+
<tr id='command-line-usage-j'>
282+
<td><code><b>j</b></code></td>
283+
<td><code></code>
284+
<td><code></code></td>
285+
<td>Alias of <code>json</code></td>
286+
</tr>
287+
<tr id='command-line-usage-empty'>
288+
<td><code><b>empty</b></code></td>
289+
<td><code>Boolean</code>
290+
<td><code>false</code></td>
291+
<td>Akin to <a href="#leafdoc.showinheritanceswhenempty">Leafdoc.showInheritancesWhenEmpty</a></td>
292+
</tr>
293+
<tr id='command-line-usage-e'>
294+
<td><code><b>e</b></code></td>
295+
<td><code></code>
296+
<td><code></code></td>
297+
<td>Alias of <code>empty</code></td>
298+
</tr>
299+
<tr id='command-line-usage-extensions'>
300+
<td><code><b>extensions</b></code></td>
301+
<td><code>String</code>
302+
<td><code>&#x27;.js,.leafdoc&#x27;</code></td>
303+
<td>Defines the extensions of the files to process. Optional.</td>
304+
</tr>
305+
<tr id='command-line-usage-x'>
306+
<td><code><b>x</b></code></td>
307+
<td><code></code>
308+
<td><code></code></td>
309+
<td>Alias of <code>extensions</code></td>
310+
</tr>
280311
</tbody></table>
281312
</section>
282313

283314

284315

285316

286-
</body></html>
317+
</body></html>

Leafdoc.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,44 @@
8282
<td><code><b>o</b></code></td>
8383
<td><code></code>
8484
<td><code></code></td>
85-
<td>Alias of <code>output</code>
86-
Alias of <code>output</code></td>
85+
<td>Alias of <code>output</code></td>
8786
</tr>
8887
<tr id='command-line-usage-json'>
8988
<td><code><b>json</b></code></td>
9089
<td><code>Boolean</code>
9190
<td><code>false</code></td>
9291
<td>Write the internal JSON representation of the documentation instead of a templated HTML file.</td>
9392
</tr>
93+
<tr id='command-line-usage-j'>
94+
<td><code><b>j</b></code></td>
95+
<td><code></code>
96+
<td><code></code></td>
97+
<td>Alias of <code>json</code></td>
98+
</tr>
99+
<tr id='command-line-usage-empty'>
100+
<td><code><b>empty</b></code></td>
101+
<td><code>Boolean</code>
102+
<td><code>false</code></td>
103+
<td>Akin to <a href="#leafdoc.showinheritanceswhenempty">Leafdoc.showInheritancesWhenEmpty</a></td>
104+
</tr>
105+
<tr id='command-line-usage-e'>
106+
<td><code><b>e</b></code></td>
107+
<td><code></code>
108+
<td><code></code></td>
109+
<td>Alias of <code>empty</code></td>
110+
</tr>
111+
<tr id='command-line-usage-extensions'>
112+
<td><code><b>extensions</b></code></td>
113+
<td><code>String</code>
114+
<td><code>&#x27;.js,.leafdoc&#x27;</code></td>
115+
<td>Defines the extensions of the files to process. Optional.</td>
116+
</tr>
117+
<tr id='command-line-usage-x'>
118+
<td><code><b>x</b></code></td>
119+
<td><code></code>
120+
<td><code></code></td>
121+
<td>Alias of <code>extensions</code></td>
122+
</tr>
94123
</tbody></table>
95124

96125

@@ -111,8 +140,8 @@ Alias of <code>output</code></td>
111140

112141

113142
<p>Output Leafdoc's own documentation to the console with:</p>
114-
<pre><code>var LeafDoc = require('./src/leafdoc.js');
115-
var doc = new LeafDoc();
143+
<pre><code>import Leafdoc from 'leafdoc';
144+
const doc = new Leafdoc();
116145
doc.addFile('src/leafdoc.js');
117146

118147
console.log( doc.outputStr() );

debug.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env node
2+
3+
import fs from 'fs';
4+
import Leafdoc from './src/leafdoc.js';
5+
6+
// const doc = new Leafdoc({templateDir: 'templates/yuml', leadingCharacter: '@'});
7+
const doc = new Leafdoc({});
8+
9+
// doc.addFile('src/leafdoc.js');
10+
doc.addDir('src');
11+
// doc.addDir('../Leaflet/src/');
12+
13+
// console.log('calling outputStr');
14+
const out = doc.outputStr();
15+
const json = doc.outputJSON();
16+
17+
fs.writeFileSync('Leafdoc.html', out);
18+
fs.writeFileSync('Leafdoc.json', json);

eslint.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import mourner from 'eslint-config-mourner';
2+
3+
export default [
4+
{ignores: ['spec/e2e/**']},
5+
...mourner,
6+
{
7+
rules: {
8+
'@stylistic/indent': [1, 'tab', {
9+
VariableDeclarator: 0,
10+
flatTernaryExpressions: true
11+
}]
12+
}
13+
}
14+
];

0 commit comments

Comments
 (0)