Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-26 Thread Hans Hagen

On 6/26/2018 9:35 AM, Hans Hagen wrote:

On 6/26/2018 4:44 AM, Rik Kabel wrote:

I thought that the ability to override a command like \index might be 
generally useful, and so brought it up to the list when I could not 
find a way to do it.
could be but only when it can be implemented efficiently (i don't want 
to add overhead related to export when export is off so it would mean 
permanently disabled and not locally in a run) ... what commands are we 
talking about

i'll add \ignoretagsinexport as in:

\setupbackend[export=yes]

\ignoretagsinexport
  [registerlocation]

\starttext

test \index {test} test

\stoptext




-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-26 Thread Alan Braslau
On Tue, 26 Jun 2018 09:35:06 +0200
Hans Hagen  wrote:

> On 6/26/2018 4:44 AM, Rik Kabel wrote:
> 
> > I thought that the ability to override a command like \index might
> > be generally useful, and so brought it up to the list when I could
> > not find a way to do it.  
> could be but only when it can be implemented efficiently (i don't
> want to add overhead related to export when export is off so it would
> mean permanently disabled and not locally in a run) ... what commands
> are we talking about

AND, I still don't get the point...
(you can always define your own custom commands by mode)

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-26 Thread Hans Hagen

On 6/26/2018 4:44 AM, Rik Kabel wrote:

I thought that the ability to override a command like \index might be 
generally useful, and so brought it up to the list when I could not find 
a way to do it.
could be but only when it can be implemented efficiently (i don't want 
to add overhead related to export when export is off so it would mean 
permanently disabled and not locally in a run) ... what commands are we 
talking about


Hans

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-26 Thread Wolfgang Schuster



Alan Braslau 
26. Juni 2018 um 04:00
On Mon, 25 Jun 2018 20:50:51 -0400

\setupregister[index][referencing=off]


This option doesn’t exist in MkIV and there is no other option to 
disable \index.


Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-25 Thread Rik Kabel

On 6/25/2018 22:00, Alan Braslau wrote:

On Mon, 25 Jun 2018 20:50:51 -0400
Rik Kabel  wrote:


On 6/25/2018 20:11, Alan Braslau wrote:

On Mon, 25 Jun 2018 19:11:30 -0400
Rik  wrote:


On 6/25/2018 17:52, Wolfgang Schuster wrote:

\startmode[ebook]
\setupbackend[export=yes]
\stopmode

\starttext

\index{Knuth}\input knuth

\index{Ward}\input ward

\index{Zapf}\input zapf

\startnotmode[*export]
\completeregister[index]
\stopnotmode

\stoptext

Unfortunately, this does not suppress generation of index
references in the exported output. Here is a snippet of the
-div.html file generated by the example you provided:

  Thus,
I came to the conclusion that the designer of a new system must not
  only be the implementer and first large--scale user; the
designer should also write the first user manual.

and a snip of the output with the default css:

Thus the request for a (simple) mechanism to redefine or disable
standard commands. There are commands other than \index that might
also benefit from similar treatment.


\def\MyIndex#1{\index{#1}}

is one route.

Another might be

\let\index\gobbleoneargument

(use at your risk)

Alan


This would work if \index took one argument, but it takes as well an
optional argument preceding the required argument, and so these fail.

The best solution would seem to be one which does not require
knowledge of the number of required and optional arguments, but that
might be a stretch.

That is why I asked for help.

\setupregister[index][referencing=off]

Besides, if you use \index, why object to index reference tags in the
export?

Alan


Alan (and list),

This option still leaves the registerlocation entries in the html file, 
and so accomplishes nothing that Wolfgang's suggestion did. Being 
implemented in the environment file, it does have the advantage of not 
requiring changes to the content source file.


As to why I object to index reference tags in the export: There are a 
few constructs beyond indexes that I wish to exclude in export output -- 
indices are one and the problem is easily demonstrated. Referencetags 
themselves are not a significant problem -- a little css will hide them. 
I have not explored the other constructs yet (among them margin notes 
and cross-references) but was hoping for a generic solution, or at least 
an easily adapted per command solution.


There are a few options I can see. In order of least to most preferred, 
I can maintain separate sources; I can invoke a filter in my makefile to 
preprocess the source, removing \index commands (or margin notes, or 
...); I can redefine \index (or margin notes, or ...) to be no-ops.


As much as possible I would like to use the same content source files 
for different output formats with some unique environment files. Filters 
are an added step and fragile, depending on correctly identifying the 
target constructs. So, I have been looking at redefinition.


I thought that the ability to override a command like \index might be 
generally useful, and so brought it up to the list when I could not find 
a way to do it.


--
Rik


___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-25 Thread Alan Braslau
On Mon, 25 Jun 2018 20:50:51 -0400
Rik Kabel  wrote:

> On 6/25/2018 20:11, Alan Braslau wrote:
> > On Mon, 25 Jun 2018 19:11:30 -0400
> > Rik  wrote:
> >
> >> On 6/25/2018 17:52, Wolfgang Schuster wrote:
> >>> \startmode[ebook]
> >>> \setupbackend[export=yes]
> >>> \stopmode
> >>>
> >>> \starttext
> >>>
> >>> \index{Knuth}\input knuth
> >>>
> >>> \index{Ward}\input ward
> >>>
> >>> \index{Zapf}\input zapf
> >>>
> >>> \startnotmode[*export]
> >>> \completeregister[index]
> >>> \stopnotmode
> >>>
> >>> \stoptext
> >> Unfortunately, this does not suppress generation of index
> >> references in the exported output. Here is a snippet of the
> >> -div.html file generated by the example you provided:
> >>
> >>   >>  onclick="location.href=#aut-1">Thus,
> >> I came to the conclusion that the designer of a new system must not
> >>  only be the implementer and first large--scale user; the
> >> designer should also write the first user manual.
> >>
> >> and a snip of the output with the default css:
> >>
> >> Thus the request for a (simple) mechanism to redefine or disable
> >> standard commands. There are commands other than \index that might
> >> also benefit from similar treatment.
> >>
> > \def\MyIndex#1{\index{#1}}
> >
> > is one route.
> >
> > Another might be
> >
> > \let\index\gobbleoneargument
> >
> > (use at your risk)
> >
> > Alan
> >
> This would work if \index took one argument, but it takes as well an 
> optional argument preceding the required argument, and so these fail.
> 
> The best solution would seem to be one which does not require
> knowledge of the number of required and optional arguments, but that
> might be a stretch.
> 
> That is why I asked for help.

\setupregister[index][referencing=off]

Besides, if you use \index, why object to index reference tags in the
export?

Alan
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-25 Thread Rik Kabel

On 6/25/2018 20:11, Alan Braslau wrote:

On Mon, 25 Jun 2018 19:11:30 -0400
Rik  wrote:


On 6/25/2018 17:52, Wolfgang Schuster wrote:

\startmode[ebook]
\setupbackend[export=yes]
\stopmode

\starttext

\index{Knuth}\input knuth

\index{Ward}\input ward

\index{Zapf}\input zapf

\startnotmode[*export]
\completeregister[index]
\stopnotmode

\stoptext

Unfortunately, this does not suppress generation of index references
in the exported output. Here is a snippet of the -div.html file
generated by the example you provided:

 Thus,
I came to the conclusion that the designer of a new system must not
 only be the implementer and first large--scale user; the designer
 should also write the first user manual.

and a snip of the output with the default css:

Thus the request for a (simple) mechanism to redefine or disable
standard commands. There are commands other than \index that might
also benefit from similar treatment.


\def\MyIndex#1{\index{#1}}

is one route.

Another might be

\let\index\gobbleoneargument

(use at your risk)

Alan

This would work if \index took one argument, but it takes as well an 
optional argument preceding the required argument, and so these fail.


The best solution would seem to be one which does not require knowledge 
of the number of required and optional arguments, but that might be a 
stretch.


That is why I asked for help.
--
Rik
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-25 Thread Alan Braslau
On Mon, 25 Jun 2018 19:11:30 -0400
Rik  wrote:

> On 6/25/2018 17:52, Wolfgang Schuster wrote:
> > \startmode[ebook]
> > \setupbackend[export=yes]
> > \stopmode
> >
> > \starttext
> >
> > \index{Knuth}\input knuth
> >
> > \index{Ward}\input ward
> >
> > \index{Zapf}\input zapf
> >
> > \startnotmode[*export]
> > \completeregister[index]
> > \stopnotmode
> >
> > \stoptext  
> 
> Unfortunately, this does not suppress generation of index references
> in the exported output. Here is a snippet of the -div.html file
> generated by the example you provided:
> 
>  onclick="location.href=#aut-1">Thus,
> I came to the conclusion that the designer of a new system must not
> only be the implementer and first large--scale user; the designer
> should also write the first user manual.
> 
> and a snip of the output with the default css:
> 
> Thus the request for a (simple) mechanism to redefine or disable 
> standard commands. There are commands other than \index that might
> also benefit from similar treatment.
> 

\def\MyIndex#1{\index{#1}}

is one route.

Another might be 

\let\index\gobbleoneargument

(use at your risk)

Alan

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-25 Thread Rik

On 6/25/2018 17:52, Wolfgang Schuster wrote:

\startmode[ebook]
\setupbackend[export=yes]
\stopmode

\starttext

\index{Knuth}\input knuth

\index{Ward}\input ward

\index{Zapf}\input zapf

\startnotmode[*export]
\completeregister[index]
\stopnotmode

\stoptext


Unfortunately, this does not suppress generation of index references in 
the exported output. Here is a snippet of the -div.html file generated 
by the example you provided:


   Thus, I
   came to the conclusion that the designer of a new system must not
   only be the implementer and first large--scale user; the designer
   should also write the first user manual.

and a snip of the output with the default css:

Thus the request for a (simple) mechanism to redefine or disable 
standard commands. There are commands other than \index that might also 
benefit from similar treatment.


--
Rik

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Overriding / redefining / disabling standard commands

2018-06-25 Thread Wolfgang Schuster



Rik Kabel 
25. Juni 2018 um 22:49
List,

What is the preferred way to override a standard command?

My use case is that I am trying to produce html (and epub, but that 
has a long long way to go) from the same source I use for pdf. Some 
features are not needed, and I have separate environment files for 
each output format to accommodate the differences.


I would like to override the standard \index command in one of those 
environment files, eliminating the generation of index references. 
There may be other constructs as well that would benefit from this 
simplification while allowing a common content source file.


You can use the “*export” mode to disable commands when the export is 
enabled.


\startmode[ebook]
\setupbackend[export=yes]
\stopmode

\starttext

\index{Knuth}\input knuth

\index{Ward}\input ward

\index{Zapf}\input zapf

\startnotmode[*export]
\completeregister[index]
\stopnotmode

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___