html_furi.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #pragma once
  2. #include <furi.h>
  3. #include <furi_hal.h>
  4. /*
  5. * @brief Parse a Furigana string from an HTML tag, handling nested child tags.
  6. *
  7. * This version accepts an HTML tag as a C-string (e.g., "<p>") and searches
  8. * for the content inside the corresponding opening and closing tags within
  9. * the provided HTML string, taking into account nested occurrences of the tag.
  10. *
  11. * For example, given the HTML string:
  12. * "<p><h1><p><h1>Test</h1></p></h1></p>"
  13. * and searching with tag "<p>" the function will return:
  14. * "<h1><p><h1>Test</h1></p></h1>"
  15. *
  16. * @param tag The HTML tag to parse (including the angle brackets).
  17. * @param html The HTML string to parse (as a FuriString).
  18. * @return A newly allocated FuriString containing the parsed content,
  19. * or an empty FuriString if the tag is not found.
  20. */
  21. FuriString *html_furi_find_tag(const char *tag, FuriString *html, size_t index);
  22. /*
  23. * @brief Parse all Furigana strings from an HTML tag, handling nested child tags.
  24. * @param tag The HTML tag to parse (including the angle brackets).
  25. * @param html The HTML string to parse (as a FuriString).
  26. * @return A newly allocated FuriString containing the parsed content,
  27. * or an empty FuriString if the tag is not found.
  28. */
  29. FuriString *html_furi_find_tags(const char *tag, FuriString *html);
  30. /*
  31. * @brief Check if an HTML tag exists in the provided HTML string.
  32. * @param tag The HTML tag to search for (including the angle brackets).
  33. * @param html The HTML string to search (as a FuriString).
  34. * @param index The starting index to search from.
  35. * @return True if the tag exists in the HTML string, false otherwise.
  36. */
  37. bool html_furi_tag_exists(const char *tag, FuriString *html, size_t index);