Skip to content

Commit c5282d1

Browse files
committed
📝 Consolidate code examples in the documentation
- Use standard code style - Extract code examples in th examples directory - Remove outdated manual.adoc file
1 parent 4b4ad7e commit c5282d1

28 files changed

+346
-654
lines changed

docs/manual.adoc

Lines changed: 0 additions & 318 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = function (registry) {
2+
registry.postprocessor(function () {
3+
var self = this
4+
self.process(function (doc, output) {
5+
return output.replace(/digitale?/g, 'numérique')
6+
})
7+
})
8+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = function (registry) {
2+
registry.preprocessor(function () {
3+
var self = this
4+
self.process(function (doc, reader) {
5+
var lines = reader.lines
6+
for (var i = 0; i < lines.length; i++) {
7+
if (lines[i].match(/^\/\/\s?draft.*/)) {
8+
doc.setAttribute('status', 'DRAFT')
9+
}
10+
}
11+
return reader
12+
})
13+
})
14+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = function (registry) {
2+
registry.inlineMacro('emoticon', function () {
3+
var self = this
4+
self.process(function (parent, target) {
5+
var text
6+
if (target === 'grin') {
7+
text = ':D'
8+
} else if (target === 'wink') {
9+
text = ';)'
10+
} else {
11+
text = ':)'
12+
}
13+
return self.createInline(parent, 'quoted', text, { 'type': 'strong' }).convert()
14+
})
15+
})
16+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = function (registry) {
2+
registry.includeProcessor(function () {
3+
var self = this
4+
self.handles(function (target) {
5+
return target.endsWith('.foo')
6+
})
7+
self.process(function (doc, reader, target, attrs) {
8+
var content = ['foo']
9+
return reader.pushInclude(content, target, target, 1, attrs)
10+
})
11+
})
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
module.exports = function (registry) {
2+
registry.treeProcessor(function () {
3+
var self = this
4+
self.process(function (doc) {
5+
doc.getBlocks()[0] = self.createBlock(doc, 'paragraph', 'GDPR compliant :)')
6+
return doc
7+
})
8+
})
9+
}

0 commit comments

Comments
 (0)