In Cloud9 IDE how to beautify HTML code inside Javascript strings? - code-formatting

In Cloud9 IDE you can automatically format HTML codes, or Javascript codes. But once in a while you need to do the formatting not compatible with the containing file type. For example, when you are authoring a web component widget, you need to provide a template, which is HTML structures, in the form of a string variable residing inside a Javascript file. Currently the IDE simply ignore this patch of code, treating it as plain text strings. How can I format the HTMLs in this case? Thanks.

The IDE only supports one file format per file, so either Javascript or HTML or PHP, etc. Templating languages like Handlebars, Blade, or others that combine HTML with other languages are not supported for auto-formatting.
If you'd like to format these files, you'll need to do one of the following:
Use a CLI utility that supports the file type you're trying to cleanup.
Copy/paste the HTML into a .html file, format it there, then paste it back into your original file.
I'd advise you use #1 because #2 doesn't sound fun. The CLI utility you install/use will depend on what types of files you're actually trying to beautify.

Related

How to display/render XHTML source code directly after pasting?

In my current use of Arquillian, it makes a lot of sense to debug functional tests with Graphene (wrapping Selenium) with WebDriver.getPageSource in the debugger which allows to easily copy the XHTML code into the clipboard. However, I need to create a temporary document in an editor, save the file and open it in a browser.
Is there any browser or website which allows to paste XHTML source code and render it (directly or in an IFrame)?
WYSIWYG editors are available for free on websites, e.g. https://html-online.com. Of course, the CSS isn't included, but it won't if the file was saved like described in the question.

Is there a way to convert submittable/fillable PDF (containing JS) to HTML?

I have a huge set of PDF files which use forms and JavaScript to submit them. I'm wondering if there's a way of converting such PDFs into HTML (or any other format except Flash which would allow for opening the page in a Web browser and submitting it).
After research on the topic I was able to find several pieces of software that would convert PDF to HTML but even if there are any fields left after conversion there's no JS apparently and all the buttons are missing.
Edit: The number of documents to convert is roughly 500... so "by hand" method is out unless it's a bit of "by hand" and then in bulk
I'm not sure whether this PDF converter will help. It can convert PDF to html, however, I'm not sure whether it will preserve your buttons and js. Maybe you can have a try. Hope this helps.

Extract "cover image" from CHM and EPUB files

How can I programmatically and reliably create PNG images from CHM and EPUB files? The page that's needed is only the first one, as in "cover image thumbnail generation".
Could this even be done just from the command line?
I have already looked at the open-source CHM QuickLook plug-in for MacOSX for source that does this and at Calibre, the latter to no avail.
In CHM, the default page is a webpage (a .html file). Of course it can only contain one page.
An extracter program is easy to do based on chmlib or Free Pascal's libs, but it will need the html parsed to also find names of other programs to extract. Roughly the algorithm would be:
use some "list" function of a cmdline extract tool to get the default page's name. (this is stored in an internal record)
extract it, and parse it for img and other referencing tags.
extract those.
The biggest picture downloaded in the previous step is probably "it"!

How to create and save a .rtf, .doc, .docx in Objective-C for iOS

I am looking to create and save either a rtf, doc or docx file on an iPad (iOS).
The scenario is that we'd like to assist a user in creating content on their iPad and then let them email this as an editable document cross-platform (OS X, WIN).
I am open to other solutions besides the rtf, doc or docx file format.
Thanks,
James
RTF is going to be the easiest, because it's a plain text format. It's kind of like HTML, but without closing tags. Here is a class for writing an RTF, but it requires a lot of dependencies from elsewhere in the framework.
DOCX would be rather difficult. It's actually a zip file, containing a few XML files. You can examine the format yourself by changing the .docx extension to .zip and unzipping it. But even though XML is a fairly easy to write format, the way the text attributes are organized is still rather complicated. Also, I recall that it has to be zipped in a very specific way to be read properly.
As for DOC, it will be very difficult because it's such a complex format. You could look into some open source projects, like Abiword or Word2x. Be careful using their code because the licenses may not agree with the App Store rules.
I've seen doc & docx readers for iPhone (App store entry linked here), but I don't know of any open source frameworks you can make use of.
RTF format should be pretty simple to write, if you're up to the challenge. There is no built in framework support for it (here's a related question, b.t.w.).
Maybe you could write out something in a regular TEXT format and e-mail that?
Docmosis has a cloud service that you can reach from iOS. You can ask it to render a doc in various formats (doc, rtf, pdf, odt etc) and email it off or stream it back - though you have to be connected. Previewing DOC on iOS is possible but a little flaky. One option is to stream PDF back for display on iOS and email editable document (which can be done in one call).

web based form to collect data and populate to a fillable PDF

Is there a script that anyone can suggest that would allow me to create a HTML or PHP web based form to collect data and save that data. the call the data to be populated in a fillable pdf?
If you have an existing PDF that you want to populate, and that PDF just has text fields (no checkboxes or radio buttons) then CAM::PDF may be able to help you. You can use it as a Perl library directly, or use its command-line interface. CAM::PDF is not useful for generating PDFs from scratch, however. Furthermore, if you have embedded fonts, then you need to ensure that all of the characters you plan to insert are represented in the embedded font.
Use a normal web page to get the data. If not sure how to do it, look for "php forms" on google, there are plenty of tutorials.
Then use a php pdf generator, like this one, to create the PDF file. If you look hard enough, you will probably find a pdf generator that will let you use a template with placeholders where the entered data should be.