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

(ERROR/3) Undefined substitution referenced #26

Closed
dforsi opened this issue Jan 26, 2016 · 4 comments
Closed

(ERROR/3) Undefined substitution referenced #26

dforsi opened this issue Jan 26, 2016 · 4 comments

Comments

@dforsi
Copy link

dforsi commented Jan 26, 2016

Hello,

using html2rest to convert the attached test.html.txt results in a file containing a single line indented with 2 spaces:
title some text\\|test|.. |test| image:: test.jpg
and when I convert that file with rst2html and other converters from Debian's docutils 0.12+dfsg-1 I get:
test.rst:1: (ERROR/3) Undefined substitution referenced: "test".

thank you,
Daniele

@jedie
Copy link
Owner

jedie commented Jan 28, 2016

Thanks for reporting.

Any idea to fix this?

@dforsi
Copy link
Author

dforsi commented Jan 28, 2016

I'm learning reStructuredText but it seems to me that explicit markup blocks ".. " must be at the beginning of a line after the indent if any, so as has an hack, having _get_block_data() insert "\n" before the content makes the converter happy:

--- creole/emitter/html2rest_emitter.py.orig    2016-01-28 15:15:56.528594017 +0100
+++ creole/emitter/html2rest_emitter.py 2016-01-28 15:15:58.280546127 +0100
@@ -53,7 +53,7 @@
         """
         content = "\n".join(self._substitution_data)
         self._substitution_data = []
-        return content
+        return "\n" + content

     #--------------------------------------------------------------------------

This fixes the original "Undefined substitution referenced" error but another error is shown

test.rst:2: (WARNING/2) Block quote ends without a blank line; unexpected unindent.

this is caused in my specific case because the contents of the HTML title is indented but I think it's a different issue, unless the code that handles the title (I can't find it) does something that confuses other code.

@jedie
Copy link
Owner

jedie commented Jan 28, 2016

Great!

Can you create a pull request with a test case for this, please?

dforsi pushed a commit to dforsi/python-creole that referenced this issue Jan 28, 2016
Add an empty line before "_substitution_data" if not already present.

Fixes issue jedie#26.
jedie pushed a commit that referenced this issue Jan 19, 2020
Add an empty line before "_substitution_data" if not already present.

Fixes issue #26.
@jedie
Copy link
Owner

jedie commented Jan 19, 2020

It's merged with 06bd422 so i will close this.

Please reopen, if something wrong ;)

@jedie jedie closed this as completed Jan 19, 2020
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