Skip to content

Commit

Permalink
baby steps towards normalcy
Browse files Browse the repository at this point in the history
  • Loading branch information
Roberto Alsina committed May 5, 2017
1 parent 3e4ad02 commit 33abf6d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion nikola/shortcodes.py
Expand Up @@ -231,7 +231,7 @@ def extract_shortcodes(data):
new_data.append(chunk[1])
elif chunk[0] == 'SHORTCODE_START':
if in_sc: # Previous sc doesn't close
sc_id = str(uuid.uuid4())
sc_id = str('SHORTCODE{0}REPLACEMENT'.format(str(uuid.uuid4()).replace('-', '')))
new_data.append(sc_id)
shortcodes[sc_id] = buffer[0][1]
for c in buffer[1:]: # Dump buffered text
Expand All @@ -246,6 +246,13 @@ def extract_shortcodes(data):
new_data.append(sc_id)
shortcodes[sc_id] = ''.join(x[1] for x in buffer)
in_sc = False
# Whatever is left in the buffer goes in the text
if in_sc: # Previous sc doesn't close
sc_id = str('SHORTCODE{0}REPLACEMENT'.format(str(uuid.uuid4()).replace('-', '')))
new_data.append(sc_id)
shortcodes[sc_id] = buffer[0][1]
for c in buffer[1:]: # Dump buffered text
new_data.append(c[1])

return ''.join(new_data), shortcodes

Expand Down

0 comments on commit 33abf6d

Please sign in to comment.