This website is extremely Lynx-friendly, but how? - lynx

I was reading a few articles today, when I stumbled upon this:
https://www.pnas.org/content/111/24/8788
When you open the page in Lynx, it's very clean, without extra elements, and even with markdown symbols. When I check the HTML source, I just don't understand how they've done that. Can someone tell me how it is done?

OK, I finally found it. There's an "alternative" meta tag in the HTML version, pointing to the plain text version of the page, and Lynx is opening that automatically.

Related

Using docx4j with ColdFusion

I am attempting to create Word documents with ColdFusion, but it does not seem there is any way to do it with only ColdFusion. The best solution seems to be docx4j. However, I can't seem to find any in-depth docx4j and ColdFusion examples (Aside from this question). Where can I get some doc4jx and ColdFusion examples?
pulling the data from a database.
https://stackoverflow.com/a/10845077/1031689 shows one approach to doing this. There are other ways, as to which see http://www.slideshare.net/plutext/document-generation-2012osdcsydney
The document needs page numbers and to
Typically you'd add these via a header or footer. You might find it easier to start with an almost empty docx structured appropriately, rather than creating the necessary structures via ColdFusion calling docx4j. You could still do it this way in conjunction with the final paragraph of this answer below.
create a table of contents.
Search the docx4j forums for how to do this.
In general, it looks like the easiest approach would be to create a Java class file which does everything you want (by invoking docx4j), and for your ColdFusion to just invoke that Java class. In other words, do a bit of Java programming first, get that working, then hook it up to your ColdFusion stuff.
I am not sure what exactly you mean with creating word document, which in my opinion is pretty simple. Manipulating yes, a bit tricky with docx4j or so.
<cfsavecontent variable="variables.mydoc">
Your content here
</cfsavecontent>
<cffile action="write" file="#yourFile.doc#" output="#variables.mydoc#">
Also see this post
Creating a Word document in Coldfusion - how to have pagenumbering?

ColdFusion - converting HTML webpage to Word or PDF document

I have a webpage, where user has a possible to Print this page OR to save it on his/her computer.
How may I save it as a Word or PDF document?
Thanks.
For the MS Word requirement, most versions of Office can interpret basic html/xml. So you might consider the old cfcontent hack as a simpler alternative to POI. (The Word package is not quite as mature as the spreadsheet package.)
Basically you generate html, but use cfheader/cfcontent to tell the browser the content is really a Word document. It is obviously not a true MS Word file. But it is simpler than most options.
http://msdn.microsoft.com/en-us/library/aa155477.aspx
<cfheader name="Content-Disposition" value="attachment; filename=someFile.doc">
<cfcontent type="application/msword">
... your html code here ...
For microsoft office documents you can use the Apache POI project. This means in your coldfusion code you need to use some basic java code to call the poi methods.
However, if you choose the pdf document things are quite easier. You can use the cfdocument tag with the PDF format option
Using the POI or OpenOffice interface (depending on your version) you can create a Word doc. Using the built-in PDF generation tools, you can create a PDF doc. HOwever, you can only present that as an option.
There is no way to override the save/print menu functions. No matter how you handle it, I cna save the source document instead of the .doc or .pdf. Similarly, you cannot prevent me from printing the original document, instead of a prepared PDF.
Here is a method that has worked for me:
Create PDF or FlashPaper with ColdFusion
However, just like printing, you will have to sacrifice some graphics, so this would be best used for exporting content (but as you did not specify, I'm just clarifying that this is possible but at a cost).
Hope that helps.
Use cfdocument to display as a PDF, then they can just click the disk image to save it to their computer. Or you can use the filename= attribute of cfdocument to assign a filename to it, and it will prompt them to save it instead of displaying in the browser.

Trying to find a syntax highlighter for ColdFusion in Notepad++

I use CFEclipse for most of my projects and heavy lifting but sometimes I find the need to do a quick fix on pages outside the project scope that is easier to accomplish in a simple text editor.
I have googled but can't seem to find an answer so either a link to a download or a link to how to build my own would be awesome. thanks.
Update: Brien Malone's answer below along with charlie arehart's comments are what people should use at this point as nppColdFusion is no longer maintained as of 23 Sept 2011.
Disregard
nppColdFusion is actively maintained
In notepadd ++, go to 'Plugins'> 'Plugin Manager'> 'show plugin manager'. 'Coldfusion Lexer' is listed as available plugin
This question is a few years old now, and unfortunately, the accepted answer involving nppColdFusion is no longer valid because the plug-in doesn't work with NP++ after version 5.x.x and is not being maintained. (It stopped working when Notepad++ switched their plug-in hooking mechanism in version 6.x.x)
The Notepad++ site points to a library of nearly every language highlighter available:
http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=User_Defined_Language_Files
ColdFusion (specifically CF9) is listed:
http://notepad-plus.sourceforge.net/commun/userDefinedLang/userDefineLang_CF9.xml
It's not as good as a full plug-in like nppColdFusion, but it is better than pages of black text.
Just a comment about Tony's answer (Aug 22 '14 at 13:00) : he wrote "In notepadd ++, go to 'Plugins'> 'Plugin Manager'> 'show plugin manager'."
However, in ver. 6.8 (maybe since before), there's no "Plugins" menu item on the menu bar. What I had to do is:
1- From the User Defined Language Page
http://docs.notepad-plus-plus.org/index.php?title=User_Defined_Language_Files
Download the ColdFusion User Defined Language file
http://notepad-plus.sourceforge.net/commun/userDefinedLang/userDefineLang_CF9.xml
Into the Notepad++ Folder
2- From the User Defined Language panel, import that file:
Language > Define your language... then press the Import button
ColdFusion will then appear at the bottom of the Language menu item selection list, and NotePad++ will automatically use it for any .CF file you open.
This link might help: http://howardscholz.wordpress.com/2007/06/01/notepad-support-for-coldfusion-8/
Disclaimer: I haven't tried it myself.
I found that nppColdFusion was working well, until I updated NP++ to version 7.6.6. I have tried just about everything to get it working, but to no avail.
I tried Delire Web's solution and it worked perfectly.
The different formatting (font and background colors) takes a bit of getting used to though.

Parsing restructured text in django (and python)

I'm going to manage some documentation using Django (I come from Sphinx) in order to have more control on the output. The docs are in rst (restructured text) in a git archive, and it's trivial to display them in HTML using a filter. My problem is that they are quite long, and I'd like to have more control on how the pagination goes, so I can show a single section per HTML page, have comments for a single section and so on...
My goal would be to be able to parse each doc, create my TOC with links to each section in a separate HMTL page, where a view would go through whole doc to render in html just a section.
I understand that it's mostly a issue of docutils, the most interesting example I've been able to find is: http://www.ibm.com/developerworks/library/x-matters24/#code2 but it seems outdated and the examples in section "Tree-oriented processing", which is where the magic goes, don't seem work with my version of docutils. Article is good: I could use more of the same subject!
Is there something similar to what I'm planning to do already available that I can study, or maybe could someone point me to a gentle introduction to docutils for parsing rst documents?
Here is a blog describing howto make a custom rst writer and call it from Django. I think it should give you a good start http://www.arnebrodowski.de/blog/write-your-own-restructuredtext-writer.html
Pygments has a ReST lexer that you could examine (or possibly even use directly).

How should I migrate a site from ZWiki to MediaWiki?

I have a fairly extensive wiki on ZWiki on Zope (in turn on Plone). Most pages are in reStructured text format, but there are several in straight HTML as well.
What is the best approach to migrate those pages over to a MediaWiki wiki with pages converted to MediaWiki and HTML formats? Of course I'd like to automagically convert all links (internal and external).
extract your wiki content to files, using the zwikiexport.py script. The command will be something like:
ZOPE/bin/zopectl run ZOPE/Products/ZWiki/bin/zwikiexport.py /zodb/path/to/wiki/folder
convert the restructured text markup to mediawiki markup. pandoc should work well - for each wiki page, run something like:
pandoc -r rst -w mediawiki PAGE.rst >PAGE.mw
convert the wiki links, which pandoc doesn't know about. Depending on your content, this may be the hardest part to do accurately. Write a perl script, or modify the zwikiexport script, using Zwiki's knowledge of where the links are (see methods in ZWikiPage.py).
import the mediawiki-format pages into mediawiki, however that's done
refinements:
the exported file tree will reflect your zwiki page hierarchy - if you use this heavily, you'll want to think about how to represent it in mediawiki
as Mark says, you'll lose the page history, unless you work extra hard to find a way to replicate that. The same goes for all page metadata you may have have been using (you can inspect most of this metadata in the page's Properties tab in the zope management interface). In particular the page creation time, last edit time, and the usernames of the page's creator and last editor are quite important, to understand your content. So I would try to script some way of preserving those or if all else fails, doing it by hand.
if you have uploaded files to the wiki, I think the export script might save those too, otherwise use the ZMI to export/save them. When you import them to mediawiki, you may need to choose a page to attach them to. You could use grep or Zwiki's search to find the pages that reference a particular file.
be prepared to iterate, testing the results pretty thoroughly and refining the process, before you declare victory. After that, the content will diverge and you won't want to re-do this.
manual fixups: at some point, it may be cheaper to stop fiddling with scripts and do the remaining cleanup by hand, by yourself or with an army of helpers.
Good luck! - Simon
http://zwiki.org
I've no experience of ZWiki and don't know how large your wiki is. But general advice - you can use find / replace in Notepad or Notepad++ - or you can write a macro in Excel.
This is per page copying which is only really suitable if your wiki is not larger than, say, 1000 pages.
I suspect you'll still have manually to check each page though, and update your scripts accordingly.
Good luck with it - I suspect you'll be pleased with the final result because MediaWiki is pretty awesome.
Update: one disadvantage of moving to a new wiki is that you will lose the page history (i.e. who wrote what, when).