Single quote escape in JavaScript function parameters

JSON.stringify(plainTextStr).replace(/&/, “&”).replace(/”/g, “"”) will produce a string you can safely embed in a quoted attribute and which will have the same meaning when seen by the JavaScript interpreter. The only caveat is that some Unicode newlines (U+2028 and U+2029) need to be escaped before being embedded in JavaScript string literals, but JSON only requires that … Read more

HTML5 block-quote with author

I googled about this and it looks like <figure> and <figcaption> should do the job: <figure> <blockquote cite=””> Quotes, parts of poems can also be a part of figure. </blockquote> <figcaption>MDN editors</figcaption> </figure> <figure> <blockquote cite=””> The figure element represents some flow content, optionally with a caption, that is self-contained and is typically referenced … Read more

How to escape single quote in sed?

Quote sed codes with double quotes: $ sed “s/ones/one’s/”<<<“ones thing” one’s thing I don’t like escaping codes with hundreds of backslashes – hurts my eyes. Usually I do in this way: $ sed ‘s/ones/one\x27s/'<<<“ones thing” one’s thing

When to use ‘ (or quote) in Lisp?

Short answer Bypass the default evaluation rules and do not evaluate the expression (symbol or s-exp), passing it along to the function exactly as typed. Long Answer: The Default Evaluation Rule When a regular (I’ll come to that later) function is invoked, all arguments passed to it are evaluated. This means you can write this: … Read more