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

Function lib2html

SLiCAP/SLiCAPhtml.py:306–338  ·  view source on GitHub ↗

Places the contents of the library file 'fileName' on the active HTML page. The library is assumed to be located in the user library path. :param fileName: Name of the library file :type fileName: str :param label: Label ID for this object. :type label: str

(fileName, label='', lib='user')

Source from the content-addressed store, hash-verified

304
305
306def lib2html(fileName, label='', lib='user'):
307 """
308 Places the contents of the library file 'fileName' on the active HTML page.
309
310 The library is assumed to be located in the user library path.
311
312 :param fileName: Name of the library file
313 :type fileName: str
314
315 :param label: Label ID for this object.
316 :type label: str
317
318 :param lib: Library path, can either be "user", or "system".
319 :type lib: str
320
321 :return: HTML string that will be placed on the page.
322 :rtype: str
323 """
324 lib = lib.lower()
325 try:
326 label = _addLabel(label, fileName=fileName, labelType="data")
327 if lib == 'user':
328 netlist = _readFile(ini.user_lib_path + fileName)
329 elif lib == 'system':
330 netlist = _readFile(ini.main_lib_path + fileName)
331 else:
332 print("ERROR: unknown library type (lib='user' or 'system').")
333 html = '<h2>' + label + 'Library: ' + fileName + '</h2>\n<pre>' + netlist + '</pre>\n'
334 html = _insertHTML(ini.html_path + ini.html_page, html)
335 except:
336 print("Error: could not open netlist file: '{0}'.".format(fileName))
337 html = ''
338 return html
339
340def elementData2html(circuitObject, label='', caption=''):
341 """

Callers

nothing calls this directly

Calls 4

_addLabelFunction · 0.85
_readFileFunction · 0.85
_insertHTMLFunction · 0.85
formatMethod · 0.80

Tested by

no test coverage detected