Skip to content

Commit

Permalink
fix temp
Browse files Browse the repository at this point in the history
  • Loading branch information
fnwinter committed Sep 29, 2024
1 parent 2d9fc03 commit 505d376
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 25 deletions.
4 changes: 2 additions & 2 deletions cnas/genhtml/navibar_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ def set_menu(self, drop_menu):
self.drop_list = []
for _title, _url in drop_menu.items():
if _url == "divider":
self.drop_list.append(hr(class_="'navbar-divider'"))
self.drop_list.append(hr(class_="navbar-divider"))
else:
_anchor = anchor(class_="'navbar-item'", href=f"'{_url}'")
_anchor = anchor(class_="navbar-item", href=f"{_url}")
_anchor.set_content(_title)
self.drop_list.append(_anchor)

Expand Down
13 changes: 8 additions & 5 deletions cnas/genhtml/photo_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ def __init__(self, *args, **kwargs):

image_file = kwargs.get("src")
file_path = kwargs.get("path")
file_type = kwargs.get("type")
file_type = kwargs.get("type_")

div_id = ""
if file_type == "folder":
div_id = ""
display_class = "display:visible;"
else:
div_id = f"photo_{photo_builder.auto_index}"
Expand All @@ -35,16 +35,19 @@ def __init__(self, *args, **kwargs):
content=f"{file_path}"),
id_=f"{div_id}",
class_="box is-align-content-center",
style=f"{display_class} width:100%;"\
style=f"{display_class} width:100%; "\
f"background-color:rgba(0,0,0,0.6);",

),
class_="image is-squre div-bottom",
class_="image is-square div-bottom",
),
data_target=f"{div_id}",
data_path=f"{file_path}",
class_=f"column is-one-quarter modal-button"\
class_=f"column is-one-quarter modal-button "\
f"js-modal-trigger hoverArea {file_type}"
)

self.append(_div)

def __str__(self):
return super().__str__() + "\n"
17 changes: 6 additions & 11 deletions cnas/genhtml/w3c/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,11 @@ def set_tag(self, tag_, is_void_element = False):
self._is_void_element = is_void_element
return self

def safe_value(self, value):
if " " in value:
return f"'{value}'"
return value

def safe_key(self, key):
def safe_key(self, key_):
reserved_ = ["class_", "type_", "id_"]
if key in reserved_:
key = key[:-1]
return key
if key_ in reserved_:
key_ = key_[:-1]
return key_

def make_element(self):
if self._tag == "":
Expand All @@ -76,8 +71,8 @@ def make_element(self):
# if key is reserved python keyword,
# remove the underscore at the end of the keyword.
__key = self.safe_key(_key)
__value = self.safe_value(_value)
_attr += f" {__key}={__value}"
_attr += f" {__key}='{_value}'"
print(f" {__key}='{_value}'")

if self._is_void_element:
self._open_tag = f"<{self._tag} {_attr} />"
Expand Down
4 changes: 2 additions & 2 deletions cnas/pages/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
</article>
"""

__CONTENT_STYLE__ = "'display: flex;justify-content: center;"\
"align-items: center;text-align: center;height: 78vh;'"
__CONTENT_STYLE__ = "display: flex;justify-content: center;"\
"align-items: center;text-align: center;height: 78vh;"

class error(page):
def __init__(self, error_message):
Expand Down
10 changes: 5 additions & 5 deletions cnas/pages/gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def get_files(self):
self.files.append(
photo_builder(
src="static/images/up.png",
path="..", style="folder"))
path="..", type_="folder"))

# folder
for _folder in os.listdir(self.current_path):
Expand All @@ -71,7 +71,7 @@ def get_files(self):
photo_builder(
src="static/images/folder.png",
path=_folder,
style="folder"))
type_="folder"))

# images
for _file in os.listdir(self.current_path):
Expand All @@ -85,16 +85,16 @@ def get_files(self):
photo_builder(
src="gallery_thumbnail/" + _rel_file,
path=_file,
style="picture"))
type_="picture"))
else:
self.files.append(
photo_builder(src="static/images/no_cache.png"))


def __str__(self):
_title_div = div(
para(class_="'title is-1 is-spaced'").set_content("Gallery"),
para(class_="'subtitle is-3'").set_content(f"/gallery/{self.r_path}"),
para(class_="title is-1 is-spaced").set_content("Gallery"),
para(class_="subtitle is-3").set_content(f"/gallery/{self.r_path}"),
br()
)

Expand Down

0 comments on commit 505d376

Please sign in to comment.