Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

Inline image link fixes for markdown from dump.xml #1

Open
DRN88 opened this issue Aug 16, 2017 · 0 comments
Open

Inline image link fixes for markdown from dump.xml #1

DRN88 opened this issue Aug 16, 2017 · 0 comments

Comments

@DRN88
Copy link

DRN88 commented Aug 16, 2017

Thanks for mw2md project. It helped me a lot!

Dump mediawiki latest data

php /var/www/html/mediawiki_1.21.1/maintenance/dumpBackup.php --current > /root/wiki2markdown/dump.xml

Dump all latest images to a folder: images

php /var/www/html/mediawiki_1.21.1/maintenance/dumpUploads.php | sed 's~mwstore://local-backend/local-public~/var/www/html/mediawiki_1.21.1/images~' | xargs cp -t /root/wiki2markdown/images/

Change config.yml. Add image tag with 'ccccccc' or any other key character(s)

# Rewrite special wiki constructs to be markdown-friendly
# (output should be HTML that feeds into the Markdown conversion)
rewrite_wiki:
  '\{\{#ev:youtube\|([^|}]*)\|([^|}]*)\}\}': '<iframe width="\2" src="//youtube.com/embed/\1" frameborder="0" allowfullscreen="true"> </iframe>'
  '\{\{#ev:youtube\|([^|}]*)\|([^|}]*)\|([^|}]*)[^}]?\}\}': '<iframe width="\2" src="//youtube.com/embed/\1" frameborder="0" align="\3" allowfullscreen="true"> </iframe>'
  '\[\[image:(.*)\]\]': '!ccccccc\1ccccccc(/images/\1)'

# Rewrite resulting Markdown
rewrite_markdown:
  '!ccccccc': '!['
  'ccccccc': ']'

Result should be

![myimageName.jpg](/images/myimageName.jpg)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant