Merge pull request #208 from kimgr/simpler-make_readme
Rewrite relative links so they can be followed on GitHub.
This commit is contained in:
commit
51fe54df47
|
@ -1,6 +1,6 @@
|
|||
# Include What You Use #
|
||||
|
||||
This README was generated on 2015-08-30 20:07:32 UTC.
|
||||
This README was generated on 2015-09-02 20:35:20 UTC.
|
||||
|
||||
For more in-depth documentation, see http://github.com/include-what-you-use/include-what-you-use/tree/master/docs.
|
||||
|
||||
|
@ -116,5 +116,5 @@ If you don't like the way `fix_includes.py` munges your `#include` lines, you ca
|
|||
* If `fix_includes.py` has wrongly added or removed a forward-declare, just fix it up manually.
|
||||
* If `fix_includes.py` has suggested a private header file (such as `<bits/stl_vector.h>`) instead of the proper public header file (`<vector>`), you can fix this by inserting a specially crafted comment near top of the private file (assuming you can write to it): '`// IWYU pragma: private, include "the/public/file.h"`'.
|
||||
|
||||
Current IWYU pragmas are described in [IWYUPragmas](IWYUPragmas.md).
|
||||
Current IWYU pragmas are described in [IWYUPragmas](docs/IWYUPragmas.md).
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
##===----------------------------------------------------------------------===##
|
||||
|
||||
from __future__ import print_function
|
||||
import re
|
||||
import sys
|
||||
from datetime import datetime
|
||||
|
||||
|
@ -42,6 +43,15 @@ def Heading():
|
|||
return '\n'.join(buf)
|
||||
|
||||
|
||||
def RewriteRelativeLinks(content):
|
||||
def Replace(m):
|
||||
if not m.group(2).startswith('http'):
|
||||
return '[' + m.group(1) + '](docs/' + m.group(2) + ')'
|
||||
return m.group(0)
|
||||
|
||||
return re.sub(r'\[(.*?)\]\((.*?)\)', Replace, content)
|
||||
|
||||
|
||||
def main(argv):
|
||||
if len(argv) != 1:
|
||||
print(_USAGE, file=sys.stderr)
|
||||
|
@ -50,7 +60,7 @@ def main(argv):
|
|||
print(Heading())
|
||||
|
||||
with open('docs/InstructionsForUsers.md', 'r') as stream:
|
||||
print(stream.read())
|
||||
print(RewriteRelativeLinks(stream.read()))
|
||||
|
||||
return 0
|
||||
|
||||
|
|
Loading…
Reference in New Issue