Skip to content

Commit

Permalink
Added @{url} and @{hostname([url])} commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
petersirka committed Sep 3, 2024
1 parent 3b0668c commit 57ae4ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
- added a new argument `size {Number}` to the `WebSocket.on('message', function(client, msg, [size]))` event
- fixed `@{href()}` command in the ViewEngine
- improved config & resource parser by adding support for `=` between key and value and for `#` as a comment
- removed `@{url()}` method and added `@{url}` property
- added `@{hostname([url])}`

========================
0.0.5
Expand Down
5 changes: 3 additions & 2 deletions viewengine.js
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,7 @@ function View(controller) {
self.language = controller?.language || '';
self.repository = { layout: 'layout' };
self.islayout = false;
self.url = controller?.url || '';
}

View.prototype.ota = function(obj) {
Expand Down Expand Up @@ -857,9 +858,9 @@ View.prototype.section = function(name, value, replace) {
return self;
};

View.prototype.url = function(hostname = false) {
View.prototype.hostname = function(url) {
var self = this;
return hostname ? (self.controller ? self.controller.hostname(self.controller.url) : '') : (self.controller ? self.controller.url : '');
return self.controller ? self.controller.hostname(url == null ? self.controller.url : url) : (url || '');
};

View.prototype.set = function() {
Expand Down

0 comments on commit 57ae4ca

Please sign in to comment.