Sindbad~EG File Manager
3
���]�$ � @ s� d Z ddlZddlZddlZdZdZddd�ZG dd� de�ZG d d
� d
e �Z
G dd� de �ZG d
d� de �Ze
dkr�ddlZejej Zejed�Zee� ejejdk� dS )a@
asciidocapi - AsciiDoc API wrapper class.
The AsciiDocAPI class provides an API for executing asciidoc. Minimal example
compiles `mydoc.txt` to `mydoc.html`:
import asciidocapi
asciidoc = asciidocapi.AsciiDocAPI()
asciidoc.execute('mydoc.txt')
- Full documentation in asciidocapi.txt.
- See the doctests below for more examples.
Doctests:
1. Check execution:
>>> import io
>>> infile = io.StringIO('Hello *{author}*')
>>> outfile = io.StringIO()
>>> asciidoc = AsciiDocAPI()
>>> asciidoc.options('--no-header-footer')
>>> asciidoc.attributes['author'] = 'Joe Bloggs'
>>> asciidoc.execute(infile, outfile, backend='html4')
>>> print(outfile.getvalue())
<p>Hello <strong>Joe Bloggs</strong></p>
>>> asciidoc.attributes['author'] = 'Bill Smith'
>>> infile = io.StringIO('Hello _{author}_')
>>> outfile = io.StringIO()
>>> asciidoc.execute(infile, outfile, backend='docbook')
>>> print(outfile.getvalue())
<simpara>Hello <emphasis>Bill Smith</emphasis></simpara>
2. Check error handling:
>>> import io
>>> asciidoc = AsciiDocAPI()
>>> infile = io.StringIO('---------')
>>> outfile = io.StringIO()
>>> asciidoc.execute(infile, outfile)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "asciidocapi.py", line 189, in execute
raise AsciiDocError(self.messages[-1])
AsciiDocError: ERROR: <stdin>: line 1: [blockdef-listing] missing closing delimiter
Copyright (C) 2009 Stuart Rackham. Free use of this software is granted
under the terms of the GNU General Public License (GPL).
� Nz0.1.2z8.4.1c C sR |dkrt jjdd�}x6|jt j�D ]"}t jj|| �}t jj|�r$|S q$W dS dS )z=
Find file fname in paths. Return None if not found.
N�PATH� )�os�environ�get�split�pathsep�path�join�isfile)�fnamer �dirZfpath� r �!/usr/lib/python3.6/asciidocapi.py�find_in_path<