docstr: Create HTML for card item in tab tabname; can return empty string if the item is not meant to be shown.
code: def create_html_for_item(self, item, tabname):
      """
      Create HTML for card item in tab tabname; can return empty string if the item is not meant to be shown.
      """
  
      preview = item.get("preview", None)
  
      onclick = item.get("onclick", None)
      if onclick is None:
          onclick = (
              '"'
              + html.escape(
                  f"""return cardClicked({quote_js(tabname)}, {item["prompt"]}, {"true" if self.allow_negative_prompt else "false"})"""
              )
              + '"'
          )
  
      height = (
          f"height: {shared.opts.extra_networks_card_height}px;"
          if shared.opts.extra_networks_card_height
          else ""
      )
      width = (
          f"width: {shared.opts.extra_networks_card_width}px;"
          if shared.opts.extra_networks_card_width
          else ""
      )
      background_image = (
          f'<img src="{html.escape(preview)}" class="preview" loading="lazy">'
          if preview
          else ""
      )
      metadata_button = ""
      metadata = item.get("metadata")
      if metadata:
          metadata_button = f"<div class='metadata-button card-button' title='Show internal metadata' onclick='extraNetworksRequestMetadata(event, {quote_js(self.name)}, {quote_js(html.escape(item['name']))})'></div>"
  
      edit_button = f"<div class='edit-button card-button' title='Edit metadata' onclick='extraNetworksEditUserMetadata(event, {quote_js(tabname)}, {quote_js(self.id_page)}, {quote_js(html.escape(item['name']))})'></div>"
  
      local_path = ""
      filename = item.get("filename", "")
      for reldir in self.allowed_directories_for_previews():
          absdir = os.path.abspath(reldir)
  
          if filename.startswith(absdir):
              local_path = filename[len(absdir) :]
  
      # if this is true, the item must not be shown in the default view, and must instead only be
      # shown when searching for it
      if shared.opts.extra_networks_hidden_models == "Always":
          search_only = False
      else:
          search_only = "/." in local_path or "\\." in local_path
  
      if (
          search_only
          and shared.opts.extra_networks_hidden_models == "Never"
      ):
          return ""
  
      sort_keys = " ".join(
          [
              f'data-sort-{k}="{html.escape(str(v))}"'
              for k, v in item.get("sort_keys", {}).items()
          ]
      ).strip()
  
      args = {
          "background_image": background_image,
          "style": f"'display: none; {height}{width}; font-size: {shared.opts.extra_networks_card_text_scale*100}%'",
          "prompt": item.get("prompt", None),
          "tabname": quote_js(tabname),
          "local_preview": quote_js(item["local_preview"]),
          "name": html.escape(item["name"]),
          "description": (
              item.get("description") or ""
              if shared.opts.extra_networks_card_show_desc
              else ""
          ),
          "card_clicked": onclick,
          "save_card_preview": '"'
          + html.escape(
              f"""return saveCardPreview(event, {quote_js(tabname)}, {quote_js(item["local_preview"])})"""
          )
          + '"',
          "search_term": item.get("search_term", ""),
          "metadata_button": metadata_button,
          "edit_button": edit_button,
          "search_only": " search_only" if search_only else "",
          "sort_keys": sort_keys,
      }
  
      return self.card_page.format(**args)
  
imports: import functools
  import os.path
  import urllib.parse
  from pathlib import Path
  from modules import shared, ui_extra_networks_user_metadata, errors, extra_networks
  from modules.images import read_info_from_image, save_image_with_geninfo
  import gradio
  import json
  import html
  from fastapi.exceptions import HTTPException
  from modules.generation_parameters_copypaste import image_from_url_text
  from modules.ui_components import ToolButton
label_desc: Use image node_id 10 for calling the ExtraNetworksPage obj's underlying member method code with example usage: obj.create_html_for_item(item, tabname) and returns: self, str