node express template engine that supports layouts and partials [closed] - node.js

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there a good way of doing templating (that allows me to write html -- not jade), that will support layouts and partials?
I have only been able to use ejs with express-partials npm plugin to get this behavior. However I feel the ejs site is out of date and not well supported.
I'm looking for good examples.
I want to create a main layout that would have header + footer and include a separate template for the nav for example.
Knockoutjs looks well supported, but I cannot find many examples of using it with express.
Update: I found a pretty good article here from LinkedIn's evaluation of js templates: http://engineering.linkedin.com/frontend/client-side-templating-throwdown-mustache-handlebars-dustjs-and-more

You can easily mimic this with the "include" feature in EJS. It's not quite as elegant as layouts in Express 2.x but it works for simple scenarios where all you need is a header and a footer plus you don't need to use Jade.
Basically you can create two "layout" pages (layoutTop.ejs and layoutBottom.ejs) and manually include them on every page.
mypage.ejs
include layoutTop
html for my page.ejs goes here
include layoutBottom
(Shameless plug) You can see a more detailed explanation here:
http://hectorcorrea.com/Blog/Using-layouts-with-EJS-in-Express-3.x

I have settled on using visionmedia's ejs with ejs-locals for layouts, includes, and blocks.
https://github.com/RandomEtc/ejs-locals
https://github.com/visionmedia/ejs

Try twigjs. It fits your description well.
https://github.com/fadrizul/twigjs
But ejs don't looks for me unsupported either. I think that this are even solutions.

Give handlebars a try.
You can use it with hotplates to have your templates automatically resolved.
It also supports reusing your partials client side.

Related

pptx converter to svg format to use with canvas [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 10 months ago.
Improve this question
I've developed some code to start reading an pptx file and now I need to convert this file to svg, i need all chart, shape, text, images to object so i can use with canvas. So, if anybody knows any package to do that with php or javascript, please suggest me about it.
I really appreciate.
You can use Aspose.Slides Cloud SDK for PHP for converting presentation slides to SVG images. The following code example shows you how to do this:
use Aspose\Slides\Cloud\Sdk\Api\Configuration;
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi;
$configuration = new Configuration();
$configuration->setAppSid("my_client_id");
$configuration->setAppKey("my_client_secret");
$slidesApi = new SlidesApi(null, $configuration);
// Convert a presentation to SVG images.
$fileStream = fopen("example.pptx", "r");
$response = $slidesApi->convert($fileStream, "svg");
print("A ZIP file with the slides as SVG images was saved to " . $response->getPathname());
Aspose.Slides Cloud SDK provides REST-based APIs for managing presentations. This is a paid product, but you can make 150 free API calls per month for evaluating all features and your purposes.
You can also use a free Aspose Slides Online Converter for converting PowerPoint presentations to other formats. I work as a Support Developer at Aspose.

How to generate an pdf invoice in a NodeJs, Express and JQuery? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have made a program based on the stack NodeJs + Express + MongoDB. It is following salesorders in the process of handling. The program works fine.
Now I like to add an option to take the data of a specific salesorder (MongoDB database) and generate a .pdf invoice. Where to start?
Are there programs/options to generate a sort of dynamic fields?
How to fill a certain pdf with data from a database in NodeJs/Express? Preferably with MongoDB?
There are several options available to solve your problem.
Process
Generate and HTML using dynamic values
How to generate?
You can use template engines like handlebars/EJS etc.
They accept JSON and render the HTML page dynamically
Generate PDF
How to generate?
There are many npm modules available which take a screenshot of HTML page and generates image or pdf.
Suggestion: Use Puppeteer
alternative: phantomjs, jsonToPdf etc.
You can create HTML and store it into a variable. Then there are lots of npm package available to convert HTML to pdf.

Generate KDoc for methods in Android Studio [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
When commenting methods for Java in Android Studio, I can type /** and AS generates javadoc with method parameters and return type for me. But it seems it doesn't work for Kotlin.
Is there some way to teach AS to generate method docs in Kotlin KDoc format automatically?
Edit: yes, this question is about the same thing as the possible duplicate, but my question isn't "why?", I understand that KDoc has different format. My question is if there is a way to do the same for Kotlin in AS? Maybe there is a way to add/edit this template or something like this?
Since January 2019, there is a plugin on the Jetbrains website called kdoc-generator.
https://plugins.jetbrains.com/plugin/10389-kdoc-generator
Plugin to generate class and method KDoc.
This generator functions exactly like JavaDoc.
That means when you create a commentary with "/**" and press enter, the kdoc-generator creates automatically "#param" or "#return" tags for the parameter and return values of the method directly below this created commentary.
When you type /**
in your file above a method you wrote and then press enter you get something similar to this:
/**
*
* #param str
* #param age
*/
fun foo(str: String, age: Int) {
}
To install this Plugin directly in Android Studio:
open File/Settings (Mac: AndroidStudio/Preferences)
choose Plugins
click Browse repositories...
enter "kdoc-generator" in searchbar
klick Install
restart Android Studio
Now the kdoc-generator is installed and you can use it directly.
Additionally Jetbrains developed a documentation engine for Kotlin, that you can use to convert your documentation in Kotlin files to some standard formats, e.g. HTML
https://github.com/Kotlin/dokka
Dokka is a documentation engine for Kotlin, performing the same function as javadoc for Java. Just like Kotlin itself, Dokka fully supports mixed-language Java/Kotlin projects. It understands standard Javadoc comments in Java files and KDoc comments in Kotlin files, and can generate documentation in multiple formats including standard Javadoc, HTML and Markdown.
As this is most likely a bug with IntelliJ, I've taken the liberty of filing a bug report here. You can choose to watch this issue to get notified of any updates.

Where to find Office 2007/2010/2013 Open XML Schemas [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
The community reviewed whether to reopen this question 2 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I am looking to pull together all of the XML schemas that Office 2007/2010/2013 documents abide by. I have found a number from the ISO/IEC 29500:2012 spec and ECMA-376 spec. I have also located a few on w3.org (e.g. xmldsig#). But I have been unable to find the majority of them (e.g. the schemas for http://schemas.openxmlformats.org/spreadsheetml/2006/main).
Searching on microsoft.com only yields pages like this that seem to have this content. However, most of these schemas do <xs:imports>s to files that I can't find.
Has anyone else had any luck finding these files?
Note: I've left my original content below; feel free to remove it if that is the preferred way to post answers.
Initially I could not find a clear source for the namespace
http://schemas.openxmlformats.org/spreadsheetml/2006/main.
I found that http://purl.oclc.org/ooxml/spreadsheetml/main is used in the ISO/IEC 29500-1 and ECMA-376 documents.
When I was looking through the files in zip 'ECMA-376, Fourth Edition, Part 1 - Fundamentals And Markup Language Reference.zip' I noticed there are two sets of XML schema files:
OfficeOpenXML-XMLSchema-Strict (In Part 1)
OfficeOpenXML-XMLSchema-Transitional (In Part 4)
I found that the Strict schema uses the purl.oclc.org namespace while the transitional schema uses the schemas.openxmlformats.org. Both sets contain the sml.xsd file (Defines SpreadsheetML) but with some differences. It seems that the different version of MS Office support different verisons of the standards (found on http://en.wikipedia.org/wiki/Office_Open_XML).
Original answer:
It appears that the comment by JasonPlutext is correct. I downloaded the file 'ECMA-376, Fourth Edition, Part 1 - Fundamentals And Markup Language Reference.zip' from the ECMA site which contains the file 'OfficeOpenXML-XMLSchema-Strict.zip' which then contains the file 'sml.xsd'.
I searched for the namespace you're looking for and found this website that appears to be an online version of the schema using the same namespace. I checked a few elements and they all appear in the sml.xsd file.
What is odd is that that none of the files in the downloaded schemas contain the schemas.openxmlformats.org namespace they all contain namespaces like this one
http://purl.oclc.org/ooxml/spreadsheetml/main
you can navigate to this URL in a browser and it references the ISO standard ISO/IEC 29500-1. I'd say they refer to the same thing but the purl version is less specific compared to the schemas.openxmlformats.org version.
If anyone else is looking for this, here is where you will find a full list of the Office Open XML schema:
https://msdn.microsoft.com/en-us/library/dd979921(v=office.12).aspx

What are the advantages and disadvantages of a web site that contains a single page? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I would like to code a little web site that will contain several sections like "Home", "Gallery", "Contact Us", "FAQs", and so on.
I thought to do this in one HTML by putting each section in a div and show only one div per time (using Javascript / jQuery), based on the chosen menu button.
Alternatively, I could create a separate HTML page per section, and link these pages to the menu buttons.
What are the advantages and disadvantages of these two methods ?
The first method means longer loading times since you have to load everything on the site up front, and it's totally broken for people who have disabled Javascript or whose browsers don't support it. The second method means the user only has to load the content they are actually looking at, and it should work even with non-Javascript browsers.
The main disadvantages that comes to mind for the first method are:
Poor SEO: Google will only see your home page as Google bot doesn't execute javascript.
Back/Forward buttons won't work.
Takes longer time to load initially.
As site becomes bigger, it'd need more memory and might slow down the browser and even the machine
The advantage of the method would be speed, when navigating you don't need a round-trip to the server.
It also has a couple of disadvantages the main ones are;
You can only link to the front-page, not directly to for example the about page because it doesn't have a separate url.
The back button in the user's browser won't work anymore.
The Advantages of the Javascript solution are mainly that you dont need to reload the page which is very nice for the user.
On the other hand you have the visitors with javascript disabled who wont be able to load the different pages. Also you cannot navigate over Javascript pages with the browser's back and forth buttons.
The last thing I see is that your code could become messy if you're not very careful and organized.
SEO for one thing - Googlebot will likely only ever index the home page, and your other pages will be effectively invisible to search engines.

Resources