Use explicitly relative paths when sourcing now that . is not in path
Add comment about perf issues with menu()
This commit is contained in:
parent
9139cdafc6
commit
bdf9922a24
4 changed files with 25 additions and 22 deletions
18
bin/fproc_cache.rc
Executable file
18
bin/fproc_cache.rc
Executable file
|
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/env rc
|
||||
#. 9.rc # Not really needed when calling from werc, only would be needed if you use fproc_cache.rc standalone
|
||||
|
||||
proc=$1
|
||||
|
||||
tmpfile=/tmp/fmttmp.$pid
|
||||
score=`{{tee $tmpfile || exit 1} | sha1sum}
|
||||
|
||||
cachedir=/tmp/fproc_cache/$score
|
||||
mkdir -p $cachedir >[2]/dev/null
|
||||
|
||||
if(test -f $cachedir/$proc)
|
||||
cat $cachedir/$proc
|
||||
if not {
|
||||
$proc < $tmpfile | tee $cachedir/$pid
|
||||
mv $cachedir/$pid $cachedir/$proc
|
||||
}
|
||||
rm $tmpfile >[2]/dev/null
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
#!/usr/bin/env rc
|
||||
. 9.rc
|
||||
|
||||
cachedir=/tmp/md_cache
|
||||
mkdir -p $cachedir >[2]/dev/null
|
||||
|
||||
tmpfile=$cachedir/mdtmp.$pid
|
||||
score=`{{tee $tmpfile || exit 1} | sha1sum}
|
||||
cachefile=$cachedir/$score
|
||||
|
||||
if(test -f $cachefile)
|
||||
cat $cachefile
|
||||
if not {
|
||||
markdown.pl < $tmpfile | tee $cachefile.$pid
|
||||
mv $cachefile.$pid $cachefile
|
||||
}
|
||||
rm $tmpfile >[2]/dev/null
|
||||
|
|
@ -30,6 +30,8 @@ fn hide_paths {
|
|||
}
|
||||
|
||||
# Sidebar
|
||||
# PERF: menu takes ~30% of werc's runtime, even for top level pages.
|
||||
# Maybe a combination of du -a/find|sort could let us avoid the recursive awk calls...
|
||||
fn menu {
|
||||
ls -F $1 | sed $dirfilter | awk -F/ '
|
||||
BEGIN { print "<ul class=\"side-bar\">" }
|
||||
|
|
@ -234,10 +236,10 @@ baseuri=http://$site/
|
|||
for(i in siteTitle siteSubTitle pageTitle extraHeaders)
|
||||
$i = ''
|
||||
|
||||
. etc/initrc
|
||||
. ./etc/initrc
|
||||
|
||||
if(test -f etc/initrc.local)
|
||||
. etc/initrc.local
|
||||
. ./etc/initrc.local
|
||||
|
||||
|
||||
# Parse request URL
|
||||
|
|
@ -275,7 +277,7 @@ for (i in ('' $args)) {
|
|||
}
|
||||
|
||||
if (test -f $fpath/_werc/config)
|
||||
. $fpath/_werc/config
|
||||
. ./$fpath/_werc/config
|
||||
|
||||
if (~ $#blogDirs 0 && ~ $#inBlog 0 && ~ $i [Bb]log)
|
||||
inBlog = 'yes'
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
plan9port=$PLAN9
|
||||
|
||||
# Path, make sure the plan9port /bin directory is included before /bin
|
||||
path=($plan9port/bin/ ./bin/ /bin/ /usr/bin/)
|
||||
path=($plan9port/bin/ ./bin/ /bin/ /usr/bin/ ./bin/contrib/)
|
||||
|
||||
# Directory where your site(s) live ($site here is your domain name, eg., example.com)
|
||||
sitedir=sites/$site
|
||||
|
|
@ -22,7 +22,7 @@ sitedir=sites/$site
|
|||
# configuration markdown.pl, that caches output)
|
||||
# Note that some werc components assume a markdown-like formatter, but all
|
||||
# major functionality should should be formatter agnostic.
|
||||
formatter=(fproc_cache.rc bin/contrib/markdown.pl)
|
||||
formatter=(fproc_cache.rc markdown.pl)
|
||||
|
||||
# Enable debugging, to disable set to ()
|
||||
debug=true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue