MCPcopy Index your code
hub / github.com/SLiCAP/SLiCAP_python / links2html

Function links2html

SLiCAP/SLiCAPhtml.py:1034–1087  ·  view source on GitHub ↗

Returns the HTML code for placing links to all labeled HTML objects. Links will be grouped as follows: #. Links to headings #. Links to circuit data and imported tables #. Links to figures #. Links to equations #. Links to analysis results (from noise2html, pz2html, et

()

Source from the content-addressed store, hash-verified

1032 return html
1033
1034def links2html():
1035 """
1036 Returns the HTML code for placing links to all labeled HTML objects.
1037
1038 Links will be grouped as follows:
1039
1040 #. Links to headings
1041 #. Links to circuit data and imported tables
1042 #. Links to figures
1043 #. Links to equations
1044 #. Links to analysis results (from noise2html, pz2html, etc.)
1045
1046 :return: html: HTML string that will be placed on the page.
1047 :rtype: str
1048 """
1049
1050 # [typ, page, '"' + text + '"']
1051
1052 htmlPage('Links')
1053 labelDict = {}
1054 html = ''
1055
1056 # Create a dictionary with key = label type and value is labes of that type
1057 for labelType in _LABELTYPES:
1058 labelDict[labelType] = []
1059 for labelName in ini.html_labels.keys():
1060 if ini.html_labels[labelName][0] == labelType:
1061 labelDict[labelType].append(labelName)
1062 # Print the labels with a heading fot each group
1063 for labelType in _LABELTYPES:
1064 if len(labelDict[labelType]) != 0:
1065 labelDict[labelType].sort()
1066 if labelType == 'headings':
1067 html += '<h2>Pages and sections</h2>\n'
1068 for name in labelDict[labelType]:
1069 html += '<p>%s</p>'%(href(name))
1070 elif labelType == 'data':
1071 html += '<h2>Circuit data and imported tables</h2>\n'
1072 for name in labelDict[labelType]:
1073 html += '<p>%s</p>\n'%(href(name))
1074 elif labelType == 'fig':
1075 html += '<h2>Figures</h2>\n'
1076 for name in labelDict[labelType]:
1077 html += '<p>%s</p>\n'%(href(name))
1078 elif labelType == 'eqn':
1079 html += '<h2>Equations</h2>\n'
1080 for name in labelDict[labelType]:
1081 html += '<p>%s</p>\n'%(href(name))
1082 elif labelType == 'analysis':
1083 html += '<h2>Analysis results</h2>\n'
1084 for name in labelDict[labelType]:
1085 html += '<p>%s</p>\n'%(href(name))
1086 html = _insertHTML(ini.html_path + ini.html_page, html)
1087 return html
1088
1089def htmlLink(address, text):
1090 """

Callers

nothing calls this directly

Calls 3

htmlPageFunction · 0.85
hrefFunction · 0.85
_insertHTMLFunction · 0.85

Tested by

no test coverage detected