#!/usr/bin/env python
# Icinga 2
-# Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org)
+# Copyright (C) 2012-2015 Icinga Development Team (http://www.icinga.org)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
if len(sys.argv) < 2:
print "Syntax: %s <md-files>"
print ""
- print "Updates intra-chapter links in the specified Markdown files."
+ print "Updates inter-chapter links in the specified Markdown files."
sys.exit(1)
anchors = {}
for file in sys.argv[1:]:
text = open(file).read()
- new_text = re.sub(r"\[(?P<text>.*)\]\((?P<file>[0-9-[a-z]\.]+)?#(?P<id>[^#\)]+)\)", update_anchor, text)
+ new_text = re.sub(r"\[(?P<text>.*?)\]\((?P<file>[0-9-a-z\.]+)?#(?P<id>[^#\)]+)\)", update_anchor, text)
open(file, "w").write(new_text)