Pages: 1
Print
Author Topic: Request: CSS extensions to insert line breaks  (Read 5224 times)
LeeHart
Member

Posts: 41


« on: September 03, 2010, 03:22:05 PM »

Some of our elements have long lists of attributes. If we were designing the schema over again we'd use more children elements but there's currently a fair bit of external tooling using this structure.

I'd like to be able to change the ordering of the display of the attributes, and put more important ones on the first line (or second line) and then have all attributes not previously displayed listed on the next line.

I can do this with a form but then I'd need to redo the xft when the schema changes (attributes seem to get added to this element every few months.) If it was done in CSS then I'd only need to touch the CSS if the new attribute became a primary attribute (not likely.)

Is there any way to do this without incurring the ongoing maintenance costs of a XFT?

XMetal versions 6.0, 5.5, and 4.x (which I know are no longer supported.)

Thanks,

Lee
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #1 on: September 07, 2010, 04:30:32 PM »

I'm not sure I understand exactly, but perhaps what you are looking for is already possible.

The basic trick here is that you can pass any character into "content" inside the quoted string bits of the pseudo elements (generated content) :before and :after in CSS by 'escaping' the character using a backslash followed by the 4 digit Unicode code point value in hex notation.

Normally this is not necessary as you can simply save your CSS file with Unicode encoding (UTF-8 or UTF-16) and insert any Unicode character, but as carriage returns are treated as regular spaces in CSS files you can't simply insert a carriage return to break lines in the "content", so in this case it becomes useful.

Everything I've written above sounds confusing to me (though I think it is technically correct) so examples are best...

The escaped notation for a carriage return would be "\000a", so something like the following may be what you need:
elemName:before {
  content: "Important Attrs: " attr(i1) "|" attr(i2) "\000a Less Important Attrs:" attr(a3) "|" attr(a4);
}


So, given a PCDATA element <elem i1="1" i2="2" a3="3" a4="4">TEXT</elem> that CSS should produce this in Tags On view:
<elem>Important Attrs: 1 | 2
Less Important Attrs: 3 | 4
TEXT
</elem>


...and in Normal view you'd see this:
Important attrs: 1 | 2
Less Important attrs: 3 | 4
Logged
LeeHart
Member

Posts: 41


« Reply #2 on: September 08, 2010, 12:39:00 PM »

The use of \000a will be very helpful - thanks.

For the unreferenced attributes, an example may help describe what I'm after.
we have a <production> element with writer, editor, lead, feature_team, art_status, author_status, tech_review, target_edit, actual_edit, target_ogf, actual_ogf, milestone, indexing_status, size, and priority attributes.

Here's what I'd like to have in our .CSS:
production:before {
 content: "priority: " attr(priority) " tech_review: " attr(tech_review) " milestone: " attr(milestone) "\000a %unreferenced-attribute-list;"
}

That way empty/default attribute values aren't even shown. Otherwise the list gets very large.

Even better if I could obscure certain attributes from the editing pane (remaining in the attribute inspector would be fine). The actual_* attributes would fall in this category. I'd like to have something like %referenced-attribute actual_ogf; that doesn't display at all.

Lee
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #3 on: September 08, 2010, 02:14:45 PM »

I think the best we can do today is discussed in this thread:
http://forums.xmetal.com/index.php/topic,925.0.html
Logged
Derek Read
Program Manager (XMetaL)
Administrator
Member

Posts: 2621



WWW
« Reply #4 on: September 08, 2010, 03:49:00 PM »

If you could work code similar to the following into your XFT it might not need any further adjustment in the future. Run this code after placing your selection inside an element to see a list of attributes with values.

Code:
//XMetaL Script Language JScript:
var rng = ActiveDocument.Range;
var msg = "";
var attrs = rng.ContainerNode.attributes;
for(i=0;i<attrs.length;i++) {
msg += attrs.item(i).nodeName + "=\"" + attrs.item(i).nodeValue + "\"\n";
}
Application.Alert(msg);
Logged
Pages: 1
Print
Jump to:  

email us