Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixes #2078
  • Loading branch information
ralsina committed Sep 15, 2015
1 parent 256e410 commit 3de54d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -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)
Expand Down
8 changes: 6 additions & 2 deletions nikola/plugins/compile/rest/listing.py
Expand Up @@ -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):
Expand All @@ -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:
Expand Down

0 comments on commit 3de54d9

Please sign in to comment.