-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #35, automatically register converter and extension
- Loading branch information
1 parent
362ad43
commit 11a10fc
Showing
4 changed files
with
91 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class BlogConverter { | ||
convert () { | ||
return '<blog></blog>'; | ||
} | ||
} | ||
|
||
module.exports.register = function register () { | ||
Opal.Asciidoctor.ConverterFactory.register(new BlogConverter(), ['blog']); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
const shoutBlock = function () { | ||
const self = this | ||
self.named('shout') | ||
self.onContext('paragraph') | ||
self.process(function (parent, reader) { | ||
const lines = reader.getLines().map(l => l.toUpperCase()) | ||
return self.createBlock(parent, 'paragraph', lines) | ||
}) | ||
} | ||
|
||
module.exports.register = function register (registry) { | ||
if (typeof registry.register === 'function') { | ||
registry.register(function () { | ||
this.block(shoutBlock) | ||
}) | ||
} else if (typeof registry.block === 'function') { | ||
registry.block(shoutBlock) | ||
} | ||
return registry | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters