I have code written in any programming language. How can I "prettify" it (bold if, else etc.) to display on a website? Are there any good APIs to do that?
There is Google's prettify which is widely used for such tasks (e.g. SO itself uses it for highlighting of code).
Google Code Prettify JavaScript library supports all C-like (Java,
PHP, C#, etc), Bash-like, and XML-like languages without need to
specify the language and has customizable styles via CSS.
Moreover, as i know, there is a lot of third-party styles for those languages that not supported officially.
If you're using PHP, I recommend GeSHi
If you're talking about an auto-formatter, I've used PEAR's PHP Beautifer before.
Although you shouldn't really need a script to format your code for you...
This is the most common plugin used on the web I think.
I think it works for most programming languages.
I see it everywhere. I am actually thinking of adding it to my website as well.
Related
There are a lot of web based IDE's like Cloud9, Codebox, AppBuilder(Icenium). And I'm really interested in how the front end / UI for these environments works.
I have a hard time believing that it's just plain HTML5/CSS/Javascript that are providing the rich features. Is there some similar framework/library that they are using?
You can look at the source for Cloud 9 yourself:
http://github.com/ajaxhub/cloud9
They use a number of JavaScript libraries but yes, the front-end is all HTML5, CSS and Javascript when it comes down to it.
I know very little HTML or web dev, but I would like to write an
HTML5 app with a fairly complex UI. Is there a framework that stands
out among the rest for this type of job? Do I need a framework; or can
I just do everything in straight HTML+CSS+JS? And what about GWT?
Thanks!
As a general HTML5 starting template, Boilerplate is always a good choice.
It will optimize and chain all your scripts and CSS files, as well as your HTML code and images, it also comes with useful tools like Modernizr.
If you are looking for JavaScript libraries, YUI is a very good library when it comes to UI, though maybe a little more complicated than jQuery or jQuery UI at first. I found it better than jQuery UI, and can work together with jQuery anyway.
EDIT
You may also be interested in Ext JS. Looking at the demo it provides, seems really like a powerful library with many ready to use UI widgets. Never used it though, and looks like it only offers a commercial license.
I suggest you to use Html5-boilerplate.
Download from github
Video Tutorials from author :
http://www.youtube.com/watch?v=qyM37XKkmKQ
http://www.youtube.com/watch?v=OXpCB3U_4Ig
GWT is a good way to go for a complex web application, particularly if you're familiar with java but not javascript. GWT now provides support for HTML5 features such as offline storage, canvas, audio, and video, although it's possible to use any HTML5 features whether GWT provides specific Java classes to support them or not (I implemented the offline storage feature in one of my apps before it was part of GWT). Using GWT will mitigate many of the browser compatibility problems you will encounter with straight HTML+CSS+JS. Although you write in Java, it's still important to be familiar with HTML, CSS and JS, since the java is compiled to js.
It seems like every web framework has its own pet template language. Ruby has eRuby, Python's django uses the Django template language, Haskell has Heist and Hamlet, Java's got JSP, and then there's PHP...
My question is, has anyone tried creating One Templating Language to Rule Them All? Are there any such templating languages that at least have some widespread support amongst the varying web frameworks?
Mustache maybe.
XSLT might be a candidate as a "universal" template language.
It might also be the greatest evil that this land has ever seen, but that's up for debate.
NHAML/HAML is the closest you'll get to a standard.
Freemarker (and Velocity to some extent) seem to be supported by a growing number of frameworks (Spring, Tiles, Struts and more) and can be used to generate code in any framework, but I don't think there is "one template engine to rule them all". If there was though, I would choose Freemarker any day
uh... Trying to find something like that for WEB project which would be able to render html from same templates at both sides. Server and Client. Already mentioned Mustache seams to be most suitable choice so far...
Maybe this JSON based solution will sound interesting...
Also HAML looks promising.
How many client-side scripting language implementations did you see except JavaScript and VBScript? Like: type="text/C++Script", text/CSharpScript, text/oberonScript, etc.
How can I learn if my browser supports those languages?
The only languages I have ever seen supported by web browsers in <script> elements are:
JavaScript / JScript (which is ubiquitous)
Webassembly (which is less of a language than a different target other languages can be compiled to) is well supported today)
VBScript (IE 10 and lower only)
PerlScript (IE with a plugin from ActiveState only)
Dart (in a nonstandard build of Chromium) which is not intended for production use.
The HTML 4 specification gives examples of Tcl, but I've never heard of a browser that implemented this.
In any practical sense (for WWW development), JavaScript and Webassembly is the only (not really a) choice.
There are also various languages (e.g. Dart, TypeScript, ES6/7) which have translators to convert programs to (ES5 flavoured) JavaScript which can then run in browsers.
Is already answered above.
If you want to learn if browser supports languages that you already know the best is to embed their small snippets into page or inject using innerHTML from JavaScript. These scripts should then set some global property like window['scripts']['oberon']=true; this way you will learn that language type was detected indeed.
Does anyone have any suggestions on how to generate accessible PDFs (including images) from HTML?
The PDFs need to look like the original HTML, including positions of images etc.
Any special HTML structure required to help make the final PDF accessible?
I've seen questions about creating PDFS none of them specifically address the important issue of accessibility.
My poison of choice is Perl but references to any program, language or library will help.
I have a more in-depth question at TypeDoc if anyone has more general information to offer.
http://doctype.com/TiB
Also,
I, and others, would find it useful if users with accessibility problems could comment if they find the "usability experience" of using PDFs better or worse than reading from Plain Old Semantic HTML (POSH).
Thanks
Mike
Look into PrinceXML. Through CSS you can control margins, page breaking and orientation. While not open source, you can try it for free, but it places a small water mark in the upper right corner.
The Adobe ColdFusion server product does a really fine job of this, not surprisingly. But it's not free, and the open source implementations of the language (Smith and BlueDragon) don't support the pdf stuff.
Developer licenses to Adobe ColdFusion are free, and you can download it.
I've done this thing on a small scale but scripting Safari to print to PDFs. I don't recommend it for large-scale projects though.
By far the most capable PDF publishing tool I've ever come across is reportlab. There is an open source library written with Python and a proprietary system that allows you to construct a document using RML, a custom xml spec. The latter is easier for more complex docs. They tend to be very flexible (and reasonable) with pricing.
Not strictly an answer to your question as it doesn't handle html-to-pdf conversions, but perhaps of use to you.