ajout d'un index pour les pages perso
darcs-hash:20061018162513-f46e9-a8337b281092a6a060934823367325d7982cfe88.gz
This commit is contained in:
parent
ab4f97fa27
commit
ac2e43a1c9
2 changed files with 38 additions and 2 deletions
|
@ -72,16 +72,33 @@ def comptes():
|
||||||
return filter(lambda x: os.path.isdir(u"/home/%s/www" % x) and not os.path.islink(u"/home/%s/www" % x),
|
return filter(lambda x: os.path.isdir(u"/home/%s/www" % x) and not os.path.islink(u"/home/%s/www" % x),
|
||||||
os.listdir(u"/home"))
|
os.listdir(u"/home"))
|
||||||
|
|
||||||
|
|
||||||
|
def makeAnchor(letter):
|
||||||
|
return u"<div class=\"vignetteperso\"><a class=\"letter_anchor\" name=\"index_%s\"><span>%s</span></a></div>" % ( letter, letter )
|
||||||
|
|
||||||
|
def makeIndex(letter_list):
|
||||||
|
index = u''
|
||||||
|
for aLetter in letter_list:
|
||||||
|
index = u"%s<a href=\"#index_%s\">%s</a>" % ( index, aLetter, aLetter)
|
||||||
|
return u"<div class=\"alphabetic_index\">%s</div>" % index
|
||||||
|
|
||||||
def execute(macro, args):
|
def execute(macro, args):
|
||||||
dirs = comptes()
|
dirs = comptes()
|
||||||
dirs.sort()
|
dirs.sort()
|
||||||
|
|
||||||
html = u""
|
html = u""
|
||||||
|
|
||||||
|
premiere_lettre = ''
|
||||||
|
letter_list = []
|
||||||
for d in dirs:
|
for d in dirs:
|
||||||
|
if premiere_lettre != d[0]:
|
||||||
|
premiere_lettre = d[0]
|
||||||
|
letter_list.append(premiere_lettre)
|
||||||
|
html = u"%s\n%s" % ( html, makeAnchor(premiere_lettre) )
|
||||||
html = u"%s\n%s" % (html, account(d).__str__())
|
html = u"%s\n%s" % (html, account(d).__str__())
|
||||||
|
|
||||||
|
|
||||||
|
index = makeIndex(letter_list)
|
||||||
|
html = index + html
|
||||||
html += u'<br style="clear: both">'
|
html += u'<br style="clear: both">'
|
||||||
return html
|
return html
|
||||||
|
|
|
@ -24,3 +24,22 @@ div.vignetteperso img {
|
||||||
max-height:100px;
|
max-height:100px;
|
||||||
margin: auto auto auto auto;
|
margin: auto auto auto auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.vignetteperso a.letter_anchor {
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: bottom;
|
||||||
|
height:1em;
|
||||||
|
padding:0;
|
||||||
|
line-height:1em;
|
||||||
|
font-size:8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.letter_anchor span {
|
||||||
|
opacity:0.5;
|
||||||
|
//font-size:9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.alphabetic_index a{
|
||||||
|
margin:3px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue