Now the cms.ini resolves variable ${abc} ... and key is case insensitive

This commit is contained in:
Jocelyn Fiat
2013-02-15 19:00:05 +01:00
parent c62ad33ddc
commit a97235c7b7
3 changed files with 59 additions and 8 deletions

View File

@@ -4,5 +4,5 @@ site.email=your@email.com
root-dir=../www
var-dir=var
files-dir=files
themes-dir=../www/themes
theme=test
themes-dir=${root-dir}/themes
#theme=test

View File

@@ -25,9 +25,20 @@ feature {NONE} -- Initialization
make
configuration_location := a_filename
import (a_filename)
resolve
analyze
end
resolve
-- Resolve options related to variable ${..}
do
across
options as c
loop
options.replace (resolved_string (c.item), c.key)
end
end
analyze
do
get_root_location
@@ -42,7 +53,7 @@ feature -- Access
option (a_name: READABLE_STRING_GENERAL): detachable ANY
do
Result := options.item (a_name.as_string_8)
Result := options.item (a_name.as_string_8.as_lower)
end
options: HASH_TABLE [STRING, STRING]
@@ -242,4 +253,43 @@ feature {NONE} -- Environment
create Result
end
resolved_string (s: READABLE_STRING_8): STRING
-- Resolved `s' using `options' or else environment variables.
local
i,n,b,e: INTEGER
k: detachable READABLE_STRING_8
do
from
i := 1
n := s.count
create Result.make (s.count)
until
i > n
loop
if i + 1 < n and then s[i] = '$' and then s[i+1] = '{' then
b := i + 2
e := s.index_of ('}', b) - 1
if e > 0 then
k := s.substring (b, e)
if attached option (k) as v then
Result.append (v.out)
i := e + 1
elseif attached execution_environment.get (k) as v then
Result.append (v)
i := e + 1
else
Result.extend (s[i])
end
else
Result.extend (s[i])
end
else
Result.extend (s[i])
end
i := i + 1
end
end
end

View File

@@ -70,9 +70,10 @@ div#main-wrapper {
}
div#main { margin: 0; padding: 0; clear: both; height:0; display: block; }
div#content { padding: 5px 3px 5px 20px;
div#content {
padding: 5px 3px 5px 20px;
margin-top: 10px;
min-width: 80%;
min-width: 60%;
display: inline;
float: left;
position: relative;
@@ -81,7 +82,7 @@ div#content { padding: 5px 3px 5px 20px;
}
div#first_sidebar {
width: 200px;
width: 20%;
margin: 5px;
padding: 5px;
display: inline;
@@ -89,11 +90,11 @@ div#first_sidebar {
position: relative;
}
div#second_sidebar {
width: 100px;
width: 20%;
margin: 5px;
padding: 5px;
display: inline;
float: right;
float: left;
position: relative;
background-color: #eee;
}