General XMetaL Discussion

XMetaL Community Forum General XMetaL Discussion Request: CSS extensions to insert line breaks

  • LeeHart

    Request: CSS extensions to insert line breaks

    Participants 3
    Replies 4
    Last Activity 12 years, 3 months ago

    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

    Reply

    Derek Read

    Reply to: Request: CSS extensions to insert line breaks

    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 “00a”, so something like the following may be what you need:
    elemName:before {
      content: "Important Attrs: " attr(i1) "|" attr(i2) "00a Less Important Attrs:" attr(a3) "|" attr(a4);
    }

    So, given a PCDATA element TEXT that CSS should produce this in Tags On view:
    Important Attrs: 1 | 2
    Less Important Attrs: 3 | 4
    TEXT

    …and in Normal view you'd see this:
    Important attrs: 1 | 2
    Less Important attrs: 3 | 4

    Reply

    LeeHart

    Reply to: Request: CSS extensions to insert line breaks

    The use of 00a will be very helpful – thanks.

    For the unreferenced attributes, an example may help describe what I'm after.
    we have a 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) “00a %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

    Reply

    Derek Read

    Reply to: Request: CSS extensions to insert line breaks

    I think the best we can do today is discussed in this thread:
    http://forums.xmetal.com/index.php/topic,925.0.html

    Reply

    Derek Read

    Reply to: Request: CSS extensions to insert line breaks

    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 msg += attrs.item(i).nodeName + “=”” + attrs.item(i).nodeValue + “”n”;
    }
    Application.Alert(msg);[/code]

    Reply

  • You must be logged in to reply to this topic.

Lost Your Password?

Products
Downloads
Support