Skip to content

Instantly share code, notes, and snippets.

@shimizukawa
Created November 29, 2012 13:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shimizukawa/4169008 to your computer and use it in GitHub Desktop.
Save shimizukawa/4169008 to your computer and use it in GitHub Desktop.
sphinx i18n avoid unusable warnings patch.
diff -r 8a5db9f7719d -r 02d86c1ce059 sphinx/environment.py
--- a/sphinx/environment.py Tue Nov 27 20:07:30 2012 +0900
+++ b/sphinx/environment.py Thu Nov 29 15:46:57 2012 +0900
@@ -219,6 +219,14 @@
if not msgstr or msgstr == msg: # as-of-yet untranslated
continue
+ # Avoid "Literal block expected; none found." warnings.
+ # If msgstr ends with '::' then it cause warning message at
+ # parser.parse() processing.
+ # literal-block-warning is only appear in avobe case.
+ if msgstr.strip().endswith('::'):
+ msgstr += '\n\n dummy literal'
+ # dummy literal node will discard by 'patch = patch[0]'
+
patch = new_document(source, settings)
parser.parse(msgstr, patch)
patch = patch[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment