Comments (8)
Fascinating idea!
I think that you need to start the require path with ./
. It works in some environments without the ./
, but safest is to use it. Just looks to me like Ruby isn't understanding where the extension is.
Of course, this would be partially solved by fixing #44, which we desperately need.
I'd say that the emoji inline macro is pretty close to this one as well, except that it is an inline macro instead of a block macro. So take a look at that one too.
from asciidoctor-extensions-lab.
asciidoctor-extensions-lab$ asciidoctor -r ./lib/gist-block-macro/extension.rb ./lib/gist-block-macro/sample.adoc
With ./
it runs, but... here's the output:
sample.html:
(...)
<h1>Gist Block Macro Extension</h1>
</div>
<div id="content">
<div class="paragraph">
<div class="title">Guard setup to live preview AsciiDoc output</div>
<p>gist::mojavelinux/5546622[]</p>
</div>
</div>
(...)
I don't know... but for if I think it's missing the registration somewhere in the code. How does it know that we have an new extension available without it?
For me, the emoji isn't working ether:
(...)
<h1>Emoji Inline Macro Extension</h1>
</div>
<div id="content">
<div class="paragraph">
<p>Faster than a emoji:turtle[1x]!</p>
</div>
<div class="paragraph">
<p>This is an example of how you can emoji:heart[lg] Asciidoctor and Twitter Emoji.</p>
</div>(...)
from asciidoctor-extensions-lab.
Hello @edusantana
I don't know... but for if I think it's missing the registration somewhere in the code. How does it know that we have an new extension available without it?
The registration is done by the Ruby files in the root of the lib
directory: https://github.com/asciidoctor/asciidoctor-extensions-lab/tree/master/lib
So the command line for gist-block-macro
is:
asciidoctor -r ./lib/gist-block-macro.rb ./lib/gist-block-macro/sample.adoc
from asciidoctor-extensions-lab.
If my extension returns video::https://www.youtube.com/watch?v=xjxjTMBoNjE[]
it would no work. It's probably because it already processed the macros.
How can I call the code to produce the video after that?
from asciidoctor-extensions-lab.
There are two approaches you can inside the block processor. Before I mention them, it's important to understand that the purpose of the block processor is to contribute zero or more nodes to the AST tree during parsing.
The first approach is to return an AST node, in this case a video node. That code would look something like:
attrs['poster'] = 'youtube'
attrs['target'] = 'xjxjTMBoNjE'
return create_block parent, :video, nil, attrs, {}
The second approach is to parse the new content inside the processor. That code would look something like:
parse_content parent, 'video::https://www.youtube.com/watch?v=xjxjTMBoNjE[]'
return nil
parse_content
is a helper method in the extension API. See https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/extensions.rb#L107-L119.
from asciidoctor-extensions-lab.
Btw, Asciidoctor Diagram uses the first approach. See https://github.com/asciidoctor/asciidoctor-diagram/blob/master/lib/asciidoctor-diagram/extensions.rb#L132-L189
from asciidoctor-extensions-lab.
It's working...
Now the work will be to create and populate a nice repository, where users will be able no navigate and search for signs to use.
The inline macro will be used to create links, and the block to display videos.
from asciidoctor-extensions-lab.
👍
from asciidoctor-extensions-lab.
Related Issues (20)
- Is there a configuration open for using divs instead of tables for admonitions? HOT 1
- mathoid-treeprocessor and new versions of mathoid HOT 4
- npm install mathoid error: Package libffi was not found in the pkg-config search path. HOT 2
- Convert all inline example to use create_inline otherwise it gives "INFO: expected substitution value for custom inline macro to be of type Inline" HOT 5
- Integrate asciidoc-coalescer.rb as extension/converter so as to make it available in the CLI HOT 1
- sectnum offset tree processor always returns 1 or 2 HOT 1
- Make all these extensions installable with gem install HOT 4
- generate pdf with chart block HOT 4
- adding row name to chart HOT 3
- Add a metadata object for year HOT 1
- Add metadata object for tag message HOT 2
- man-inline-macro doesn't generate the correct output in the manpage backend HOT 5
- Section offset plugin fails when creating PDF HOT 4
- Using the Preprocessor ignores ifdef directives HOT 1
- add link to the current script location as comment into the script HOT 6
- Idea: Create file tree containing all included files HOT 2
- Graduate the asciidoc-coalescer.rb script to a separate project HOT 4
- showcomments-preprocessor seems broken with latest asciidoctor HOT 2
- Create summaries from distributed definitions HOT 1
- Help With Callouts: Any Examples? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from asciidoctor-extensions-lab.