Generate script docs with docbook
This commit is contained in:
parent
b7ea52b401
commit
c0289c3020
@ -40,10 +40,10 @@ moo/moopython/pygtk/moo-generated.defs
|
|||||||
moo/moolua/gtk.xml
|
moo/moolua/gtk.xml
|
||||||
moo/moolua/moo-lua-api.cpp
|
moo/moolua/moo-lua-api.cpp
|
||||||
moo/moolua/gtk-lua-api.cpp
|
moo/moolua/gtk-lua-api.cpp
|
||||||
doc/help/*.html
|
doc/help/*
|
||||||
doc/man-medit.t2t
|
doc/man-medit.t2t
|
||||||
doc/medit.texi
|
doc/medit.texi
|
||||||
doc/medit.1
|
doc/medit.1
|
||||||
doc/help.html
|
doc/script-lua.docbook
|
||||||
doc/script-lua.texi
|
doc/script-lua-gtk.docbook
|
||||||
doc/script-python.texi
|
doc/script-python.docbook
|
||||||
|
@ -19,9 +19,11 @@ genlua_files = \
|
|||||||
|
|
||||||
gendocs_files = \
|
gendocs_files = \
|
||||||
gendocs.py \
|
gendocs.py \
|
||||||
|
gendocbook.py \
|
||||||
mpi/__init__.py \
|
mpi/__init__.py \
|
||||||
mpi/module.py \
|
mpi/module.py \
|
||||||
mpi/texiwriter.py
|
mpi/texiwriter.py \
|
||||||
|
mpi/docbookwriter.py
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
$(docparser_files) \
|
$(docparser_files) \
|
||||||
|
22
api/gendocbook.py
Normal file
22
api/gendocbook.py
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
#! /usr/bin/env python
|
||||||
|
|
||||||
|
import sys
|
||||||
|
import optparse
|
||||||
|
|
||||||
|
from mpi.module import Module
|
||||||
|
from mpi.docbookwriter import Writer
|
||||||
|
|
||||||
|
op = optparse.OptionParser()
|
||||||
|
op.add_option("--python", action="store_true")
|
||||||
|
op.add_option("--lua", action="store_true")
|
||||||
|
(opts, args) = op.parse_args()
|
||||||
|
|
||||||
|
assert len(args) == 1
|
||||||
|
assert bool(opts.python) + bool(opts.lua) == 1
|
||||||
|
if opts.python:
|
||||||
|
mode = 'python'
|
||||||
|
elif opts.lua:
|
||||||
|
mode = 'lua'
|
||||||
|
|
||||||
|
mod = Module.from_xml(args[0])
|
||||||
|
Writer(mode, sys.stdout).write(mod)
|
249
api/mpi/docbookwriter.py
Normal file
249
api/mpi/docbookwriter.py
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
import StringIO
|
||||||
|
|
||||||
|
from mpi.util import *
|
||||||
|
from mpi.module import *
|
||||||
|
|
||||||
|
tmpl_file_start = """\
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<article>
|
||||||
|
"""
|
||||||
|
|
||||||
|
tmpl_file_end = """\
|
||||||
|
</article>
|
||||||
|
"""
|
||||||
|
|
||||||
|
lua_constants = {
|
||||||
|
'NULL': 'nil',
|
||||||
|
'TRUE': 'true',
|
||||||
|
'FALSE': 'false',
|
||||||
|
}
|
||||||
|
|
||||||
|
python_constants = {
|
||||||
|
'NULL': 'None',
|
||||||
|
'TRUE': 'True',
|
||||||
|
'FALSE': 'False',
|
||||||
|
}
|
||||||
|
|
||||||
|
def split_camel_case_name(name):
|
||||||
|
comps = []
|
||||||
|
cur = ''
|
||||||
|
for c in name:
|
||||||
|
if c.islower() or not cur:
|
||||||
|
cur += c
|
||||||
|
else:
|
||||||
|
comps.append(cur)
|
||||||
|
cur = c
|
||||||
|
if cur:
|
||||||
|
comps.append(cur)
|
||||||
|
return comps
|
||||||
|
|
||||||
|
def name_all_caps(cls):
|
||||||
|
return '_'.join([s.upper() for s in split_camel_case_name(cls.name)])
|
||||||
|
|
||||||
|
class Writer(object):
|
||||||
|
def __init__(self, mode, out):
|
||||||
|
super(Writer, self).__init__()
|
||||||
|
self.out = out
|
||||||
|
self.mode = mode
|
||||||
|
if mode == 'python':
|
||||||
|
self.constants = python_constants
|
||||||
|
elif mode == 'lua':
|
||||||
|
self.constants = lua_constants
|
||||||
|
else:
|
||||||
|
oops('unknown mode %s' % mode)
|
||||||
|
|
||||||
|
self.section_suffix = ' (%s)' % self.mode.capitalize()
|
||||||
|
|
||||||
|
def __string_to_bool(self, s):
|
||||||
|
if s == '0':
|
||||||
|
return False
|
||||||
|
elif s == '1':
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
oops()
|
||||||
|
|
||||||
|
def __check_bind_ann(self, obj):
|
||||||
|
bind = self.__string_to_bool(obj.annotations.get('moo.' + self.mode, '1'))
|
||||||
|
if bind:
|
||||||
|
bind = not self.__string_to_bool(obj.annotations.get('moo.private', '0'))
|
||||||
|
return bind
|
||||||
|
|
||||||
|
def __format_constant(self, value):
|
||||||
|
if value in self.constants:
|
||||||
|
return self.constants[value]
|
||||||
|
try:
|
||||||
|
i = int(value)
|
||||||
|
return value
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
oops("unknown constant '%s'" % value)
|
||||||
|
|
||||||
|
def __format_doc(self, doc):
|
||||||
|
text = doc.text
|
||||||
|
text = re.sub(r'@([\w\d_]+)(?!\{)', r'<parameter>\1</parameter>', text)
|
||||||
|
text = re.sub(r'%method{([\w\d_]+(\(\))?)}', r'<function>\1</function>', text)
|
||||||
|
text = re.sub(r'%NULL\b', '<constant>%s</constant>' % self.constants['NULL'], text)
|
||||||
|
text = re.sub(r'%TRUE\b', '<constant>%s</constant>' % self.constants['TRUE'], text)
|
||||||
|
text = re.sub(r'%FALSE\b', '<constant>%s</constant>' % self.constants['FALSE'], text)
|
||||||
|
|
||||||
|
def repl_func(m):
|
||||||
|
return '<function><link linkend="%s" endterm="%s.title"></link></function>' % (m.group(1), m.group(1))
|
||||||
|
text = re.sub(r'([\w\d_.]+)\(\)', repl_func, text)
|
||||||
|
|
||||||
|
assert not re.search(r'NULL|TRUE|FALSE', text)
|
||||||
|
return text
|
||||||
|
|
||||||
|
def __make_class_name(self, cls):
|
||||||
|
if self.mode == 'python':
|
||||||
|
return 'moo.%s' % cls.short_name
|
||||||
|
elif self.mode == 'lua':
|
||||||
|
return 'medit.%s' % cls.short_name
|
||||||
|
else:
|
||||||
|
oops()
|
||||||
|
|
||||||
|
def __write_function(self, func, cls):
|
||||||
|
if not self.__check_bind_ann(func):
|
||||||
|
return
|
||||||
|
|
||||||
|
func_params = list(func.params)
|
||||||
|
if func.has_gerror_return:
|
||||||
|
func_params = func_params[:-1]
|
||||||
|
params = []
|
||||||
|
for p in func_params:
|
||||||
|
if p.default_value is not None:
|
||||||
|
params.append('%s=%s' % (p.name, self.__format_constant(p.default_value)))
|
||||||
|
else:
|
||||||
|
params.append(p.name)
|
||||||
|
|
||||||
|
if isinstance(func, Constructor):
|
||||||
|
if self.mode == 'python':
|
||||||
|
func_name = cls.short_name
|
||||||
|
func_id = '%s.%s' % (cls.short_name, cls.short_name)
|
||||||
|
elif self.mode == 'lua':
|
||||||
|
func_name = 'medit.%s' % func.name
|
||||||
|
func_id = func_name
|
||||||
|
else:
|
||||||
|
oops()
|
||||||
|
elif cls is not None:
|
||||||
|
func_name = func.name
|
||||||
|
func_id = '%s.%s' % (cls.short_name, func.name)
|
||||||
|
else:
|
||||||
|
if self.mode == 'python':
|
||||||
|
func_name = 'moo.%s' % func.name
|
||||||
|
func_id = func_name
|
||||||
|
elif self.mode == 'lua':
|
||||||
|
func_name = 'medit.%s' % func.name
|
||||||
|
func_id = func_name
|
||||||
|
else:
|
||||||
|
oops()
|
||||||
|
|
||||||
|
params_string = ', '.join(params)
|
||||||
|
|
||||||
|
if func.summary:
|
||||||
|
oops(func_id)
|
||||||
|
|
||||||
|
func_id = func.c_name
|
||||||
|
|
||||||
|
self.out.write("""\
|
||||||
|
<sect2 id="%(func_id)s">
|
||||||
|
<title id="%(func_id)s.title">%(func_name)s()</title>
|
||||||
|
<programlisting>%(func_name)s(%(params_string)s)</programlisting>
|
||||||
|
""" % locals())
|
||||||
|
|
||||||
|
if func.doc:
|
||||||
|
self.out.write('<para>%s</para>\n' % self.__format_doc(func.doc))
|
||||||
|
|
||||||
|
has_param_docs = False
|
||||||
|
for p in func_params:
|
||||||
|
if p.doc:
|
||||||
|
has_param_docs = True
|
||||||
|
break
|
||||||
|
|
||||||
|
if has_param_docs:
|
||||||
|
self.out.write("""\
|
||||||
|
<variablelist>
|
||||||
|
<?dbhtml list-presentation="table"?>
|
||||||
|
<?dbhtml term-separator=" : "?>
|
||||||
|
""")
|
||||||
|
|
||||||
|
for p in func_params:
|
||||||
|
param_dic = dict(param=p.name, doc=self.__format_doc(p.doc))
|
||||||
|
self.out.write("""\
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>%(param)s</parameter></term>
|
||||||
|
<listitem><para>%(doc)s</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
""" % param_dic)
|
||||||
|
|
||||||
|
self.out.write('</variablelist>\n')
|
||||||
|
|
||||||
|
|
||||||
|
self.out.write('</sect2>\n')
|
||||||
|
|
||||||
|
def __write_class(self, cls):
|
||||||
|
if not self.__check_bind_ann(cls):
|
||||||
|
return
|
||||||
|
|
||||||
|
do_write = False
|
||||||
|
if cls.constructor is not None and self.__check_bind_ann(cls.constructor):
|
||||||
|
do_write = True
|
||||||
|
else:
|
||||||
|
for meth in cls.methods:
|
||||||
|
if self.__check_bind_ann(meth):
|
||||||
|
do_write = True
|
||||||
|
break
|
||||||
|
if not do_write:
|
||||||
|
return
|
||||||
|
|
||||||
|
title = self.__make_class_name(cls)
|
||||||
|
if cls.summary:
|
||||||
|
title += ' - ' + cls.summary.text
|
||||||
|
dic = dict(Class=self.__make_class_name(cls),
|
||||||
|
HELPSECTION='SCRIPT_%s_%s' % (self.mode.upper(), name_all_caps(cls)),
|
||||||
|
section_suffix=self.section_suffix,
|
||||||
|
title=title,
|
||||||
|
summary=cls.summary.text + '.' if cls.summary else '',
|
||||||
|
subsection='class %s' % self.__make_class_name(cls))
|
||||||
|
self.out.write("""\
|
||||||
|
<sect1 id="%(Class)s">
|
||||||
|
<title>%(title)s</title>
|
||||||
|
""" % dic)
|
||||||
|
|
||||||
|
if cls.doc:
|
||||||
|
self.out.write('<para>%s</para>\n' % self.__format_doc(cls.doc))
|
||||||
|
|
||||||
|
if cls.constructor is not None:
|
||||||
|
self.__write_function(cls.constructor, cls)
|
||||||
|
if hasattr(cls, 'constructable') and cls.constructable:
|
||||||
|
implement_me('GObject constructor of %s' % cls.name)
|
||||||
|
if isinstance(cls, Class):
|
||||||
|
if cls.vmethods:
|
||||||
|
implement_me('virtual methods of %s' % cls.name)
|
||||||
|
for meth in cls.methods:
|
||||||
|
self.__write_function(meth, cls)
|
||||||
|
|
||||||
|
self.out.write("""\
|
||||||
|
</sect1>
|
||||||
|
""" % dic)
|
||||||
|
|
||||||
|
def write(self, module):
|
||||||
|
self.module = module
|
||||||
|
|
||||||
|
self.out.write(tmpl_file_start)
|
||||||
|
|
||||||
|
for cls in module.get_classes() + module.get_boxed() + module.get_pointers():
|
||||||
|
self.__write_class(cls)
|
||||||
|
|
||||||
|
self.out.write("""\
|
||||||
|
<sect1 id="functions">
|
||||||
|
<title>Functions</title>
|
||||||
|
""")
|
||||||
|
|
||||||
|
for func in module.get_functions():
|
||||||
|
self.__write_function(func, None)
|
||||||
|
|
||||||
|
self.out.write('</sect1>\n')
|
||||||
|
|
||||||
|
self.out.write(tmpl_file_end)
|
||||||
|
|
||||||
|
del self.module
|
@ -1,5 +1,19 @@
|
|||||||
|
BUILT_SOURCES =
|
||||||
|
|
||||||
if MOO_DEV_MODE
|
if MOO_DEV_MODE
|
||||||
|
|
||||||
|
# docbook_files = \
|
||||||
|
# medit.docbook \
|
||||||
|
# prefs.docbook
|
||||||
|
#
|
||||||
|
# medit.docbook: medit.docbook.in $(top_builddir)/config.status
|
||||||
|
# $(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.docbook
|
||||||
|
# $(AM_V_at)mv medit.docbook $(srcdir)/medit.docbook
|
||||||
|
#
|
||||||
|
# medit.html: $(docbook_files)
|
||||||
|
# $(AM_V_GEN)xsltproc /usr/share/xml/docbook/stylesheet/docbook-xsl/html/docbook.xsl $(srcdir)/medit.docbook > medit.html.tmp && \
|
||||||
|
# mv medit.html.tmp $(srcdir)/medit.html
|
||||||
|
|
||||||
src_texinfo_files = \
|
src_texinfo_files = \
|
||||||
medit.texi \
|
medit.texi \
|
||||||
prefs.texi \
|
prefs.texi \
|
||||||
@ -7,36 +21,55 @@ src_texinfo_files = \
|
|||||||
user-tools.texi \
|
user-tools.texi \
|
||||||
regex.texi \
|
regex.texi \
|
||||||
license.texi \
|
license.texi \
|
||||||
script.texi \
|
script.texi
|
||||||
script-python.texi \
|
|
||||||
script-lua.texi
|
|
||||||
|
|
||||||
medit.texi: medit.texi.in $(top_builddir)/config.status
|
medit.texi: medit.texi.in $(top_builddir)/config.status
|
||||||
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.texi
|
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/medit.texi
|
||||||
$(AM_V_at)mv medit.texi $(srcdir)/medit.texi
|
$(AM_V_at)mv medit.texi $(srcdir)/medit.texi
|
||||||
|
|
||||||
gendocs_files = \
|
gendocbook_files = \
|
||||||
$(top_srcdir)/api/gendocs.py \
|
$(top_srcdir)/api/gendocbook.py \
|
||||||
$(top_srcdir)/api/mpi/__init__.py \
|
$(top_srcdir)/api/mpi/__init__.py \
|
||||||
$(top_srcdir)/api/mpi/module.py \
|
$(top_srcdir)/api/mpi/module.py \
|
||||||
$(top_srcdir)/api/mpi/texiwriter.py
|
$(top_srcdir)/api/mpi/docbookwriter.py
|
||||||
|
|
||||||
script-python.texi: $(gendocs_files) $(top_srcdir)/api/moo.xml
|
script-python.docbook: $(gendocbook_files) $(top_srcdir)/api/moo.xml
|
||||||
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocs.py --python $(top_srcdir)/api/moo.xml \
|
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocbook.py --python $(top_srcdir)/api/moo.xml \
|
||||||
> script-python.texi.tmp && mv script-python.texi.tmp $(srcdir)/script-python.texi
|
> script-python.docbook.tmp && mv script-python.docbook.tmp $(srcdir)/script-python.docbook
|
||||||
|
|
||||||
script-lua.texi: $(gendocs_files) $(top_srcdir)/api/moo.xml
|
script-lua.docbook: $(gendocbook_files) $(top_srcdir)/api/moo.xml
|
||||||
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocs.py --lua $(top_srcdir)/api/moo.xml \
|
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocbook.py --lua $(top_srcdir)/api/moo.xml \
|
||||||
> script-lua.texi.tmp && mv script-lua.texi.tmp $(srcdir)/script-lua.texi
|
> script-lua.docbook.tmp && mv script-lua.docbook.tmp $(srcdir)/script-lua.docbook
|
||||||
|
|
||||||
|
script-lua-gtk.docbook: $(gendocbook_files) $(top_srcdir)/moo/moolua/gtk.xml
|
||||||
|
$(AM_V_GEN)$(PYTHON) $(top_srcdir)/api/gendocbook.py --lua $(top_srcdir)/moo/moolua/gtk.xml \
|
||||||
|
> script-lua-gtk.docbook.tmp && mv script-lua-gtk.docbook.tmp $(srcdir)/script-lua-gtk.docbook
|
||||||
|
|
||||||
|
help/script-python.html: script-python.docbook script.xsl help/index.html
|
||||||
|
$(AM_V_GEN)xsltproc --output script-python.html.tmp \
|
||||||
|
$(srcdir)/script.xsl $(srcdir)/script-python.docbook \
|
||||||
|
&& mv script-python.html.tmp $(srcdir)/help/script-python.html
|
||||||
|
|
||||||
|
help/script-lua.html: script-lua.docbook script.xsl help/index.html
|
||||||
|
$(AM_V_GEN)xsltproc --output script-lua.html.tmp \
|
||||||
|
$(srcdir)/script.xsl $(srcdir)/script-lua.docbook \
|
||||||
|
&& mv script-lua.html.tmp $(srcdir)/help/script-lua.html
|
||||||
|
|
||||||
|
help/script-lua-gtk.html: script-lua-gtk.docbook script.xsl help/index.html
|
||||||
|
$(AM_V_GEN)xsltproc --output script-lua-gtk.html.tmp \
|
||||||
|
$(srcdir)/script.xsl $(srcdir)/script-lua-gtk.docbook \
|
||||||
|
&& mv script-lua-gtk.html.tmp $(srcdir)/help/script-lua-gtk.html
|
||||||
|
|
||||||
|
help/script.css: script.css
|
||||||
|
$(AM_V_GEN)cp $(srcdir)/script.css $(srcdir)/help/
|
||||||
|
|
||||||
help/index.html: $(src_texinfo_files)
|
help/index.html: $(src_texinfo_files)
|
||||||
$(AM_V_at)rm -f $(srcdir)/help/*.html
|
$(AM_V_at)rm -f $(srcdir)/help/*.html
|
||||||
$(AM_V_at)$(MKDIR_P) $(srcdir)/help
|
$(AM_V_at)$(MKDIR_P) $(srcdir)/help
|
||||||
$(AM_V_GEN)cd $(srcdir) && makeinfo --html medit.texi
|
$(AM_V_GEN)cd $(srcdir) && makeinfo --html medit.texi
|
||||||
|
|
||||||
help.html: help/index.html
|
help/help.html: help/index.html
|
||||||
$(AM_V_at)rm -f $(srcdir)/help.html
|
$(AM_V_GEN)cd $(srcdir) && makeinfo --html --no-split medit.texi && mv help.html help/
|
||||||
$(AM_V_GEN)cd $(srcdir) && makeinfo --html --no-split medit.texi
|
|
||||||
|
|
||||||
help-sections.h.stamp: help/index.html $(srcdir)/gensections.py
|
help-sections.h.stamp: help/index.html $(srcdir)/gensections.py
|
||||||
$(AM_V_GEN)$(PYTHON) $(srcdir)/gensections.py $(srcdir)/help/*.html > help-sections.h.tmp && \
|
$(AM_V_GEN)$(PYTHON) $(srcdir)/gensections.py $(srcdir)/help/*.html > help-sections.h.tmp && \
|
||||||
@ -45,7 +78,15 @@ help-sections.h.stamp: help/index.html $(srcdir)/gensections.py
|
|||||||
$(AM_V_at)echo stamp > help-sections.h.stamp
|
$(AM_V_at)echo stamp > help-sections.h.stamp
|
||||||
|
|
||||||
all-am: doc
|
all-am: doc
|
||||||
doc: help/index.html help.html help-sections.h.stamp medit.1
|
doc: \
|
||||||
|
help/index.html \
|
||||||
|
help/help.html \
|
||||||
|
help/script-lua.html \
|
||||||
|
help/script-lua-gtk.html \
|
||||||
|
help/script-python.html \
|
||||||
|
help/script.css \
|
||||||
|
help-sections.h.stamp \
|
||||||
|
medit.1
|
||||||
|
|
||||||
man-medit.t2t: man-medit.t2t.in $(top_builddir)/config.status
|
man-medit.t2t: man-medit.t2t.in $(top_builddir)/config.status
|
||||||
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/man-medit.t2t
|
$(AM_V_GEN)cd $(top_builddir) && ./config.status --silent --file=doc/man-medit.t2t
|
||||||
@ -57,7 +98,7 @@ medit.1: man-medit.t2t
|
|||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
EXTRA_DIST = help help.html help-sections.h medit.1
|
EXTRA_DIST = help help-sections.h medit.1
|
||||||
|
|
||||||
install-data-local:
|
install-data-local:
|
||||||
$(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR)
|
$(MKDIR_P) $(DESTDIR)$(MOO_HELP_DIR)
|
||||||
|
@ -16,11 +16,12 @@ sections = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
for f in sys.argv[1:]:
|
for f in sys.argv[1:]:
|
||||||
for line in open(f):
|
if not os.path.basename(f) in ['help.html', 'script-lua.html', 'script-lua-gtk.html', 'script-python.html']:
|
||||||
m = re_section.search(line)
|
for line in open(f):
|
||||||
if m:
|
m = re_section.search(line)
|
||||||
sections.append([m.group(1), f])
|
if m:
|
||||||
break
|
sections.append([m.group(1), f])
|
||||||
|
break
|
||||||
|
|
||||||
print '#ifndef MOO_HELP_SECTIONS_H'
|
print '#ifndef MOO_HELP_SECTIONS_H'
|
||||||
print '#define MOO_HELP_SECTIONS_H'
|
print '#define MOO_HELP_SECTIONS_H'
|
||||||
|
@ -23,35 +23,6 @@
|
|||||||
#define HELP_SECTION_PREFS_PLUGINS "index.html"
|
#define HELP_SECTION_PREFS_PLUGINS "index.html"
|
||||||
#define HELP_SECTION_REGEX "Regular-expressions.html"
|
#define HELP_SECTION_REGEX "Regular-expressions.html"
|
||||||
#define HELP_SECTION_SCRIPT "Scripting.html"
|
#define HELP_SECTION_SCRIPT "Scripting.html"
|
||||||
#define HELP_SECTION_SCRIPT_LUA_FUNCTIONS "Functions-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_APP "medit_002eApp-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT "medit_002eEdit-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_EDITOR "medit_002eEditor-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_OPEN_INFO "medit_002eEditOpenInfo-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_RELOAD_INFO "medit_002eEditReloadInfo-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_SAVE_INFO "medit_002eEditSaveInfo-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_EDIT_WINDOW "medit_002eEditWindow-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_PANE "medit_002ePane-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_PANE_LABEL "medit_002ePaneLabel-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_PANE_PARAMS "medit_002ePaneParams-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_LUA_MOO_TEXT_VIEW "medit_002eTextView-_0028Lua_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_FUNCTIONS "Functions-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_APP "moo_002eApp-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_DOC_PLUGIN "moo_002eDocPlugin-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT "moo_002eEdit-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDITOR "moo_002eEditor-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_OPEN_INFO "moo_002eEditOpenInfo-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_RELOAD_INFO "moo_002eEditReloadInfo-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_SAVE_INFO "moo_002eEditSaveInfo-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_EDIT_WINDOW "moo_002eEditWindow-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PANE "moo_002ePane-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PANE_LABEL "moo_002ePaneLabel-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PANE_PARAMS "moo_002ePaneParams-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PLUGIN "moo_002ePlugin-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PLUGIN_INFO "moo_002ePluginInfo-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_PLUGIN_PARAMS "moo_002ePluginParams-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_TEXT_VIEW "moo_002eTextView-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_SCRIPT_PYTHON_MOO_WIN_PLUGIN "moo_002eWinPlugin-_0028Python_0029.html"
|
|
||||||
#define HELP_SECTION_USER_TOOLS "User_002ddefined-tools.html"
|
#define HELP_SECTION_USER_TOOLS "User_002ddefined-tools.html"
|
||||||
#define HELP_SECTION_USER_TOOLS_FILES "Storing-tools-in-files.html"
|
#define HELP_SECTION_USER_TOOLS_FILES "Storing-tools-in-files.html"
|
||||||
#define HELP_SECTION_USER_TOOLS_MANAGING "Managing-tools.html"
|
#define HELP_SECTION_USER_TOOLS_MANAGING "Managing-tools.html"
|
||||||
|
138
doc/script.css
Normal file
138
doc/script.css
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
.variablelist
|
||||||
|
{
|
||||||
|
padding: 4px;
|
||||||
|
margin-left: 3em;
|
||||||
|
}
|
||||||
|
.variablelist td:first-child
|
||||||
|
{
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.programlisting
|
||||||
|
{
|
||||||
|
/* tango:sky blue 0/1 */
|
||||||
|
background: #e6f3ff;
|
||||||
|
border: solid 1px #729fcf;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navigation .title
|
||||||
|
{
|
||||||
|
font-size: 200%;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.table table
|
||||||
|
{
|
||||||
|
border-collapse: collapse;
|
||||||
|
border-spacing: 0px;
|
||||||
|
/* tango:aluminium 3 */
|
||||||
|
border: solid 1px #babdb6;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.table table td, div.table table th
|
||||||
|
{
|
||||||
|
/* tango:aluminium 3 */
|
||||||
|
border: solid 1px #babdb6;
|
||||||
|
padding: 3px;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.table table th
|
||||||
|
{
|
||||||
|
/* tango:aluminium 2 */
|
||||||
|
background-color: #d3d7cf;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr
|
||||||
|
{
|
||||||
|
/* tango:aluminium 3 */
|
||||||
|
color: #babdb6;
|
||||||
|
background: #babdb6;
|
||||||
|
border: none 0px;
|
||||||
|
height: 1px;
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer
|
||||||
|
{
|
||||||
|
padding-top: 3.5em;
|
||||||
|
/* tango:aluminium 3 */
|
||||||
|
color: #babdb6;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning
|
||||||
|
{
|
||||||
|
/* tango:orange 0/1 */
|
||||||
|
background: #ffeed9;
|
||||||
|
border-color: #ffb04f;
|
||||||
|
}
|
||||||
|
.note
|
||||||
|
{
|
||||||
|
/* tango:chameleon 0/0.5 */
|
||||||
|
background: #d8ffb2;
|
||||||
|
border-color: #abf562;
|
||||||
|
}
|
||||||
|
.note, .warning
|
||||||
|
{
|
||||||
|
padding: 0.5em;
|
||||||
|
border-width: 1px;
|
||||||
|
border-style: solid;
|
||||||
|
}
|
||||||
|
.note h3, .warning h3
|
||||||
|
{
|
||||||
|
margin-top: 0.0em
|
||||||
|
}
|
||||||
|
.note p, .warning p
|
||||||
|
{
|
||||||
|
margin-bottom: 0.0em
|
||||||
|
}
|
||||||
|
|
||||||
|
/* blob links */
|
||||||
|
h2 .extralinks, h3 .extralinks
|
||||||
|
{
|
||||||
|
float: right;
|
||||||
|
/* tango:aluminium 3 */
|
||||||
|
color: #babdb6;
|
||||||
|
font-size: 80%;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.annotation
|
||||||
|
{
|
||||||
|
/* tango:aluminium 5 */
|
||||||
|
color: #555753;
|
||||||
|
font-size: 80%;
|
||||||
|
font-weight: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listing_frame {
|
||||||
|
/* tango:sky blue 1 */
|
||||||
|
border: solid 1px #729fcf;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.listing_lines, .listing_code {
|
||||||
|
margin-top: 0px;
|
||||||
|
margin-bottom: 0px;
|
||||||
|
padding: 0.5em;
|
||||||
|
}
|
||||||
|
.listing_lines {
|
||||||
|
/* tango:sky blue 0.5 */
|
||||||
|
background: #a6c5e3;
|
||||||
|
/* tango:aluminium 6 */
|
||||||
|
color: #2e3436;
|
||||||
|
}
|
||||||
|
.listing_code {
|
||||||
|
/* tango:sky blue 0 */
|
||||||
|
background: #e6f3ff;
|
||||||
|
}
|
||||||
|
.listing_code .programlisting {
|
||||||
|
/* override from previous */
|
||||||
|
border: none 0px;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
.listing_lines pre, .listing_code pre {
|
||||||
|
margin: 0px;
|
||||||
|
}
|
@ -2,14 +2,6 @@
|
|||||||
@chapter Scripting
|
@chapter Scripting
|
||||||
@helpsection{SCRIPT}
|
@helpsection{SCRIPT}
|
||||||
|
|
||||||
@macro method{text}
|
|
||||||
@code{\text\}
|
|
||||||
@end macro
|
|
||||||
|
|
||||||
@macro param{text}
|
|
||||||
@code{\text\}
|
|
||||||
@end macro
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Lua:: Lua
|
* Lua:: Lua
|
||||||
* Python:: Python
|
* Python:: Python
|
||||||
@ -17,8 +9,10 @@
|
|||||||
|
|
||||||
@node Lua
|
@node Lua
|
||||||
@section Lua
|
@section Lua
|
||||||
@include script-lua.texi
|
@uref{script-lua.html, script-lua}
|
||||||
|
|
||||||
|
@uref{script-lua-gtk.html, script-lua-gtk}
|
||||||
|
|
||||||
@node Python
|
@node Python
|
||||||
@section Python
|
@section Python
|
||||||
@include script-python.texi
|
@uref{script-python.html, script-python}
|
||||||
|
28
doc/script.xsl
Normal file
28
doc/script.xsl
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?xml version='1.0'?>
|
||||||
|
<xsl:stylesheet
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
||||||
|
|
||||||
|
<xsl:import href="http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl"/>
|
||||||
|
|
||||||
|
<xsl:param name="html.stylesheet" select="'script.css'"/>
|
||||||
|
|
||||||
|
<xsl:output method="html"
|
||||||
|
indent="yes"/>
|
||||||
|
|
||||||
|
<!--<xsl:param name="variablelist.as.table" select="1"/>-->
|
||||||
|
|
||||||
|
<xsl:template match="sect1">
|
||||||
|
<xsl:if test="preceding-sibling::sect1">
|
||||||
|
<hr/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-imports/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- <xsl:template match="sect2">
|
||||||
|
<xsl:if test="preceding-sibling::sect2">
|
||||||
|
<hr/>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:apply-imports/>
|
||||||
|
</xsl:template>-->
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
@ -52,6 +52,26 @@ moo_edit_begin_non_undoable_action (MooEdit *doc)
|
|||||||
moo_text_view_begin_non_undoable_action (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
moo_text_view_begin_non_undoable_action (MOO_TEXT_VIEW (moo_edit_get_view (doc)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* moo_edit_begin_user_action:
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
moo_edit_begin_user_action (MooEdit *doc)
|
||||||
|
{
|
||||||
|
moo_return_if_fail (MOO_IS_EDIT (doc));
|
||||||
|
gtk_text_buffer_begin_user_action (moo_edit_get_buffer (doc));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* moo_edit_end_user_action:
|
||||||
|
**/
|
||||||
|
void
|
||||||
|
moo_edit_end_user_action (MooEdit *doc)
|
||||||
|
{
|
||||||
|
moo_return_if_fail (MOO_IS_EDIT (doc));
|
||||||
|
gtk_text_buffer_end_user_action (moo_edit_get_buffer (doc));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_end_non_undoable_action:
|
* moo_edit_end_non_undoable_action:
|
||||||
**/
|
**/
|
||||||
@ -364,6 +384,8 @@ moo_edit_delete_text (MooEdit *doc,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_append_text:
|
* moo_edit_append_text:
|
||||||
|
*
|
||||||
|
* Append text to the end of document.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
moo_edit_append_text (MooEdit *doc,
|
moo_edit_append_text (MooEdit *doc,
|
||||||
@ -382,6 +404,8 @@ moo_edit_append_text (MooEdit *doc,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_clear:
|
* moo_edit_clear:
|
||||||
|
*
|
||||||
|
* Remove all text from document.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
moo_edit_clear (MooEdit *doc)
|
moo_edit_clear (MooEdit *doc)
|
||||||
@ -398,6 +422,8 @@ moo_edit_clear (MooEdit *doc)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_cut:
|
* moo_edit_cut:
|
||||||
|
*
|
||||||
|
* Cut selection to clipboard.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
moo_edit_cut (MooEdit *doc)
|
moo_edit_cut (MooEdit *doc)
|
||||||
@ -408,6 +434,8 @@ moo_edit_cut (MooEdit *doc)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_copy:
|
* moo_edit_copy:
|
||||||
|
*
|
||||||
|
* Copy selection to clipboard.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
moo_edit_copy (MooEdit *doc)
|
moo_edit_copy (MooEdit *doc)
|
||||||
@ -418,6 +446,8 @@ moo_edit_copy (MooEdit *doc)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_paste:
|
* moo_edit_paste:
|
||||||
|
*
|
||||||
|
* Paste clipboard contents.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
moo_edit_paste (MooEdit *doc)
|
moo_edit_paste (MooEdit *doc)
|
||||||
@ -428,6 +458,8 @@ moo_edit_paste (MooEdit *doc)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_select_text:
|
* moo_edit_select_text:
|
||||||
|
*
|
||||||
|
* Select text from @start to @end.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
moo_edit_select_text (MooEdit *doc,
|
moo_edit_select_text (MooEdit *doc,
|
||||||
@ -597,7 +629,7 @@ join_lines (char **strv)
|
|||||||
* selected lines with, maybe empty
|
* selected lines with, maybe empty
|
||||||
*
|
*
|
||||||
* replace selected lines with @replacement. Similar to
|
* replace selected lines with @replacement. Similar to
|
||||||
* %method{replace_selected_text()}, but selection is extended to include
|
* moo_edit_replace_selected_text(), but selection is extended to include
|
||||||
* whole lines. If nothing is selected, then line at cursor is replaced.
|
* whole lines. If nothing is selected, then line at cursor is replaced.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
@ -657,6 +689,10 @@ moo_edit_delete_selected_text (MooEdit *doc)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* moo_edit_delete_selected_lines:
|
* moo_edit_delete_selected_lines:
|
||||||
|
*
|
||||||
|
* Delete selected lines. Similar to moo_edit_delete_selected_text() but
|
||||||
|
* selection is extended to include whole lines. If no text is selected then
|
||||||
|
* line at cursor is deleted.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
moo_edit_delete_selected_lines (MooEdit *doc)
|
moo_edit_delete_selected_lines (MooEdit *doc)
|
||||||
@ -667,7 +703,7 @@ moo_edit_delete_selected_lines (MooEdit *doc)
|
|||||||
/**
|
/**
|
||||||
* moo_edit_replace_selected_text:
|
* moo_edit_replace_selected_text:
|
||||||
*
|
*
|
||||||
* replace selected text with @replacement. If nothing is selected,
|
* Replace selected text with string @replacement. If nothing is selected,
|
||||||
* then @replacement is inserted at cursor.
|
* then @replacement is inserted at cursor.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
|
@ -9,6 +9,8 @@ gboolean moo_edit_can_undo (MooEdit *doc);
|
|||||||
gboolean moo_edit_can_redo (MooEdit *doc);
|
gboolean moo_edit_can_redo (MooEdit *doc);
|
||||||
gboolean moo_edit_undo (MooEdit *doc);
|
gboolean moo_edit_undo (MooEdit *doc);
|
||||||
gboolean moo_edit_redo (MooEdit *doc);
|
gboolean moo_edit_redo (MooEdit *doc);
|
||||||
|
void moo_edit_begin_user_action (MooEdit *doc);
|
||||||
|
void moo_edit_end_user_action (MooEdit *doc);
|
||||||
void moo_edit_begin_non_undoable_action (MooEdit *doc);
|
void moo_edit_begin_non_undoable_action (MooEdit *doc);
|
||||||
void moo_edit_end_non_undoable_action (MooEdit *doc);
|
void moo_edit_end_non_undoable_action (MooEdit *doc);
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class:MooEdit: (parent GObject): Document object
|
* class:MooEdit: (parent GObject): document object
|
||||||
*
|
*
|
||||||
* Object which represents a document. It has methods for file operations
|
* Object which represents a document. It has methods for file operations
|
||||||
* and manipulating document text.
|
* and manipulating document text.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user