From 8ac176c068fbbcc44a9c3859e8ee04b03038a73e Mon Sep 17 00:00:00 2001 From: TEC Date: Wed, 18 Jan 2023 23:45:30 +0800 Subject: [PATCH] Add creating md backend spec to docs --- org-glossary.org | 26 ++++++++++++++++++++++++++ org-glossary.texi | 29 +++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/org-glossary.org b/org-glossary.org index b391abb..cce4bc8 100644 --- a/org-glossary.org +++ b/org-glossary.org @@ -576,3 +576,29 @@ to avoid the =\ifnum%n>0= LaTeX switch. This allows for any change in other backends or the defaults you're not particularly attached to from freely updating. + +** Adding a new export backend + +Adding a new export spec is as easy as pushing a spec list to +~org-glossary-export-specs~, for example should we want to add an =ox-md= backend we +could do this: + +#+begin_example +(push '(md (t :use "[%t](#gls-%K)" + :definition "%t {#gls-%K}" + :definition-structure "%d\n\\colon{} %v [%n uses]\n")) + org-glossary-export-specs) +#+end_example + +We need to remember to use =\colon{}= instead of =:= to avoid it being interpreted +as Org fixed-width syntax. + +Alternatively, we could use ~org-glossary-set-export-spec~, which has the +advantage of being idempotent, and I would argue a little clearer. + +#+begin_example +(org-glossary-set-export-spec 'md t + :use "[%t](#gls-%K)" + :definition "%t {#gls-%K}" + :definition-structure "%d\n\\colon{} %v [%n uses]\n") +#+end_example diff --git a/org-glossary.texi b/org-glossary.texi index 9915a77..b9e9732 100644 --- a/org-glossary.texi +++ b/org-glossary.texi @@ -60,6 +60,7 @@ Export configuration * Structure of an export template set:: * Creating a new glossary type:: * Tweaking specific exports:: +* Adding a new export backend:: @end detailmenu @end menu @@ -526,6 +527,7 @@ the use, when @code{org-glossary-display-substitute-value} is non-nil. * Structure of an export template set:: * Creating a new glossary type:: * Tweaking specific exports:: +* Adding a new export backend:: @end menu @node Setting export parameters @@ -765,4 +767,31 @@ to avoid the @samp{\ifnum%n>0} @LaTeX{} switch. This allows for any change in other backends or the defaults you're not particularly attached to from freely updating. +@node Adding a new export backend +@section Adding a new export backend + +Adding a new export spec is as easy as pushing a spec list to +@code{org-glossary-export-specs}, for example should we want to add an @samp{ox-md} backend we +could do this: + +@example +(push '(md (t :use "[%t](#gls-%K)" + :definition "%t @{#gls-%K@}" + :definition-structure "%d\n\\colon@{@} %v [%n uses]\n")) + org-glossary-export-specs) +@end example + +We need to remember to use @samp{\colon@{@}} instead of @samp{:} to avoid it being interpreted +as Org fixed-width syntax. + +Alternatively, we could use @code{org-glossary-set-export-spec}, which has the +advantage of being idempotent, and I would argue a little clearer. + +@example +(org-glossary-set-export-spec 'md t + :use "[%t](#gls-%K)" + :definition "%t @{#gls-%K@}" + :definition-structure "%d\n\\colon@{@} %v [%n uses]\n") +@end example + @bye