File size: 3,311 Bytes
d8117a8 c032139 d8117a8 e84d05c d8117a8 c032139 d8117a8 e84d05c d8117a8 c032139 d8117a8 c032139 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
def generate_markdown(state):
html_str= f"""
# The Software diversity card of {state["master"]["title"]}
{state["master"]["desc"]}
## 🏢 Teams Summary
<table>
<tr>
<th>Name</th>
<th>Description</th>
<th>Type</th>
<th>Age Range</th>
<th>Ethnicities</th>
<th>Genders</th>
<th>Team Size</th>
<th>Location</th>
</tr>"""
## If development team addit
if 'participants' in state:
for key, participant in state['participants'].items():
if participant['name']:
html_str = html_str + f"""
<tr>
<td><strong>{participant['name']}</strong></td>
<td>{participant['description'].replace('\n', '')}</td>
"""
if 'type' in participant:
html_str = html_str + f"""<td>{participant['type'][0]}</td>"""
else:
html_str = html_str + f"""<td> </td>"""
html_str = html_str + f"""
<td>{participant['age'][0]}-{participant['age'][1]}</td>
<td>{participant['ethnicities']}</td>
<td>{participant['genders']}</td>
<td>{participant['size']}</td>
<td>{participant['location']}</td>
</tr>"""
## If target Communities add it
if state['socialContext']['targetCommunity']['name']:
html_str = html_str + f"""
<tr>
<td><strong>{state['socialContext']['targetCommunity']['name']}</strong></td>
<td>{state['socialContext']['targetCommunity']['description'].replace('\n', '')}</td>
<td> Targeted Community </td>
<td>{state['socialContext']['targetCommunity']['age'][0]}-{state['socialContext']['targetCommunity']['age'][1]}</td>
<td>{state['socialContext']['targetCommunity']['ethnicities']}</td>
<td>{state['socialContext']['targetCommunity']['genders']}</td>
<td> many </td>
<td>{state['socialContext']['targetCommunity']['location']}</td>
</tr>"""
## If bodies add
if 'governance' in state:
if 'bodies' in state['governance']:
for key, body in state['governance']["bodies"].items():
if body['name']:
html_str = html_str + f"""
<tr>
<td><strong>{body['name'].replace('\n', '')}</strong></td>
<td>{body['description'].replace('\n', '')}</td>"""
if 'type' in body:
html_str = html_str + f"""<td>{body['type'][0]}</td>"""
else:
html_str = html_str + f"""<td> </td>"""
if body['organization']['name']:
html_str = html_str + f"""
<td>{body['organization']['age'][0]}-{body['organization']['age'][1]}</td>
<td>{body['organization']['ethnicities']}</td>
<td>{body['organization']['genders']}</td>
<td> - </td>
<td>{body['organization']['location']}</td>
</tr>"""
if body['participant']['name']:
html_str = html_str + f"""
<td>45</td>
<td>{body['participant']['ethincity']}</td>
<td>{body['participant']['gender']}</td>
<td> - </td>
<td>{body['participant']['location']}</td>
</tr>"""
## End summary
html_str = html_str + f" </table>"
return html_str |