Stuart Rackham <[email protected]> writes:
> On 07/09/10 01:11, Phillip Lord wrote:
>>
>>
>>
>> I have a two part question with respect to blogpost. First, I'd like to
>> be able to get the output from the asciidoc invocation through to the
>> command line. Currently, I think, it's getting swallowed somewhere,
>> in the asciidocapi.py calls
>
> Yes.
>
>
>>
>> Second, the reason that I am doing this, is that I want to add an
>> additional configuration file into the asciidoc invocation. Normally I
>> want to do this on a per-blog basis; I can't add in "-f blog.conf"
>> command line options to asciidoc (not blogpost!), in the way that I
>> used to in the past. I thought to patch blogpost to achieve this.
>> Currently, it's not working, and I don't know why, because I can't see
>> the results of the asciidoc invocation!
>
> It would make sense to be able to pass --verbose to asciidoc if you used the
> blogpost --verbose option -- I've just committed an update to do this:
> http://code.google.com/p/blogpost/source/detail?r=7e465dcd79e4110b25f0da7261e81fa7fafe2ed9

Good stuff. Having to specify twice had me confused for a bit, but then
I read the docs. 

> Passing asciidoc options would also be nice --asciidoc-opts=ASCIIDOC_OPTS 
> c.f. a2x


Would something like this do the trick? It seems to work in my hands. 


changeset:   89:1da48f83d7df
tag:         tip
user:        Phillip Lord <[email protected]>
date:        Tue Sep 07 12:31:50 2010 +0100
summary:     Support for the passing of asciidoc options from blogpost command 
line.

diff -r dbd30d960339 -r 1da48f83d7df blogpost.py
--- a/blogpost.py       Tue Sep 07 11:42:18 2010 +0100
+++ b/blogpost.py       Tue Sep 07 12:31:50 2010 +0100
@@ -209,6 +209,14 @@
         asciidoc.options('--doctype', self.doctype)
         if OPTIONS.verbose > 1:
             asciidoc.options('--verbose')
+        if( OPTIONS.asciidoc_opts ):
+            for i in OPTIONS.asciidoc_opts:
+                infomsg( 'setting option for asciidoc: %s' % i )
+                split = i.partition( " " )
+                if( split[ 2 ] ):
+                    asciidoc.options( split[ 0 ], split[ 2 ] )
+                else:
+                    asciidoc.options( split[ 0 ] )
         outfile = StringIO.StringIO()
         asciidoc.execute(self.blog_file, outfile, backend='wordpress')
         result = outfile.getvalue()
@@ -693,6 +701,9 @@
     parser.add_option('-v', '--verbose',
         action='count', dest='verbose', default=0,
         help='increase verbosity')
+    parser.add_option('--asciidoc-opts',
+        action='append',dest='asciidoc_opts', default=[],
+        metavar='ASCIIDOC_OPTIONS', help='asciidoc options')
     if len(sys.argv) == 1:
         parser.parse_args(['--help'])
     OPTIONS, args = parser.parse_args()
diff -r dbd30d960339 -r 1da48f83d7df doc/blogpost.1.txt
--- a/doc/blogpost.1.txt        Tue Sep 07 11:42:18 2010 +0100
+++ b/doc/blogpost.1.txt        Tue Sep 07 12:31:50 2010 +0100
@@ -56,6 +56,10 @@
 
 OPTIONS
 -------
+*--asciidoc-options='OPTION'::
+  Specifies an OPTION to be passed to the underlying 'asciidoc(1)' invocation. 
+  For options with arguments OPTION should be quoted. 
+
 *-a, --attributes*='ATTRIBUTES'::
   Specifies a comma separated list of one or more weblog parameters
   that must be defined in the 'BLOG_FILE'. If this option is not

-- 
You received this message because you are subscribed to the Google Groups 
"asciidoc" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/asciidoc?hl=en.

Reply via email to