You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to write a behavior for <ref> that does one thing if the element has a @type="internal" and another if it has @type="bibl" attribute. I'm modeling it on the <ref> example in CETEIcean. The documentation seems to say that I can't make a second behavior - so I am trying to add a second component to the <ref> behavior.
This is not working, but I'm not sure of how the js script syntax works in this case. My js abilities are so-so. In the example below, the first part [type=internal] is fine. The question is where and how to add the [type=bibl]. And I may just be writing bad javascript...
I've looked for an example to follow but was unable to find one (which doesn't mean that there it's not there.)
``
"ref": [
["[type=internal]", function(elt) {
var linkNum = elt.getAttribute("target").replace(/#A-/,"");
var linkPre = '{{ site.baseurl }}edition/plant';
var link = document.createElement("a");
link.innerHTML = elt.innerHTML;
link.href = linkPre.concat(linkNum);
return link;
}],
["[type=bibl]", ["[target]", ["<a href="$rw@target">",""]]]
]
The text was updated successfully, but these errors were encountered:
should work. Whether the {{ site.baseurl }} bit works may depend on when and how your templating engine processes things. The [type=bibl][target] is a CSS selector, and that syntax ought to work for multiple attributes.
I'm trying to write a behavior for
<ref>
that does one thing if the element has a@type="internal"
and another if it has@type="bibl"
attribute. I'm modeling it on the<ref>
example in CETEIcean. The documentation seems to say that I can't make a second behavior - so I am trying to add a second component to the<ref>
behavior.This is not working, but I'm not sure of how the js script syntax works in this case. My js abilities are so-so. In the example below, the first part [type=internal] is fine. The question is where and how to add the [type=bibl]. And I may just be writing bad javascript...
I've looked for an example to follow but was unable to find one (which doesn't mean that there it's not there.)
``
"ref": [
["[type=internal]", function(elt) {
var linkNum = elt.getAttribute("target").replace(/#A-/,"");
var linkPre = '{{ site.baseurl }}edition/plant';
var link = document.createElement("a");
link.innerHTML = elt.innerHTML;
link.href = linkPre.concat(linkNum);
return link;
}],
["[type=bibl]", ["[target]", ["<a href="$rw@target">",""]]]
]
The text was updated successfully, but these errors were encountered: