3 ms·
This Wikipedia article is sorely lacking concrete examples to help aid understanding.. Anyone care to add some examples to the article??
by codetrotter 4y ago
This Wikipedia article is sorely lacking concrete examples to help aid understanding..
Anyone care to add some examples to the article??
- dspillett 4y agoThe "Approaches and implementations" section includes some clear (to my eyes at least) examines of overlapping lines and sentences in poetry represented as html-like markup. What sort of examples would improve the article's clarity for you? Wrt the existing examples, perhaps there should be a small section before that, explicitly called "examples", that contains a minimal summary of those examples to illustrate the concept before the reader delves deeper.
- codetrotter 4y agoYeah, I agree with what you are saying. I was viewing this article on mobile and it was hard to spot these examples on mobile, because all sections are collapsed by default and none of the sections had the examples stand out at a cursory glance on mobule. Now that I am on a laptop I easily spot them. I also agree with what you are saying that an explicit section named examples would be good. Especially for mobile reading.
- FigmentEngine 4y agooverlapping b and i elements <p>he<b>ll<i>o w</b>or</i>ld</p> contary to the article it can still be represented as a tree, by decomposing the children into their own nodes (so in this case characters become nodes with child nodes expressing what formatting is active, followed by the letter, and then turn of all the active formatting)
- admax88qqq 4y agoNo that's just nesting. It's overlapping if the lifetime of a child tag is greater than the lifetime of the parent tag. Example if you have two paragraphs and bold the end of one and the start of the next <p>hello <b>world</p> <p>this is</b> your captain speaking</p> Obviously bold is a poor example as you can just terminate and start a new bold without penalty. But if these were more semantic elements like "sections" and "verses" and "lines" then it might not be possible.
- chrismorgan 4y ago> without penalty It’s actually fiddlier than you may think. Take “Ta” for an example: in most decent fonts, there will be a kerning pair that tightens those characters, tucking the “a” underneath the beam of the “T” a little. The shaper thus needs to follow the actual fonts being used, for kerning purposes, rather than the markup—but this is still visible at the element level, with getBoundingClientRect(). Take this demo (which depends on your default font having such a kerning pair; if it doesn’t, you may need to find one that does and change the font by inserting <html style="font-family:sans-serif"> or similar after the comma): data:text/html,<p>Ta<p><b>T</b>a<p>T<b>a</b><p><b>Ta</b><p><b>T</b><b>a</b><script>document.querySelectorAll("b").forEach(e=>console.log(e.getBoundingClientRect().width))</script> This shows five variants of “Ta”, with the last two being <b>Ta</b> and <b>T</b><b>a</b>, and prints five numbers to the console, the widths of each <b> element. Numbers one and four (both corresponding to a <b>T</b>) differ if you have a kerning pair such as I describe: for me, the first is 11.7px, and the second 10.73333px (though it overflows that width in its rendering) because of the <b>a</b> that follows it. If you gave bold elements the style `display: inline-block`, it wouldn’t kern the pair and would thus go back to 11.7px. Most fonts could really use italic-aware kerning (that is, kerning a pair where one glyph is regular and the other italic), but it’s sadly not a thing.
- tannhaeuser 4y agoSGML's CONCUR feature (criticized but not described in that Wikipedia article) allows tags to have optional name groups specifying one or more document type names (that must be declared in the prolog) to which the tag applies, and allows tag pairs with disjoint document type name qualifiers to overlap like this: <(a)x>bla <(b|c)y>bla</(a)x></(b|c)y> Traditionally used for poetry and lyrics/drama but could also be useful for postal addresses, lyrics in certain types of musical notation, in translations, and maybe specific text apps such as subtitles/tracks for the hearing impaired. Basically, wherever there's a desire to markup text in more than a single hierarchy.
- teej 4y agoI immediately thought of this Vox breakdown of rhyming in rap. https://youtu.be/QWveXdj6oZU https://youtu.be/QWveXdj6oZU
- Mikhail_Edoshin 4y agoBook-like indices are a notable example. A book index is a list of topics with references to pages. A topic may very easily overlap with another topic and all indexing tools imply that. For example, XSL-FO is an XML-based notation, so in general it is strictly hierarchical: a tag encloses other tags. For index entries, however, it uses disjoint tags like `<index-range-begin>` and `<index-range-end>` linked via the `id/ref-id` attributes.