Hi @lbutlr,
One possible approach is with node.js and the node module html-entities
<https://github.com/mdevils/html-entities>.
Create a BBEdit Text Filter with this snippet into ~/Library/Application
Support/BBEdit/Text\ Filters/html_entities_to_xml_entities.js
#!/usr/bin/env node
const html_entities = require('html-entities');
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(text) {
let decoded = html_entities.decode(text);
let reencoded = html_entities.encode(decoded, {mode:
'nonAsciiPrintable', level: 'xml'});
process.stdout.write(reencoded);
})
In case node.js is not already installed on your system:
% brew install node
In case the node html-entities <https://github.com/mdevils/html-entities>
module in not already installed on your system:
% npm install -g html-entities
HTH
Jean Jourdain
On Wednesday, January 26, 2022 at 2:42:25 AM UTC+1 [email protected] wrote:
> Is there a way to easily convert a block of HTML text with entities in,
> like & into CDATA XML-compatible codes like &?
>
> The only thing I see in the manual for CDATA is
>
> > • Escape <CDATA>: This option controls whether BBEdit should convert
> <![CDATA[]]> sections to normal text.
>
> --
> If you have any young friends who aspire to become writers, the
> second-greatest favor you can do them is to present them with
> copies of The Elements of Style. The first-greatest, of course,
> is to shoot them now, while they're happy. -Dorothy Parker
>
>
--
This is the BBEdit Talk public discussion group. If you have a feature request
or need technical support, please email "[email protected]" rather than
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/bbedit/2840c053-470f-479f-b974-d24d027cd74fn%40googlegroups.com.