110 lineno = func.func_code.co_firstlineno |
110 lineno = func.func_code.co_firstlineno |
111 lineno += offset(src, func.__doc__, name, 1) |
111 lineno += offset(src, func.__doc__, name, 1) |
112 print poentry(path, lineno, func.__doc__) |
112 print poentry(path, lineno, func.__doc__) |
113 |
113 |
114 |
114 |
|
115 def rawtext(path): |
|
116 src = open(path).read() |
|
117 print poentry(path, 1, src) |
|
118 |
|
119 |
115 if __name__ == "__main__": |
120 if __name__ == "__main__": |
116 # It is very important that we import the Mercurial modules from |
121 # It is very important that we import the Mercurial modules from |
117 # the source tree where hggettext is executed. Otherwise we might |
122 # the source tree where hggettext is executed. Otherwise we might |
118 # accidentally import and extract strings from a Mercurial |
123 # accidentally import and extract strings from a Mercurial |
119 # installation mentioned in PYTHONPATH. |
124 # installation mentioned in PYTHONPATH. |
120 sys.path.insert(0, os.getcwd()) |
125 sys.path.insert(0, os.getcwd()) |
121 from mercurial import demandimport; demandimport.enable() |
126 from mercurial import demandimport; demandimport.enable() |
122 for path in sys.argv[1:]: |
127 for path in sys.argv[1:]: |
123 docstrings(path) |
128 if path.endswith('.txt'): |
|
129 rawtext(path) |
|
130 else: |
|
131 docstrings(path) |