Re: problem with title evaluation.

Bernhard Fischer <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
On Sun, Feb 20, 2005 at 12:55:24PM +0100, Bernhard Fischer wrote:
>Hi,

>2) The attached simple example barfs at the title.
>an error occured trying to evaluate the value of 'title'
>Haven't looked what went wrong yet, so i thought i quickly ask.
>
>Thanks,

[snip]
>	synopsis -v -d -f HTML -Wf,title="'foo, C implementation -- Documentation'" -o $@ $^
[snip]

Something to the effect of the attached cures it for me.
(I'm no python guru, so please fix properly).

Thanks,
eval_repr.diff (text/plain, 899 B)
diff -X /usr/src/excl -rdup trunk/Synopsis/getoptions.py Synopsis/Synopsis/getoptions.py
--- trunk/Synopsis/getoptions.py	2005-01-14 00:52:49.000000000 +0100
+++ Synopsis/Synopsis/getoptions.py	2005-02-20 14:33:19.000000000 +0100
@@ -29,9 +29,12 @@ def parse_option(arg):
          try:
             value = eval(value) # it's a python expression
          except:
-            sys.stderr.write("""an error occured trying to evaluate the value of \'%s\' (\'%s\')
+            try:
+               value = eval(repr(value)) # it's a string representation
+            except:
+               sys.stderr.write("""an error occured trying to evaluate the value of \'%s\' (\'%s\')
 to pass this as a string, please use %s="'%s'" \n"""%(name, value, name, value))
-            sys.exit(-1)
+               sys.exit(-1)
    else:
       name, value = attribute[0][2:], True # flag the attribute as 'set'
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.