Txt2tags
This commit is contained in:
parent
d9a3137465
commit
372a5aacd2
13
Makefile.am
13
Makefile.am
@ -4,7 +4,6 @@ m4files = \
|
||||
m4/moo-comps.m4 \
|
||||
m4/moo-debug.m4 \
|
||||
m4/moo-dirs.m4 \
|
||||
m4/moo-docs.m4 \
|
||||
m4/moo-fam.m4 \
|
||||
m4/moo-flags.m4 \
|
||||
m4/moo-funcs.m4 \
|
||||
@ -47,16 +46,10 @@ if MOO_ENABLE_NLS
|
||||
po_subdirs = po po-gsv
|
||||
endif
|
||||
|
||||
if MOO_ENABLE_HELP
|
||||
if MOO_BUILD_DOCS
|
||||
doc_subdirs = doc
|
||||
endif
|
||||
endif
|
||||
|
||||
if MOO_BUILD_MEDIT
|
||||
SUBDIRS = . $(po_subdirs) $(doc_subdirs) moo medit
|
||||
SUBDIRS = . $(po_subdirs) doc moo medit
|
||||
else
|
||||
SUBDIRS = . $(po_subdirs) $(doc_subdirs) moo
|
||||
SUBDIRS = . $(po_subdirs) doc moo
|
||||
endif
|
||||
|
||||
if MOO_ENABLE_TESTS
|
||||
@ -78,7 +71,7 @@ DISTCLEANFILES = \
|
||||
po-subdirs-stamp-2 \
|
||||
po-subdirs-stamp
|
||||
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-docs --enable-unit-tests
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-unit-tests
|
||||
distuninstallcheck_listfiles = find . -type f -print | grep -v share/mime/ | grep -v share/icons/hicolor
|
||||
|
||||
snapshot:
|
||||
|
@ -36,7 +36,6 @@ AC_SUBST(MOO_SRC_PREFIX)
|
||||
MOO_COMPONENTS([app,edit,term],[])
|
||||
MOO_AC_SET_DIRS
|
||||
MOO_AC_FLAGS(moo)
|
||||
MOO_DOCS
|
||||
|
||||
|
||||
################################################################################
|
||||
|
@ -1,77 +1,52 @@
|
||||
docbook_files = \
|
||||
medit.docbook \
|
||||
license.docbook \
|
||||
prefs.docbook \
|
||||
prefs-file.docbook \
|
||||
user-tools.docbook
|
||||
t2t_sources = \
|
||||
license.t2t \
|
||||
medit.t2t \
|
||||
prefs-file.t2t \
|
||||
prefs.t2t \
|
||||
user-tools.t2t
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(docbook_files) \
|
||||
help-sections.h \
|
||||
manual.xsl \
|
||||
help.xsl \
|
||||
help.css \
|
||||
txt2xml
|
||||
EXTRA_DIST = \
|
||||
$(t2t_sources) \
|
||||
splity/splity.pl \
|
||||
splity/index-template.html \
|
||||
splity/page-template.html \
|
||||
makedocs \
|
||||
stamp-help \
|
||||
help-sections.h
|
||||
|
||||
all: build-help manual.html
|
||||
BUILT_SOURCES = stamp-help help-sections.h
|
||||
|
||||
build-help: help/help.css
|
||||
help-sections.h: stamp-help
|
||||
build-docs: stamp-help
|
||||
|
||||
DISTCLEANFILES = LGPL.xml
|
||||
# Stupid form feed characters and stupid XML and stupid xsltproc!!!
|
||||
LGPL.xml: $(top_srcdir)/COPYING
|
||||
$(srcdir)/txt2xml $(top_srcdir)/COPYING > LGPL.xml.tmp && \
|
||||
mv LGPL.xml.tmp LGPL.xml
|
||||
|
||||
stamp-help: $(docbook_files) help.xsl
|
||||
$(MAKE) $(AM_MAKEFLAGS) LGPL.xml && \
|
||||
rm -f help/*.html && \
|
||||
stamp-help: $(t2t_sources) makedocs
|
||||
rm -fr help && \
|
||||
$(mkdir_p) help && \
|
||||
xsltproc --xinclude --path "." --stringparam base.dir $(builddir)/help/ $(srcdir)/help.xsl $(srcdir)/medit.docbook && \
|
||||
$(srcdir)/makedocs $(srcdir) $(srcdir)/medit.t2t && \
|
||||
echo stamp > stamp-help
|
||||
help/help.css: stamp-help help.css
|
||||
cp $(srcdir)/help.css help/
|
||||
|
||||
manual.html: $(docbook_files) manual.xsl
|
||||
$(MAKE) $(AM_MAKEFLAGS) LGPL.xml && \
|
||||
xsltproc --xinclude --path "." --output manual.html $(srcdir)/manual.xsl $(srcdir)/medit.docbook
|
||||
medit.lo: build-docs
|
||||
prefs.lo: build-docs
|
||||
prefs-file.lo: build-docs
|
||||
license.lo: build-docs
|
||||
user-tools.lo: build-docs
|
||||
|
||||
medit.lo: build-help
|
||||
prefs.lo: build-help
|
||||
prefs-file.lo: build-help
|
||||
license.lo: build-help
|
||||
user-tools.lo: build-help
|
||||
|
||||
#############################################################################
|
||||
# Standard automake stuff
|
||||
#
|
||||
install: install-data
|
||||
install-data: build-help manual.html
|
||||
install-data-hook: build-docs
|
||||
$(mkdir_p) $(DESTDIR)$(htmldir)/help
|
||||
if test -f stamp-help; then \
|
||||
$(INSTALL_DATA) manual.html $(DESTDIR)$(htmldir)/ && \
|
||||
$(INSTALL_DATA) help/* $(DESTDIR)$(htmldir)/help/ ; \
|
||||
else \
|
||||
$(INSTALL_DATA) $(srcdir)/manual.html $(DESTDIR)$(htmldir)/ && \
|
||||
$(INSTALL_DATA) $(srcdir)/help/* $(DESTDIR)$(htmldir)/help/ ; \
|
||||
fi
|
||||
uninstall:
|
||||
rm -fr $(DESTDIR)$(htmldir)/help $(htmldir)/manual.html
|
||||
uninstall-hook:
|
||||
rm -fr $(DESTDIR)$(htmldir)/help
|
||||
|
||||
if MOO_BUILD_DOCS
|
||||
dist-hook:
|
||||
$(MAKE) $(AM_MAKEFLAGS) all || exit 1
|
||||
if test -f stamp-help; then \
|
||||
cp -p stamp-help manual.html $(distdir)/ && \
|
||||
cp -pR help/ $(distdir)/ ; \
|
||||
else \
|
||||
cp -p $(srcdir)/stamp-help $(srcdir)/manual.html $(distdir)/ && \
|
||||
cp -pR $(srcdir)/help/ $(distdir)/ ; \
|
||||
fi
|
||||
endif
|
||||
|
||||
clean: mostlyclean
|
||||
mostlyclean:
|
||||
rm -fr help stamp-help manual.html
|
||||
distclean: clean
|
||||
rm -f Makefile Makefile.in
|
||||
distclean-hook:
|
||||
rm -fr help stamp-help
|
||||
|
@ -1,21 +0,0 @@
|
||||
#ifndef HELP_SECTIONS_H
|
||||
#define HELP_SECTIONS_H
|
||||
|
||||
|
||||
#define HELP_SECTION_LICENSE "app-license"
|
||||
|
||||
#define HELP_SECTION_PREFS_LANGS_AND_FILTERS "prefs-langs-and-filters"
|
||||
#define HELP_SECTION_PREFS_PLUGINS "prefs-plugins"
|
||||
#define HELP_SECTION_PREFS_USER_TOOLS "prefs-user-tools"
|
||||
#define HELP_SECTION_PREFS_FILE_SELECTOR "prefs-file-selector"
|
||||
#define HELP_SECTION_PREFS_DIALOG "prefs-dialog"
|
||||
|
||||
#define HELP_SECTION_DIALOG_FIND "dialog-find"
|
||||
#define HELP_SECTION_DIALOG_REPLACE "dialog-replace"
|
||||
#define HELP_SECTION_DIALOG_FIND_IN_FILES "dialog-find-in-files"
|
||||
#define HELP_SECTION_DIALOG_FIND_FILE "dialog-find-file"
|
||||
|
||||
#define HELP_SECTION_FILE_SELECTOR "file-selector"
|
||||
|
||||
|
||||
#endif /* HELP_SECTIONS_H */
|
@ -1,3 +0,0 @@
|
||||
P.generated-date {
|
||||
font-size: 72%;
|
||||
}
|
82
doc/help.xsl
82
doc/help.xsl
@ -1,82 +0,0 @@
|
||||
<?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/chunk.xsl"/>
|
||||
|
||||
|
||||
<!-- Do not print section title in subsection headers -->
|
||||
<xsl:template name="header.navigation">
|
||||
<xsl:param name="prev" select="/foo"/>
|
||||
<xsl:param name="next" select="/foo"/>
|
||||
<xsl:param name="nav.context"/>
|
||||
|
||||
<xsl:variable name="home" select="/*[1]"/>
|
||||
<xsl:variable name="up" select="parent::*"/>
|
||||
|
||||
<xsl:variable name="row2" select="count($prev) > 0
|
||||
or $navig.showtitles != 0
|
||||
or count($next) > 0"/>
|
||||
|
||||
<xsl:if test="$suppress.navigation = '0' and $suppress.header.navigation = '0'">
|
||||
<div class="navheader">
|
||||
<xsl:if test="$row2">
|
||||
<table width="100%" summary="Navigation header">
|
||||
<xsl:if test="$row2">
|
||||
<tr>
|
||||
<td width="20%" align="left">
|
||||
<xsl:if test="count($prev)>0">
|
||||
<a accesskey="p">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$prev"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
<xsl:with-param name="direction" select="'prev'"/>
|
||||
</xsl:call-template>
|
||||
</a>
|
||||
</xsl:if>
|
||||
<xsl:text> </xsl:text>
|
||||
</td>
|
||||
<th width="60%" align="center">
|
||||
<xsl:apply-templates select="." mode="object.title.markup"/>
|
||||
</th>
|
||||
<td width="20%" align="right">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="count($next)>0">
|
||||
<a accesskey="n">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:call-template name="href.target">
|
||||
<xsl:with-param name="object" select="$next"/>
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="navig.content">
|
||||
<xsl:with-param name="direction" select="'next'"/>
|
||||
</xsl:call-template>
|
||||
</a>
|
||||
</xsl:if>
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:if>
|
||||
</table>
|
||||
</xsl:if>
|
||||
<xsl:if test="$header.rule != 0">
|
||||
<hr/>
|
||||
</xsl:if>
|
||||
</div>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:param name="chunker.output.indent" select="'yes'"/>
|
||||
<xsl:param name="chunk.first.sections" select="1"/>
|
||||
<xsl:param name="chunk.section.depth" select="2"/>
|
||||
<xsl:param name="use.id.as.filename" select="'yes'"/>
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
|
||||
<!--<xsl:param name="footer.rule" select="0"/>-->
|
||||
<!--<xsl:param name="header.rule" select="0"/>-->
|
||||
<xsl:param name="html.stylesheet" select="'help.css'"/>
|
||||
<xsl:param name="para.propagates.style" select="'yes'"/>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,70 +0,0 @@
|
||||
<appendix id="app-license">
|
||||
<title>License</title>
|
||||
<para>
|
||||
&app; as a whole is distributed under the terms of GNU General Public License,
|
||||
version 2, but most of its code is released under the GNU Lesser General Public
|
||||
License. Full text of these licenses as well as licenses and acknowledgements for
|
||||
third-party software incorporated in &app; can be found in this section.
|
||||
</para>
|
||||
|
||||
<sect1 id="gpl">
|
||||
<title>GNU General Public License</title>
|
||||
<programlisting><xi:include href="../COPYING.GPL" parse="text" encoding="UTF-8"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="lgpl">
|
||||
<title>GNU Lesser General Public License</title>
|
||||
<xi:include href="LGPL.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="license-lua">
|
||||
<title>Lua License</title>
|
||||
<programlisting><xi:include href="../moo/moolua/COPYRIGHT" parse="text" encoding="UTF-8"
|
||||
xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="license-lua-lfs">
|
||||
<title>LuaFileSystem License</title>
|
||||
<programlisting>
|
||||
LuaFileSystem - File System Library for Lua
|
||||
Copyright 2003-2007 PUC-Rio
|
||||
http://www.keplerproject.org/luafilesystem
|
||||
|
||||
LuaFileSystem is a Lua library developed to complement the set of functions
|
||||
related to file systems offered by the standard Lua distribution. LuaFileSystem
|
||||
offers a portable way to access the underlying directory structure and file
|
||||
attributes. LuaFileSystem is free software and uses the same license as Lua 5.1
|
||||
Current version is 1.2.1.
|
||||
</programlisting>
|
||||
</sect1>
|
||||
|
||||
<sect1 id="license-xdg-utils">
|
||||
<title>xdg-utils License</title>
|
||||
<programlisting>
|
||||
Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
|
||||
Copyright 2006, Jeremy White <jwhite@codeweavers.com>
|
||||
|
||||
LICENSE:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
</programlisting>
|
||||
</sect1>
|
||||
|
||||
</appendix>
|
56
doc/license.t2t
Normal file
56
doc/license.t2t
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
== License ==[app-license]
|
||||
|
||||
APPNAME as a whole is distributed under the terms of the GNU General
|
||||
Public License, version 2, but most of its code is released under the
|
||||
GNU Lesser General Public License. Full text of these licenses, as well
|
||||
as licenses and acknowledgements for third-party software incorporated
|
||||
in APPNAME, can be found in this section.
|
||||
|
||||
=== GNU General Public License ===[gpl]
|
||||
%!include: ``../COPYING.GPL``
|
||||
|
||||
=== GNU Lesser General Public License ===[lgpl]
|
||||
%!include: ``../COPYING``
|
||||
|
||||
=== Lua License ===[license-lua]
|
||||
%!include: ``../moo/moolua/COPYRIGHT``
|
||||
|
||||
=== LuaFileSystem License ===[license-lua-lfs]
|
||||
```
|
||||
LuaFileSystem - File System Library for Lua
|
||||
Copyright 2003-2007 PUC-Rio
|
||||
http://www.keplerproject.org/luafilesystem
|
||||
|
||||
LuaFileSystem is a Lua library developed to complement the set of functions
|
||||
related to file systems offered by the standard Lua distribution. LuaFileSystem
|
||||
offers a portable way to access the underlying directory structure and file
|
||||
attributes. LuaFileSystem is free software and uses the same license as Lua 5.1
|
||||
Current version is 1.2.1.
|
||||
```
|
||||
|
||||
=== xdg-utils License ===[license-xdg-utils]
|
||||
```
|
||||
Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
|
||||
Copyright 2006, Jeremy White <jwhite@codeweavers.com>
|
||||
|
||||
LICENSE:
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
```
|
44
doc/makedocs
Executable file
44
doc/makedocs
Executable file
@ -0,0 +1,44 @@
|
||||
#! /bin/sh
|
||||
|
||||
# makedocs SRCDIR INPUT
|
||||
|
||||
srcdir=`cd $1 && pwd`
|
||||
thisdir=`pwd`
|
||||
infile="$2"
|
||||
outfile="$thisdir"/`basename $infile .t2t`.html
|
||||
outdir="$thisdir/help"
|
||||
|
||||
T2T=txt2tags
|
||||
SPLITY="$srcdir/splity/splity.pl"
|
||||
SPLITY_INDEX="$srcdir/splity/index-template.html"
|
||||
SPLITY_PAGE="$srcdir/splity/page-template.html"
|
||||
|
||||
if test ! -f "$infile"; then
|
||||
echo "Input file '$infile' does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test ! -e "$outdir"; then
|
||||
echo "Directory $outdir does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
generate () {
|
||||
$T2T --outfile=$2 $1 || exit 1
|
||||
(cd "$outdir" && $SPLITY -index $SPLITY_INDEX -page $SPLITY_PAGE $2) || exit 1
|
||||
}
|
||||
|
||||
write_sections () {
|
||||
echo "#ifndef HELP_SECTIONS_H" > help-sections.h
|
||||
echo "#define HELP_SECTIONS_H" >> help-sections.h
|
||||
echo "" >> help-sections.h
|
||||
for s in `grep '@@.*@@' $1 | sed 's/.*@@\(.*\)@@.*/\1/'`; do
|
||||
echo "#define HELP_SECTION_`echo $s | tr '[a-z]' '[A-Z]' | tr -- - _` \"$s\"" >> help-sections.h
|
||||
done
|
||||
echo "" >> help-sections.h
|
||||
echo "#endif /* HELP_SECTIONS_H */" >> help-sections.h
|
||||
}
|
||||
|
||||
generate $infile $outfile || exit 1
|
||||
write_sections $outfile || exit 1
|
||||
rm $outfile || exit 1
|
@ -1,18 +0,0 @@
|
||||
<?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:template name="user.head.content">
|
||||
<style type="text/css">
|
||||
P.generated-date {
|
||||
font-size: 50%;
|
||||
}
|
||||
</style>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:output method="html" indent="yes"/>
|
||||
|
||||
<xsl:param name="section.autolabel" select="1"/>
|
||||
|
||||
</xsl:stylesheet>
|
@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||
<!ENTITY appversion "0.9.0">
|
||||
<!ENTITY manrevision "0.1">
|
||||
<!ENTITY date "November 2007">
|
||||
<!ENTITY app "medit">
|
||||
<!ENTITY license SYSTEM "license.docbook">
|
||||
<!ENTITY user-tools SYSTEM "user-tools.docbook">
|
||||
<!ENTITY prefs SYSTEM "prefs.docbook">
|
||||
<!ENTITY prefs-file SYSTEM "prefs-file.docbook">
|
||||
]>
|
||||
|
||||
<article>
|
||||
|
||||
<articleinfo>
|
||||
<title>&app; manual</title>
|
||||
</articleinfo>
|
||||
|
||||
<!--<section id="xxx-getting-started">
|
||||
<title>Getting Started</title>
|
||||
|
||||
<section id="xxx-medit-command-line">
|
||||
<title>Starting &app; from Command Line</title>
|
||||
<para></para>
|
||||
</section>
|
||||
|
||||
</section>-->
|
||||
|
||||
<!--<section id="sect-opening-and-saving">
|
||||
<title>Opening and Saving Files</title>
|
||||
<section id="dialog-open">
|
||||
<title>dialog-open</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="dialog-save">
|
||||
<title>dialog-save</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="file-selector">
|
||||
<title>file-selector</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="prefs-file-selector">
|
||||
<title>app-prefs-file-selector</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
</section>-->
|
||||
|
||||
<!--<section id="sect-editing-text">
|
||||
<title>Editing text</title>
|
||||
<section id="dialog-find">
|
||||
<title>dialog-find</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="dialog-replace">
|
||||
<title>dialog-replace</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="dialog-find-in-files">
|
||||
<title>dialog-find-in-files</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="dialog-find-file">
|
||||
<title>dialog-find-file</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
</section>-->
|
||||
|
||||
<!--<section id="sect-searching">
|
||||
<title>Search</title>
|
||||
<section id="dialog-find">
|
||||
<title>Searching in the document</title>
|
||||
</section>
|
||||
|
||||
<section id="dialog-replace">
|
||||
<title>dialog-replace</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="dialog-find-in-files">
|
||||
<title>dialog-find-in-files</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
|
||||
<section id="dialog-find-file">
|
||||
<title>dialog-find-file</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
</section>-->
|
||||
|
||||
<!--<section id="prefs-dialog">
|
||||
<title>Preferences</title>
|
||||
<section id="prefs-langs-and-filters">
|
||||
<title>app-prefs-langs-and-filters</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
</section>-->
|
||||
|
||||
&prefs;
|
||||
&user-tools;
|
||||
&prefs-file;
|
||||
|
||||
<!--<xi:include href="editor-plugins.docbook" xmlns:xi="http://www.w3.org/2001/XInclude"/>-->
|
||||
<!--<section id="sect-plugins">
|
||||
<title>Plugins</title>
|
||||
<section id="prefs-plugins">
|
||||
<title>app-prefs-plugins</title>
|
||||
blah blah blah
|
||||
</section>
|
||||
</section>-->
|
||||
|
||||
&license;
|
||||
|
||||
<para role="generated-date">This document was generated
|
||||
<?dbtimestamp format="Y-m-d H:M:S"?>.</para>
|
||||
|
||||
</article>
|
43
doc/medit.t2t
Normal file
43
doc/medit.t2t
Normal file
@ -0,0 +1,43 @@
|
||||
APPNAME APPVERSION Manual
|
||||
|
||||
|
||||
%! Target : html
|
||||
%! Encoding: UTF-8
|
||||
%! Options : --css-sugar
|
||||
|
||||
%% 'entities'
|
||||
%! Postproc: APPNAME medit
|
||||
%! Postproc: APPVERSION 0.9.3
|
||||
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
%%
|
||||
%% Sections stuff
|
||||
%%
|
||||
%% Convert '== Title ==[anchor]' to '== !!ANCHOR!!anchor!!Title!! ==[anchor]'
|
||||
%! Preproc : '^(=+)\s*(.*)\s+\1\[(.*)\]' '\1 !!ANCHOR!!\3!!\2!! \1[\3]'
|
||||
%% Remove t2t-generated '<A NAME="anchor"></A>'
|
||||
%! Postproc: '<A NAME=".*"></A>' ''
|
||||
%% Convert '<H1>!!ANCHOR!!anchor!!Title!!</H1>' to '<H1><a name="anchor">Title</a></H1><!-- @@anchor@@ -->'
|
||||
%! Postproc: '<(H\d)>!!ANCHOR!!(.*)!!(.*)!!</\1>' '<\1><a name="\2">\3</a></\1><!-- @@\2@@ -->'
|
||||
%% Convert remaining '!!ANCHOR!!anchor!!Title!!' to 'Title'
|
||||
%! Postproc: '!!ANCHOR!!(.*)!!(.*)!!' '\2'
|
||||
%%
|
||||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||
|
||||
APPNAME APPVERSION Manual
|
||||
|
||||
%!include: prefs.t2t
|
||||
%!include: user-tools.t2t
|
||||
%!include: prefs-file.t2t
|
||||
%!include: license.t2t
|
||||
|
||||
|
||||
%% Fake help sections
|
||||
`<!-- @@dialog-replace@@ -->`
|
||||
`<!-- @@dialog-find@@ -->`
|
||||
`<!-- @@prefs-dialog@@ -->`
|
||||
`<!-- @@prefs-plugins@@ -->`
|
||||
`<!-- @@prefs-file-selector@@ -->`
|
||||
`<!-- @@dialog-find-in-files@@ -->`
|
||||
`<!-- @@dialog-find-file@@ -->`
|
||||
`<!-- @@file-selector@@ -->`
|
@ -1,61 +0,0 @@
|
||||
<!-- ========== prefs-file ========== -->
|
||||
<section id="prefs-file">
|
||||
<title>Preferences files</title>
|
||||
<para>
|
||||
&app; preferences are stored in <filename>$HOME/.config/&app;rc</filename> file.
|
||||
It is an XML file which may be edited to set preferences which have not found
|
||||
their place in the <interface>Preferences</interface> dialog.
|
||||
</para>
|
||||
<note>
|
||||
&app; reads the preferences file on startup and writes it whenever <guibutton>OK</guibutton>
|
||||
or <guibutton>Apply</guibutton> button is clicked in the <interface>Preferences</interface>
|
||||
dialog. Therefore, if you modify the preferences file, your changes may be overwritten,
|
||||
and they not take the effect until you restart &app;.
|
||||
</note>
|
||||
<para>
|
||||
The following "hidden" settings are available.
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry><term><userinput>Editor/window_title</userinput>:</term>
|
||||
<listitem>
|
||||
Format of the window title. It is a string which may contain format sequences:
|
||||
percent sign followed by a character:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<userinput>%a</userinput>: application name;
|
||||
</listitem>
|
||||
<listitem>
|
||||
<userinput>%b</userinput>: current document basename;
|
||||
</listitem>
|
||||
<listitem>
|
||||
<userinput>%f</userinput>: full path of the current document;
|
||||
</listitem>
|
||||
<listitem>
|
||||
<userinput>%u</userinput>: URI of the current document;
|
||||
</listitem>
|
||||
<listitem>
|
||||
<userinput>%s</userinput>: the status of the current document, e.g. "<literal> [modified]</literal>".
|
||||
It is prefixed with space, so that "<literal>%b%s</literal>" will produce a nice string;
|
||||
</listitem>
|
||||
<listitem>
|
||||
<userinput>%%</userinput>: the percent character.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
Default value is "<literal>%a - %f%s</literal>" which produces something like
|
||||
"<literal>&app; - /home/user/file [modified]</literal>".
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Editor/window_title_no_doc</userinput>:</term>
|
||||
<listitem>
|
||||
Same as <userinput>Editor/window_title</userinput>, used when no document is open. Default value
|
||||
is "<literal>%a</literal>".
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Editor/tab_width</userinput>:</term>
|
||||
<listitem>
|
||||
Visual width of the Tab character, 8 by default.
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
<!-- ========== prefs-file ========== -->
|
30
doc/prefs-file.t2t
Normal file
30
doc/prefs-file.t2t
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
== Preferences files ==[prefs-file]
|
||||
|
||||
APPNAME preferences are stored in ``$HOME/.config/APPNAMErc`` file.
|
||||
It is an XML file which may be edited to set preferences which have not found
|
||||
their place in the <interface>Preferences</interface> dialog.
|
||||
|
||||
NOTE: APPNAME reads the preferences file on startup and writes it whenever //OK//
|
||||
or //Apply// button is clicked in the //Preferences// dialog. Therefore, if you
|
||||
modify the preferences file, your changes may be overwritten, and they not take
|
||||
the effect until you restart APPNAME.
|
||||
|
||||
The following "hidden" settings are available.
|
||||
|
||||
- ``Editor/window_title``: Format of the window title. It is a string which may
|
||||
contain format sequences: percent sign followed by a character:
|
||||
- ``%a``: application name;
|
||||
- ``%b``: current document basename;
|
||||
- ``%f``: full path of the current document;
|
||||
- ``%u``: URI of the current document;
|
||||
- ``%s``: the status of the current document, e.g. "`` [modified]``". It is prefixed
|
||||
with space, so that "``%b%s``" will produce a nice string;
|
||||
- ``%%``: the percent character.
|
||||
|
||||
Default value is "``%a - %f%s``" which produces something like "``APPNAME - /home/user/file [modified]``".
|
||||
|
||||
- ``Editor/window_title_no_doc``: Same as ``Editor/window_title``, used when no document is open. Default value is "``%a``".
|
||||
- ``Editor/tab_width``: Visual width of the Tab character, 8 by default.
|
||||
|
||||
|
@ -1,140 +0,0 @@
|
||||
<!-- ========== prefs-langs-and-filters ========== -->
|
||||
<section id="prefs-langs-and-filters">
|
||||
<title>Selecting editing options and languages</title>
|
||||
<para>
|
||||
<guilabel>Languages and files</guilabel> tab in the <guilabel>Editor</guilabel>
|
||||
section of the <interface>Preferences</interface> dialog allows customizing
|
||||
how syntax highlighting language and editing options are chosen
|
||||
depending on the document filename, as well as setting editing options for
|
||||
all documents which use given language and choosing file patterns and mime types
|
||||
for which the given language should be used.
|
||||
</para>
|
||||
|
||||
<!-- ========== Language-specific options ========== -->
|
||||
<section id="prefs-lang-options">
|
||||
<title>Language-specific options</title>
|
||||
<para>
|
||||
Here you can set editing options on per-language basis, as well as define
|
||||
for which file patterns and mime types given language should be used.
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry><term><userinput>Language</userinput> combo box:</term>
|
||||
<listitem>
|
||||
Choose the language you want to customize. Settings for <literal>None</literal>
|
||||
will apply to documents for which no syntax highlighting language was chosen.
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Mime types</userinput>:</term>
|
||||
<listitem>
|
||||
The given language will be used for files with these mime types, unless the language
|
||||
is chosen based on the filename or overridden in the <interface>File filters</interface>
|
||||
section.
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Extensions</userinput>:</term>
|
||||
<listitem>
|
||||
The given language will be used for files whose filenames match these patterns, unless
|
||||
overridden in the <interface>File filters</interface> section.
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Options</userinput>:</term>
|
||||
<listitem>
|
||||
Default editing options to use in documents which use the given language. These options
|
||||
can be overridden using <interface>File filters</interface> section, and options set
|
||||
in the file text have a higher priority as well. See the
|
||||
<link linkend="editing-options" endterm="editing-options.title"/> section for the format
|
||||
of this entry content.
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
<!-- ========== File filters ========== -->
|
||||
<section id="prefs-file-filters">
|
||||
<title>File filters</title>
|
||||
<para>
|
||||
<interface>File filters</interface> section allows to customize editing options,
|
||||
as well as syntax highlighting language, on per-document basis using regular expressions
|
||||
which are matched against the document filename. Full file paths are used, so one can
|
||||
have per-directory settings.<footnote><para>Use dollar if you need to match ends
|
||||
of filenames, e.g. "<literal>\.doc$</literal>" will work as "<literal>*.doc</literal>"
|
||||
pattern.</para></footnote>
|
||||
</para>
|
||||
<para>
|
||||
The filters are applied in the order they appear in the list, one by one. All filters
|
||||
are applied to every file, so several filters may affect options in the same file. In this
|
||||
way one can set some options for a set of files or a directory, then set or modify some
|
||||
additional options for certain files in that set, etc.
|
||||
</para>
|
||||
<para>
|
||||
To add a filter, use <guilabel>New</guilabel> button. Click the filter in the list to
|
||||
select it, then click the <guilabel>Filter</guilabel> or <guilabel>Options</guilabel>
|
||||
part of it to edit. Use <guilabel>Delete</guilabel> button to delete a filter,
|
||||
and <guilabel>Up</guilabel>/<guilabel>Down</guilabel> buttons to change the order in
|
||||
which they are applied.
|
||||
</para>
|
||||
<para>
|
||||
<guilabel>Filter</guilabel> field contains a regular expression matched agains the
|
||||
document filename. If it is found in the filename, then the options from the
|
||||
<guilabel>Options</guilabel> field are applied to the document.
|
||||
</para>
|
||||
<para>
|
||||
<guilabel>Options</guilabel> field contains the options, in format described in the
|
||||
<link linkend="editing-options" endterm="editing-options.title"/> section.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<!-- ========== Tools preferences ========== -->
|
||||
<section id="editing-options">
|
||||
<title id="editing-options.title">Editing options</title>
|
||||
<para>
|
||||
&app; has some editing options which can be set in the file text, or in the
|
||||
<interface>Preferences</interface> dialog for sets of files or for given syntax highlighting
|
||||
language.
|
||||
</para>
|
||||
<para>
|
||||
To set the options in the document text, place the following on the first, second or the last
|
||||
line of the document:
|
||||
<programlisting>-%- <emphasis>options</emphasis> -%-</programlisting>
|
||||
where <emphasis>options</emphasis> is the option string
|
||||
<programlisting><emphasis>key</emphasis>: <emphasis>value</emphasis>; <emphasis>key</emphasis>: <emphasis>value</emphasis>; ...</programlisting>
|
||||
(the latter is the format used also in the <interface>Preferences</interface> dialog).
|
||||
</para>
|
||||
<para>
|
||||
Values can be strings, integer numbers, or boolean values. Boolean values may be specified
|
||||
using <userinput>yes</userinput>/<userinput>no</userinput>,
|
||||
<userinput>true</userinput>/<userinput>false</userinput>, <userinput>1</userinput>/<userinput>0</userinput>.
|
||||
The following options are available:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<userinput>lang</userinput>: syntax highlighting language to use in this document.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>strip</userinput>: a boolean value, whether trailing whitespace should be removed
|
||||
from the document on saving.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>add-newline</userinput>: a boolean value, whether the editor should ensure that saved files
|
||||
have a trailing new line character.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>tab-width</userinput>: displayed width of the Tab character.<footnote><para>This is not an indentation
|
||||
offset, this is the visual width of a Tab character.</para></footnote>
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>use-tabs</userinput>: whether the Tab character should be used for indentation.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>indent-width</userinput>: an integer specifying indentation offset used when the
|
||||
Tab key is pressed to indent text.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
<para>
|
||||
&app; tries to understand modelines of Vim, Emacs, and Kate text editors, so chances are it will correctly
|
||||
pick up the conventional settings from source files.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
<!-- ========== User-defined tools ========== -->
|
87
doc/prefs.t2t
Normal file
87
doc/prefs.t2t
Normal file
@ -0,0 +1,87 @@
|
||||
|
||||
== Selecting editing options and languages ==[prefs-langs-and-filters]
|
||||
|
||||
//Languages and files// tab in the //Editor//
|
||||
section of the //Preferences// dialog allows customizing
|
||||
how syntax highlighting language and editing options are chosen
|
||||
depending on the document filename, as well as setting editing options for
|
||||
all documents which use given language and choosing file patterns and mime types
|
||||
for which the given language should be used.
|
||||
|
||||
|
||||
=== Language-specific options ===[prefs-lang-options]
|
||||
|
||||
Here you can set editing options on per-language basis, as well as define
|
||||
for which file patterns and mime types given language should be used.
|
||||
|
||||
| //Language// combo box | Choose the language you want to customize. Settings for ``None`` will apply to documents for which no syntax highlighting language was chosen. |
|
||||
| //Mime types// | The given language will be used for files with these mime types, unless the language is chosen based on the filename or overridden in the //File filters// section.
|
||||
| //Extensions// | The given language will be used for files whose filenames match these patterns, unless overridden in the //File filters// section.
|
||||
| //Options// | Default editing options to use in documents which use the given language. These options can be overridden using //File filters// section, and options set in the file text have a higher priority as well. See the [Editing options #editing-options] section for the format of this entry content.
|
||||
|
||||
|
||||
=== File filters ===[prefs-file-filters]
|
||||
|
||||
//File filters// section allows to customize editing options,
|
||||
as well as syntax highlighting language, on per-document basis using regular expressions
|
||||
which are matched against the document filename. Full file paths are used, so one can
|
||||
have per-directory settings.
|
||||
|
||||
Use dollar if you need to match ends of filenames, e.g. "``\.doc$``" will work as "``*.doc``"
|
||||
pattern.
|
||||
|
||||
The filters are applied in the order they appear in the list, one by one. All filters
|
||||
are applied to every file, so several filters may affect options in the same file. In this
|
||||
way one can set some options for a set of files or a directory, then set or modify some
|
||||
additional options for certain files in that set, etc.
|
||||
|
||||
To add a filter, use //New// button. Click the filter in the list to
|
||||
select it, then click the //Filter// or //Options//
|
||||
part of it to edit. Use //Delete// button to delete a filter,
|
||||
and //Up// and //Down// buttons to change the order in
|
||||
which they are applied.
|
||||
|
||||
//Filter// field contains a regular expression matched agains the
|
||||
document filename. If it is found in the filename, then the options from the
|
||||
//Options// field are applied to the document.
|
||||
|
||||
//Options// field contains the options, in format described in the
|
||||
[Editing options #editing-options] section.
|
||||
|
||||
|
||||
=== Editing options ===[editing-options]
|
||||
|
||||
APPNAME has some editing options which can be set in the document text,
|
||||
or in the //Preferences// dialog for sets of files or for given syntax
|
||||
highlighting language.
|
||||
|
||||
To set the options in the document text, place the following on the first,
|
||||
second or the last line of the document:
|
||||
```
|
||||
-%- options -%-
|
||||
```
|
||||
where //options// is the option string
|
||||
```
|
||||
key: value; key: value; ...
|
||||
```
|
||||
(the latter is the format used also in the //Preferences// dialog).
|
||||
|
||||
Values can be strings, integer numbers, or boolean values.
|
||||
|
||||
Boolean values may be specified using ``yes``, ``no``, ``true``, ``false``, ``1``, ``0``.
|
||||
|
||||
If a string value contains ``:`` character, then the following syntax may be used: ``key=/value/``.
|
||||
Any character may be used instead of slash (and it must not occur in the //value//).
|
||||
Example: ``word-chars=@-/:@``
|
||||
|
||||
The following options are available:
|
||||
|
||||
| ``lang`` | syntax highlighting language to use in this document. |
|
||||
| ``strip`` | a boolean value, whether trailing whitespace should be removed from the document on save.
|
||||
| ``add-newline`` | a boolean value, whether the editor should ensure that saved files have a trailing new line character.
|
||||
| ``tab-width`` | displayed width of the Tab character. NOTE: This is not an indentation offset, this is the visual width of a Tab character.
|
||||
| ``use-tabs`` | whether the Tab character should be used for indentation.
|
||||
| ``indent-width`` | an integer specifying indentation offset used when the Tab key is pressed to indent text.
|
||||
|
||||
APPNAME tries to understand modelines of Vim, Emacs, and Kate text editors, so chances are it will correctly
|
||||
pick up the conventional settings from source files.
|
16
doc/splity/index-template.html
Normal file
16
doc/splity/index-template.html
Normal file
@ -0,0 +1,16 @@
|
||||
{$opening}
|
||||
|
||||
<!--<div style="float:right;"><a href="{$source}">Print version</a>-->
|
||||
<!--<br><sup>(all sections in one long page)</sup></div>-->
|
||||
|
||||
<{$title_tag}>{$title}</{main::end_tag($title_tag)}>
|
||||
|
||||
{$content}
|
||||
|
||||
<hr>
|
||||
<h2 style="margin:0;">Contents:</h2>
|
||||
<ul>
|
||||
{main::sub_list(\@sub, 0, 0, 'li', 'ul')}
|
||||
</ul>
|
||||
|
||||
{$closing}
|
29
doc/splity/page-template.html
Normal file
29
doc/splity/page-template.html
Normal file
@ -0,0 +1,29 @@
|
||||
{
|
||||
%next = %top unless (%next);
|
||||
$opening =~ s!<title>.*</title>!'<title>'.main::strip_tags($title).'</title>'!eis;
|
||||
$opening;
|
||||
}
|
||||
|
||||
<table width="100%"><tr valign="top">
|
||||
<td width="33%" align="left">Previous: <a href="{$prev{'name'}}.html">{main::strip_tags($prev{'title'})}</a></td>
|
||||
<td width="33%" align="center">Up: <a href="{$up{'name'}}.html">{main::strip_tags($up{'title'})}</a></td>
|
||||
<td width="33%" align="right">Next: <a href="{$next{'name'}}.html">{main::strip_tags($next{'title'})}</a></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
||||
<{$title_tag}>{$title}</{main::end_tag($title_tag)}>
|
||||
|
||||
{$content}
|
||||
|
||||
<ul>
|
||||
{main::sub_list(\@sub, 0, 0, 'li', 'ul')}
|
||||
</ul>
|
||||
|
||||
<hr>
|
||||
<table width="100%"><tr valign="top">
|
||||
<td width="33%" align="left">Previous: <a href="{$prev{'name'}}.html">{main::strip_tags($prev{'title'})}</a></td>
|
||||
<td width="33%" align="center">Up: <a href="{$up{'name'}}.html">{main::strip_tags($up{'title'})}</a></td>
|
||||
<td width="33%" align="right">Next: <a href="{$next{'name'}}.html">{main::strip_tags($next{'title'})}</a></td>
|
||||
</tr></table>
|
||||
|
||||
{$closing}
|
234
doc/splity/splity.pl
Executable file
234
doc/splity/splity.pl
Executable file
@ -0,0 +1,234 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
# (C) 2002 Yonat Sharon
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
use strict;
|
||||
|
||||
use Text::Template;
|
||||
|
||||
# documentation:
|
||||
sub usage {
|
||||
print <<END;
|
||||
|
||||
splity.pl - Split a long HTML file to smaller HTML files
|
||||
according to sections with <hN> headings.
|
||||
|
||||
Usage:
|
||||
split.pl [-h N] [-index <file>] [-page <file>] <html-file>
|
||||
<html-file> source HTML file to split
|
||||
-h N split on <h1> to <hN> (default is 3)
|
||||
-index <file> template file to use for the index page
|
||||
(default is index-template.html)
|
||||
-page <file> template file to use for the section pages
|
||||
(default is page-template.html)
|
||||
|
||||
See splity.html for details on the format of the source HTML
|
||||
file and the template files.
|
||||
END
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
return 1 if ($0 =~ /splity.t$/);
|
||||
usage() unless (@ARGV);
|
||||
|
||||
# init parameters:
|
||||
my $source = pop; # TODO: default to 'all.html'
|
||||
my %param = @ARGV;
|
||||
my $max_h_level = $param{'-h'} || 3;
|
||||
my $index_template = $param{'-index'} || 'index-template.html';
|
||||
my $page_template = $param{'-page'} || 'page-template.html';
|
||||
|
||||
# extract data:
|
||||
my $s = slurp_file($source);
|
||||
my ($opening, $closing, @sections) = split_sections($s, $max_h_level);
|
||||
my $doc_vars = {'opening' => $opening, 'closing' => $closing, 'source' => $source};
|
||||
my @pages;
|
||||
foreach my $section (@sections) {
|
||||
push(@pages, extract_page_data($section));
|
||||
}
|
||||
create_structure(\@pages);
|
||||
|
||||
# fill-in empty names and titles:
|
||||
for (my $i = 0; $i < scalar(@pages); ++$i) {
|
||||
$pages[$i]->{'name'} ||= $i || 'index'; # TODO: should be according to parent, like 1.4.2
|
||||
$pages[$i]->{'title'} ||= $pages[$i]->{'name'};
|
||||
}
|
||||
|
||||
# create index
|
||||
my $index_page = shift @pages;
|
||||
my $tt = new Text::Template(SOURCE => $index_template)
|
||||
or die "Can't construct template $index_template: $Text::Template::ERROR";
|
||||
output_page($tt, $index_page, $doc_vars);
|
||||
|
||||
# create pages
|
||||
$tt = new Text::Template(SOURCE => $page_template)
|
||||
or die "Can't construct template $page_template: $Text::Template::ERROR";
|
||||
foreach my $page (@pages) {
|
||||
output_page($tt, $page, $doc_vars);
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
||||
### output_page($template, $page) # Create output file for $page using $template.
|
||||
sub output_page {
|
||||
my ($template, $page, $doc_vars) = @_;
|
||||
open(F, "> $page->{'name'}.html")
|
||||
or die "Can't open $page->{'name'}.html for writing: $!";
|
||||
$template->fill_in(HASH => [$page, $doc_vars], OUTPUT => \*F)
|
||||
or die "Can't fill_in template for $page->{'name'}: $Text::Template::ERROR";
|
||||
close F;
|
||||
}
|
||||
|
||||
### $s = slurp_file($filename) # Read the whole file into a string. ############
|
||||
sub slurp_file {
|
||||
local $/;
|
||||
open(F, $_[0]) or die "Can't open $_[0]: $!";
|
||||
my $s = <F>;
|
||||
close(F);
|
||||
return $s;
|
||||
}
|
||||
|
||||
### ($opening, $closing, @sections) = split_sections($html, $max_h_level) ######
|
||||
### Split HTML file to sections according to headings 1-$max_h_level.
|
||||
sub split_sections { # split to @sections, and common $opening and $closing
|
||||
my $level = qr/[1-$_[1]]/i;
|
||||
my @sections = split(/(?=<h$level\W)/i, $_[0]);
|
||||
|
||||
# cut $closing from last section
|
||||
my $closing;
|
||||
my $closing_tag = qr/<h\d[^>]+style="[^"]*display\s*:\s*none\s*;/is;
|
||||
if ($sections[$#sections] =~ /^$closing_tag/) {
|
||||
$closing = pop @sections;
|
||||
} else {
|
||||
$sections[$#sections] =~ s!($closing_tag.*)!!is;
|
||||
$sections[$#sections] =~ s!(</body.*)!!is unless ($1);
|
||||
$closing = $1;
|
||||
}
|
||||
return (shift @sections, $closing, @sections);
|
||||
}
|
||||
|
||||
### $hash_ref = extract_page_data($html_section) ###############################
|
||||
### Extract the following fields from an HTML page section:
|
||||
### title - heading text
|
||||
### level - heading level
|
||||
### name - <a name> in heading
|
||||
### title_tag - complete heading tag
|
||||
### content - everything but the heading
|
||||
### excerpt - content of <excerpt></excerpt> tag (if exists)
|
||||
sub extract_page_data {
|
||||
local $_ = $_[0];
|
||||
my $page;
|
||||
my $title;
|
||||
|
||||
# extract <hN>title</hN>
|
||||
s!<(h(\d)[^>]*)>(.*?)</h\2>!!is;
|
||||
$page->{'title_tag'} = $1;
|
||||
$page->{'level'} = $2;
|
||||
$title = $3;
|
||||
|
||||
# extract <a name="name">
|
||||
$page->{'name'} = $1 if
|
||||
$title =~ s!<a[^>]+name="(.*?)"[^>]*>(.*?)</a>!$2!is; # TODO: quotes should not be required
|
||||
$title =~ s!\s*\n! !g;
|
||||
$page->{'title'} = $title;
|
||||
|
||||
# extract <excerpt>excerpt</excerpt>
|
||||
$page->{'excerpt'} = $1 if s!<excerpt>([^<]*)</excerpt>!$1!i;
|
||||
|
||||
# redirect internal links
|
||||
s!\bhref="#(.*?)"!href="$1.html"!gi; # TODO: only inside A tags!
|
||||
|
||||
$page->{'content'} = $_;
|
||||
|
||||
return $page;
|
||||
}
|
||||
|
||||
### create_structure(\@array_of_hash_refs) #####################################
|
||||
### Create linking fields between @array elements, based on their 'level' field:
|
||||
### top - first element
|
||||
### prev - previous element
|
||||
### next - next element
|
||||
### up - parent element
|
||||
### sub - array of child elements (direct children only)
|
||||
sub create_structure {
|
||||
my $array = shift;
|
||||
my $top = $array->[0];
|
||||
my $level = $top->{'level'};
|
||||
my $last;
|
||||
foreach my $curr (@$array) {
|
||||
$curr->{'top'} = $top;
|
||||
if ($last) {
|
||||
$curr->{'prev'} = $last;
|
||||
$last->{'next'} = $curr;
|
||||
|
||||
# find parent:
|
||||
my $curr_level = $curr->{'level'};
|
||||
my $last_level = $last->{'level'};
|
||||
if ($last_level == $curr_level) { # same level
|
||||
$curr->{'up'} = $last->{'up'};
|
||||
} elsif ($last_level < $curr_level) { # sub-section
|
||||
$curr->{'up'} = $last;
|
||||
} else { # up-section
|
||||
my $up = $last->{'up'};
|
||||
while ($up->{'level'} >= $curr_level) {
|
||||
$up = $up->{'up'};
|
||||
}
|
||||
$curr->{'up'} = $up;
|
||||
}
|
||||
|
||||
push(@{$curr->{'up'}->{'sub'}}, $curr);
|
||||
}
|
||||
$last = $curr;
|
||||
}
|
||||
}
|
||||
|
||||
### $html = sub_list(\@sub, $depth, $show_excerpts, $item_tag, $sub_list_tag) ##
|
||||
### Return HTML multi-level list of descendants.
|
||||
### \@sub - direct children
|
||||
### $depth - show descendants up to $depth level (0 means show all)
|
||||
### $excerpt_format - format string for excerpt, with '$1' as fill-in place.
|
||||
### e.g., '<span class="excerpt">"$1 ..."</span>'
|
||||
### $item_tag - wrap each descendant with this tag (eg 'li')
|
||||
### $sub_list_tag - wrap descendants' sub-lists with this tag (eg 'ul')
|
||||
sub sub_list {
|
||||
my $sub = shift;
|
||||
join("\n" , map {sub_list_item($_, @_)} @$sub);
|
||||
}
|
||||
|
||||
sub sub_list_item {
|
||||
my ($page, $depth, $excerpt_format, $item_tag, $sub_list_tag) = @_;
|
||||
my $html = qq(<a href="$page->{'name'}.html">$page->{'title'}</a>);
|
||||
if ($excerpt_format and $page->{'excerpt'}) {
|
||||
$excerpt_format =~ s/\$1/$page->{'excerpt'}/;
|
||||
$html .= $excerpt_format;
|
||||
}
|
||||
if ($depth != 1 and $page->{'sub'}) {
|
||||
--$depth if ($depth > 0);
|
||||
$html .= "<$sub_list_tag>";
|
||||
$html .= sub_list($page->{'sub'}, $depth, $excerpt_format, $item_tag, $sub_list_tag);
|
||||
$html .= '</' . end_tag($sub_list_tag) . '>';
|
||||
}
|
||||
return "<$item_tag>$html</" . end_tag($item_tag) . '>';
|
||||
}
|
||||
|
||||
### $closing_tag = end_tag($tag_with_attributes) ###############################
|
||||
sub end_tag {
|
||||
my $tag = $_[0];
|
||||
$tag =~ s/\W.*//s;
|
||||
return $tag;
|
||||
}
|
||||
|
||||
### $text = strip_tags($html) # Strip tags out of $html. #######################
|
||||
sub strip_tags {
|
||||
local $_ = $_[0];
|
||||
s/<.*?>//gs;
|
||||
s/^\s*//s;
|
||||
s/\s*$//s;
|
||||
return $_;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
echo "<programlisting>"
|
||||
sed -e 's/\f//' -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' \
|
||||
-e 's/"/\"/g' -e "s/'/\&\#39;/g" "$1"
|
||||
echo "</programlisting>"
|
@ -1,457 +0,0 @@
|
||||
<!-- ========== User-defined tools ========== -->
|
||||
<section id="sect-user-tools">
|
||||
<title>User-defined Tools</title>
|
||||
<para>
|
||||
&app; allows extending its functionality with user-defined
|
||||
<emphasis>tools</emphasis>. It can be a Lua or Python (provided
|
||||
&app; has been built with Python support) script
|
||||
which is executed inside &app;, or a shell script which can
|
||||
use the text of the open document as its input and/or output.
|
||||
</para><para>
|
||||
There is a number of predefined tools which you can use as
|
||||
an example or to modify to suit your needs.
|
||||
</para>
|
||||
|
||||
<!-- ========== Tools preferences ========== -->
|
||||
<section id="prefs-user-tools">
|
||||
<title>Managing tools</title>
|
||||
<para>
|
||||
To create a new tool or to modify existing ones, open
|
||||
<interface>Preferences</interface> dialog and select
|
||||
<guilabel>Tools</guilabel> in the list on the left.
|
||||
</para><para>
|
||||
Select the tool in the list or click the <guilabel>New</guilabel>
|
||||
button to create a new one. To modify the order in which the tools
|
||||
appear in the <guimenu>Tools</guimenu> menu (or in the document
|
||||
context menu), use the <guilabel>Up</guilabel> and <guilabel>Down</guilabel>
|
||||
button. To rename a tool, click its name in the list to select it
|
||||
and then click again to edit the name. Use the <guilabel>Delete</guilabel>
|
||||
button to delete a tool.
|
||||
</para><para>
|
||||
The following controls are available to modify the tools behavior:
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry><term><userinput>Files</userinput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies for which files the tool is going to be available.
|
||||
The entry content can be the following:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para>
|
||||
a comma-separated list of file patterns, e.g. "<literal>*.c,*.h</literal>";
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
a comma-separated list of languages prefixed with "<literal>langs:</literal>", e.g.
|
||||
"<literal>langs: c, c++, objc</literal>";
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
a regular expression matching document filename prefixed with "<literal>regex:</literal>", e.g.
|
||||
the above pattern list may be written as "<literal>regex:\.[ch]$</literal>".
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
Empty entry means the tool will be available for all documents.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Options</userinput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies under which conditions the tool should be enabled. It is a comma-separated
|
||||
list of the following:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<userinput>need-doc</userinput>: the tool needs an open document;
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>need-file</userinput>: the tool will not work in new unsaved documents.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>need-save</userinput>: the document will be saved before the command is executed.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>need-save-all</userinput>: all open documents will be saved before the command is executed.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Command type</userinput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
The type of the tool: a Python script, a Lua script, or a shell script.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Code text field</userinput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Here you enter the actual script text.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
||||
<para>
|
||||
Shell script tools also have the following controls available:
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry><term><userinput>Input</userinput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies what text from the document should be passed to the command via its
|
||||
standard input:
|
||||
</para><para>
|
||||
<userinput>None</userinput>: no input text.
|
||||
</para><para>
|
||||
<userinput>Selected lines</userinput>: the lines containing selection or the line containing the cursor
|
||||
in case when no text is selected.
|
||||
</para><para>
|
||||
<userinput>Selection</userinput>: exact selected text. This will be different from "Selected lines"
|
||||
if selection does not span whole lines of the document, for instance if it is
|
||||
a single word.
|
||||
</para><para>
|
||||
<userinput>Whole document</userinput>: whole document contents.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Output</userinput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Specifies how the standard output of the command should be redirected.
|
||||
</para><para>
|
||||
<userinput>None</userinput>: the command output will be suppressed.
|
||||
</para><para>
|
||||
<userinput>None, asynchronous</userinput>: the command output will be suppressed, and the command
|
||||
will be executed in background. For instance, you should use this if you need
|
||||
to launch some external program like a web browser.
|
||||
</para><para>
|
||||
<userinput>Output pane</userinput>: the command output will be displayed in an output pane. This is
|
||||
useful for running programs like compilers, where you want to see the output.
|
||||
</para><para>
|
||||
<userinput>Insert into the document</userinput>: output will be inserted into the current document at
|
||||
the cursor position. It will replace the text used as an input, if any.
|
||||
</para><para>
|
||||
<userinput>New document</userinput>: new document will be created and the command output will be inserted
|
||||
into it.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry><term><userinput>Filter</userinput></term>
|
||||
<listitem>
|
||||
<para>
|
||||
If the output pane is used, then it can be passed through a <emphasis>filter</emphasis>:
|
||||
the filter can match filenames and line numbers, so when you click the text in the
|
||||
output pane it will open the corresponding file. This is used for compilers and similar
|
||||
commands, which output locations of errors in processed files.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</section>
|
||||
|
||||
<!-- ========== Tools files ========== -->
|
||||
<section id="user-tools-files">
|
||||
<title>Storing tools in files</title>
|
||||
<para>
|
||||
It is possible to create tools without using the <interface>Preferences</interface> dialog,
|
||||
they can be stored in files in <filename>tools</filename> subfolder of the &app; data
|
||||
folders (or <filename>tools-context</filename> for tools which appear in the document context
|
||||
menu). In particular, on Unix systems you can place files into <filename>$HOME/.local/share/medit/tools/</filename>
|
||||
folder.
|
||||
</para><para>
|
||||
Names of the files in the <filename>tools</filename> folder are used as their menu item
|
||||
labels, after stripping first two characters, so you can use two-character prefix to affect
|
||||
the order of the menu items, e.g. you can have <filename>00Do Something</filename>,
|
||||
<filename>01Another tool</filename> files to have them in that order in the menu. The files
|
||||
may be of three types: files with extension "<filename>.py</filename>", they will be used
|
||||
as Python scripts; files with extension "<filename>.lua</filename>", they will be used
|
||||
as Lua scripts; and executable files, they will be executed in the same way as shell commands.
|
||||
</para><para>
|
||||
To set parameters for a tool, place them on the first or the second line of the file in
|
||||
the following format:
|
||||
<programlisting>!! <emphasis>key=value; key=value; ...</emphasis> !!</programlisting>
|
||||
<emphasis>key</emphasis> may be one of the following:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<userinput>position</userinput>: it can be <userinput>start</userinput> or <userinput>end</userinput>,
|
||||
and defines whether the menu item will be located at the start or at the end of the menu.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>id</userinput>: the tool identificator.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>name</userinput>: the tool name, i.e. the label used in the menu item. It will override
|
||||
the file name.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>os</userinput>: <userinput>windows</userinput> or <userinput>unix</userinput>. If specified,
|
||||
then the tool will not be used when &app; is running on a different operating system.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>accel</userinput>: default keyboard accelerator used to invoke this tool.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>menu</userinput>: the menu to place this tool into. By default the tools are
|
||||
located in the Tools menu, but they can be as well put into any other menu.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>langs</userinput>: comma-separated list of languages for which this tool will
|
||||
be enabled.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>file-filter</userinput>: defines for which files this tool
|
||||
will be enabled. The value has the same format as in the <interface>Preferences</interface> dialog.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>options</userinput>: same as the <guilabel>Options</guilabel> entry content
|
||||
in the <interface>Preferences</interface> dialog.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
<para>
|
||||
In addition to these, you can set input and output options for executable files:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<userinput>input</userinput>: can be <userinput>none</userinput>, <userinput>lines</userinput>,
|
||||
<userinput>selection</userinput>, or <userinput>doc</userinput>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>output</userinput>: can be <userinput>none</userinput>, <userinput>async</userinput>,
|
||||
<userinput>pane</userinput>, <userinput>insert</userinput>, or <userinput>new-doc</userinput>.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<userinput>filter</userinput>: the output filter name.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<!-- ========== Python scripts ========== -->
|
||||
<section id="user-tools-python">
|
||||
<title>Python scripts</title>
|
||||
<para>
|
||||
If &app; is built with Python support, then Python scripts have full access to the program
|
||||
internals via builtin <symbol>moo</symbol> module. &app; classes extend classes from <symbol>pygtk</symbol>,
|
||||
in particular the <symbol>moo.edit.Edit</symbol> class representing documents extends the
|
||||
<symbol>gtk.TextView</symbol> class, and all editing operations can be implemented using
|
||||
<symbol>pygtk</symbol> API.
|
||||
</para><para>
|
||||
Python scripts executed from inside &app; have <filename>LIBDIR/plugins/lib</filename>
|
||||
and <filename>USERDATADIR/plugins/lib</filename> directories added to <symbol>sys.path</symbol>,
|
||||
you can place there &app;-specific modules to be used from python tools.
|
||||
</para><para>
|
||||
Python scripts have the following variables predefined:
|
||||
</para>
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
<symbol>doc</symbol>: the current document object.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<symbol>window</symbol>: the current editor window.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<symbol>buffer</symbol>: the text buffer (a <symbol>moo.edit.TextBuffer</symbol> instance) of
|
||||
the current document.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<symbol>editor</symbol>: the <symbol>moo.edit.Editor</symbol> object representing the text
|
||||
editor. Use its methods to open/close files, switch between documents and windows, etc.
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
<symbol>moo</symbol>: the <symbol>moo</symbol> module, already imported so you can omit
|
||||
<literal>import moo</literal> statement in scripts.
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</section>
|
||||
|
||||
<!-- ========== Lua scripts ========== -->
|
||||
<section id="user-tools-lua">
|
||||
<title>Lua scripts</title>
|
||||
<para>
|
||||
Lua scripts can use the standard Lua library, <symbol>lfs</symbol> and <symbol>lua-ex</symbol>
|
||||
libraries, and <symbol>medit</symbol> package which provides some text editor API. Lua scripts
|
||||
have the following variables and functions available.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>doc</literal>: a table with the following fields:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<literal>file</literal>: the document file path.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>name</literal>: the document file basename.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>dir</literal>: the document file directory.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>ext</literal>: the document filename extension including the period.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>base</literal>: the document filename without the extension: the basename is always
|
||||
<literal>base..ext</literal>.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>Cut()</literal>, <literal>Copy()</literal>, <literal>Paste()</literal>: clipboard operations.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>Backspace()</literal>, <literal>Delete()</literal>: corresponding key actions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>Up()</literal>, <literal>Down()</literal>, <literal>Left()</literal>, <literal>Right()</literal>:
|
||||
move cursor as the arrow keys do.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>Selection()</literal>: returns selected text as a string. Returns <literal>nil</literal>
|
||||
when no text is selected.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>Select(n)</literal>: selects <literal>n</literal> characters to the right
|
||||
if <literal>n</literal> is positive, and <literal>-n</literal> characters to the left
|
||||
if it is negative.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>Insert(...)</literal>: inserts text at cursor. Namely, it converts each argument to a string
|
||||
and inserts the result into the document.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>NewLine()</literal>: inserts new line character.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The following functions are provided for more advanced text manipulation. Position in the
|
||||
document is denoted by the character offset from the beginning of the document, starting
|
||||
from 1, so the first character is at position 1. Functions which take or return ranges use pairs of
|
||||
offsets, a pair <literal>start</literal>, <literal>end</literal> denotes range of text from
|
||||
<literal>start</literal> to <literal>end</literal>, <emphasis>not</emphasis> including the
|
||||
chracter at offset <literal>end</literal>. For instance, the single-character range consisting
|
||||
of the first character in the document corresponds to the pair 1, 2. Non-positive offset
|
||||
denotes the end of the document.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>InsertText(pos, ...)</literal>: inserts text at the position <literal>pos</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>DeleteText(start, end)</literal>: deletes text in the range <literal>[start..end)</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>GetInsert()</literal>: returns position of the cursor in the document.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>GetSelectionBounds()</literal>: returns positions of the selection start and end.
|
||||
If no text is selected, returns pair <literal>pos, pos</literal> where <literal>pos</literal>
|
||||
is the cursor position.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>GetLine([pos])</literal>: returns line number of the character at the position
|
||||
<literal>pos</literal>. If <literal>pos</literal> is not specified, it defaults to the
|
||||
cursor position.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>GetPosAtLine(n)</literal>: returns position at the beginning of the
|
||||
<literal>n</literal>-th line.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>LineStart([pos])</literal>: returns the position of the beginning of the line
|
||||
which contains character at <literal>pos</literal>.
|
||||
If <literal>pos</literal> is not specified, it defaults to the cursor position.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>LineEnd([pos])</literal>: returns the position of the end of the line
|
||||
which contains character at <literal>pos</literal>.
|
||||
If <literal>pos</literal> is not specified, it defaults to the cursor position.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>ForwardLine([pos, [n]])</literal>: returns the position of the beginning
|
||||
of the next line (or <literal>n</literal>-th line if <literal>n</literal>
|
||||
is specified). <literal>pos</literal> defaults to the cursor position if not
|
||||
specified.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>BackwardLine([pos, [n]])</literal>: returns the position of the beginning
|
||||
of the previous line (or <literal>n</literal>-th line backwards if <literal>n</literal>
|
||||
is specified). <literal>pos</literal> defaults to the cursor position if not
|
||||
specified.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<literal>GetText(start, end)</literal>: returns the text in the <literal>[start..end)</literal>.
|
||||
If <literal>start == end</literal>, it returns an empty string, not <literal>nil</literal>.
|
||||
</para>
|
||||
|
||||
</section>
|
||||
|
||||
<!-- ========== Shell scripts ========== -->
|
||||
<section id="user-tools-shell">
|
||||
<title>Shell scripts</title>
|
||||
<para>
|
||||
In addition to the document text passed via standard input,
|
||||
shell scripts have a number of environment variables set. <literal>$APP_PID</literal>
|
||||
variable is set to the current process process id, so that opening a file in the
|
||||
same instance of &app; is as simple as <command>&app; filename</command> (on the other
|
||||
hand, you will have to use command line options if you need to run a new &app; instance).
|
||||
The following environment variables are set when scripts are executed:
|
||||
</para>
|
||||
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<literal>DOC</literal>: the document basename.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>DOC_DIR</literal>: the document file directory. The full file path is
|
||||
<literal>$DOC_DIR/$DOC</literal>.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>DOC_BASE</literal>: the basename without extension.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>DOC_EXT</literal>: the document filename extension including the period. The basename
|
||||
is always <literal>$DOC_BASE$DOC_EXT</literal>.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>LINE</literal>: the number of the line containing cursor.
|
||||
</listitem>
|
||||
<listitem>
|
||||
<literal>DATA_DIR</literal>: the user data directory. For example the tools are stored
|
||||
in <filename>$DATA_DIR/menu.cfg</filename> file and in files in the <filename>$DATA_DIR/tools/</filename>
|
||||
directory.
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
<para>
|
||||
Additionally, all processes ran from inside &app; will have <filename>DATADIR/scripts</filename>
|
||||
directories in <literal>$PATH</literal>, so you may place some &app;-specific programs
|
||||
or scripts into <filename>USERDATADIR/scripts/</filename> to be used from shell script tools.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
<!-- ========== User-defined tools ========== -->
|
204
doc/user-tools.t2t
Normal file
204
doc/user-tools.t2t
Normal file
@ -0,0 +1,204 @@
|
||||
|
||||
== User-defined Tools ==[sect-user-tools]
|
||||
|
||||
APPNAME allows extending its functionality with user-defined
|
||||
//tools//. It can be a Lua or Python (provided APPNAME has been
|
||||
built with Python support) script which is executed inside APPNAME,
|
||||
or a shell script which can use the text of the open document as
|
||||
its input and/or output.
|
||||
|
||||
There are some predefined tools which you can use as
|
||||
an example or to modify to suit your needs.
|
||||
|
||||
|
||||
=== Managing tools ===[prefs-user-tools]
|
||||
|
||||
To create a new tool or to modify existing ones, open
|
||||
//Preferences// dialog and select //Tools// in the list on the left.
|
||||
|
||||
Select the tool in the list or click the //New//
|
||||
button to create a new one. To modify the order in which the tools
|
||||
appear in the //Tools// menu (or in the document
|
||||
context menu), use //Up// and //Down// buttons. To rename a tool,
|
||||
click its name in the list to select it and then click again to
|
||||
edit the name. Use the //Delete// button to delete a tool.
|
||||
|
||||
The following controls are available to modify the tools behavior:
|
||||
|
||||
| //Files// | Specifies for which files the tool is going to be available. |
|
||||
| //Options// | Specifies under which conditions the tool should be enabled.
|
||||
| //Command type// | The type of the tool: a Python script, a Lua script, or a shell script.
|
||||
| //Code text field// | Here you enter the actual script text.
|
||||
|
||||
|
||||
//Files// entry content is a comma-separated list of the following:
|
||||
| ``need-doc`` | the tool needs an open document |
|
||||
| ``need-file`` | the tool will not work in new unsaved documents.
|
||||
| ``need-save`` | the document will be saved before the command is executed.
|
||||
| ``need-save-all`` | all open documents will be saved before the command is executed.
|
||||
|
||||
|
||||
//Options// entry content can be the following:
|
||||
- a comma-separated list of file patterns, e.g. "``*.c,*.h``";
|
||||
- a comma-separated list of languages prefixed with "``langs:``", e.g. "``langs: c, c++, objc``";
|
||||
- a regular expression matching document filename prefixed with "``regex:``", e.g. the above
|
||||
pattern list may be written as "``regex:\.[ch]$``".
|
||||
|
||||
|
||||
Empty entry means that the tool will be available for all documents.
|
||||
|
||||
|
||||
|
||||
Shell script tools also have the following controls available:
|
||||
|
||||
//Input// entry specifies what text from the document should be passed to the command via its standard input:
|
||||
| ``None`` | no input text. |
|
||||
| ``Selected lines`` | the lines containing selection or the line containing the cursor in case when no text is selected.
|
||||
| ``Selection`` | exact selected text. This will be different from "Selected lines" if selection does not span whole lines of the document, for instance if it is a single word.
|
||||
| ``Whole document`` | whole document contents.
|
||||
|
||||
|
||||
//Output// entry specifies how the standard output of the command should be redirected.
|
||||
| ``None`` | the command output will be suppressed. |
|
||||
| ``None, asynchronous`` | the command output will be suppressed, and the command will be executed in background. For instance, you should use this if you need to launch some external program like a web browser.
|
||||
| ``Output pane`` | the command output will be displayed in an output pane. This is useful for running programs like compilers, where you want to see the output.
|
||||
| ``Insert into the document`` | output will be inserted into the current document at the cursor position. It will replace the text used as an input, if any.
|
||||
| ``New document`` | new document will be created and the command output will be inserted into it.
|
||||
|
||||
|
||||
//Filter// combo. If the output pane is used, then it can be passed through a //filter//:
|
||||
the filter can match filenames and line numbers, so when you click the text in the
|
||||
output pane it will open the corresponding file. This is used for compilers and similar
|
||||
commands, which output locations of errors in processed files.
|
||||
|
||||
|
||||
=== Storing tools in files ===[user-tools-files]
|
||||
|
||||
It is possible to create tools without using the //Preferences// dialog,
|
||||
they can be stored in files in ``tools`` subfolder of the APPNAME data
|
||||
folders (or ``tools-context`` for tools which appear in the document context
|
||||
menu). In particular, on Unix systems you can place files into
|
||||
``$HOME/.local/share/APPNAME/tools/`` folder.
|
||||
|
||||
Names of the files in the ``tools`` folder are used as their menu item
|
||||
labels, after stripping first three characters, so you can use trhee-character
|
||||
prefix to affect the order of the menu items, e.g. you can have ``00-Do Something``,
|
||||
``01-Another tool`` files to have them in that order in the menu. The files
|
||||
may be of three types: files with extension "``.py``", they will be used
|
||||
as Python scripts; files with extension "``.lua``", they will be used
|
||||
as Lua scripts; and executable files, they will be executed in the same way
|
||||
as shell commands.
|
||||
|
||||
To set parameters for a tool, place them on the first or the second line of the file in
|
||||
the following format:
|
||||
```
|
||||
!! key=value; key=value; ... !!
|
||||
```
|
||||
|
||||
//key// may be one of the following:
|
||||
| ``position`` | it can be ``start`` or ``end``, and defines whether the menu item will be located at the start or at the end of the menu. |
|
||||
| ``id`` | the tool identificator.
|
||||
| ``name`` | the tool name, i.e. the label used in the menu item. Overrides the file name.
|
||||
| ``os`` | ``windows`` or ``unix``. If specified, then the tool will not be used when APPNAME is running on a different operating system.
|
||||
| ``accel`` | default keyboard accelerator used to invoke this tool.
|
||||
| ``menu`` | the menu to place this tool into. By default the tools are located in the Tools menu, but they can be as well put into any other menu.
|
||||
| ``langs`` | comma-separated list of languages for which this tool will be enabled.
|
||||
| ``file-filter`` | defines for which files this tool will be enabled. The value has the same format as in the //Preferences// dialog.
|
||||
| ``options`` | same as the //Options// entry content in the //Preferences// dialog.
|
||||
|
||||
In addition to these, you can set input and output options for executable files:
|
||||
|
||||
| ``input`` | can be ``none``, ``lines``, ``selection``, or ``doc``. |
|
||||
| ``output`` | can be ``none``, ``async``, ``pane``, ``insert``, or ``new-doc``.
|
||||
| ``filter`` | the output filter name.
|
||||
|
||||
|
||||
=== Python scripts ===[user-tools-python]
|
||||
|
||||
If APPNAME is built with Python support, then Python scripts have full access to the program
|
||||
internals via builtin ``moo`` module. APPNAME classes extend classes from ``pygtk``,
|
||||
in particular the ``moo.edit.Edit`` class representing documents extends the
|
||||
``gtk.TextView`` class, and all editing operations can be implemented using
|
||||
``pygtk`` API.
|
||||
|
||||
Python scripts executed from inside APPNAME have ``LIBDIR/plugins/lib``
|
||||
and ``USERDATADIR/plugins/lib`` directories added to ``sys.path``,
|
||||
you can place there APPNAME-specific modules to be used from python tools.
|
||||
|
||||
Python scripts have the following variables predefined:
|
||||
|
||||
| ``doc`` | the current document object. |
|
||||
| ``window`` | the current editor window.
|
||||
| ``buffer`` | the text buffer (a ``moo.edit.TextBuffer`` instance) of the current document.
|
||||
| ``editor`` | the ``moo.edit.Editor`` object representing the text editor. Use its methods to open/close files, switch between documents and windows, etc.
|
||||
| ``moo`` | the ``moo`` module, already imported so you can omit ``import moo`` statement in scripts.
|
||||
|
||||
|
||||
=== Lua scripts ===[user-tools-lua]
|
||||
|
||||
Lua scripts can use the standard Lua library, ``lfs`` library, and ``medit`` package
|
||||
which provides some text editor API. Lua scripts have the following variables and functions available.
|
||||
|
||||
- ``doc``: a table with the following fields:
|
||||
| ``file`` | the document file path. |
|
||||
| ``name`` | the document file basename.
|
||||
| ``dir`` | the document file directory.
|
||||
| ``ext`` | the document filename extension including the period.
|
||||
| ``base`` | the document filename without the extension: the basename is always ``base..ext``.
|
||||
- ``Cut()``, ``Copy()``, ``Paste()``: clipboard operations.
|
||||
- ``Backspace()``, ``Delete()``: corresponding key actions.
|
||||
- ``Up()``, ``Down()``, ``Left()``, ``Right()``: move cursor as the arrow keys do.
|
||||
- ``Selection()``: returns selected text as a string. Returns ``nil`` when no text is selected.
|
||||
- ``Select(n)``: selects ``n`` characters to the right if ``n`` is positive, and ``-n`` characters to the left if it is negative.
|
||||
- ``Insert(...)``: inserts text at cursor. Namely, it converts each argument to a string and inserts the result into the document.
|
||||
- ``NewLine()``: inserts new line character.
|
||||
|
||||
The following functions are provided for more advanced text manipulation. Position in the
|
||||
document is denoted by the character offset from the beginning of the document, starting
|
||||
from 1, so the first character is at position 1. Functions which take or return ranges use pairs of
|
||||
offsets, a pair ``start``, ``end`` denotes range of text from
|
||||
``start`` to ``end``, **not** including the character at offset ``end``. For instance, the
|
||||
single-character range consisting of the first character in the document corresponds to the
|
||||
pair ``1, 2``. Non-positive offset denotes the end of the document.
|
||||
|
||||
- ``InsertText(pos, ...)``: inserts text at the position ``pos``.
|
||||
- ``DeleteText(start, end)``: deletes text in the range ``[start..end)``.
|
||||
- ``GetInsert()``: returns position of the cursor in the document.
|
||||
- ``GetSelectionBounds()``: returns positions of the selection start and end. If no text is
|
||||
selected, returns pair ``pos, pos`` where ``pos`` is the cursor position.
|
||||
- ``GetLine([pos])``: returns line number of the character at the position ``pos``. If ``pos``
|
||||
is not specified, it defaults to the cursor position.
|
||||
- ``GetPosAtLine(n)``: returns position at the beginning of the ``n``-th line.
|
||||
- ``LineStart([pos])``: returns the position of the beginning of the line which contains character at ``pos``.
|
||||
If ``pos`` is not specified, it defaults to the cursor position.
|
||||
- ``LineEnd([pos])``: returns the position of the end of the line which contains character at ``pos``.
|
||||
If ``pos`` is not specified, it defaults to the cursor position.
|
||||
- ``ForwardLine([pos, [n]])``: returns the position of the beginning of the next line (or
|
||||
``n``-th line if ``n`` is specified). ``pos`` defaults to the cursor position if not
|
||||
specified.
|
||||
- ``BackwardLine([pos, [n]])``: returns the position of the beginning of the previous line
|
||||
(or ``n``-th line backwards if ``n`` is specified). ``pos`` defaults to the cursor position
|
||||
if not specified.
|
||||
- ``GetText(start, end)``: returns the text in the ``[start..end)``. If ``start == end``, it
|
||||
returns an empty string, not ``nil``.
|
||||
|
||||
|
||||
=== Shell scripts ===[user-tools-shell]
|
||||
|
||||
In addition to the document text passed via standard input,
|
||||
shell scripts have a number of environment variables set. ``$APP_PID``
|
||||
variable is set to the current process process id, so that opening a file in the
|
||||
same instance of APPNAME is as simple as ``APPNAME filename`` (on the other
|
||||
hand, you will have to use command line options if you need to run a new APPNAME instance).
|
||||
The following environment variables are set when scripts are executed:
|
||||
|
||||
| ``DOC`` | the document basename. |
|
||||
| ``DOC_DIR`` | the document file directory. The full file path is ``$DOC_DIR/$DOC``.
|
||||
| ``DOC_BASE`` | the basename without extension.
|
||||
| ``DOC_EXT`` | the document filename extension including the period. The basename is always ``$DOC_BASE$DOC_EXT``.
|
||||
| ``LINE`` | the number of the line containing cursor.
|
||||
| ``DATA_DIR`` | the user data directory. For example the tools are stored in ``$DATA_DIR/menu.cfg`` file and in files in the ``$DATA_DIR/tools/`` directory.
|
||||
|
||||
Additionally, all processes ran from inside APPNAME will have ``DATADIR/scripts``
|
||||
directories in ``$PATH``, so you may place some APPNAME-specific programs
|
||||
or scripts into ``USERDATADIR/scripts/`` to be used from shell script tools.
|
@ -1,71 +0,0 @@
|
||||
AC_DEFUN([_MOO_AC_CHECK_XSLT_DOCBOOK],[
|
||||
AC_ARG_VAR([XSLTPROC],[path to xsltproc utility])
|
||||
AC_CHECK_PROG([XSLTPROC],[xsltproc],[xsltproc])
|
||||
|
||||
if test -z "$XSLTPROC"; then
|
||||
$2
|
||||
fi
|
||||
|
||||
if test -n "$XSLTPROC"; then
|
||||
AC_MSG_CHECKING([whether xsltproc works])
|
||||
cat > conftest.docbook << EOFEOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
|
||||
>
|
||||
<article>
|
||||
<articleinfo>
|
||||
<title>Title</title>
|
||||
</articleinfo>
|
||||
<sect1>
|
||||
<title>A section</title>
|
||||
<para>Blah blah blah.</para>
|
||||
</sect1>
|
||||
</article>
|
||||
EOFEOF
|
||||
if ($XSLTPROC --nonet http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl conftest.docbook 2>/dev/null >/dev/null); then
|
||||
AC_MSG_RESULT([yes])
|
||||
rm -f conftest.docbook
|
||||
$1
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
rm -f conftest.docbook
|
||||
$2
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([MOO_DOCS],[
|
||||
AC_REQUIRE([MOO_AC_SET_DIRS])
|
||||
|
||||
AC_ARG_ENABLE([help],
|
||||
AC_HELP_STRING(--disable-help, [Disable building html help files (default = auto).]),
|
||||
[:],[enable_help=auto])
|
||||
|
||||
if test "x$MOO_ENABLE_HELP" != xyes; then
|
||||
if test "x$enable_help" = xauto -o "x$enable_help" = xyes; then
|
||||
_MOO_AC_CHECK_XSLT_DOCBOOK([_moo_xslt_working=yes],[_moo_xslt_working=no])
|
||||
if test $_moo_xslt_working = yes; then
|
||||
MOO_ENABLE_HELP=yes
|
||||
elif test "x$enable_help" = xauto; then
|
||||
MOO_ENABLE_HELP=no
|
||||
else
|
||||
AC_MSG_ERROR([xsltproc will not work])
|
||||
fi
|
||||
else
|
||||
MOO_ENABLE_HELP=no
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$MOO_ENABLE_HELP" != xyes; then
|
||||
MOO_BUILD_DOCS=no
|
||||
elif test "x$MOO_BUILD_DOCS" = x; then
|
||||
MOO_BUILD_DOCS=yes
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(MOO_ENABLE_HELP, test "x$MOO_ENABLE_HELP" = xyes)
|
||||
AM_CONDITIONAL(MOO_BUILD_DOCS, test "x$MOO_BUILD_DOCS" = xyes)
|
||||
if test "x$MOO_ENABLE_HELP" = xyes; then
|
||||
AC_DEFINE(MOO_ENABLE_HELP, [1], [enable help functionality])
|
||||
fi
|
||||
])
|
@ -41,5 +41,6 @@ AM_CFLAGS = \
|
||||
-I.. \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir)/doc \
|
||||
-I$(top_builddir)/doc \
|
||||
$(MOO_CFLAGS) \
|
||||
$(MOO_DEBUG_CFLAGS)
|
||||
|
@ -1280,14 +1280,12 @@ install_common_actions (void)
|
||||
"closure-callback", moo_app_about_dialog,
|
||||
NULL);
|
||||
|
||||
#ifdef MOO_ENABLE_HELP
|
||||
moo_window_class_new_action (klass, "Help", NULL,
|
||||
"label", GTK_STOCK_HELP,
|
||||
"accel", "F1",
|
||||
"stock-id", GTK_STOCK_HELP,
|
||||
"closure-callback", moo_app_help,
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
moo_window_class_new_action (klass, "SystemInfo", NULL,
|
||||
/* menu item label */
|
||||
|
@ -139,7 +139,7 @@ show_credits (void)
|
||||
static void
|
||||
license_clicked (void)
|
||||
{
|
||||
moo_help_open_id (HELP_SECTION_LICENSE, NULL);
|
||||
moo_help_open_id (HELP_SECTION_APP_LICENSE, NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -245,6 +245,7 @@ AM_CFLAGS = \
|
||||
-I.. \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir)/doc \
|
||||
-I$(top_builddir)/doc \
|
||||
$(MOO_CFLAGS) \
|
||||
$(MOO_DEBUG_CFLAGS)
|
||||
AM_OBJCFLAGS = $(AM_CFLAGS) $(MOO_OBJCFLAGS)
|
||||
|
@ -56,6 +56,7 @@ langs2 = \
|
||||
scheme.lang \
|
||||
sh.lang \
|
||||
sql.lang \
|
||||
t2t.lang \
|
||||
tcl.lang \
|
||||
texinfo.lang \
|
||||
vala.lang \
|
||||
|
@ -143,4 +143,11 @@
|
||||
<style name="sh:dollar" foreground="dark-green" bold="true"/>
|
||||
|
||||
<style name="makefile:trailing-tab" background="#FFC0CB"/>
|
||||
|
||||
<style name="t2t:italic" italic="true"/>
|
||||
<style name="t2t:bold" bold="true"/>
|
||||
<style name="t2t:verbatim" background="#lightgrey"/>
|
||||
<style name="t2t:verbatim-block" line-background="#lightgrey"/>
|
||||
<style name="t2t:comment" foreground="dark-green"/>
|
||||
<style name="t2t:option" foreground="dark-green"/>
|
||||
</style-scheme>
|
||||
|
148
moo/mooedit/language-specs/t2t.lang
Normal file
148
moo/mooedit/language-specs/t2t.lang
Normal file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Author: Yevgen Muntyan <muntyan@tamu.edu>
|
||||
Copyright (C) 2008 Yevgen Muntyan <muntyan@tamu.edu>
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
-->
|
||||
<language id="t2t" _name="Text2Tags" version="2.0" _section="Markup">
|
||||
<metadata>
|
||||
<property name="globs">*.t2t</property>
|
||||
<property name="line-comment-start">%</property>
|
||||
</metadata>
|
||||
|
||||
<styles>
|
||||
<style id="comment" _name="Comment"/>
|
||||
<style id="option" _name="Option"/>
|
||||
<style id="option-name" _name="Option Name" map-to="def:keyword"/>
|
||||
<style id="header" _name="Header" map-to="def:keyword"/>
|
||||
<style id="section" _name="Section" map-to="def:keyword"/>
|
||||
<style id="section-1" _name="Section 1" map-to="t2t:section"/>
|
||||
<style id="section-2" _name="Section 2" map-to="t2t:section"/>
|
||||
<style id="section-3" _name="Section 3" map-to="t2t:section"/>
|
||||
<style id="section-4" _name="Section 4" map-to="t2t:section"/>
|
||||
<style id="section-5" _name="Section 5" map-to="t2t:section"/>
|
||||
<style id="anchor" _name="Anchor" map-to="t2t:section"/>
|
||||
<style id="italic" _name="Italic"/>
|
||||
<style id="bold" _name="Bold"/>
|
||||
<style id="verbatim" _name="Verbatim"/>
|
||||
<style id="verbatim-block" _name="Verbatim Block"/>
|
||||
</styles>
|
||||
|
||||
<definitions>
|
||||
<context id="header" first-line-only="true" style-ref="header">
|
||||
<match>.+</match>
|
||||
</context>
|
||||
|
||||
<context id="options">
|
||||
<include>
|
||||
<context id="option" style-ref="option">
|
||||
<match>^(%!\s*(?:Target|Encoding|Options|Postproc|Preproc|include)(?:\(\S+\))?)\s*:.*</match>
|
||||
<include>
|
||||
<context id="option-name" sub-pattern="1" style-ref="option-name"/>
|
||||
</include>
|
||||
</context>
|
||||
<context id="invalid-option" style-ref="def:error">
|
||||
<match>^%!.*</match>
|
||||
</context>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="comment" style-ref="comment" end-at-line-end="true">
|
||||
<start>^%</start>
|
||||
</context>
|
||||
|
||||
<context id="sections">
|
||||
<include>
|
||||
<context id="section-1">
|
||||
<match>^(=(?!=).*(?<!=)=)(?!=)(\[.*\])?</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="section-1"/>
|
||||
<context sub-pattern="2" style-ref="anchor"/>
|
||||
</include>
|
||||
</context>
|
||||
<context id="section-2">
|
||||
<match>^(==(?!=).*(?<!=)==)(?!=)(\[.*\])?</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="section-2"/>
|
||||
<context sub-pattern="2" style-ref="anchor"/>
|
||||
</include>
|
||||
</context>
|
||||
<context id="section-3">
|
||||
<match>^(===(?!=).*(?<!=)===)(?!=)(\[.*\])?</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="section-3"/>
|
||||
<context sub-pattern="2" style-ref="anchor"/>
|
||||
</include>
|
||||
</context>
|
||||
<context id="section-4">
|
||||
<match>^(====(?!=).*(?<!=)====)(?!=)(\[.*\])?</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="section-4"/>
|
||||
<context sub-pattern="2" style-ref="anchor"/>
|
||||
</include>
|
||||
</context>
|
||||
<context id="section-5">
|
||||
<match>^(=====(?!=).*(?<!=)=====)(?!=)(\[.*\])?</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="section-5"/>
|
||||
<context sub-pattern="2" style-ref="anchor"/>
|
||||
</include>
|
||||
</context>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="italic">
|
||||
<match>//(.*?)//</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="italic"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="bold">
|
||||
<match>\*\*(.*?)\*\*</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="bold"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="verbatim">
|
||||
<match>``(.*?)``</match>
|
||||
<include>
|
||||
<context sub-pattern="1" style-ref="verbatim"/>
|
||||
</include>
|
||||
</context>
|
||||
|
||||
<context id="verbatim-block" style-ref="verbatim-block" style-inside="true">
|
||||
<start>^```$</start>
|
||||
<end>^```$</end>
|
||||
</context>
|
||||
|
||||
<context id="t2t">
|
||||
<include>
|
||||
<context ref="header"/>
|
||||
<context ref="sections"/>
|
||||
<context ref="options"/>
|
||||
<context ref="comment"/>
|
||||
<context ref="italic"/>
|
||||
<context ref="bold"/>
|
||||
<context ref="verbatim"/>
|
||||
<context ref="verbatim-block"/>
|
||||
</include>
|
||||
</context>
|
||||
</definitions>
|
||||
</language>
|
@ -9,11 +9,22 @@
|
||||
# gap.lang gtkrc.lang html.lang ini.lang latex.lang m4.lang
|
||||
# makefile.lang ms.lang perl.lang po.lang python.lang sh.lang
|
||||
# texinfo.lang xml.lang yacc.lang libtool.lang pkgconfig.lang
|
||||
# objc.lang chdr.lang testv1.lang
|
||||
# objc.lang chdr.lang testv1.lang t2t.lang fortran.lang forth.lang
|
||||
|
||||
dir="testdir"
|
||||
mkdir -p $dir/
|
||||
|
||||
cat > $dir/file.t2t <<EOFEOF
|
||||
! gtk-source-lang: t2t
|
||||
|
||||
%!include ``something``
|
||||
% Comment
|
||||
``verbatim`` //italic//
|
||||
```
|
||||
verbatim block
|
||||
```
|
||||
EOFEOF
|
||||
|
||||
cat > $dir/file.f <<EOFEOF
|
||||
! gtk-source-lang: fortran
|
||||
c comment
|
||||
|
@ -16,6 +16,7 @@ AM_CFLAGS = \
|
||||
-I../.. \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir)/doc \
|
||||
-I$(top_builddir)/doc \
|
||||
$(MOO_CFLAGS) \
|
||||
$(MOO_DEBUG_CFLAGS)
|
||||
AM_OBJCFLAGS = $(AM_CFLAGS) $(MOO_OBJCFLAGS)
|
||||
|
@ -238,6 +238,7 @@ AM_CFLAGS = \
|
||||
-I$(top_builddir) \
|
||||
-I.. \
|
||||
-I$(top_srcdir)/doc \
|
||||
-I$(top_builddir)/doc \
|
||||
$(MOO_CFLAGS) \
|
||||
$(MOO_DEBUG_CFLAGS) \
|
||||
-DMOO_LOCALE_DIR=\"$(datadir)/locale\" \
|
||||
|
@ -364,14 +364,12 @@ GtkWidget *file_chooser_dialog_new (const char *title,
|
||||
start_dir);
|
||||
|
||||
|
||||
#ifdef MOO_ENABLE_HELP
|
||||
if (help_id)
|
||||
{
|
||||
moo_help_set_id (dialog, help_id);
|
||||
moo_help_connect_keys (dialog);
|
||||
gtk_dialog_add_button (GTK_DIALOG (dialog), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
|
||||
}
|
||||
#endif
|
||||
|
||||
return dialog;
|
||||
}
|
||||
|
@ -126,18 +126,14 @@ moo_prefs_dialog_init (MooPrefsDialog *dialog)
|
||||
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
|
||||
|
||||
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
|
||||
#ifdef MOO_ENABLE_HELP
|
||||
GTK_STOCK_HELP, GTK_RESPONSE_HELP,
|
||||
#endif
|
||||
GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
|
||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||
GTK_STOCK_OK, GTK_RESPONSE_OK,
|
||||
NULL);
|
||||
#if GTK_MINOR_VERSION >= 6
|
||||
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
|
||||
#ifdef MOO_ENABLE_HELP
|
||||
GTK_RESPONSE_HELP,
|
||||
#endif
|
||||
GTK_RESPONSE_OK,
|
||||
GTK_RESPONSE_CANCEL,
|
||||
GTK_RESPONSE_APPLY,
|
||||
|
Loading…
x
Reference in New Issue
Block a user