3

I know there are many questions on this topic but After 6 hours of try-this-and-try-that-tool, I still can't find a single tool that takes wikitext of the form

'<center>Welcome to the world's foremost open content<br><big><big><big>'''Organic Chemistry Textbook'''</big></big></big><br>on the web!</center> {| cellpadding="5" |- | <noinclude><big>'''[[Organic Chemistry|Go&nbsp;to&nbsp;contents&nbsp;>>]]'''</big> </noinclude> | [[Image:Ethane3D.png]] | This '''free''' online text is intended to become a ''complete replacement'' for your printed book. |} == The Study of Organic Chemistry == Organic chemistry is primarily devoted to the unique properties of the carbon atom and its compounds. These compounds play a critical role in biology and ecology, Earth sciences and geology, physics, industry, medicine and &mdash; of course &mdash; chemistry. At first glance, the new material that organic chemistry brings to the table may seem complicated and daunting, but all it takes is concentration and perseverance. Millions of students before you have successfully passed this course and you can too! This field of chemistry is based less on formulas and more on reactions between various molecules under different conditions. Whereas a typical general chemistry question may ask a student to compute an answer with an equation from the chapter that they memorized, a more typical organic chemistry question is along the lines of "what product will form when substance X is treated with solution Y and bombarded by light". The key to learning organic chemistry is to ''understand'' it rather than cram it in the night before a test. It is all well and good to memorize the mechanism of Michael addition, but a superior accomplishment would be the ability to explain ''why'' such a reaction would take place. As in all things, it is easier to build up a body of new knowledge on a foundation of solid prior knowledge. Students will be well served by much of the knowledge brought to this subject from the subject of [[General Chemistry]]. Concepts with particular importance to organic chemists are covalent bonding, Molecular Orbit theory, VSEPR Modeling, understanding acid/base chemistry vis-a-vis pKa values, and even trends of the periodic table. This is by no means a comprehensive list of the knowledge you should have gained already in order to fully understand the subject of organic chemistry, but it should give you some idea of the things you need to know to succeed in an organic chemistry test or course. Organic Chemistry is one of the subjects which are varying useful and close to our daily life. We always try to figure out some of the unknown mysteries of our daily life through our factious thinking habit, which generates superstitions. Through the help of chemistry we can help ourselves to get out of this kind of superstition.     We always try to find the ultimate truth through our own convenience. In the ancient past we had struggled to make things to go as per our need. In that context we have found fire, house, food, transportation, etc… Now the burning question is: "how can chemistry help our daily life?" To find the answer of this questions, we have to know the subject thoroughly. Let us start it from now. {{BookCat}}'

and returns me corresponding html. Please help

prongs
  • 9,422
  • 21
  • 67
  • 105
  • 3
    Which tools (this-and-that) have you tried exactly? [This](https://github.com/pediapress/mwlib) and [that](https://github.com/peter17/mediawiki-parser) look promising to me. I got the links from [this](http://www.mediawiki.org/wiki/Alternative_parsers) page. – aganders3 Apr 11 '12 at 16:38
  • There are way too many wiki syntaxes, which one are you trying to convert? wikimedia syntax? – KurzedMetal Apr 11 '12 at 18:24
  • @KurzedMetal I have wikibooks and wikipedia dumps. I don't know what syntax they are in. :( – prongs Apr 11 '12 at 19:04
  • @aganders3 : [This](https://github.com/pediapress/mwlib) is giving me problems in installation. It failed four times because It didn't find certain `.h` files and [that](https://github.com/peter17/mediawiki-parser) requires something called `pijnu` which I can't find anywhere in synaptic. :( – prongs Apr 11 '12 at 19:09
  • @prongs: Sorry I can't help more, but there is a github repo for [`pijnu`](https://github.com/erikrose/pijnu). Looks to be getting stale, but it may be your best shot. – aganders3 Apr 11 '12 at 20:29
  • @prongs Any luck or recipe on how to proceed in the problem? (wikitext TO hmtl) – Marcelo Sardelich Apr 03 '14 at 15:15
  • Well, it's been two years. Even if I've had any luck, I don't remember. :P – prongs Apr 08 '14 at 11:41
  • Considering all kinds of fun you can encounter in Wikimedia wiki dumps, including Lua templates, I'd rather recommend you to import the dump into a MediaWiki instance, then grab HTML from it.Of course, if you don't need a fully compatible HTML output other options might also work, but knowing the precise use case would be helpful in such situations. – MaxSem Jan 20 '15 at 23:00

1 Answers1

2

In Python? I'm not aware of any good parsers for wikitext in that language. If you're willing to run node.js you could use Parsoid. Otherwise, you'll have to use the API. Make sure you run it on the domain that you got the wikitext from so that things like images and transclusions will be resolved correctly.

Krenair
  • 570
  • 5
  • 21
  • Caveat: Wikipedians have this nasty habit of making incompatible changes to templates from time to time, and assuming that everything is okay once the *current* users of those templates work with the *current* templates. In other words, old versions of pages won't necessarily be using the right syntax, and in fact some of the templates could even have been deleted. – SamB Nov 06 '16 at 02:34
  • Yes, this is true. IIRC it even affects browsing old versions of pages on Wikipedia itself. – Krenair Nov 06 '16 at 02:36
  • No, I provided pointers about how to convert wikitext of the form provided to HTML, as requested. I am not requesting clarification of anything. – Krenair Nov 07 '16 at 23:01