Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X
Hello,
We would like to use the arbortext change tracking markup information to generate various output in our publishing system. We had noticed that <atict> does not append tags when edits are made again in the same location by the same user in different time.
Here is the example:
I typed this line
This is the first line
XML Code in Arbortext with change tracking on is:
<atict:add user="kkumar" time="1264610729">This is the first line</atict:add>
I closed the xml file and open it again and added (this is my second line) like below
This is the first line This is my second line
Now the xml is change like
<atict:add user="kkumar" time="1264610729">This is the first line This is my second line</atict:add>
I want this to be marked up differently even though it is same user but it is different time stamp. Is this something that I can change any preferences of settings in Arbortext? Or do I need to have a custome code?
Thanks is advance for the help.
Karthik
Hi Karthik,
Arbortext change tracking merges adjacent or nested changes done by
the same user into one change to match common editing patterns. For
example, if a user deletes a line from a paragraph and subsequently
deletes the second line, Arbortext assumes the two deletions are parts
of the same atomic edit operation and merges them together.
There are workarounds but none of them are pretty. For example, you
could, every time a document is opened, automatically change the user to
"kkumar1" and keep bumping the numeric suffix (2, 3, ...) based on the
user list found in the document. The function
function bump_user()
{
local basepattern = "^(.*[^0-9])[0-9]*$"; # end string"
local user = option("user");
local userbase = user;
if (match(user, basepattern)) {
userbase = match_result(1);
}
local i, maxsuffix = 0;
local userlist[];
local suffixpattern = "^" . userbase . "([0-9]+)";
change_tracking_user_list(userlist);
for (i in userlist) {
local name = userlist[i];
if (match(name, suffixpattern)) {
local suffix = match_result(1);
if (maxsuffix < suffix) {
maxsuffix = suffix;
}
}
}
local newuser = userbase . (maxsuffix + 1);
set user = $newuser;
}
will populate the array with the current set of users. Find those
matching the current user name pattern and keep track of the highest
numeric suffix. Then change the suffix to be one higher on the user
set option.
You should also change the user dictionary to keep the same color for
the new user, since the number of good distinct forground colors is
limited. Something like the following should do:
function keep_user_color(olduser, newuser)
{
local oldinfo[];
change_tracking_user_properties(olduser, oldinfo);
if ("color" in oldinfo) {
local newinfo[];
change_tracking_user_properties(newuser, newinfo);
newinfo["color"] = oldinfo["color"];
change_tracking_user_properties(newuser, newinfo, 1);
}
}
Code like this should be run via a file in custom/editinit/. For example:
global olduser = option("user");
bump_user();
keep_user_color(olduser, option("user"));
Every time a file is opened for editing the user id will be bumped.
However the "user" is a global setting so already opened documents
will be affected as well. It might be better to bump the user suffix
only when starting a separate editing session by putting this code
into custom/init.
Andrew
P.S. I have not tested the code above. If you decide to use this
approach but needed to make some changes please post them back for the
benefit of other users.
Andrew,
Thank you so much. I will try this and will get back to you if it does not work.
Karthik