mediawiki-to-markdown icon indicating copy to clipboard operation
mediawiki-to-markdown copied to clipboard

patch needed to run under Windows

Open simonpa71 opened this issue 10 years ago • 4 comments

Nice job, took me a few tries to get it working under Windows 7. The Pandoc PHP wrapper , Copyright (c) Ryan Kadwell [email protected], appears to be written with *nix in mind, and fails under Windows. Specifically, is searches for the path to pandoc using "which" and "is_executable" that, in my case, failed gracefully, so I could discover where to comment out the code running the checks.

Also, the instructions say to run "php composer.phar install" that results in an error. The solution, as per stack-exchange question, is to run "composer install", if the PATH is set correctly and loaded.

Can I suggest a simple comment in the instructions to say "tested under (whatever), may need some googling and light hacking to work under Windows", while somebody comes up with a better fix for the wrapper.

simonpa71 avatar Jun 21 '15 23:06 simonpa71

Hi, what exactly did you do do get it running under Windows? I'm trying to do a tutorial on how to convert MediaWiki pages to use them in a Gitlab Wiki and want to show a way how to do it under Windows (because not everyone has a Linux system at hand). Thanks! Regards, dansou901

dansou901 avatar Mar 01 '16 09:03 dansou901

Did you manage to run it under windows @simonpa71 ?

realrubberduckdev avatar Apr 17 '20 10:04 realrubberduckdev

If it helps anyone, I have just forked to use docker (so that we can use it on windows as well) mediawiki-to-markdown

realrubberduckdev avatar Apr 18 '20 09:04 realrubberduckdev

Could not get docker working so I did the following quick hack for windows 10.

In file \mediawiki-to-gfm\vendor\ryakad\pandoc-php\src\Pandoc\Pandoc.php I changed:

        // Since we can not validate that the command that they give us is
        // *really* pandoc we will just check that its something.
        // If the provide no path to pandoc we will try to find it on our own
        if ( ! $executable) {
            exec('which pandoc', $output, $returnVar);			
            if ($returnVar === 0) {
                $this->executable = $output[0];
            } else {
                throw new PandocException('Unable to locate pandoc');
            }
        } else {
            $this->executable = $executable;
        }

        if ( ! is_executable($this->executable)) {
            throw new PandocException('Pandoc executable is not executable');
        }

To

        // Since we can not validate that the command that they give us is
        // *really* pandoc we will just check that its something.
        // If the provide no path to pandoc we will try to find it on our own
        if ( ! $executable) {
            //exec('which pandoc', $output, $returnVar);
            $returnVar = 0;
            if ($returnVar === 0) {
                 //just input your path to pandoc exe
	        $this->executable = 'c:/Pandoc/pandoc.exe';  
            } else {
                throw new PandocException('Unable to locate pandoc');
            }
        } else {
            $this->executable = $executable;
        }
		
        /*if ( ! is_executable($this->executable)) {
            throw new PandocException('Pandoc executable is not executable');
        }*/

paddlepaw avatar Oct 27 '22 18:10 paddlepaw