Skip to content

Commit f4b7e9b

Browse files
committed
stmhal, docs: Small changes to URL links; adds list of files if none given.
This documentation is now available at micropython.org/doc/
1 parent 4ae52d4 commit f4b7e9b

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

stmhal/gendoc.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def dump(self):
230230
s.append('## Classes')
231231
for c in sorted(self.classes.values(), key=lambda x:x.name):
232232
s.append('')
233-
s.append('[`{}.{}`]({}/index.html) - {}'.format(self.name, c.name, c.name, c.descr))
233+
s.append('[`{}.{}`]({}) - {}'.format(self.name, c.name, c.name, c.descr))
234234
return '\n'.join(s)
235235

236236
def write(self, dir):
@@ -241,7 +241,7 @@ def write(self, dir):
241241
class_dir = os.path.join(dir, c.name)
242242
makedirs(class_dir)
243243
class_dump = c.dump()
244-
class_dump = 'part of the [{} module](../index.html)'.format(self.name) + '\n' + class_dump
244+
class_dump = 'part of the [{} module](./)'.format(self.name) + '\n' + class_dump
245245
index = markdown.markdown(class_dump)
246246
with open(os.path.join(class_dir, 'index.html'), 'wt') as f:
247247
f.write(index)
@@ -272,9 +272,7 @@ def process_moduleref(self, lex, d):
272272
if name not in self.modules:
273273
lex.error('module {} referenced before definition'.format(name))
274274
self.cur_module = self.modules[name]
275-
276-
#def process_classref(self, lex, d):
277-
# self.cur_module.process_classref(lex, d)
275+
lex.opt_break()
278276

279277
def process_class(self, lex, d):
280278
self.check_module(lex)
@@ -341,9 +339,12 @@ def process_file(file, doc):
341339
def main():
342340
cmd_parser = argparse.ArgumentParser(description='Generate documentation for pyboard API from C files.')
343341
cmd_parser.add_argument('--outdir', metavar='<output dir>', default='gendoc-out', help='ouput directory')
344-
cmd_parser.add_argument('files', nargs='+', help='input files')
342+
cmd_parser.add_argument('files', nargs='*', help='input files')
345343
args = cmd_parser.parse_args()
346344

345+
if len(args.files) == 0:
346+
args.files = ['modpyb.c', 'accel.c', 'adc.c', 'dac.c', 'extint.c', 'i2c.c', 'led.c', 'pin.c', 'rng.c', 'servo.c', 'spi.c', 'uart.c', 'usrsw.c']
347+
347348
doc = Doc()
348349
for file in args.files:
349350
print('processing', file)

0 commit comments

Comments
 (0)