QtMvvm  1.0.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
doxme.py
1 #!/usr/bin/python
2 # $1 The readme to be transformed
3 # $pwd: dest dir
4 
5 import sys
6 
7 def readFirst(line, out):
8  if line[0:2] != "# ":
9  raise ValueError("Expected first line to start with '# '")
10  # skip the first line
11  out.write("[TOC]\n\n")
12 
13 readCounter = 0
14 def readMore(line, out):
15  global readCounter
16  if line[0:2] == "##":
17  out.write(line[1:] + " {{#qtmvvm_readme_label_{}}}\n".format(readCounter))
18  readCounter += 1
19  else:
20  out.write(line + "\n")
21 
22 #read args
23 readme = sys.argv[1]
24 doxme = "./README.md"
25 
26 inFile = open(readme, "r")
27 outFile = open(doxme, "w")
28 
29 isFirst = True
30 for line in inFile:
31  if isFirst:
32  readFirst(line[:-1], outFile)
33  isFirst = False
34  else:
35  readMore(line[:-1], outFile)
36 
37 inFile.close();
38 outFile.close();