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