Hi all,
I've posted about this topic some time ago in userchat.eng (quoted
below), in hope to trigger a discussion, but sadly got no response.
So after some more experimenting and thinking, I'd like to put forward
the following proposal:
The syntax for displaying attribute values should be expanded to allow
regular expression search & replace operations on the attribute value.
Lets say the attribute SVN_ID contains the string
$Id: myboard.brd 123 2011-11-14 10:14:29Z LL $
A text containing
"last committed >SVN_ID/Id: + + (.*) $/\1/"
then would display
last committed 2011-11-14 10:14:29Z LL
The regex syntax above is derived from gawk, but any other regex
syntax that allows manipulation/extraction will do.
strxstr already supports regex searching, perhaps the library use to
implement that, could be used for the proposed feature too.
Any other solution I mentioned in my original post requires additional
setup of ULPs/SCRs and poses the risk of file corruption and/or
manipulation by faulty, corrupted or manipulated UPLs/SCRs.
In addition: in combination with a version control system, solutions
that change any text or attribute values introduce file changes, that
in turn will be picked up from the version control system.
Any comments welcome, but ...
putting my eagle files under version control (subversion in my case).
>One of subversions features is putting revision information into the
>files by keyword expansion.
>As eagle now uses XML formatted files this now works without problems.
>Just put for instance "$URL:$" or "$Revision:$" into a text and
>subversion will replace it with "$URL: in or updated.
>As a first step that is ok. But ...
>What I'd like to do is to incorporate only part of this strings into
>my page frames. That is: I would like to display "" omitting the leading "$URL: " and the trailing " $".
>
>As far as I can see that is not easily done in the moment.
>I've considered putting the revision info into one or more hidden
>attributes of the page frame(s) and using the "eagle -C "run xyz.ulp"
>command line option.
>The ULP would then process the hidden attributes and put whatever
>derived information into text fields of the frames.
>That should work, but requires a batch file to call eagle or fiddling
>with the registry (in windows at least). Under Linux a command alias
>would do the job.
>Anyhow this solution requires that this batch file, registry hack or
>command alias is installed on every workstation.
>
>I would like to propose one of the following solutions.
>Either implement some sort of search&replace possibility for eagles
>text placeholders (there is already a regular expression engine in
>eagle used by the strxstr function),
>or a new meta text placeholder ">ULP ulp-name ulp-parameters ..."
>Both solution would solve my immediate needs.
>
>What do you think?
On 03/05/2013 05:53 AM, Lorenz wrote:
Hi all,
I've posted about this topic some time ago in userchat.eng (quoted
below), in hope to trigger a discussion, but sadly got no response.
So after some more experimenting and thinking, I'd like to put forward
the following proposal:
The syntax for displaying attribute values should be expanded to allow
regular expression search & replace operations on the attribute value.
Lets say the attribute SVN_ID contains the string
$Id: myboard.brd 123 2011-11-14 10:14:29Z LL $
A text containing
"last committed >SVN_ID/Id: + + (.*) $/\1/"
then would display
last committed 2011-11-14 10:14:29Z LL
I second this request. The embedded syntax needs a bit of refinement.
We can borrow an already familiar syntax from the Bourne-Again Shell (bash):
${SVN_ID//regex/replacement/}
GNU Make also has a syntax that is worth noting:
${subst /from,to,text/}
The latter lends itself well to other extensions:
${regex /pattern,replacement,text/}
${shell argv0 argv1 argv2 ...}
${ulp ulpname argv1 argv2 ...}
Lorenz' example would be to set a text value to:
"last committed >${regex 'Id: + + (.*) $','\1',$SVN_ID}"
In addition: in combination with a version control system, solutions
that change any text or attribute values introduce file changes, that
in turn will be picked up from the version control system.
True. The parsed value should not be stored in the file. ULP
references to the UL_TEXT object should be able to provide both the
original unparsed text, and the result.
UL_TEXT mytext;
...
mytext.value is the processed result, just as it is now
mytext.preval is a new data member containing the unprocessed
string as stored in the file.
Other ideas?
- Chuck
| 4382.att1.html.zip |
How frustrating,
no one out there interested enough in this to at least shoot the idea
down?
--
Lorenz
Lorenz wrote:
I've posted about this topic some time ago in userchat.eng (quoted
below), in hope to trigger a discussion, but sadly got no response.
So after some more experimenting and thinking, I'd like to put forward
the following proposal:
The syntax for displaying attribute values should be expanded to allow
regular expression search & replace operations on the attribute value.
Lets say the attribute SVN_ID contains the string
> $Id: myboard.brd 123 2011-11-14 10:14:29Z LL $
A text containing
> "last committed >SVN_ID/Id: + + (.*) $/\1/"
then would display
> last committed 2011-11-14 10:14:29Z LL
The regex syntax above is derived from gawk, but any other regex
syntax that allows manipulation/extraction will do.
strxstr already supports regex searching, perhaps the library use to
implement that, could be used for the proposed feature too.
Any other solution I mentioned in my original post requires additional
setup of ULPs/SCRs and poses the risk of file corruption and/or
manipulation by faulty, corrupted or manipulated UPLs/SCRs.
In addition: in combination with a version control system, solutions
that change any text or attribute values introduce file changes, that
in turn will be picked up from the version control system.
Any comments welcome, but ...
<getting ready to duck and run>
... don't tell me this won't be available in the next beta 8-)
Lorenz wrote:
after I've finally upgraded to eagle 6, I'm now experimenting with
putting my eagle files under version control (subversion in my case).
One of subversions features is putting revision information into the
files by keyword expansion.
As eagle now uses XML formatted files this now works without problems.
Just put for instance "$URL:$" or "$Revision:$" into a text and
subversion will replace it with "$URL: <path to file in repository> $"
and "$Revision 12345 $" every time the file is checked out, checked
in or updated.
As a first step that is ok. But ...
What I'd like to do is to incorporate only part of this strings into
my page frames. That is: I would like to display "<path to file in
repository>" omitting the leading "$URL: " and the trailing " $".
As far as I can see that is not easily done in the moment.
I've considered putting the revision info into one or more hidden
attributes of the page frame(s) and using the "eagle -C "run xyz.ulp"
command line option.
The ULP would then process the hidden attributes and put whatever
derived information into text fields of the frames.
That should work, but requires a batch file to call eagle or fiddling
with the registry (in windows at least). Under Linux a command alias
would do the job.
Anyhow this solution requires that this batch file, registry hack or
command alias is installed on every workstation.
I would like to propose one of the following solutions.
Either implement some sort of search&replace possibility for eagles
text placeholders (there is already a regular expression engine in
eagle used by the strxstr function),
or a new meta text placeholder ">ULP ulp-name ulp-parameters ..."
Both solution would solve my immediate needs.
What do you think?
Lorenz wrote on Wed, 13 March 2013 06:02
How frustrating, no one out there interested enough in this to at least
shoot the idea
down?
Cadsoft isn't going to jump on something that clearly nobody cares about.
It's not worth rebutting it since it will go away all on its own.
--
Web access to CadSoft support forums at www.eaglecentral.ca. Where the CadSoft EAGLE community meets.