diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 000000000..b73024f83 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +git+https://github.com/fabpot/sphinx-php.git@52f7bd2216cc22ef52494f346c5643bb2a74513f#egg=sphinx-php diff --git a/source/conf.py b/source/conf.py index d527d1039..51e4e1e77 100644 --- a/source/conf.py +++ b/source/conf.py @@ -28,10 +28,15 @@ if not on_rtd: sys.path.append(os.path.abspath('./../_exts/sphinx-php')) - # adding PhpLexer +# adding PhpLexer +try: from sphinx.highlighting import lexers from pygments.lexers.compiled import CLexer from pygments.lexers.web import PhpLexer + php_lexer_available = True +except ImportError: + php_lexer_available = False + print('specific import not available') # -- General configuration ------------------------------------------------ @@ -46,13 +51,33 @@ extensions = [ 'sphinx.ext.todo', ] -if not on_rtd: - extensions += [ - 'sensio.sphinx.refinclude', - 'sensio.sphinx.configurationblock', - 'sensio.sphinx.phpcode', - 'sensio.sphinx.bestpractice', - ] +try: + import sensio.sphinx.refinclude +except ImportError: + print('sensio.sphinx.refinclude is not available') +else: + extensions += ['sensio.sphinx.refinclude'] + +try: + import sensio.sphinx.configurationblock +except ImportError: + print('sensio.sphinx.configurationblock is not available') +else: + extensions += ['sensio.sphinx.configurationblock'] + +try: + import sensio.sphinx.phpcode +except ImportError: + print('sensio.sphinx.phpcode') +else: + extensions += ['sensio.sphinx.phpcode'] + +try: + import sensio.sphinx.bestpractice +except ImportError: + print('sensio.sphinx.bestpractice is not avaialble') +else: + extensions += ['sensio.sphinx.bestpractice'] #add configuration for api url @@ -122,7 +147,7 @@ pygments_style = 'sphinx' #keep_warnings = False # -- Settings for symfony doc extension --------------------------------------------------- -if not on_rtd: +if php_lexer_available: # enable highlighting for PHP code not between ```` by default lexers['php'] = PhpLexer(startinline=True) lexers['php-annotations'] = PhpLexer(startinline=True)