Tags:
create new tag
view all tags
A placeholder for discussing standard syntax for parameters and values whenever macros are used (example %TAG{fred="bad" "sad" joe="mad"}%. Some of standard places where it is defined: =%SEARCH{}% definition in TWikiVariables, SharedCode. (For potential addition into TWikiDocumentation.)

-- VinodKulkarni - 16 Jul 2004


Embedding strings within other strings

One of the problems is in use of embedded syntax for a string included in another string. For example, $pattern("string") included within $format="". The syntax (using $quot etc.) is usually cumbersome, and some combinations are not even possible. FormattedSearchinTopics proposed a syntax of using any character for delimiting $pattern string (like in perl).

Here is an alternate proposal: Allow use of previously defined attr-value strings within other subsequent strings. For example: %SEARCH{... $str="(a|b)" format="| $topic | $pattern($str) |"}%.

-- VinodKulkarni - 16 Jul 2004


How nicely to parse (and specify) %TAG1{ ... %TAG2{}% ... }%?

Issues:

  • Standard parsing routine required so it will give a data structure.
  • Rendering of internal macro calls could be part of parsing process, but the exact rules need to be standardized. How to avoid such renderings? What happens when there are multiple levels?

It would be nice to document the current mechanisms (such as for INCLUDE, SEARCH) here, without bringing in the semantics of each implementation.

-- VinodKulkarni - 16 Jul 2004


- I use a standard module in all my plugins to parse the attribute list; see SharedCode and read about TWiki::Attrs. That parser recognises all the standard syntax and also handles single and double quotes, which eases the quote mbedding problem. The code was proposed for inclusion in the core a couple of years ago but has not been adopted. I just wrote a piece of code to parse recursively embedded %TAG{ }%s properly as well, though it's not released yet. -- CrawfordCurrie - 15 Jul 2004 - 23:06

- From SharedCode:


"The parser is forgiving; it will handle standard TWiki syntax (parameter values double-quoted) but also single-quoted values, unquoted spaceless values, spaces around the =, and commas as well as spaces separating values."

Could you also add some info on what happens when strings are to be included within strings, and so on?

-VinodKulkarni -- VinodKulkarni - 16 Jul 2004 - 01:25

- Sure - it breaks. But it breaks less than the standard parser.. >:-)
-- CrawfordCurrie - 16 Jul 2004 - 03:58

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2004-07-16 - CrawfordCurrie
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.