Merged birkenfeld/sphinx into default

This commit is contained in:
shirou 2013-02-09 22:44:56 +09:00
commit fc63acf3d1
10 changed files with 889 additions and 1 deletions

View File

@ -1,7 +1,10 @@
Release 1.2 (in development)
============================
* Fix text builder did not respect wide/fullwidth charactors.
* New locales: #1097: Added Basque locale.
* Fix text builder did not respect wide/fullwidth characters:
title underline width, table layout width and text wrap width.
* #1062: sphinx.ext.autodoc use __init__ method signature for class signature.

View File

@ -373,6 +373,7 @@ documentation on :ref:`intl` for details.
* ``en`` -- English
* ``es`` -- Spanish
* ``et`` -- Estonian
* ``eu`` -- Basque
* ``fa`` -- Iranian
* ``fi`` -- Finnish
* ``fr`` -- French

View File

@ -0,0 +1 @@
Documentation.addTranslations({"locale": "eu", "plural_expr": "(n != 1)", "messages": {"Hide Search Matches": "Bilaketa bat-etortzeak ezkutatu", "Permalink to this definition": "Definizio honetarako esteka iraunkorra", "Expand sidebar": "Alboko barra luzatu", "Permalink to this headline": "Goiburu honetarako esteka iraunkorra", "Collapse sidebar": "Alboko barra tolestu"}});

Binary file not shown.

View File

@ -0,0 +1,769 @@
# Translations template for Sphinx.
# Copyright (C) 2011 ORGANIZATION
# This file is distributed under the same license as the Sphinx project.
# Ales Zabala Alava <shagi@gisa-elkartea.org>, 2011.
#
msgid ""
msgstr ""
"Project-Id-Version: Sphinx 1.1pre/9523af9ba9aa+\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2011-09-21 10:06+0200\n"
"PO-Revision-Date: 2013-02-07 11:51+0100\n"
"Last-Translator: Ales Zabala Alava (Shagi) <shagi@gisa-elkartea.org>\n"
"Language-Team: Basque\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"
"Language: eu\n"
#: sphinx/config.py:81
#, python-format
msgid "%s %s documentation"
msgstr "%s %s dokumentazioa"
#: sphinx/environment.py:119 sphinx/writers/latex.py:190
#: sphinx/writers/manpage.py:67 sphinx/writers/texinfo.py:203
#, python-format
msgid "%B %d, %Y"
msgstr "%Y %B %d"
#: sphinx/environment.py:1625
#, python-format
msgid "see %s"
msgstr "%s ikusi"
#: sphinx/environment.py:1628
#, python-format
msgid "see also %s"
msgstr "ikusi %s baita ere"
#: sphinx/roles.py:175
#, python-format
msgid "Python Enhancement Proposals; PEP %s"
msgstr "Python Hobekuntza Proposamena; PEP %s"
#: sphinx/builders/changes.py:73
msgid "Builtins"
msgstr ""
#: sphinx/builders/changes.py:75
msgid "Module level"
msgstr "Modulu maila"
#: sphinx/builders/html.py:274
#, python-format
msgid "%b %d, %Y"
msgstr "%Y %b %d"
#: sphinx/builders/html.py:293 sphinx/themes/basic/defindex.html:30
msgid "General Index"
msgstr "Indize orokorra"
#: sphinx/builders/html.py:293
msgid "index"
msgstr "indizea"
#: sphinx/builders/html.py:353
msgid "next"
msgstr "hurrengoa"
#: sphinx/builders/html.py:362
msgid "previous"
msgstr "aurrekoa"
#: sphinx/builders/latex.py:141 sphinx/builders/texinfo.py:196
msgid " (in "
msgstr " (hemen: "
#: sphinx/directives/other.py:136
msgid "Section author: "
msgstr "Atalaren egilea: "
#: sphinx/directives/other.py:138
msgid "Module author: "
msgstr "Moduluaren egilea: "
#: sphinx/directives/other.py:140
msgid "Code author: "
msgstr "Kodearen egilea: "
#: sphinx/directives/other.py:142
msgid "Author: "
msgstr "Egilea:"
#: sphinx/directives/other.py:215
msgid "See also"
msgstr "Ikusi baita ere"
#: sphinx/domains/__init__.py:244
#, python-format
msgid "%s %s"
msgstr "%s %s"
#: sphinx/domains/c.py:51 sphinx/domains/python.py:95
msgid "Parameters"
msgstr "Parametroak"
#: sphinx/domains/c.py:54 sphinx/domains/javascript.py:128
#: sphinx/domains/python.py:107
msgid "Returns"
msgstr "Itzultzen du"
#: sphinx/domains/c.py:56 sphinx/domains/python.py:109
msgid "Return type"
msgstr "Itzulketa mota"
#: sphinx/domains/c.py:141
#, python-format
msgid "%s (C function)"
msgstr "%s (C funtzioa)"
#: sphinx/domains/c.py:143
#, python-format
msgid "%s (C member)"
msgstr "%s (C partaidea)"
#: sphinx/domains/c.py:145
#, python-format
msgid "%s (C macro)"
msgstr "%s (C makroa)"
#: sphinx/domains/c.py:147
#, python-format
msgid "%s (C type)"
msgstr "%s (C mota)"
#: sphinx/domains/c.py:149
#, python-format
msgid "%s (C variable)"
msgstr "%s (C aldagaia)"
#: sphinx/domains/c.py:204 sphinx/domains/cpp.py:1060
#: sphinx/domains/javascript.py:162 sphinx/domains/python.py:559
msgid "function"
msgstr "funtzioa"
#: sphinx/domains/c.py:205 sphinx/domains/cpp.py:1061
msgid "member"
msgstr "partaidea"
#: sphinx/domains/c.py:206
msgid "macro"
msgstr "makroa"
#: sphinx/domains/c.py:207 sphinx/domains/cpp.py:1062
msgid "type"
msgstr "mota"
#: sphinx/domains/c.py:208
msgid "variable"
msgstr "aldagaia"
#: sphinx/domains/cpp.py:904
#, python-format
msgid "%s (C++ class)"
msgstr "%s (C++ klasea)"
#: sphinx/domains/cpp.py:919
#, python-format
msgid "%s (C++ type)"
msgstr "%s (C++ mota)"
#: sphinx/domains/cpp.py:938
#, python-format
msgid "%s (C++ member)"
msgstr "%s (C++ partaidea)"
#: sphinx/domains/cpp.py:990
#, python-format
msgid "%s (C++ function)"
msgstr "%s (C++ funtzioa)"
#: sphinx/domains/cpp.py:1059 sphinx/domains/javascript.py:163
#: sphinx/domains/python.py:561
msgid "class"
msgstr "klasea"
#: sphinx/domains/javascript.py:106 sphinx/domains/python.py:254
#, python-format
msgid "%s() (built-in function)"
msgstr ""
#: sphinx/domains/javascript.py:107 sphinx/domains/python.py:318
#, python-format
msgid "%s() (%s method)"
msgstr "%s() (%s metodoa)"
#: sphinx/domains/javascript.py:109
#, python-format
msgid "%s() (class)"
msgstr "%s() (klasea)"
#: sphinx/domains/javascript.py:111
#, python-format
msgid "%s (global variable or constant)"
msgstr "%s (aldagai globala edo konstantea)"
#: sphinx/domains/javascript.py:113 sphinx/domains/python.py:356
#, python-format
msgid "%s (%s attribute)"
msgstr "%s (%s atributua)"
#: sphinx/domains/javascript.py:122
msgid "Arguments"
msgstr "Argumentuak"
#: sphinx/domains/javascript.py:125
msgid "Throws"
msgstr "Jaurtitzen du"
#: sphinx/domains/javascript.py:164 sphinx/domains/python.py:560
msgid "data"
msgstr "datuak"
#: sphinx/domains/javascript.py:165 sphinx/domains/python.py:566
msgid "attribute"
msgstr "atributua"
#: sphinx/domains/python.py:100
msgid "Variables"
msgstr "Aldagaiak"
#: sphinx/domains/python.py:104
msgid "Raises"
msgstr "Goratzen du"
#: sphinx/domains/python.py:255 sphinx/domains/python.py:312
#: sphinx/domains/python.py:324 sphinx/domains/python.py:337
#, python-format
msgid "%s() (in module %s)"
msgstr "%s() (%s moduluan)"
#: sphinx/domains/python.py:258
#, python-format
msgid "%s (built-in variable)"
msgstr ""
#: sphinx/domains/python.py:259 sphinx/domains/python.py:350
#, python-format
msgid "%s (in module %s)"
msgstr "%s (%s moduluan)"
#: sphinx/domains/python.py:275
#, python-format
msgid "%s (built-in class)"
msgstr ""
#: sphinx/domains/python.py:276
#, python-format
msgid "%s (class in %s)"
msgstr "%s (klasea %s-(e)n)"
#: sphinx/domains/python.py:316
#, python-format
msgid "%s() (%s.%s method)"
msgstr "%s() (%s.%s metodoa)"
#: sphinx/domains/python.py:328
#, python-format
msgid "%s() (%s.%s static method)"
msgstr "%s() (%s.%s metodo estatikoa)"
#: sphinx/domains/python.py:331
#, python-format
msgid "%s() (%s static method)"
msgstr "%s() (%s metodo estatikoa)"
#: sphinx/domains/python.py:341
#, python-format
msgid "%s() (%s.%s class method)"
msgstr "%s() (%s.%s klaseko metodoa)"
#: sphinx/domains/python.py:344
#, python-format
msgid "%s() (%s class method)"
msgstr "%s() (%s klaseko metodoa)"
#: sphinx/domains/python.py:354
#, python-format
msgid "%s (%s.%s attribute)"
msgstr "%s (%s.%s atributua)"
#: sphinx/domains/python.py:434
#, python-format
msgid "%s (module)"
msgstr "%s (modulua)"
#: sphinx/domains/python.py:491
msgid "Python Module Index"
msgstr "Python moduluen indizea"
#: sphinx/domains/python.py:492
msgid "modules"
msgstr "moduluak"
#: sphinx/domains/python.py:537
msgid "Deprecated"
msgstr "Zaharkitua"
#: sphinx/domains/python.py:562 sphinx/locale/__init__.py:179
msgid "exception"
msgstr "salbuespena"
#: sphinx/domains/python.py:563
msgid "method"
msgstr "metodoa"
#: sphinx/domains/python.py:564
msgid "class method"
msgstr "klaseko metodoa"
#: sphinx/domains/python.py:565
msgid "static method"
msgstr "metodo estatikoa"
#: sphinx/domains/python.py:567 sphinx/locale/__init__.py:175
msgid "module"
msgstr "modulua"
#: sphinx/domains/python.py:695
msgid " (deprecated)"
msgstr " (zaharkitua)"
#: sphinx/domains/rst.py:55
#, python-format
msgid "%s (directive)"
msgstr ""
#: sphinx/domains/rst.py:57
#, python-format
msgid "%s (role)"
msgstr "%s (rola)"
#: sphinx/domains/rst.py:106
msgid "directive"
msgstr ""
#: sphinx/domains/rst.py:107
msgid "role"
msgstr "rola"
#: sphinx/domains/std.py:70 sphinx/domains/std.py:86
#, python-format
msgid "environment variable; %s"
msgstr "inguruneko aldagaia; %s"
#: sphinx/domains/std.py:162
#, python-format
msgid "%scommand line option; %s"
msgstr "%skomando lerroko aukera; %s"
#: sphinx/domains/std.py:393
msgid "glossary term"
msgstr "glosarioko terminoa"
#: sphinx/domains/std.py:394
msgid "grammar token"
msgstr "gramatikako token-a"
#: sphinx/domains/std.py:395
msgid "reference label"
msgstr "erreferentzia etiketa"
#: sphinx/domains/std.py:396
msgid "environment variable"
msgstr "inguruneko aldagaia"
#: sphinx/domains/std.py:397
msgid "program option"
msgstr "programako aukera"
#: sphinx/domains/std.py:427 sphinx/themes/basic/genindex-single.html:32
#: sphinx/themes/basic/genindex-split.html:11
#: sphinx/themes/basic/genindex-split.html:14
#: sphinx/themes/basic/genindex.html:32 sphinx/themes/basic/genindex.html:35
#: sphinx/themes/basic/genindex.html:68 sphinx/themes/basic/layout.html:134
#: sphinx/writers/latex.py:179 sphinx/writers/texinfo.py:456
msgid "Index"
msgstr "Indizea"
#: sphinx/domains/std.py:428
msgid "Module Index"
msgstr "Moduluen indizea"
#: sphinx/domains/std.py:429 sphinx/themes/basic/defindex.html:25
msgid "Search Page"
msgstr "Bilaketa orria"
#: sphinx/ext/autodoc.py:1002
#, python-format
msgid " Bases: %s"
msgstr ""
#: sphinx/ext/autodoc.py:1038
#, python-format
msgid "alias of :class:`%s`"
msgstr ""
#: sphinx/ext/todo.py:41
msgid "Todo"
msgstr "Egitekoa"
#: sphinx/ext/todo.py:109
#, python-format
msgid "(The <<original entry>> is located in %s, line %d.)"
msgstr ""
#: sphinx/ext/todo.py:117
msgid "original entry"
msgstr "jatorrizko sarrera"
#: sphinx/ext/viewcode.py:70
msgid "[source]"
msgstr "[iturburua]"
#: sphinx/ext/viewcode.py:117
msgid "[docs]"
msgstr "[dokumentazioa]"
#: sphinx/ext/viewcode.py:131
msgid "Module code"
msgstr "Moduluko kodea"
#: sphinx/ext/viewcode.py:137
#, python-format
msgid "<h1>Source code for %s</h1>"
msgstr "<h1>%s(r)en iturburu kodea</h1>"
#: sphinx/ext/viewcode.py:164
msgid "Overview: module code"
msgstr "Gainbegirada: moduluko kodea"
#: sphinx/ext/viewcode.py:165
msgid "<h1>All modules for which code is available</h1>"
msgstr "<h1>Kodea eskuragarri duten modulu guztiak</h1>"
#: sphinx/locale/__init__.py:155
msgid "Attention"
msgstr "Adi"
#: sphinx/locale/__init__.py:156
msgid "Caution"
msgstr "Kontuz"
#: sphinx/locale/__init__.py:157
msgid "Danger"
msgstr "Arriskua"
#: sphinx/locale/__init__.py:158
msgid "Error"
msgstr "Errorea"
#: sphinx/locale/__init__.py:159
msgid "Hint"
msgstr "Argibidea"
#: sphinx/locale/__init__.py:160
msgid "Important"
msgstr "Garrantzitsua"
#: sphinx/locale/__init__.py:161
msgid "Note"
msgstr "Nota"
#: sphinx/locale/__init__.py:162
msgid "See Also"
msgstr "Ikusi baita ere"
#: sphinx/locale/__init__.py:163
msgid "Tip"
msgstr "Iradokizuna"
#: sphinx/locale/__init__.py:164
msgid "Warning"
msgstr "Kontuz"
#: sphinx/locale/__init__.py:168
#, python-format
msgid "New in version %s"
msgstr "Berria %s bertsioan"
#: sphinx/locale/__init__.py:169
#, python-format
msgid "Changed in version %s"
msgstr "%s bertsioan aldatuta"
#: sphinx/locale/__init__.py:170
#, python-format
msgid "Deprecated since version %s"
msgstr "%s bertsiotik aurrera zaharkituta"
#: sphinx/locale/__init__.py:176
msgid "keyword"
msgstr "gako-hitza"
#: sphinx/locale/__init__.py:177
msgid "operator"
msgstr "eragiketa"
#: sphinx/locale/__init__.py:178
msgid "object"
msgstr "objetua"
#: sphinx/locale/__init__.py:180
msgid "statement"
msgstr "sententzia"
#: sphinx/locale/__init__.py:181
msgid "built-in function"
msgstr ""
#: sphinx/themes/agogo/layout.html:45 sphinx/themes/basic/globaltoc.html:10
#: sphinx/themes/basic/localtoc.html:11
msgid "Table Of Contents"
msgstr "Eduki taula"
#: sphinx/themes/agogo/layout.html:49 sphinx/themes/basic/layout.html:137
#: sphinx/themes/basic/search.html:11 sphinx/themes/basic/search.html:20
msgid "Search"
msgstr "Bilatu"
#: sphinx/themes/agogo/layout.html:52 sphinx/themes/basic/searchbox.html:15
msgid "Go"
msgstr "Joan"
#: sphinx/themes/agogo/layout.html:57 sphinx/themes/basic/searchbox.html:20
msgid "Enter search terms or a module, class or function name."
msgstr "Sartu bilaketa terminoa edo modulu, klase edo funtzioaren izena."
#: sphinx/themes/agogo/layout.html:78 sphinx/themes/basic/sourcelink.html:14
msgid "Show Source"
msgstr "Iturburua ikusi"
#: sphinx/themes/basic/defindex.html:11
msgid "Overview"
msgstr "Gainbegirada"
#: sphinx/themes/basic/defindex.html:20
msgid "Indices and tables:"
msgstr "Indizeak eta taulak:"
#: sphinx/themes/basic/defindex.html:23
msgid "Complete Table of Contents"
msgstr "Eduki taula osoa"
#: sphinx/themes/basic/defindex.html:24
msgid "lists all sections and subsections"
msgstr "atal eta azpiatal guztiak zerrendatu"
#: sphinx/themes/basic/defindex.html:26
msgid "search this documentation"
msgstr "dokumentazio honetan bilatu"
#: sphinx/themes/basic/defindex.html:28
msgid "Global Module Index"
msgstr "Modulu indize globala"
#: sphinx/themes/basic/defindex.html:29
msgid "quick access to all modules"
msgstr "modulu guztietara atzipen azkarra"
#: sphinx/themes/basic/defindex.html:31
msgid "all functions, classes, terms"
msgstr "funtzio, klase, termino guztiak"
#: sphinx/themes/basic/genindex-single.html:35
#, python-format
msgid "Index &ndash; %(key)s"
msgstr "Indizea &ndash; %(key)s"
#: sphinx/themes/basic/genindex-single.html:63
#: sphinx/themes/basic/genindex-split.html:24
#: sphinx/themes/basic/genindex-split.html:38
#: sphinx/themes/basic/genindex.html:74
msgid "Full index on one page"
msgstr "Indize guztia orri batean"
#: sphinx/themes/basic/genindex-split.html:16
msgid "Index pages by letter"
msgstr "Indize orriak hizkika"
#: sphinx/themes/basic/genindex-split.html:25
msgid "can be huge"
msgstr "handia izan daiteke"
#: sphinx/themes/basic/layout.html:29
msgid "Navigation"
msgstr "Nabigazioa"
#: sphinx/themes/basic/layout.html:122
#, python-format
msgid "Search within %(docstitle)s"
msgstr "Bilatu %(docstitle)s(e)n"
#: sphinx/themes/basic/layout.html:131
msgid "About these documents"
msgstr "Dokumentu hauen inguruan"
#: sphinx/themes/basic/layout.html:140
msgid "Copyright"
msgstr "Copyright"
#: sphinx/themes/basic/layout.html:189
#, python-format
msgid "&copy; <a href=\"%(path)s\">Copyright</a> %(copyright)s."
msgstr "&copy; <a href=\"%(path)s\">Copyright</a> %(copyright)s."
#: sphinx/themes/basic/layout.html:191
#, python-format
msgid "&copy; Copyright %(copyright)s."
msgstr "&copy; Copyright %(copyright)s."
#: sphinx/themes/basic/layout.html:195
#, python-format
msgid "Last updated on %(last_updated)s."
msgstr "Azken aldaketa: %(last_updated)s."
#: sphinx/themes/basic/layout.html:198
#, python-format
msgid ""
"Created using <a href=\"http://sphinx-doc.org/\">Sphinx</a> "
"%(sphinx_version)s."
msgstr ""
"<a href=\"http://sphinx-doc.org/\">Sphinx</a> %(sphinx_version)s erabiliz "
"sortutakoa."
#: sphinx/themes/basic/opensearch.xml:4
#, python-format
msgid "Search %(docstitle)s"
msgstr "%(docstitle)s bilatu"
#: sphinx/themes/basic/relations.html:11
msgid "Previous topic"
msgstr "Aurreko gaia"
#: sphinx/themes/basic/relations.html:13
msgid "previous chapter"
msgstr "aurreko kapitulua"
#: sphinx/themes/basic/relations.html:16
msgid "Next topic"
msgstr "Hurrengo gaia"
#: sphinx/themes/basic/relations.html:18
msgid "next chapter"
msgstr "hurrengo kapitulua"
#: sphinx/themes/basic/search.html:24
msgid ""
"Please activate JavaScript to enable the search\n"
" functionality."
msgstr "Mesedez, gaitu JavaScript-a bilaketa erabili ahal izateko."
#: sphinx/themes/basic/search.html:29
msgid ""
"From here you can search these documents. Enter your search\n"
" words into the box below and click \"search\". Note that the search\n"
" function will automatically search for all of the words. Pages\n"
" containing fewer words won't appear in the result list."
msgstr ""
"Honekin dokumentu hauetan bilatu dezakezu. Sartu zure bilaketa hitzak\n"
"ondoko kutxan eta \"bilatu\" sakatu. Kontutan eduki bilaketa funtzioak\n"
"hitz guztiak bilatuko dituela. Hitz gutxiago dituzten orriak ez dira \n"
"emaitzen zerrendan agertuko."
#: sphinx/themes/basic/search.html:36
msgid "search"
msgstr "bilatu"
#: sphinx/themes/basic/search.html:40
msgid "Search Results"
msgstr "Bilaketa emaitzak"
#: sphinx/themes/basic/search.html:42
msgid "Your search did not match any results."
msgstr "Zure bilaketak ez du emaitzarik eman."
#: sphinx/themes/basic/searchbox.html:12
msgid "Quick search"
msgstr "Bilaketa azkarra"
#: sphinx/themes/basic/sourcelink.html:11
msgid "This Page"
msgstr "Orri hau"
#: sphinx/themes/basic/changes/frameset.html:5
#: sphinx/themes/basic/changes/versionchanges.html:12
#, python-format
msgid "Changes in Version %(version)s &mdash; %(docstitle)s"
msgstr "%(version)s bertsioko aldaketak &mdash; %(docstitle)s"
#: sphinx/themes/basic/changes/rstsource.html:5
#, python-format
msgid "%(filename)s &mdash; %(docstitle)s"
msgstr "%(filename)s &mdash; %(docstitle)s"
#: sphinx/themes/basic/changes/versionchanges.html:17
#, python-format
msgid "Automatically generated list of changes in version %(version)s"
msgstr "Automatikoki sortutako %(version)s bertsioaren aldaketen zerrenda"
#: sphinx/themes/basic/changes/versionchanges.html:18
msgid "Library changes"
msgstr "Liburutegi aldaketak"
#: sphinx/themes/basic/changes/versionchanges.html:23
msgid "C API changes"
msgstr "C API aldaketak"
#: sphinx/themes/basic/changes/versionchanges.html:25
msgid "Other changes"
msgstr "Beste aldaketak"
#: sphinx/themes/basic/static/doctools.js:154 sphinx/writers/html.py:504
#: sphinx/writers/html.py:510
msgid "Permalink to this headline"
msgstr "Goiburu honetarako esteka iraunkorra"
#: sphinx/themes/basic/static/doctools.js:160 sphinx/writers/html.py:92
msgid "Permalink to this definition"
msgstr "Definizio honetarako esteka iraunkorra"
#: sphinx/themes/basic/static/doctools.js:189
msgid "Hide Search Matches"
msgstr "Bilaketa bat-etortzeak ezkutatu"
#: sphinx/themes/default/static/sidebar.js:69
msgid "Expand sidebar"
msgstr "Alboko barra luzatu"
#: sphinx/themes/default/static/sidebar.js:82
#: sphinx/themes/default/static/sidebar.js:110
msgid "Collapse sidebar"
msgstr "Alboko barra tolestu"
#: sphinx/themes/haiku/layout.html:26
msgid "Contents"
msgstr "Edukiak"
#: sphinx/writers/latex.py:177
msgid "Release"
msgstr "Argitalpena"
#: sphinx/writers/latex.py:594 sphinx/writers/manpage.py:182
#: sphinx/writers/texinfo.py:589
msgid "Footnotes"
msgstr "Oin-oharrak"
#: sphinx/writers/latex.py:676
msgid "continued from previous page"
msgstr "aurreko orritik jarraitzen du"
#: sphinx/writers/latex.py:681
msgid "Continued on next page"
msgstr "Hurrengo orrian jarraitzen du"
#: sphinx/writers/text.py:437
msgid "[image]"
msgstr "[irudia]"

View File

@ -11,6 +11,7 @@
import os
import re
import textwrap
from itertools import groupby
from docutils import nodes, writers
from docutils.utils import column_width
@ -28,6 +29,98 @@ class TextWrapper(textwrap.TextWrapper):
r'[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|' # hyphenated words
r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash
def _wrap_chunks(self, chunks):
"""_wrap_chunks(chunks : [string]) -> [string]
Original _wrap_chunks use len() to calculate width.
This method respect to wide/fullwidth characters for width adjustment.
"""
drop_whitespace = getattr(self, 'drop_whitespace', True) #py25 compat
lines = []
if self.width <= 0:
raise ValueError("invalid width %r (must be > 0)" % self.width)
chunks.reverse()
while chunks:
cur_line = []
cur_len = 0
if lines:
indent = self.subsequent_indent
else:
indent = self.initial_indent
width = self.width - column_width(indent)
if drop_whitespace and chunks[-1].strip() == '' and lines:
del chunks[-1]
while chunks:
l = column_width(chunks[-1])
if cur_len + l <= width:
cur_line.append(chunks.pop())
cur_len += l
else:
break
if chunks and column_width(chunks[-1]) > width:
self._handle_long_word(chunks, cur_line, cur_len, width)
if drop_whitespace and cur_line and cur_line[-1].strip() == '':
del cur_line[-1]
if cur_line:
lines.append(indent + ''.join(cur_line))
return lines
def _break_word(self, word, space_left):
"""_break_word(word : string, space_left : int) -> (string, string)
Break line by unicode width instead of len(word).
"""
total = 0
for i,c in enumerate(word):
total += column_width(c)
if total > space_left:
return word[:i-1], word[i-1:]
return word, ''
def _split(self, text):
"""_split(text : string) -> [string]
Override original method that only split by 'wordsep_re'.
This '_split' split wide-characters into chunk by one character.
"""
split = lambda t: textwrap.TextWrapper._split(self, t)
chunks = []
for chunk in split(text):
for w, g in groupby(chunk, column_width):
if w == 1:
chunks.extend(split(''.join(g)))
else:
chunks.extend(list(g))
return chunks
def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width):
"""_handle_long_word(chunks : [string],
cur_line : [string],
cur_len : int, width : int)
Override original method for using self._break_word() instead of slice.
"""
space_left = max(width - cur_len, 1)
if self.break_long_words:
l, r = self._break_word(reversed_chunks[-1], space_left)
cur_line.append(l)
reversed_chunks[-1] = r
elif not cur_line:
cur_line.append(reversed_chunks.pop())
MAXWIDTH = 70
STDINDENT = 3

View File

@ -12,6 +12,7 @@
from textwrap import dedent
from docutils.utils import column_width
from sphinx.writers.text import MAXWIDTH
from util import *
@ -63,3 +64,23 @@ def test_multibyte_table(app):
lines = [line.strip() for line in result.splitlines() if line.strip()]
line_widths = [column_width(line) for line in lines]
assert len(set(line_widths)) == 1 # same widths
@with_text_app()
def test_multibyte_maxwidth(app):
sb_text = u'abc' #length=3
mb_text = u'\u65e5\u672c\u8a9e' #length=3
sb_line = ' '.join([sb_text] * int(MAXWIDTH / 3))
mb_line = ' '.join([mb_text] * int(MAXWIDTH / 3))
mix_line = ' '.join([sb_text, mb_text] * int(MAXWIDTH / 6))
contents = u'\n\n'.join((sb_line, mb_line, mix_line))
(app.srcdir / 'contents.rst').write_text(contents, encoding='utf-8')
app.builder.build_all()
result = (app.outdir / 'contents.txt').text(encoding='utf-8')
lines = [line.strip() for line in result.splitlines() if line.strip()]
line_widths = [column_width(line) for line in lines]
assert max(line_widths) < MAXWIDTH