camlspotter avatar camlspotter committed 3824a62

added files + sphinx-quickstart

Comments (0)

Files changed (8)

+_build$
+.*~$
+
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  hatena    to make Hatena diary draft"
+	@echo "  html      to make standalone HTML files"
+	@echo "  dirhtml   to make HTML files named index.html in directories"
+	@echo "  pickle    to make pickle files"
+	@echo "  json      to make JSON files"
+	@echo "  htmlhelp  to make HTML files and a HTML help project"
+	@echo "  qthelp    to make HTML files and a qthelp project"
+	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  changes   to make an overview of all changed/added/deprecated items"
+	@echo "  linkcheck to check all external links for integrity"
+	@echo "  doctest   to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	-rm -rf $(BUILDDIR)/*
+
+hatena:
+	$(SPHINXBUILD) -b hatena $(ALLSPHINXOPTS) $(BUILDDIR)/hatena
+	@echo
+	@echo "Build finished. The Hatena pages are in $(BUILDDIR)/hatena."
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Sphinx-hatena.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Sphinx-hatena.qhc"
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+	      "run these through (pdf)latex."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
+# -*- coding: utf-8 -*-
+#
+# Sphinx-hatena documentation build configuration file, created by
+# sphinx-quickstart on Fri Feb 11 13:04:38 2011.
+#
+# This file is execfile()d with the current directory set to its containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys, os
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+#sys.path.append(os.path.abspath('.'))
+
+# -- General configuration -----------------------------------------------------
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = []
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'Sphinx-hatena'
+copyright = u'2011, Jun FURUSE'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = '0.0.0'
+# The full version, including alpha/beta/rc tags.
+release = '0.0.0'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of documents that shouldn't be included in the build.
+#unused_docs = []
+
+# List of directories, relative to source directory, that shouldn't be searched
+# for source files.
+exclude_trees = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------------
+
+# The theme to use for HTML and HTML Help pages.  Major themes that come with
+# Sphinx are currently 'default' and 'sphinxdoc'.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further.  For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents.  If None, it defaults to
+# "<project> v<release> documentation".
+#html_title = None
+
+# A shorter title for the navigation bar.  Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs.  This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_use_modindex = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it.  The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = ''
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'Sphinx-hatenadoc'
+
+
+# -- Options for LaTeX output --------------------------------------------------
+
+# The paper size ('letter' or 'a4').
+#latex_paper_size = 'letter'
+
+# The font size ('10pt', '11pt' or '12pt').
+#latex_font_size = '10pt'
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title, author, documentclass [howto/manual]).
+latex_documents = [
+  ('index', 'Sphinx-hatena.tex', u'Sphinx-hatena Documentation',
+   u'Jun FURUSE', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# Additional stuff for the LaTeX preamble.
+#latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_use_modindex = True

extensions/hatena.py

+#!/usr/bin/env python
+#coding:utf-8
+
+from hatenaBuilder import HatenaBuilder
+
+def setup(app):
+    app.add_builder(HatenaBuilder)

extensions/hatenaBuilder.py

+#!/usr/bin/env python
+#coding:utf-8
+from sphinx.builders.text import TextBuilder
+from hatenaWriter import HatenaWriter
+
+class HatenaBuilder(TextBuilder):
+    name = 'hatena'
+    format = 'hatena'
+    out_suffix = '.txt'
+
+    def prepare_writing(self, docnames):
+        self.writer = HatenaWriter(self)
+

extensions/hatenaWriter.py

+#!/usr/bin/env python
+#coding:utf-8
+import re
+import textwrap
+
+from docutils import nodes, writers
+
+from sphinx import addnodes
+from sphinx.locale import admonitionlabels, versionlabels
+from sphinx.writers.text import TextWriter, TextTranslator
+
+
+class HatenaWriter(TextWriter):
+    def translate(self):
+        visitor = HatenaTranslator(self.document, self.builder)
+        self.document.walkabout(visitor)
+        self.output = visitor.body
+
+
+# # monkey-patch from TextTranslator
+# new_wordsep_re = re.compile(
+#         r'(\s+|'                                  # any whitespace
+#         r'(?<=\s)(?::[a-z-]+:)?`\S+|'             # interpreted text start
+#         r'[^\s\w]*\w+[a-zA-Z]-(?=\w+[a-zA-Z])|'   # hyphenated words
+#         r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))')   # em-dash
+# textwrap.TextWrapper.wordsep_re = new_wordsep_re
+# 
+# MAXWIDTH = 70
+# STDINDENT = 3
+
+def isstring(s):
+    return isinstance(s, unicode) or isinstance(s, str)
+
+class InlineFailure(Exception):
+    """hoge"""
+
+def inline_failure():
+    raise InlineFailure
+
+class Block():
+    def __init__(self, parent):
+
+        self.parent = parent
+        self.contents = []
+        # It is a list of string (with inlined markups) and bloks 
+
+    def name(self):
+        return self.__class__.__name__
+
+    def __str__(self):
+        return self.name() + '[' + ','.join([str(elem) for elem in self.contents]) + ']'
+
+    def is_first_item(self):
+        if self.parent:
+            return self is self.parent.contents[0]
+        else:
+            True
+
+    def append_string(self, elem):
+        # if the last elem is string and elem is a string too, concatenate it
+        if self.contents and isstring(self.contents[-1]):
+            self.contents[-1] += ' ' + elem
+        else:
+            self.contents.extend([elem])
+
+    def append(self, elem):
+        if isstring(elem):
+            self.append_string(elem)
+        else:
+            self.contents.extend([elem])
+
+    def elem_to_string(self, indent, x):
+        if isinstance(x, unicode) or isinstance(x,str):
+            return ' ' * indent + re.sub(r'[\n\r]+', ' ', x)
+        else:
+            return x.to_string(indent)
+
+    def to_string(self, indent):
+        return '\n'.join([self.elem_to_string(indent, x) for x in self.contents])
+
+    def try_inline_elem(self, elem): # string is special and thus stupid
+        if isstring(elem):
+            return elem
+        else:
+            return elem.try_inline()
+
+    def try_inline_internal(self):
+        return ' '.join([self.try_inline_elem(elem) for elem in self.contents])
+
+    # may raise InlineFailure
+    def try_inline(self):
+        inline_failure()
+        
+class Title(Block):
+    def __init__(self, parent, level):
+        Block.__init__(self, parent)
+        self.level = level
+
+    def to_string(self, indent):
+        return '*' * self.level + ' ' + Block.try_inline_internal(self)
+
+class Par(Block):
+    def __init__(self, parent):
+        Block.__init__(self, parent)
+
+    def to_string(self, indent):
+        if self.is_first_item():
+            return 'P ' + Block.to_string(self, indent) + ' /P'
+        else:
+            return ' ' * indent + '<p>\n' + Block.to_string(self, indent)
+
+    def try_inline(self):
+        if self.is_first_item():
+            return self.try_inline_internal()
+        else:
+            print "HOGE" + str(self.contents)
+            inline_failure()
+
+class HTML(Block):
+    def __init__(self, parent, tag):
+        Block.__init__(self, parent)
+        self.tagname = tag
+
+    def name(self):
+        return self.tagname
+
+    def tag(self):
+        return self.tagname
+
+    def to_string(self, indent):
+        try:
+            return ' ' * indent + '<' + self.tag() + '>' + self.try_inline_internal() + '</' + self.tag() + '>'
+        except InlineFailure:
+            return ' ' * indent + '<' + self.tag() + '>\n' + Block.to_string(self, indent+2) + '\n' + ' ' * indent + '</' + self.tag() + '>' 
+
+class LItem(HTML):
+    def __init__(self, parent):
+        HTML.__init__(self, parent, '?LITEM?')
+        self.dict = {'ul':'li',
+                     'ol':'oi'}
+        
+    def tag(self):
+        if self.parent.tag:
+            return self.dict.get(self.parent.tag, '?' + self.parent.tag()) 
+        else:
+            return "?LITEM?"
+
+class LiteralBlock(Block):
+    def __init__(self, parent, lang):
+        Block.__init__(self, parent)
+        self.lang = lang
+        
+    def append_string(self, elem):
+        self.contents.extend(elem.split('\n'))
+
+    def to_string(self, indent):
+        return '>|' + self.lang + '|\n' + Block.to_string(self, 0) + '\n||<'
+
+class Verbose(Block):
+    def __init__(self, parent, name):
+        Block.__init__(self, parent)
+        self.name = name
+
+    def to_string(self, indent):
+        return ' ' * indent + '<' + self.name + '>\n' + Block.to_string(self, indent+2) + '\n' + ' ' * indent + '</' + self.name + '>'
+
+class HatenaTranslator(nodes.NodeVisitor):
+    sectionchars = '*=-~"+'
+
+    def __init__(self, document, builder):
+        nodes.NodeVisitor.__init__(self, document)
+
+        self.theBlock = Block(None)
+        self.block = self.theBlock
+        self.sectionlevel = 0
+        self.highlightlang = ''
+
+    def add_text(self, text):
+        self.block.append(text)
+
+    def new_block(self, blockCls, *args):
+        b = blockCls(self.block, *args)
+        self.block.append(b)
+        self.block = b
+
+    def end_block(self):
+        parent = self.block.parent
+        self.block = parent
+
+    def visit_document(self, node):
+        pass
+    def depart_document(self, node):
+        self.body = self.theBlock.to_string(0) + '\n'
+
+        # XXX header/footer?
+
+    def visit_highlightlang(self, node):
+        self.highlightlang = node['lang']
+    def depart_highlightlang(self, node):
+        pass
+
+    def visit_section(self, node):
+        self.sectionlevel += 1
+    def depart_section(self, node):
+        self.sectionlevel -= 1
+
+#    def visit_topic(self, node):
+#        self.new_state(0)
+#    def depart_topic(self, node):
+#        self.end_state()
+#
+#    visit_sidebar = visit_topic
+#    depart_sidebar = depart_topic
+#
+#    def visit_rubric(self, node):
+#        self.new_state(0)
+#        self.add_text('-[ ')
+#    def depart_rubric(self, node):
+#        self.add_text(' ]-')
+#        self.end_state()
+#
+#    def visit_compound(self, node):
+#        pass
+#    def depart_compound(self, node):
+#        pass
+#
+#    def visit_glossary(self, node):
+#        pass
+#    def depart_glossary(self, node):
+#        pass
+#
+    def visit_title(self, node):
+        self.new_block(Title, self.sectionlevel)
+    def depart_title(self, node):
+        self.end_block()
+
+#    def visit_subtitle(self, node):
+#        pass
+#    def depart_subtitle(self, node):
+#        pass
+#
+#    def visit_attribution(self, node):
+#        self.add_text('-- ')
+#    def depart_attribution(self, node):
+#        pass
+#
+#    def visit_module(self, node):
+#        if node.has_key('platform'):
+#            self.new_state(0)
+#            self.add_text(_('Platform: %s') % node['platform'])
+#            self.end_state()
+#        raise nodes.SkipNode
+#
+#    def visit_desc(self, node):
+#        pass
+#    def depart_desc(self, node):
+#        pass
+#
+#    def visit_desc_signature(self, node):
+#        self.new_state(0)
+#        if node.parent['desctype'] in ('class', 'exception'):
+#            self.add_text('%s ' % node.parent['desctype'])
+#    def depart_desc_signature(self, node):
+#        # XXX: wrap signatures in a way that makes sense
+#        self.end_state(wrap=False, end=None)
+#
+#    def visit_desc_name(self, node):
+#        pass
+#    def depart_desc_name(self, node):
+#        pass
+#
+#    def visit_desc_addname(self, node):
+#        pass
+#    def depart_desc_addname(self, node):
+#        pass
+#
+#    def visit_desc_type(self, node):
+#        pass
+#    def depart_desc_type(self, node):
+#        pass
+#
+#    def visit_desc_returns(self, node):
+#        self.add_text(' -> ')
+#    def depart_desc_returns(self, node):
+#        pass
+#
+#    def visit_desc_parameterlist(self, node):
+#        self.add_text('(')
+#        self.first_param = 1
+#    def depart_desc_parameterlist(self, node):
+#        self.add_text(')')
+#
+#    def visit_desc_parameter(self, node):
+#        if not self.first_param:
+#            self.add_text(', ')
+#        else:
+#            self.first_param = 0
+#        self.add_text(node.astext())
+#        raise nodes.SkipNode
+#
+#    def visit_desc_optional(self, node):
+#        self.add_text('[')
+#    def depart_desc_optional(self, node):
+#        self.add_text(']')
+#
+#    def visit_desc_annotation(self, node):
+#        pass
+#    def depart_desc_annotation(self, node):
+#        pass
+#
+#    def visit_refcount(self, node):
+#        pass
+#    def depart_refcount(self, node):
+#        pass
+#
+#    def visit_desc_content(self, node):
+#        self.new_state()
+#        self.add_text('\n')
+#    def depart_desc_content(self, node):
+#        self.end_state()
+#
+#    def visit_figure(self, node):
+#        self.new_state()
+#    def depart_figure(self, node):
+#        self.end_state()
+#
+#    def visit_caption(self, node):
+#        pass
+#    def depart_caption(self, node):
+#        pass
+#
+#    def visit_productionlist(self, node):
+#        self.new_state()
+#        names = []
+#        for production in node:
+#            names.append(production['tokenname'])
+#        maxlen = max(len(name) for name in names)
+#        for production in node:
+#            if production['tokenname']:
+#                self.add_text(production['tokenname'].ljust(maxlen) + ' ::=')
+#                lastname = production['tokenname']
+#            else:
+#                self.add_text('%s    ' % (' '*len(lastname)))
+#            self.add_text(production.astext() + '\n')
+#        self.end_state(wrap=False)
+#        raise nodes.SkipNode
+#
+#    def visit_seealso(self, node):
+#        self.new_state()
+#    def depart_seealso(self, node):
+#        self.end_state(first='')
+#
+#    def visit_footnote(self, node):
+#        self._footnote = node.children[0].astext().strip()
+#        self.new_state(len(self._footnote) + 3)
+#    def depart_footnote(self, node):
+#        self.end_state(first='[%s] ' % self._footnote)
+#
+#    def visit_citation(self, node):
+#        if len(node) and isinstance(node[0], nodes.label):
+#            self._citlabel = node[0].astext()
+#        else:
+#            self._citlabel = ''
+#        self.new_state(len(self._citlabel) + 3)
+#    def depart_citation(self, node):
+#        self.end_state(first='[%s] ' % self._citlabel)
+#
+#    def visit_label(self, node):
+#        raise nodes.SkipNode
+#
+#    # XXX: option list could use some better styling
+#
+#    def visit_option_list(self, node):
+#        pass
+#    def depart_option_list(self, node):
+#        pass
+#
+#    def visit_option_list_item(self, node):
+#        self.new_state(0)
+#    def depart_option_list_item(self, node):
+#        self.end_state()
+#
+#    def visit_option_group(self, node):
+#        self._firstoption = True
+#    def depart_option_group(self, node):
+#        self.add_text('     ')
+#
+#    def visit_option(self, node):
+#        if self._firstoption:
+#            self._firstoption = False
+#        else:
+#            self.add_text(', ')
+#    def depart_option(self, node):
+#        pass
+#
+#    def visit_option_string(self, node):
+#        pass
+#    def depart_option_string(self, node):
+#        pass
+#
+#    def visit_option_argument(self, node):
+#        self.add_text(node['delimiter'])
+#    def depart_option_argument(self, node):
+#        pass
+#
+#    def visit_description(self, node):
+#        pass
+#    def depart_description(self, node):
+#        pass
+#
+#    def visit_tabular_col_spec(self, node):
+#        raise nodes.SkipNode
+#
+#    def visit_colspec(self, node):
+#        self.table[0].append(node['colwidth'])
+#        raise nodes.SkipNode
+#
+#    def visit_tgroup(self, node):
+#        pass
+#    def depart_tgroup(self, node):
+#        pass
+#
+#    def visit_thead(self, node):
+#        pass
+#    def depart_thead(self, node):
+#        pass
+#
+#    def visit_tbody(self, node):
+#        self.table.append('sep')
+#    def depart_tbody(self, node):
+#        pass
+#
+#    def visit_row(self, node):
+#        self.table.append([])
+#    def depart_row(self, node):
+#        pass
+#
+#    def visit_entry(self, node):
+#        if node.has_key('morerows') or node.has_key('morecols'):
+#            raise NotImplementedError('Column or row spanning cells are '
+#                                      'not implemented.')
+#        self.new_state(0)
+#    def depart_entry(self, node):
+#        text = '\n'.join('\n'.join(x[1]) for x in self.states.pop())
+#        self.stateindent.pop()
+#        self.table[-1].append(text)
+#
+#    def visit_table(self, node):
+#        if self.table:
+#            raise NotImplementedError('Nested tables are not supported.')
+#        self.new_state(0)
+#        self.table = [[]]
+#    def depart_table(self, node):
+#        lines = self.table[1:]
+#        fmted_rows = []
+#        colwidths = self.table[0]
+#        realwidths = colwidths[:]
+#        separator = 0
+#        # don't allow paragraphs in table cells for now
+#        for line in lines:
+#            if line == 'sep':
+#                separator = len(fmted_rows)
+#            else:
+#                cells = []
+#                for i, cell in enumerate(line):
+#                    par = textwrap.wrap(cell, width=colwidths[i])
+#                    if par:
+#                        maxwidth = max(map(len, par))
+#                    else:
+#                        maxwidth = 0
+#                    realwidths[i] = max(realwidths[i], maxwidth)
+#                    cells.append(par)
+#                fmted_rows.append(cells)
+#
+#        def writesep(char='-'):
+#            out = ['+']
+#            for width in realwidths:
+#                out.append(char * (width+2))
+#                out.append('+')
+#            self.add_text(''.join(out) + '\n')
+#
+#        def writerow(row):
+#            lines = map(None, *row)
+#            for line in lines:
+#                out = ['|']
+#                for i, cell in enumerate(line):
+#                    if cell:
+#                        out.append(' ' + cell.ljust(realwidths[i]+1))
+#                    else:
+#                        out.append(' ' * (realwidths[i] + 2))
+#                    out.append('|')
+#                self.add_text(''.join(out) + '\n')
+#
+#        for i, row in enumerate(fmted_rows):
+#            if separator and i == separator:
+#                writesep('=')
+#            else:
+#                writesep('-')
+#            writerow(row)
+#        writesep('-')
+#        self.table = None
+#        self.end_state(wrap=False)
+#
+#    def visit_acks(self, node):
+#        self.new_state(0)
+#        self.add_text(', '.join(n.astext() for n in node.children[0].children)
+#                      + '.')
+#        self.end_state()
+#        raise nodes.SkipNode
+#
+#    def visit_image(self, node):
+#        self.add_text(_('[image]'))
+#        raise nodes.SkipNode
+#
+#    def visit_transition(self, node):
+#        indent = sum(self.stateindent)
+#        self.new_state(0)
+#        self.add_text('=' * (MAXWIDTH - indent))
+#        self.end_state()
+#        raise nodes.SkipNode
+
+    def visit_bullet_list(self, node):
+        self.new_block(HTML, 'ul')
+    def depart_bullet_list(self, node):
+        self.end_block()
+
+#    def visit_enumerated_list(self, node):
+#        self.list_counter.append(0)
+#    def depart_enumerated_list(self, node):
+#        self.list_counter.pop()
+
+    def visit_definition_list(self, node):
+        self.new_block(HTML, 'dl')
+    def depart_definition_list(self, node):
+        self.end_block()
+
+    def visit_list_item(self, node):
+        self.new_block(LItem)
+    def depart_list_item(self, node):
+        self.end_block()
+
+#    def visit_list_item(self, node):
+#        if self.list_counter[-1] == -1:
+#            # bullet list
+#            self.new_state(2)
+#        elif self.list_counter[-1] == -2:
+#            # definition list
+#            pass
+#        else:
+#            # enumerated list
+#            self.list_counter[-1] += 1
+#            self.new_state(len(str(self.list_counter[-1])) + 2)
+#    def depart_list_item(self, node):
+#        if self.list_counter[-1] == -1:
+#            self.end_state(first='* ', end=None)
+#        elif self.list_counter[-1] == -2:
+#            pass
+#        else:
+#            self.end_state(first='%s. ' % self.list_counter[-1], end=None)
+
+    def visit_definition_list_item(self, node):
+        self._li_has_classifier = len(node) >= 2 and \
+                                  isinstance(node[1], nodes.classifier)
+        pass
+    def depart_definition_list_item(self, node):
+        pass
+
+    def visit_term(self, node):
+        self.new_block(HTML, 'dt')
+    def depart_term(self, node):
+        self.end_block()
+
+#        if not self._li_has_classifier:
+#            self.end_state(end=None)
+
+#    def visit_classifier(self, node):
+#        self.add_text(' : ')
+#    def depart_classifier(self, node):
+#        self.end_state(end=None)
+
+    def visit_definition(self, node):
+        self.new_block(HTML, 'dd')
+    def depart_definition(self, node):
+        self.end_block()
+
+#    def visit_field_list(self, node):
+#        pass
+#    def depart_field_list(self, node):
+#        pass
+#
+#    def visit_field(self, node):
+#        pass
+#    def depart_field(self, node):
+#        pass
+#
+#    def visit_field_name(self, node):
+#        self.new_state(0)
+#    def depart_field_name(self, node):
+#        self.add_text(':')
+#        self.end_state(end=None)
+#
+#    def visit_field_body(self, node):
+#        self.new_state()
+#    def depart_field_body(self, node):
+#        self.end_state()
+#
+#    def visit_centered(self, node):
+#        pass
+#    def depart_centered(self, node):
+#        pass
+#
+#    def visit_hlist(self, node):
+#        pass
+#    def depart_hlist(self, node):
+#        pass
+#
+#    def visit_hlistcol(self, node):
+#        pass
+#    def depart_hlistcol(self, node):
+#        pass
+#
+#    def visit_admonition(self, node):
+#        self.new_state(0)
+#    def depart_admonition(self, node):
+#        self.end_state()
+#
+#    def _visit_admonition(self, node):
+#        self.new_state(2)
+#    def _make_depart_admonition(name):
+#        def depart_admonition(self, node):
+#            self.end_state(first=admonitionlabels[name] + ': ')
+#        return depart_admonition
+#
+#    visit_attention = _visit_admonition
+#    depart_attention = _make_depart_admonition('attention')
+#    visit_caution = _visit_admonition
+#    depart_caution = _make_depart_admonition('caution')
+#    visit_danger = _visit_admonition
+#    depart_danger = _make_depart_admonition('danger')
+#    visit_error = _visit_admonition
+#    depart_error = _make_depart_admonition('error')
+#    visit_hint = _visit_admonition
+#    depart_hint = _make_depart_admonition('hint')
+#    visit_important = _visit_admonition
+#    depart_important = _make_depart_admonition('important')
+#    visit_note = _visit_admonition
+#    depart_note = _make_depart_admonition('note')
+#    visit_tip = _visit_admonition
+#    depart_tip = _make_depart_admonition('tip')
+#    visit_warning = _visit_admonition
+#    depart_warning = _make_depart_admonition('warning')
+#
+#    def visit_versionmodified(self, node):
+#        self.new_state(0)
+#        if node.children:
+#            self.add_text(versionlabels[node['type']] % node['version'] + ': ')
+#        else:
+#            self.add_text(versionlabels[node['type']] % node['version'] + '.')
+#    def depart_versionmodified(self, node):
+#        self.end_state()
+#
+    def visit_literal_block(self, node):
+        self.new_block(LiteralBlock, self.highlightlang)
+    def depart_literal_block(self, node):
+        self.end_block()
+
+#    def visit_doctest_block(self, node):
+#        self.new_state(0)
+#    def depart_doctest_block(self, node):
+#        self.end_state(wrap=False)
+#
+#    def visit_line_block(self, node):
+#        self.new_state(0)
+#    def depart_line_block(self, node):
+#        self.end_state(wrap=False)
+#
+#    def visit_line(self, node):
+#        pass
+#    def depart_line(self, node):
+#        pass
+
+    def visit_block_quote(self, node):
+        self.new_block(Verbose, "block_quote")
+    def depart_block_quote(self, node):
+        self.end_block()
+
+#    def visit_compact_paragraph(self, node):
+#        pass
+#    def depart_compact_paragraph(self, node):
+#        pass
+
+    def visit_paragraph(self, node):
+        if not isinstance(node.parent, nodes.Admonition) or \
+               isinstance(node.parent, addnodes.seealso):
+            self.new_block(Par)
+    def depart_paragraph(self, node):
+        if not isinstance(node.parent, nodes.Admonition) or \
+               isinstance(node.parent, addnodes.seealso):
+            self.end_block()
+
+#    def visit_target(self, node):
+#        raise nodes.SkipNode
+#
+#    def visit_index(self, node):
+#        raise nodes.SkipNode
+#
+#    def visit_substitution_definition(self, node):
+#        raise nodes.SkipNode
+#
+#    def visit_pending_xref(self, node):
+#        pass
+#    def depart_pending_xref(self, node):
+#        pass
+#
+    def visit_reference(self, node):
+        pass
+    def depart_reference(self, node):
+        pass
+
+#    def visit_download_reference(self, node):
+#        pass
+#    def depart_download_reference(self, node):
+#        pass
+#
+    def visit_emphasis(self, node):
+        self.add_text('<it>')
+    def depart_emphasis(self, node):
+        self.add_text('</it>')
+
+#    def visit_literal_emphasis(self, node):
+#        self.add_text('<it>')
+#    def depart_literal_emphasis(self, node):
+#        self.add_text('</it>')
+
+    def visit_strong(self, node):
+        self.add_text('<b>')
+    def depart_strong(self, node):
+        self.add_text('</b>')
+
+#    def visit_abbreviation(self, node):
+#        self.add_text('')
+#    def depart_abbreviation(self, node):
+#        if node.hasattr('explanation'):
+#            self.add_text(' (%s)' % node['explanation'])
+#
+#    def visit_title_reference(self, node):
+#        self.add_text('*')
+#    def depart_title_reference(self, node):
+#        self.add_text('*')
+
+    def visit_literal(self, node):
+        self.add_text('<tt>')
+    def depart_literal(self, node):
+        self.add_text('</tt>')
+
+#    def visit_subscript(self, node):
+#        self.add_text('_')
+#    def depart_subscript(self, node):
+#        pass
+#
+#    def visit_superscript(self, node):
+#        self.add_text('^')
+#    def depart_superscript(self, node):
+#        pass
+#
+#    def visit_footnote_reference(self, node):
+#        self.add_text('[%s]' % node.astext())
+#        raise nodes.SkipNode
+#
+#    def visit_citation_reference(self, node):
+#        self.add_text('[%s]' % node.astext())
+#        raise nodes.SkipNode
+
+    def visit_Text(self, node):
+        self.add_text(node.astext())
+    def depart_Text(self, node):
+        pass
+
+#    def visit_generated(self, node):
+#        pass
+#    def depart_generated(self, node):
+#        pass
+#
+#    def visit_inline(self, node):
+#        pass
+#    def depart_inline(self, node):
+#        pass
+
+    def visit_problematic(self, node):
+        self.new_block(Verbose, "problematic")
+    def depart_problematic(self, node):
+        self.end_block()
+
+#    def visit_system_message(self, node):
+#        self.new_state(0)
+#        self.add_text('<SYSTEM MESSAGE: %s>' % node.astext())
+#        self.end_state()
+#        raise nodes.SkipNode
+#
+#    def visit_comment(self, node):
+#        raise nodes.SkipNode
+#
+#    def visit_meta(self, node):
+#        # only valid for HTML
+#        raise nodes.SkipNode
+#
+#    def visit_raw(self, node):
+#        if 'text' in node.get('format', '').split():
+#            self.body.append(node.astext())
+#        raise nodes.SkipNode
+
+    def unknown_visit(self, node):
+        print "WARNING: Not implemented. Skiping " + node.__class__.__name__
+        self.new_block(HTML, node.__class__.__name__)
+
+    def unknown_departure(self, node):
+        self.end_block()
+.. Sphinx-hatena documentation master file, created by
+   sphinx-quickstart on Fri Feb 11 13:04:38 2011.
+   You can adapt this file completely to your liking, but it should at least
+   contain the root `toctree` directive.
+
+Welcome to Sphinx-hatena's documentation!
+=========================================
+
+Contents:
+
+.. toctree::
+   :maxdepth: 2
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
+
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+set SPHINXBUILD=sphinx-build
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+	set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+	:help
+	echo.Please use `make ^<target^>` where ^<target^> is one of
+	echo.  html      to make standalone HTML files
+	echo.  dirhtml   to make HTML files named index.html in directories
+	echo.  pickle    to make pickle files
+	echo.  json      to make JSON files
+	echo.  htmlhelp  to make HTML files and a HTML help project
+	echo.  qthelp    to make HTML files and a qthelp project
+	echo.  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+	echo.  changes   to make an overview over all changed/added/deprecated items
+	echo.  linkcheck to check all external links for integrity
+	echo.  doctest   to run all doctests embedded in the documentation if enabled
+	goto end
+)
+
+if "%1" == "clean" (
+	for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+	del /q /s %BUILDDIR%\*
+	goto end
+)
+
+if "%1" == "html" (
+	%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+	goto end
+)
+
+if "%1" == "dirhtml" (
+	%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+	echo.
+	echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+	goto end
+)
+
+if "%1" == "pickle" (
+	%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+	echo.
+	echo.Build finished; now you can process the pickle files.
+	goto end
+)
+
+if "%1" == "json" (
+	%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+	echo.
+	echo.Build finished; now you can process the JSON files.
+	goto end
+)
+
+if "%1" == "htmlhelp" (
+	%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+	echo.
+	echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+	goto end
+)
+
+if "%1" == "qthelp" (
+	%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+	echo.
+	echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+	echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Sphinx-hatena.qhcp
+	echo.To view the help file:
+	echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Sphinx-hatena.ghc
+	goto end
+)
+
+if "%1" == "latex" (
+	%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+	echo.
+	echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+	goto end
+)
+
+if "%1" == "changes" (
+	%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+	echo.
+	echo.The overview file is in %BUILDDIR%/changes.
+	goto end
+)
+
+if "%1" == "linkcheck" (
+	%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+	echo.
+	echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+	goto end
+)
+
+if "%1" == "doctest" (
+	%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+	echo.
+	echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+	goto end
+)
+
+:end
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.