ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Rik Kabel <context@rik.users.panix.com>
To: Alan Braslau <braslau.list@comcast.net>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Overriding / redefining / disabling standard commands
Date: Mon, 25 Jun 2018 22:44:18 -0400	[thread overview]
Message-ID: <d587c800-7c6a-496d-74ca-aa6c3b177770@rik.users.panix.com> (raw)
In-Reply-To: <20180625200003.44e4c37e@poo.hsd1.co.comcast.net>

On 6/25/2018 22:00, Alan Braslau wrote:
> On Mon, 25 Jun 2018 20:50:51 -0400
> Rik Kabel <context@rik.users.panix.com> wrote:
>
>> On 6/25/2018 20:11, Alan Braslau wrote:
>>> On Mon, 25 Jun 2018 19:11:30 -0400
>>> Rik <rik@panix.com> 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:
>>>>
>>>>       <div class="registerlocation index" href="#aut-1"
>>>>       onclick="location.href=&apos;#aut-1&apos;"><!--empty--></div>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
___________________________________________________________________________________

  reply	other threads:[~2018-06-26  2:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-25 20:49 Rik Kabel
2018-06-25 21:52 ` Wolfgang Schuster
2018-06-25 23:11   ` Rik
2018-06-26  0:11     ` Alan Braslau
2018-06-26  0:50       ` Rik Kabel
2018-06-26  2:00         ` Alan Braslau
2018-06-26  2:44           ` Rik Kabel [this message]
2018-06-26  7:35             ` Hans Hagen
2018-06-26 12:56               ` Alan Braslau
2018-06-26 13:22               ` Hans Hagen
2018-06-26  6:34           ` Wolfgang Schuster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d587c800-7c6a-496d-74ca-aa6c3b177770@rik.users.panix.com \
    --to=context@rik.users.panix.com \
    --cc=braslau.list@comcast.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).