def findDescriptionTagAndOutputTextBlock(elem, noDescriptionText = False): text = '' noDescTxt = 'No description' if noDescriptionText: noDescTxt = '*-*' if elem.find('description') is None: text += rst.block(noDescTxt) elif elem.find('description').text is None: text += rst.block(noDescTxt) elif elem.find('description').text.strip() == '': text += rst.block(noDescTxt) elif elem.find('description').text.strip() != '': text += rst.block(elem.find('description').text) return text;
def findDescriptionTagAndOutputTextBlock(elem, noDescriptionText=False): text = '' noDescTxt = 'No description' if noDescriptionText: noDescTxt = '*-*' if elem.find('description') is None: text += rst.block(noDescTxt) elif elem.find('description').text is None: text += rst.block(noDescTxt) elif elem.find('description').text.strip() == '': text += rst.block(noDescTxt) elif elem.find('description').text.strip() != '': text += rst.block(elem.find('description').text) return text
files = [] # Prepare directory tree. shutil.rmtree(src_dir, True) shutil.rmtree(bld_dir, True) os.makedirs(src_dir) shutil.copytree(img_dir, os.path.join(bld_dir, 'images')) # Message format. text = rst.h1('Message Format') files.append('Message Format.rst') # Field types. text += rst.h2('Field types') text += rst.block(root.find('types/description').text) ttypes = rst.Table() ttypes.add_row('Name', 'Size', 'Description') for t in root.findall('types/type'): if 'size' in t.attrib: size = t.attrib['size'].strip() else: size = 'n/a' ttypes.add_row(t.attrib['name'], size, t.find('description').text) text += str(ttypes) open(os.path.join(src_dir, 'Message Format.rst'), 'w').write(text) # Serialization. text = rst.h2('Serialization') text += rst.block(root.find('serialization/description').text) ttypes = rst.Table()
# Prepare directory tree. shutil.rmtree(src_dir, True) shutil.rmtree(bld_dir, True) os.makedirs(src_dir) shutil.copytree(img_dir, os.path.join(bld_dir, 'images')) # Message format. text = rst.h1('Message Format') files.append('Message Format.rst') headerFooterSize = 0 # Field types. text += rst.h2('Field types') text += rst.block(root.find('types/description').text) ttypes = rst.Table() ttypes.add_row('Name', 'Size', 'Description') for t in root.findall('types/type'): if 'size' in t.attrib: size = t.attrib['size'].strip() else: size = 'n/a' ttypes.add_row(t.attrib['name'], size, t.find('description').text) text += str(ttypes) open(os.path.join(src_dir, 'Message Format.rst'), 'w', encoding='utf-8').write(text) # Serialization. if root.find('serialization') is not None: text = rst.h2('Serialization') descElm = root.find('serialization/description')
# Prepare directory tree. shutil.rmtree(src_dir, True) shutil.rmtree(bld_dir, True) os.makedirs(src_dir) shutil.copytree(img_dir, os.path.join(bld_dir, 'images')) # Message format. text = rst.h1('Message Format') files.append('Message Format.rst') headerFooterSize = 0 # Field types. text += rst.h2('Field types') text += rst.block(root.find('types/description').text) ttypes = rst.Table() ttypes.add_row('Name', 'Size', 'Description') for t in root.findall('types/type'): if 'size' in t.attrib: size = t.attrib['size'].strip() else: size = 'n/a' ttypes.add_row(t.attrib['name'], size, t.find('description').text) text += str(ttypes) open(os.path.join(src_dir, 'Message Format.rst'), 'w', encoding='utf-8').write(text) # Serialization. if root.find('serialization') is not None: text = rst.h2('Serialization')
files = [] # Prepare directory tree. shutil.rmtree(src_dir, True) shutil.rmtree(bld_dir, True) os.makedirs(src_dir) shutil.copytree(img_dir, os.path.join(bld_dir, "images")) # Message format. text = rst.h1("Message Format") files.append("Message Format.rst") # Field types. text += rst.h2("Field types") text += rst.block(root.find("types/description").text) ttypes = rst.Table() ttypes.add_row("Name", "Size", "Description") for t in root.findall("types/type"): if "size" in t.attrib: size = t.attrib["size"].strip() else: size = "n/a" ttypes.add_row(t.attrib["name"], size, t.find("description").text) text += str(ttypes) open(os.path.join(src_dir, "Message Format.rst"), "w").write(text) # Serialization. text = rst.h2("Serialization") text += rst.block(root.find("serialization/description").text) ttypes = rst.Table()