How to use the fontbakery.checks.check_DESCRIPTION_is_propper_HTML_snippet function in fontbakery

To help you get started, we’ve selected a few fontbakery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlefonts / fontbakery / bin / fontbakery-check-description.py View on Github external
continue

  if len(files_to_check) == 0:
    print("ERROR: None of the specified files "
          "seem to be valid DESCRIPTION files.")
    exit(-1)

  for f in files_to_check:
    try:
      contents = open(f).read()
    except:
      print("ERROR: File '{}' does not exist.".format(f))
      continue

    checks.check_DESCRIPTION_file_contains_no_broken_links(fb, contents)
    checks.check_DESCRIPTION_is_propper_HTML_snippet(fb, f)
    checks.check_DESCRIPTION_min_length(fb, f)
    checks.check_DESCRIPTION_max_length(fb, f)
    fb.output_report(f)
github googlefonts / fontbakery / bin / fontbakery-check-ttf.py View on Github external
" are valid TrueType files!\n"
                  "Aborting.")
    sys.exit(-1)

  print (("Fontbakery will check the following files:\n\t"
          "{}\n\n").format("\n\t".join(fonts_to_check)))

  # This expects all fonts to be in the same folder:
  family_dir = os.path.split(fonts_to_check[0])[0]

  # Perform a few checks on DESCRIPTION files

  descfilepath = os.path.join(family_dir, "DESCRIPTION.en_us.html")
  if os.path.exists(descfilepath):
    fb.default_target = descfilepath
    checks.check_DESCRIPTION_is_propper_HTML_snippet(fb, descfilepath)

# DC This is definitely not step 1, cross-family comes after individual
# in order that individual hotfixes can enable cross-family checks to pass
###########################################################################
## Step 1: Cross-family tests
##         * Validates consistency of data throughout all TTF files
##           in a given family
##         * The list of TTF files in infered from the METADATA.pb file
##         * We avoid testing the same family twice by deduplicating the
##           list of METADATA.pb files first
###########################################################################

  metadata_to_check = []
  for target in fonts_to_check:
    metadata = os.path.join(family_dir, "METADATA.pb")
    if not os.path.exists(metadata):
github googlefonts / fontbakery / bin / fontbakery-check-ttf.py View on Github external
sys.exit(-1)

  print (("Fontbakery will check the following files:\n\t"
          "{}\n\n").format("\n\t".join(fonts_to_check)))

  # This expects all fonts to be in the same folder:
  family_dir = os.path.split(fonts_to_check[0])[0]

  # Perform a few checks on DESCRIPTION files

  descfilepath = os.path.join(family_dir, "DESCRIPTION.en_us.html")
  if os.path.exists(descfilepath):
    fb.default_target = descfilepath
    contents = open(descfilepath).read()
    checks.check_DESCRIPTION_file_contains_no_broken_links(fb, contents)
    checks.check_DESCRIPTION_is_propper_HTML_snippet(fb, descfilepath)
    checks.check_DESCRIPTION_max_length(fb, descfilepath)
    checks.check_DESCRIPTION_min_length(fb, descfilepath)

  checks.check_all_files_in_a_single_directory(fb, fonts_to_check)

  registered_vendor_ids = fetch_vendorID_list(logging)

# DC This is definitely not step 1, cross-family comes after individual
# in order that individual hotfixes can enable cross-family checks to pass
###########################################################################
## Step 1: Cross-family tests
##         * Validates consistency of data throughout all TTF files
##           in a given family
##         * The list of TTF files in infered from the METADATA.pb file
##         * We avoid testing the same family twice by deduplicating the
##           list of METADATA.pb files first