Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key error u'##' #46

Closed
tynopet opened this issue Jul 4, 2017 · 4 comments
Closed

Key error u'##' #46

tynopet opened this issue Jul 4, 2017 · 4 comments

Comments

@tynopet
Copy link

tynopet commented Jul 4, 2017

I try to transform this text:

# test
### test
## test

and get exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/core.py", line 1368, in textile
    return Textile(html_type=html_type).parse(text)
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/core.py", line 250, in parse
    text = self.block(text)
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/core.py", line 471, in block
    block = Block(self, tag, atts, ext, cite, line)
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/objects/block.py", line 32, in __init__
    self.process()
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/objects/block.py", line 124, in process
    self.content = self.textile.graf(self.content)
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/core.py", line 607, in graf
    text = self.textileLists(text)
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/core.py", line 297, in textileLists
    return pattern.sub(self.fTextileList, text)
  File "/home/dmitry/.local/lib/python2.7/site-packages/textile/core.py", line 349, in fTextileList
    self.olstarts[tl] = self.olstarts[tl] + 1
KeyError: u'##'

Can you fix this?

@ikirudennis
Copy link
Member

Man, that packs a lot of ugly textile into a tiny test. I'm doing a massive rewrite of list handling, so I can't guarantee there will be a quick fix. I don't suppose there's any way to format that list correctly?

txstyle.org produces the following:

<ol>
	<li>test
		<ol>
			<li>test</li>
		</ol></li>
	<ol>
		<li>test</li>
	</ol></li>
	</ol>

That seems pretty messy and not exactly what I'd expect given the input, but if you can't can't format the textile input better, is that what you're looking for? Can you provide an example of what you think the output should look like?

@tynopet
Copy link
Author

tynopet commented Jul 4, 2017

Yes, this output is satisfactory. The main thing doesn't throw an error. Thank you.

ikirudennis added a commit that referenced this issue Jul 8, 2017
@ikirudennis
Copy link
Member

Hi, @tynopet. I think I've fixed both this issue and #47. Would you mind testing this to confirm it's fixed and not causing any other issues? pip install git+https://github.com/textile/python-textile.git@develop#egg=textile will have the fixes for both issues. Thanks, again.

@tynopet
Copy link
Author

tynopet commented Jul 10, 2017

Thank you for fixes.

@tynopet tynopet closed this as completed Jul 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants