forked from ivre/ivre
-
Notifications
You must be signed in to change notification settings - Fork 0
/
builddocs
executable file
·26 lines (24 loc) · 1.37 KB
/
builddocs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /bin/bash
# This file is part of IVRE.
# Copyright 2011 - 2014 Pierre LALET <[email protected]>
#
# IVRE is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IVRE is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IVRE. If not, see <http://www.gnu.org/licenses/>.
for f in doc/*.md ; do
out=`echo ${f/.md/.txt} | tr 'A-Z' 'a-z'`
pandoc -f markdown_github -t native $f \
| python -c "print __import__('re').sub('([,\\[](?:Link|Image) \\[[^\\]]*\\] \\(\")([^\\\"]*)(\",\"[^\\\"]*\"\\))', lambda x: x.groups()[0] + (('doc:' if x.groups()[1].split('#', 1)[0] else '') + ('#'.join([x.groups()[1].split('#', 1)[0].replace('.md', ''), x.groups()[1].split('#', 1)[1].replace('-', '_')]) if '#' in x.groups()[1] else x.groups()[1].replace('.md', '').replace('/', ':')) if ':' not in x.groups()[1] else x.groups()[1]) + x.groups()[2], __import__('sys').stdin.read())" \
| pandoc -f native -t dokuwiki \
| sed 's#\\\\ # #g' \
> "web/dokuwiki/$out"
done