aboutsummaryrefslogtreecommitdiff
path: root/page.rb
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2024-04-24 20:06:53 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2024-04-25 11:33:30 +0200
commit7a352964815c2669f487e011bcf6377247dee1dc (patch)
treea650cd3340bcb490f49a7175a1291a1ab875c3c5 /page.rb
parent23896dda4f3e22de6163f43cda0ad5db73b5a09b (diff)
downloadhyde-7a352964815c2669f487e011bcf6377247dee1dc.tar.gz
hyde-7a352964815c2669f487e011bcf6377247dee1dc.zip
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.
Diffstat (limited to 'page.rb')
-rw-r--r--page.rb4
1 files changed, 4 insertions, 0 deletions
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