Skip to content
Permalink
Browse files
Fixes #2078
  • Loading branch information
ralsina committed Sep 15, 2015
1 parent 256e410 commit 3de54d96e67e0df26490f8018692fd2b14dfd9e6
Showing with 7 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +6 −2 nikola/plugins/compile/rest/listing.py
@@ -19,6 +19,7 @@ Features
Bugfixes
--------

* In listings, if lexer is not specified, use literal (Issue #2078)
* Remove bogus ambiguity on listing links (Issue #2080)
* Unix-slash caused conflict in windows (Issue #2079)
* Locale is now threadsafe, avoid races in threaded builds (Issue #2071)
@@ -171,7 +171,12 @@ def run(self):
"""Run listing directive."""
_fname = self.arguments.pop(0)
fname = _fname.replace('/', os.sep)
lang = self.arguments.pop(0)
try:
lang = self.arguments.pop(0)
self.options['code'] = lang
except IndexError:
self.options['literal'] = True

if len(self.folders) == 1:
listings_folder = next(iter(self.folders.keys()))
if fname.startswith(listings_folder):
@@ -181,7 +186,6 @@ def run(self):
else:
fpath = os.path.join(fname) # must be new syntax: specify folder name
self.arguments.insert(0, fpath)
self.options['code'] = lang
if 'linenos' in self.options:
self.options['number-lines'] = self.options['linenos']
with io.open(fpath, 'r+', encoding='utf8') as fileobject:

0 comments on commit 3de54d9

Please sign in to comment.