Best template engine for generate javascript from Node.js - node.js

For me, to produce HTML or XML, pug is favorite one.
However, when the expected result is not based on mark up language, I used to use Handlebars. But When I produce javascript dynamically using handlebar, It makes very difficulties to maintain templates and terrible readability to keep generated code pretty.
When I do same thing with java, I prefer to use Xtend.
Is there any template engine that is intended to generate code?
(which is not based on AST)
Full Scenario
I made a Java Script library using TypeScript.
To make Eclipse's Java Script type inference engine can support content assist for this library, I needed to create some TS to JS-skeleton trans-compiler. (result js just contains scheme and js-doc for Eclipse JS capability)
I used type-script from NPM to inspect library scheme.
I transformed TypeScript AST to my own purpose model to generate JavaScript files.
Then I need to generate Java Script files from this model, And I'm looking for best template engine.
The template engine should be easy to manage indent, iteration, conditional templates to generate clear code with readable template.

Related

Is there a replacement for Bixby JavaScript API module textLib?

The Bixby Import and search template uses a library module textLib which throws an error due to the library having been deprecated. The template uses a javascript file named "transaction_util.js" that requires the library via var textLib = require('textLib'). The library contains functions that were used for various text-related functions for fuzzy matching.
Is there a replacement module or a workaround for this?
Sorry for the inconvenience. We had an emergency update to the template capsule. You can try it now and should use externalTextLib which is included in the template.
If you already started your coding, you may want to create a new template capsules, copy and paste code/lib/externalTextLib.js to your existing capsule and change the line to var textLib = require('externalTextLib'), which should work without any additional coding change.
Or start a new project with the new template. It might be a safer option.

How to compile Java code after DXL import?

Using the Domino/Notes API, when importing DXL design elements (for example a LotusScript agent), you have the option to either compile LotusScript code at the time of import, with DXLImporter.setCompileLotusScript(boolean flag), or leave the code uncompiled. If you leave the code uncompiled, then Domino will compile the code before first use. This is all fine with LotusScript.
Reading the API, I see no option for Java code. How can you compile Java code for use after importing from DXL programmatically?
(The question is not how you do it manually (like open every Java design element and save it to force compilation) but how it can be done programmatically)
You're going to need to do something along the lines of what the ODP to NSF compiler does https://frostillic.us/blog/thread.xsp?thread=NSF+ODP+Tooling. For obvious reasons (OSGi dependencies, Java library accessibility, builder processes etc) it's not a trivial task.

how to generate excel vba code in selenium ide

I am using Selenium IDE 2.9.1 (a Firefox plugin) to get web element. I am unable to see VBA code when I go to options > format. Does anybody know how to get or set VBA source code?
This is the info from the documentation. This seems to imply format VBA is not a supported feature.
Format
Format, under the Options menu, allows you to select a language
for saving and displaying the test case. The default is HTML.
If you will be using Selenium-RC to run your test cases, this feature
is used to translate your test case into a programming language.
Select the language, e.g. Java, PHP, you will be using with
Selenium-RC for developing your test programs. Then simply save the
test case using File=>Export Test Case As. Your test case will be
translated into a series of functions in the language you choose.
Essentially, program code supporting your test is generated for you by
Selenium-IDE.
Also, note that if the generated code does not suit your needs, you
can alter it by editing a configuration file which defines the
generation process. Each supported language has configuration settings
which are editable. This is under the Options=>Options=>Formats tab.
Note
At the time of this writing, this feature is not yet supported by the
Selenium developers. However the author has altered the C# format in a
limited manner and it has worked well.

Nodejs alternative template paths for template engine

Is there any solution to configure template engine use some alternative paths, as described below?
i.e.
templates/{file}.jade
../template2/{file}.jade
../../template/{file}.jade
at first resolves 1st path, if file doesnot exist, runs for 2nd and so on..
i'm using express and jade.
As far as I know, no. Jade uses the usual directory path structure not arbitrary file mapping, to map file to paths.
This is the natural and correct way. The directory structure would work for you too. If you want to implement a fallback, do it in node.js (for different files) or with express (for different requests). To be more precise do it in code, don't use include headers/lookup strategy to accomplish that.

Parsing Excel files in monotouch

Are there any good ways of parsing Excel files in monotouch? Seems like most methods to work with Excel is based on using the Excel Object Library. Doesn't seem like that's even an option in monotouch? I read that objective-c doesn't have any native support for Excel-files, so don't know if that would change anything?
You would need to either
write your own
find an obj-c library that does it and write MT bindings for it
find a open source .NET library and port it to MT
If all you want to do is display a file, you can use the existing iOS document APIs to do it.
The newest Office formats are XML based, so depending on how complex the files are, writing your own parser might be feasible to do.
I ended up just writing the middle step, a web service that fetches the Excel file, parses it and serves up the content as xml/json.

Resources