Skip to content
This repository has been archived by the owner on Dec 20, 2023. It is now read-only.

Commit

Permalink
Fixes regression with stripping whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jensscherbl committed Mar 4, 2023
1 parent ca49b6f commit aa8c2d5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "kenshodigital/kirby-xhtml",
"description": "Ensures well-formed XHTML output for Kirby templates.",
"type": "kirby-plugin",
"version": "2.0.0",
"version": "2.0.1",
"homepage": "https://github.com/kenshodigital/kirby-xhtml",
"license": "MIT",
"authors":
Expand Down
7 changes: 5 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Kenshō\XHTML;

use DOMDocument;
use DOMImplementation;
use Kirby\Cms\App;

Expand All @@ -28,11 +29,13 @@
$document = $dom->createDocument(null, '', $doctype);
$document->xmlVersion = '1.0';
$document->encoding = 'utf-8';
$document->preserveWhiteSpace = false;
$fragment = $document->createDocumentFragment();

$fragment->appendXML($html);
$document->appendChild($fragment);
$xml = $document->saveXML();
$document = new DOMDocument('1.0', 'utf-8');
$document->preserveWhiteSpace = false;
$document->loadXML($xml);

App::instance()->response()->type('application/xhtml+xml');

Expand Down

0 comments on commit aa8c2d5

Please sign in to comment.