Server IP : 127.0.0.2 / Your IP : 3.144.103.205 Web Server : Apache/2.4.18 (Ubuntu) System : User : www-data ( ) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : disk_free_space,disk_total_space,diskfreespace,dl,exec,fpaththru,getmyuid,getmypid,highlight_file,ignore_user_abord,leak,listen,link,opcache_get_configuration,opcache_get_status,passthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,php_uname,phpinfo,posix_ctermid,posix_getcwd,posix_getegid,posix_geteuid,posix_getgid,posix_getgrgid,posix_getgrnam,posix_getgroups,posix_getlogin,posix_getpgid,posix_getpgrp,posix_getpid,posix,_getppid,posix_getpwnam,posix_getpwuid,posix_getrlimit,posix_getsid,posix_getuid,posix_isatty,posix_kill,posix_mkfifo,posix_setegid,posix_seteuid,posix_setgid,posix_setpgid,posix_setsid,posix_setuid,posix_times,posix_ttyname,posix_uname,pclose,popen,proc_open,proc_close,proc_get_status,proc_nice,proc_terminate,shell_exec,source,show_source,system,virtual MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/lib/python2.7/dist-packages/docutils/transforms/ |
Upload File : |
# $Id: writer_aux.py 7320 2012-01-19 22:33:02Z milde $ # Author: Lea Wiemann <LeWiemann@gmail.com> # Copyright: This module has been placed in the public domain. """ Auxiliary transforms mainly to be used by Writer components. This module is called "writer_aux" because otherwise there would be conflicting imports like this one:: from docutils import writers from docutils.transforms import writers """ __docformat__ = 'reStructuredText' from docutils import nodes, utils, languages from docutils.transforms import Transform class Compound(Transform): """ Flatten all compound paragraphs. For example, transform :: <compound> <paragraph> <literal_block> <paragraph> into :: <paragraph> <literal_block classes="continued"> <paragraph classes="continued"> """ default_priority = 910 def apply(self): for compound in self.document.traverse(nodes.compound): first_child = True for child in compound: if first_child: if not isinstance(child, nodes.Invisible): first_child = False else: child['classes'].append('continued') # Substitute children for compound. compound.replace_self(compound[:]) class Admonitions(Transform): """ Transform specific admonitions, like this: <note> <paragraph> Note contents ... into generic admonitions, like this:: <admonition classes="note"> <title> Note <paragraph> Note contents ... The admonition title is localized. """ default_priority = 920 def apply(self): language = languages.get_language(self.document.settings.language_code, self.document.reporter) for node in self.document.traverse(nodes.Admonition): node_name = node.__class__.__name__ # Set class, so that we know what node this admonition came from. node['classes'].append(node_name) if not isinstance(node, nodes.admonition): # Specific admonition. Transform into a generic admonition. admonition = nodes.admonition(node.rawsource, *node.children, **node.attributes) title = nodes.title('', language.labels[node_name]) admonition.insert(0, title) node.replace_self(admonition)