On Jul 2, 2006, at 9:22 AM, Rob Stevenson wrote:
While it's easy to insert the whole code block on all pages, I
can't quite see how to automagically turn the current page's link
into the span. It's kind of the opposite of using the #FILE#
placeholder. I suspect I need a bit of script to do this, and since
it's a common enough task, I was hoping someone had already worked
it out and would be willing to share.
You could accomplish this with an include script. Here is an example
which should get you started:
#!/usr/bin/env python
import os
import sys
file_being_updated = sys.argv[1]
filename = os.path.basename(file_being_updated)
links = [
["Prefatory", "./prefatory.html"],
["Then", "./Then/then.html"],
["Others", "./Others/others.html"],
]
print """<p class="navbarmain">"""
for (link_name, link_url) in links:
if os.path.basename(link_url) == filename:
print """<span class="here">%s</span> / """ % (link_name)
else:
print """<a href="%s">%s</a> / """ % (link_url, link_name)
print """</p>"""
--
------------------------------------------------------------------
Have a feature request? Not sure the software's working correctly?
If so, please send mail to <[EMAIL PROTECTED]>, not to the list.
List FAQ: <http://www.barebones.com/support/lists/bbedit_talk.shtml>
List archives: <http://www.listsearch.com/BBEditTalk.lasso>
To unsubscribe, send mail to: <[EMAIL PROTECTED]>