Asciidoctorj : How to allow extension to write additional files - asciidoctor

I'm trying to build an extension to customize look/feel/behaviour of the standard HTMLConverter via an AsciiDoctorJ extension.
The "look and feel" part consists in adding custom CSS/JS to the final document. This is achievable via the Postprocessor or DocInfoProcessor API as long as data is inlined in the HTML.
It does not seem possible the write external files to the final destination mostly because the API doesn't have access to it.
The workaround seems to write a custom converter (or extending the ruby HTMLConverter) which would be a bit overkill.
It would be nice that one of these API to be as flexible as the Syntax Highlighter API, that can link and copy external resources: https://docs.asciidoctor.org/asciidoctorj/latest/syntax-highlighting/link-external-resources/
Is there a way to achieve this with only the standard AsciidoctorJ extension API ?

I found out that one can access the output directory via document options (the to_dir option).
=> document.getOptions().get("to_dir")

Related

Typo3 extension to search on zotero groups

I would like to have a typo3 extension to search at the same time content both on my web page and on external bibliographies in zotero groups.
There is something like this? Would be difficult to develop something like that?
You could use the extension "ke_search". It allows to write a "custom indexer" wich can contain PHP code to retrieve data from any API. I don't know if Zotero offers APIs but this would be one possible way to do it.

Is it possible to use the WebAPIs in VsCode such as WebAudio etc?

I'd like to use the awesome WebAPIs which power VsCode/electron. So, is there a way to use VsCode for, say, playing audio from the local disk?
A VSCode extension does not have access to editor's DOM or web specific APIs. Two possible ways to work around this:
Use the previewHtml command if you need to create a custom view. This command allows you to hand VSCode an html document to render. Any scripts in the html will not have access to the editor's DOM, but can access their own dom and most web APIs. This approach works well if you are building a custom view or custom UI.
Call out to an external program to provide this functionality. Since the extension has access to node, to play audio for example, you could spawn a process that invokes afplay.

Templatize a file using nodejs

I have a requirement where i have a config file which has a bunch of properties. The user has to download the property file from the server using a browser. Some of these properties have to be changed based on the user's input and then the file has to be downloaded. This basically fits the perfect description of having templates and then at run time generating a file by replacing the properties provided by the user. How can i achieve this using node js. Any pointer will be deeply appreciated. Please pardon my limited knowledge of MEAN stack.
Template engines are a common thing and it's quite easy to use one with express.
I suggest you start with the docs on using template engines with express. They also have a wiki entry with a list of available engines.
Most template engines are meant to generate HTML, if you want to output something else (even plaintext) it can be a bit tricky sometimes.
Otherwise the choice mainly depends on what your familiar with. I can recommend Mozilla Nunjucks.

Clean HTML documentation template for Enterprise Architect

I use Enterprise Architect from Sparx Systems for reverse-engineering URL class diagrams from my source code, and want to take this a step further by using the software to generate HTML API documentation of my code.
However I find the markup generated by Enterprise Architect to be full of Javascript, and I think I may have even spotted some VB Script in there. Want I want is a clean HTML-only template that I can use to produce simple markup that will work fine in all browsers.
I have tried to manually create this template using the template editor in Enterprise Architect 8, but find this cumbersome.
Does anyone know of an existing template I can use, or an easier way to generate a template without using the built in template editor?
The only way is to use JavaScript, you can turn it on by allowing XMLHTTPRequest in your browser. It works well in Firefox, Opera and IE.
EA HTML Template doesn't give much possibilities but you can modify everything thanks to JavaScript.
Another way is to export all diagrams as png or other image file and then manually create a static web page.

How do you include a JavaScript file from within a SharePoint WebPart?

We have a medium sized .js file that we include in our web framework that I am porting over to SharePoint. However, I'm not sure how to go about this or what the best practice is. This is for a framework solution that will be used by other client projects, so it's best for it to be self contained and deploy-able, rather than requiring manually deploying files to the webserver.
My current thinking to put the JavaScript into an embedded resource and then use the script manager to write out the file. Does this seem reasonable? Or does anyone have any other recommendations?
Embeded resource is the best way and you don't need to use the ScriptManager to render it out (as AJAX is not configured OoB on SharePoint), you can just render it as any other client script resource (through the ClientScriptManager).
Best idea is the have an if ContainsScriptManager else UsClientScriptManager style.
That way you get the best of both worlds
You could just toss it into a doc library.
If you are packaging your web part into a sharepoint solution, you could include it as a Module (VSEWSS item). Your manifest file would get something like:
<TemplateFiles>
<TemplateFile Location="LAYOUTS\somescript.js" />
</TemplateFiles>
Theres lots of info on how to do this on the web. I've liked the doc library option for images, css, and javascript because I don't have to rebuild and wait for for SP to JIT compile for 30 seconds each time I do a minor tweak to some style or script. I just edit these things in SPDesigner right out of the doc library.
Create resource mapped folder in your project and put the js file there and give the referene of the js file as _layout/jsfilename.js and this js file will be deployed with your project where ever you will deploy it.

Resources