Skip to content

Commit da80804

Browse files
committedSep 15, 2015
merged master
2 parents 8845dfd + 4e0142b commit da80804

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed
 

‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Bugfixes
2121

2222
* Look for bundle assets also in output/, allowing bundling of files
2323
created by plugins (Issue #1370)
24+
* In listings, if lexer is not specified, use literal (Issue #2078)
2425
* Remove bogus ambiguity on listing links (Issue #2080)
2526
* Unix-slash caused conflict in windows (Issue #2079)
2627
* Locale is now threadsafe, avoid races in threaded builds (Issue #2071)

‎nikola/plugins/compile/rest/listing.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,12 @@ def run(self):
171171
"""Run listing directive."""
172172
_fname = self.arguments.pop(0)
173173
fname = _fname.replace('/', os.sep)
174-
lang = self.arguments.pop(0)
174+
try:
175+
lang = self.arguments.pop(0)
176+
self.options['code'] = lang
177+
except IndexError:
178+
self.options['literal'] = True
179+
175180
if len(self.folders) == 1:
176181
listings_folder = next(iter(self.folders.keys()))
177182
if fname.startswith(listings_folder):
@@ -181,7 +186,6 @@ def run(self):
181186
else:
182187
fpath = os.path.join(fname) # must be new syntax: specify folder name
183188
self.arguments.insert(0, fpath)
184-
self.options['code'] = lang
185189
if 'linenos' in self.options:
186190
self.options['number-lines'] = self.options['linenos']
187191
with io.open(fpath, 'r+', encoding='utf8') as fileobject:

0 commit comments

Comments
 (0)
Please sign in to comment.