Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Text.Tidy
Performs tidy on XML or HTML.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Text | 14.4 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
Input | The input text. Can be broken HTML or XML. |
"<title>test</title" // missing > | |
Options | The options as JSON object. | Optional |
Result
Returns text or error.
Description
Performs tidy on XML or HTML.Sets error log, which can be queried with Text.TidyErrorLog function.
Returns new XML or HTML back after repairing.
For options, check this website:
https://api.html-tidy.org/tidy/tidylib_api_5.8.0/tidy_quickref.html
Use XML.Colorize to apply colors if needed.
By default we apply options to use utf-8 for input and output as encoding. Line endings use Char(13) as FileMaker does and we disable the tidy mark for the html header.
Examples
Cleanup HTML:
MBS( "Text.Tidy"; "<title>Test" )
Example result:
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
</head>
<body>
</body>
</html>
Cleanup some XML:
MBS( "Text.Tidy"; "<title>Test"; "{\"output-xml\": true, \"input-xml\": true}" )
Remove comments and only body part:
MBS( "Text.Tidy"; "<p>Hello</p> <!-- hello --> <p>World</p>"; "{\"hide-comments\":1, \"show-body-only\":1}" )
Example result:
<p>Hello</p>
<p>World</p>
Perform accessibility check:
Let([
html = MBS( "Text.Tidy"; "<p>Hello</p>"; "{\"accessibility-check\":1}" );
log = MBS("Text.TidyErrorLog")
]; log)
Example result:
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: inserting implicit <body>
Accessibility Checks:
line 1 column 1 - Warning: inserting missing 'title' element
Info: Document content looks like HTML5
Tidy found 3 warnings and 0 errors!
Perform cleanup of HTML fragment:
MBS( "Text.Tidy"; "<p><i>Hello <b>World</p>"; "{\"show-body-only\":1}" )
Example result: <p><i>Hello <b>World</b></i></p>
See also
Release notes
- Version 14.4
- Added Text.Tidy and Text.TidyErrorLog functions to tidy XML and HTML.
Blog Entries
- New in MBS FileMaker Plugin 14.4
- Neues MBS Plugin 14.4 für Claris FileMaker
- MBS Plugin 14.4 for Claris FileMaker
- MBS FileMaker Plugin, version 14.4pr1
This function checks for a license.
Created 21st July 2024, last changed 25th October 2024