/usr/lib/python2.7/dist-packages/sphinx/writers/xml.py is in python-sphinx 1.6.7-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # -*- coding: utf-8 -*-
"""
sphinx.writers.xml
~~~~~~~~~~~~~~~~~~
Docutils-native XML and pseudo-XML writers.
:copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from docutils import writers
from docutils.writers.docutils_xml import Writer as BaseXMLWriter
if False:
# For type annotation
from typing import Any, Tuple # NOQA
from sphinx.builders import Builder # NOQA
class XMLWriter(BaseXMLWriter):
def __init__(self, builder):
# type: (Builder) -> None
BaseXMLWriter.__init__(self)
self.builder = builder
self.translator_class = self.builder.get_translator_class()
def translate(self, *args, **kwargs):
# type: (Any, Any) -> None
self.document.settings.newlines = \
self.document.settings.indents = \
self.builder.env.config.xml_pretty
self.document.settings.xml_declaration = True
self.document.settings.doctype_declaration = True
return BaseXMLWriter.translate(self)
class PseudoXMLWriter(writers.Writer):
supported = ('pprint', 'pformat', 'pseudoxml')
"""Formats this writer supports."""
config_section = 'pseudoxml writer'
config_section_dependencies = ('writers',) # type: Tuple[unicode]
output = None
"""Final translated form of `document`."""
def __init__(self, builder):
# type: (Builder) -> None
writers.Writer.__init__(self)
self.builder = builder
def translate(self):
# type: () -> None
self.output = self.document.pformat()
def supports(self, format):
# type: (unicode) -> bool
"""This writer supports all format-specific elements."""
return True
|