Skip to content

Commit b4629cd

Browse files
committed
Make compatible with xp-forge/mustache 9.0.0
1 parent fbc035d commit b4629cd

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ HandleBars change log
33

44
## ?.?.? / ????-??-??
55

6+
* Refactored template loading to no longer use deprecated functionality
7+
from the `xp-forge/mustache` library, making it compatible with its
8+
newest major release
9+
(@thekid)
10+
611
## 9.5.0 / 2025-03-02
712

813
* Merged PR #31: Make `withTemplates()` accept folder references and in-

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"keywords": ["module", "xp"],
88
"require" : {
99
"xp-framework/core": "^12.0 | ^11.0 | ^10.0",
10-
"xp-forge/mustache": "^8.2",
10+
"xp-forge/mustache": "^9.0 | ^8.2",
1111
"xp-framework/logging": "^11.0 | ^10.0 | ^9.1",
1212
"php" : ">=7.0.0"
1313
},

src/main/php/com/handlebarsjs/Templates.class.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<?php namespace com\handlebarsjs;
22

3-
use com\github\mustache\templates\{Compiled, NotFound, Source, Tokens};
3+
use com\github\mustache\templates\{Compiled, NotFound, Source, InString, Templates as Base};
44
use com\github\mustache\{Node, Template, TemplateListing};
55
use lang\ClassLoader;
66
use text\StringTokenizer;
77

88
/**
99
* Template loading implementation
1010
*
11-
* @test xp://com.handlebarsjs.unittest.TemplatesTest
11+
* @test com.handlebarsjs.unittest.TemplatesTest
1212
*/
13-
class Templates extends \com\github\mustache\templates\Templates {
13+
class Templates extends Base {
1414
private static $composite= null;
1515
private $templates= [];
1616
private $delegate;
@@ -42,7 +42,7 @@ public function register($name, $content) {
4242
} else if ($content instanceof Node) {
4343
$this->templates[$name]= new Compiled(new Template($name, $content));
4444
} else {
45-
$this->templates[$name]= new Tokens($name, new StringTokenizer($content));
45+
$this->templates[$name]= new InString($name, (string)$content);
4646
}
4747

4848
return $previous;
@@ -56,7 +56,7 @@ public function register($name, $content) {
5656
* @return com.github.mustache.templates.Source
5757
*/
5858
public function tokens($content, $name= '(string)') {
59-
return new Tokens($name, new StringTokenizer((string)$content));
59+
return new InString($name, (string)$content);
6060
}
6161

6262
/**

0 commit comments

Comments
 (0)