From 7a352964815c2669f487e011bcf6377247dee1dc Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Wed, 24 Apr 2024 20:06:53 +0200 Subject: Add url to the Page class This attribute is used to generate hrefs in HTML page. But it is limited only to paths ending with html extension. For example, if you have a file: test.rhtml url attribute will be: test.html But, if you have a file: test.rhtml.php url attribute will be: test.html.php At the moment, it's not possible to manage other extesnsions. --- page.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/page.rb b/page.rb index fd1daaf..40c58d0 100644 --- a/page.rb +++ b/page.rb @@ -31,11 +31,13 @@ class Page attr :category attr :master attr :baseHref + attr :url def initialize(fileName, date = nil, baseHref = nil) @fileName = fileName @date = date @baseHref = baseHref + @url = fileName.gsub(/rhtml/, 'html') parseConfig(fileName + '.config') end @@ -55,6 +57,7 @@ class Page masterPage.date = @date masterPage.classes = @classes masterPage.baseHref = @baseHref + masterPage.url = @url masterPage.content = t.result(binding) masterPage.render else @@ -102,6 +105,7 @@ class Page attr_writer :master attr_writer :content attr_writer :baseHref + attr_writer :url def initialize1 title, pageFileName, pageNames, description, date, classes, category @title = title -- cgit v1.2.3