Initialize the HTML classes Parameters: web_dir (str) -- a directory that stores the webpage. HTML file will be created at /index.html; images will be saved at <web_dir/images/ title (str) -- the webpage name refresh (int) -- how often the webs
(self, web_dir, title, refresh=0)
| 12 | """ |
| 13 | |
| 14 | def __init__(self, web_dir, title, refresh=0): |
| 15 | """Initialize the HTML classes |
| 16 | |
| 17 | Parameters: |
| 18 | web_dir (str) -- a directory that stores the webpage. HTML file will be created at <web_dir>/index.html; images will be saved at <web_dir/images/ |
| 19 | title (str) -- the webpage name |
| 20 | refresh (int) -- how often the website refresh itself; if 0; no refreshing |
| 21 | """ |
| 22 | self.title = title |
| 23 | self.web_dir = web_dir |
| 24 | self.img_dir = os.path.join(self.web_dir, 'images') |
| 25 | if not os.path.exists(self.web_dir): |
| 26 | os.makedirs(self.web_dir) |
| 27 | if not os.path.exists(self.img_dir): |
| 28 | os.makedirs(self.img_dir) |
| 29 | |
| 30 | self.doc = dominate.document(title=title) |
| 31 | if refresh > 0: |
| 32 | with self.doc.head: |
| 33 | meta(http_equiv="refresh", content=str(refresh)) |
| 34 | |
| 35 | def get_image_dir(self): |
| 36 | """Return the directory that stores images""" |
nothing calls this directly
no outgoing calls
no test coverage detected