1
0
Fork 0

Documentation update

This commit is contained in:
François Poulain 2014-05-22 15:46:32 +00:00
parent 456d0e8033
commit 627edd9f9b
1 changed files with 37 additions and 64 deletions

View File

@ -1,9 +1,10 @@
<TeXmacs|1.0.2.3>
<TeXmacs|1.99.1>
<style|tmdoc>
<style|<tuple|tmdoc|english>>
<\body>
<expand|tmdoc-title|Adding new data formats and converters>
<with|font-shape|italic|><tmdoc-title|Adding new data formats and
converters>
Using the <name|Guile>/<name|Scheme> extension language, it is possible to
add new data formats and converters to <TeXmacs> in a modular way. Usually,
@ -17,13 +18,13 @@
A new format is declared using the command
<\expand|scheme-fragment>
<\scm-code>
(define-format <em|format>
\ \ (:name <em|format-name>)
\ \ <em|options>)
</expand>
</scm-code>
Here <verbatim|<em|format>> is a symbol which stands for the format and
<verbatim|<em|format-name>> a string which can be used in menus. In fact, a
@ -41,44 +42,50 @@
formats by their file suffix and contents. The possible suffixes for a
format, with the default one listed first, may be specified using
<\expand|scheme-fragment>
<\scm-code>
(:suffix <em|default-suffix> <em|other-suffix-1> ... <em|other-suffix-n>)
</expand>
</scm-code>
A (heuristic) routine for recognizing whether a given document matches the
format can be specified using either one of the following:
<\expand|scheme-fragment>
<\scm-code>
(:recognize <em|predicate>)
(:must-recognize <em|predicate>)
</expand>
</scm-code>
In the first case, suffix recognition takes precedence over document
recognition and in the second case, the heuristic recognition is entirely
determined by the document recognition predicate.
A format can be removed from menus using the following:
<\scm-code>
(:hidden)
</scm-code>
<paragraph*|Declaring new converters>
New converters are declared using
<\expand|scheme-fragment>
<\scm-code>
(converter <em|from> <em|to>
\ \ <em|options>)
</expand>
</scm-code>
The actual converter is specified using either one of the following
options:
<\expand|scheme-fragment>
<\scm-code>
(:function <em|converter>)
(:function-with-options <em|converter-with-options>)
(:shell <em|prog> <em|prog-pre-args> from <em|progs-infix-args> to
<em|prog-post-args>)
</expand>
</scm-code>
In the first case, the <verbatim|<em|converter>> is a routine which takes
an object of the <verbatim|<em|from>> format and returns a routine of the
@ -92,22 +99,22 @@
<TeXmacs> automatically computes the transitive closure of all converters
using a shortest path algorithm. In other words, if you have a converter
from <with|mode|math|x> to <with|mode|math|y> and a converter from
<with|mode|math|y> to <with|mode|math|z>, then you will automatically have
a converter from <with|mode|math|x> to <with|mode|math|z>. A ``distance
between two formats via a given converter'' may be specified using
from <math|x> to <math|y> and a converter from <math|y> to <math|z>, then
you will automatically have a converter from <math|x> to <math|z>. A
``distance between two formats via a given converter'' may be specified
using
<\expand|scheme-fragment>
<\scm-code>
(:penalty <em|floating-point-distance>)
</expand>
</scm-code>
Further options for converters are:
<\expand|scheme-fragment>
<\scm-code>
(:require <em|cond>)
(:option <em|option> <em|default-value>)
</expand>
</scm-code>
The first option specifies a condition which must be satisfied for this
converter to be used. This option should be specified as the first or
@ -116,49 +123,15 @@
default value. This option automatically become a user preference and it
will be passed to all converters with options.
<apply|tmdoc-copyright|1998--2002|Joris van der Hoeven>
<tmdoc-copyright|1998--2002|Joris van der Hoeven>
<expand|tmdoc-license|Permission is granted to copy, distribute and/or
modify this document under the terms of the GNU Free Documentation License,
Version 1.1 or any later version published by the Free Software Foundation;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. A copy of the license is included in the section entitled
"GNU Free Documentation License".>
<tmdoc-license|Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.1
or any later version published by the Free Software Foundation; with no
Invariant Sections, with no Front-Cover Texts, and with no Back-Cover
Texts. A copy of the license is included in the section entitled "GNU Free
Documentation License".>
</body>
<\initial>
<\collection>
<associate|paragraph width|150mm>
<associate|odd page margin|30mm>
<associate|shrinking factor|4>
<associate|page right margin|30mm>
<associate|page top margin|30mm>
<associate|reduction page right margin|25mm>
<associate|page type|a4>
<associate|reduction page bottom margin|15mm>
<associate|even page margin|30mm>
<associate|reduction page left margin|25mm>
<associate|page bottom margin|30mm>
<associate|reduction page top margin|15mm>
<associate|language|english>
</collection>
</initial>
<\references>
<\collection>
<associate|toc-1|<tuple|<uninit>|?>>
<associate|toc-2|<tuple|<uninit>|?>>
</collection>
</references>
<\auxiliary>
<\collection>
<\associate|toc>
<with|left margin|<quote|6fn>|font size|<quote|0.84>|Declaring new
formats<value|toc-dots><pageref|toc-1>>
<with|left margin|<quote|6fn>|font size|<quote|0.84>|Declaring new
converters<value|toc-dots><pageref|toc-2>>
</associate>
</collection>
</auxiliary>
<initial|<\collection>
</collection>>