texinfo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keep information of texinfo source


From: Patrice Dumas
Subject: Re: keep information of texinfo source
Date: Mon, 12 Dec 2011 11:45:59 +0100
User-agent: Mutt/1.4.2.2i

On Sun, Dec 11, 2011 at 02:21:50PM -0800, Karl Berry wrote:
>     I consider that all the tree
>     should be read only by the user
> 
> Sure, but that doesn't mean it has to be a valid user-level command
> name.  The question is whether @sourcemark would ever be output when
> reconstructing the document, or only used internally to do so.  My
> impression was the latter.  If it only exists inside Perl, then it just
> seemed logical to me for it to be inaccessible at the source level.
> 
> No biggie.

I think that you are misunderstanding, though it is certainly because I
wasn't clear.  The idea is that @sourcemark, as a source level command
is only used internally (for now), but it is also a key of tree elements
that are visible externally.  For example, with

 @macro mymacro{arg}
 res\arg\
 @end macro

for the following code:

 @mymacro{call} text.

The tree would be 

'contents -> [ 
  {'sourcemark' => 'macrobegin',
   'extra' => {'macro' => pointer to the macro definition,
               'number' => 2,
               'args' => ['call']}},
  {'text' => 'rescall'},
  {'sourcemark' => 'macroend',
   'extra' => {'macro' => pointer to the macro definition,
               'number' => 2,
               'begin' => pointer to the sourcemark above}},
   {'text' => 'text.'}
]

As you can see the sourcemark elements have no associated cmdname.

At some point during parsing, the texinfo code would be 

 address@hidden,mymacro,2} text.

but no sourcemark will appear in results.


An 'equivalent' texinfo code, that would never be output as Texinfo
code (at least for now) would be

 @sourcemark{macrobegin,mymacro,address@hidden,mymacro,2} text.

As such it would be quite unuseful, but if there is in addition a file
which contains all the information available in the tree in extra, along

@sourcemark{macrobegin,mymacro,2}
args:
@delimiter{}
call
@delimiter{}

It could be then be possible to recreate the tree.  I doubt it may be 
usefull in real life, but it may be useful to debug the parser and/or do 
unit tests.

>     not source_mark, it is illicit, 
> 
> Right.  The underscore making it an invalid user-level name is precisely
> why I suggested using it.

Indeed, that would make sense, however I'd prefer using a licit command, 
in order not to have to do a specific regexp, and also because at some
point it could be possible to have it output in the the resulting texinfo.

>     should be source-mark...
> 
> No, in this alternative, it should be sourcemark.  Names with hyphens
> (or anything non-alphabetic) fail in TeX.

Ok, but it is explicitly accepted by makeinfo...  Though you are right,
it is better to have someting also accepted (and ignored) by TeX.

-- 
Pat



reply via email to

[Prev in Thread] Current Thread [Next in Thread]