davidmerfield / Typeset

An HTML pre-proces­sor for web ty­pog­ra­phy
https://typeset.lllllllllllllllll.com/
Creative Commons Zero v1.0 Universal
2.65k stars 54 forks source link

`smallCaps` is escaping HTML tags in the browser #31

Closed fiatjaf closed 8 years ago

fiatjaf commented 9 years ago

Trying to run Typeset from the browser, with jQuery, I got this string:

<p>Yjarni Sigurðardóttir spoke to NATO from Iceland yesterday: "Light of my life, fire of my florins -- my sin, my soul. The tip of the tongue taking a trip to 118° 19' 43.5"."</p>

  <p>"She's faster than a 120' 4" whale." <em>Piña co&shy;ladas</em> were widely consumed in Götterdämmerung from 1880–1912. For the low price of $20 / year from Ex&shy;hi&shy;bits A–E... Then the <em>duplex</em> came forward. "Thrice the tower, he mounted the round gunrest, 'awaking' HTML. He can print a fixed num&shy;ber of dots in a square inch (for in&shy;stance, 600 × 600)."
  </p>

turned into this:

<p>&lt;span class="pull-Y"&gt;Y&lt;/span&gt;jarni Sigurðardót&shy;tir spoke to &lt;span&lt;span class="push-c"&gt;&lt;/span&gt; &lt;span class="pull-c"&gt;c&lt;/span&gt;lass="small-caps"&gt;NATO&lt;/span&gt; from Ice&shy;land yes&shy;ter&shy;day:&lt;span class="push-double"&gt;&lt;/span&gt; &lt;span class="pull-double"&gt;“&lt;/span&gt;Light&lt;span class="push-o"&gt;&lt;/span&gt; &lt;span class="pull-o"&gt;o&lt;/span&gt;f my life, fire&lt;span class="push-o"&gt;&lt;/span&gt; &lt;span class="pull-o"&gt;o&lt;/span&gt;f my florins&amp;thinsp;&amp;mdash;&amp;thinsp;my sin, my soul.&lt;span class="push-T"&gt;&lt;/span&gt; &lt;span class="pull-T"&gt;T&lt;/span&gt;he tip&lt;span class="push-o"&gt;&lt;/span&gt; &lt;span class="pull-o"&gt;o&lt;/span&gt;f the tongue tak&shy;ing a trip to 118° 19′ 43.5″.”</p>

  <p>&lt;span class="pull-double"&gt;“&lt;/span&gt;She’s faster than a 120′ 4″&lt;span class="push-w"&gt;&lt;/span&gt; &lt;span class="pull-w"&gt;w&lt;/span&gt;hale.” <em>Piña&lt;span class="push-c"&gt;&lt;/span&gt; &lt;span class="pull-c"&gt;c&lt;/span&gt;o&shy;ladas</em> &lt;span class="pull-w"&gt;w&lt;/span&gt;ere&lt;span class="push-w"&gt;&lt;/span&gt; &lt;span class="pull-w"&gt;w&lt;/span&gt;idely&lt;span class="push-c"&gt;&lt;/span&gt; &lt;span class="pull-c"&gt;c&lt;/span&gt;on&shy;sumed in Göt&shy;ter&shy;däm&shy;merung from 1880–1912. For the low price&lt;span class="push-o"&gt;&lt;/span&gt; &lt;span class="pull-o"&gt;o&lt;/span&gt;f $20&#8202;/&#8202;year from Ex&shy;hi&shy;bits&lt;span class="push-A"&gt;&lt;/span&gt; &lt;span class="pull-A"&gt;A&lt;/span&gt;–E…&lt;span class="push-T"&gt;&lt;/span&gt; &lt;span class="pull-T"&gt;T&lt;/span&gt;hen the <em>du&shy;plex</em> &lt;span class="pull-c"&gt;c&lt;/span&gt;ame for&shy;ward.&lt;span class="push-double"&gt;&lt;/span&gt; &lt;span class="pull-double"&gt;“&lt;/span&gt;Thrice the tower, he mounted the round gun&shy;rest,&lt;span class="push-single"&gt;&lt;/span&gt; &lt;span class="pull-single"&gt;‘&lt;/span&gt;awak&shy;ing’ &lt;span&lt;span class="push-c"&gt;&lt;/span&gt; &lt;span class="pull-c"&gt;c&lt;/span&gt;lass="small-caps"&gt;HTML&lt;/span&gt;. He&lt;span class="push-c"&gt;&lt;/span&gt; &lt;span class="pull-c"&gt;c&lt;/span&gt;an print a fixed num&shy;ber&lt;span class="push-o"&gt;&lt;/span&gt; &lt;span class="pull-o"&gt;o&lt;/span&gt;f dots in a square inch (for in&shy;stance, 600&#8202;×&#8202;600).”
  </p>

I investigated the sequential calling of modules that continuously transform the initial text, and notice that the HTML tags were not escaped by "quotes", "hyphenate" or "ligatures", but only after "smallCaps".

I couldn't understand why.

lydell commented 8 years ago

This is fixed in #28.

davidmerfield commented 8 years ago

28 was merged and this should be fixed. Closing this for now!