Hello,
With the new <definevar> resource file tag of 2.0a1 and the
<include> tag it is (painful but) possible to define
list specific values for custom variables while sharing
one main resource file for different archives. To make user
defined variables handling easier I added a -uservars
option to mhonarc.
E.g., with
mhonarc -rcfile .shared.rc \
-uservars "LIST=>'TestList', SMILE=>':-)'" \
...
and a resource file .shared.rc:
<-- Should not the sub get_elem_content chomp the last newline? -->
<-- \n after the last 'la' is stored in .mhonarc.db! -->
<definevar>
TITLEPOSTFIX
bla bla
la la
</definevar>
<ttitle>
$LIST$ Archive. Threaded ($TITLEPOSTFIX$) $SMILE$
</ttitle>
Gives a thread.html title "TestList Archive. Threaded (bla bla la la) :-)".
Using -uservars instead of <include> has the additional advantage that
the values defined by -uservars are stored in .mhonarc.db itself and
therefore the archive does not depend on other files resource
files as with <include>.
The allowed <string> values for -usersvars are that of a perl list
without surrounding '(' ')':
"'LIST','name','MYKEY','MYVALUE'" # for perl4/5
"LIST => 'name', MYKEY => 'MYVALUE'" # only perl5
[this is due to perl code: eval "%hash = "($uservars, %hash)" ]
Could this feature be added the next release/snapshot?
Thanks,
Achim
P.S. The patch line numbers and that of 2.0a1 may be different
due to other local hacks.
--- mhonarc 1996/09/24 21:53:21 1.2
+++ mhonarc 1996/09/26 00:16:00
@@ -135,6 +135,7 @@
"tlevels=i", # Maximum # of nested lists in threaded index
"treverse", # List most recent thread first
"umask=i", # Set umask of process
+ "uservars=s", # add this list to the user defined variables
"v", # Version information
"help" # A brief usage message
@@ -348,6 +349,11 @@
$MULTIIDX = 0 if $IDXONLY;
+ # add usersvars to the hash of hash Custom Vars from the rcfile
+ if (defined($opt_uservars)) {
+ eval "%CustomRcVars = ($opt_uservars, %CustomRcVars)";
+ }
+
## Set umask
if ($UNIX) {
$UMASK = $opt_umask if $opt_umask;
@@ -2107,6 +2113,8 @@
-ttitle <string> : Title of thread index page
(def: "Mail Thread Index")
-umask <umask> : Umask of MHonArc process (Unix only)
+ -uservars <string> : list of key value pairs to _add_ to the list of
+ custom variables.
-v : Print version information
Description: