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

Function htmlPage

SLiCAP/SLiCAPhtml.py:181–228  ·  view source on GitHub ↗

Creates an HTML page with the title in the title bar. If index==True the page will be used as new index page, else a link to this page will be placed on the current index page. :param pageTitle:Title of the page. :type param: str :param index: True or False :type

(pageTitle, index = False, label = '')

Source from the content-addressed store, hash-verified

179### User Functions ###########################################################
180
181def htmlPage(pageTitle, index = False, label = ''):
182 """
183 Creates an HTML page with the title in the title bar.
184
185 If index==True the page will be used as new index page, else a link to this
186 page will be placed on the current index page.
187
188 :param pageTitle:Title of the page.
189 :type param: str
190
191 :param index: True or False
192 :type index: Bool
193
194 :param label: ID of a label to be assigned to this page.
195 :type label: str
196
197 :return: None
198 :rtype: NoneType
199
200 """
201 if not ini.notebook:
202 if index == True:
203 # The page is a new index page
204 fileName = ini.html_prefix + 'index.html'
205 # Place link on old index page
206 href = '<li><a href="' + fileName +'">' + pageTitle + '</a></li>'
207 _insertHTML(ini.html_path + ini.html_index, href)
208 # Create the new HTML file
209 toc = '<h2>Table of contents</h2>'
210 html = _HTMLhead(pageTitle) + toc + '<ol>' + _HTMLINSERT + '</ol>' + _HTMLfoot(ini.html_index)
211 _writeFile(ini.html_path + fileName, html)
212 # Make this page the new index page
213 ini.html_index = fileName
214 else:
215 fileName = ini.html_prefix + '-'.join(pageTitle.split()) + '.html'
216 # Place link on the current index page
217 href = '<li><a href="' + fileName +'">' + pageTitle + '</a></li>'
218 _insertHTML(ini.html_path + ini.html_index, href)
219 # Create the new HTML page
220 if label != "":
221 ini.html_labels[label] = _Label(label, 'heading', fileName, pageTitle)
222 label = '<a id="' + label + '"></a>'
223 html = label + _HTMLhead(pageTitle) + _HTMLINSERT + _HTMLfoot(ini.html_index)
224 _writeFile(ini.html_path + fileName, html)
225 # Make this page the active HTML page
226 ini.html_page = fileName
227 ini.html_pages.append(fileName)
228 return
229
230def head2html(headText, label=''):
231 """

Callers 3

_checkCircuitFunction · 0.90
makeCircuitFunction · 0.90
links2htmlFunction · 0.85

Calls 5

_insertHTMLFunction · 0.85
_HTMLheadFunction · 0.85
_HTMLfootFunction · 0.85
_writeFileFunction · 0.85
_LabelFunction · 0.85

Tested by

no test coverage detected