Created
November 28, 2013 19:05
-
-
Save kogakure/7696789 to your computer and use it in GitHub Desktop.
SASS/CSS: SASS-Mixin for correct quotes around `q` inline-quotes, with correct nesting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="de"> | |
<!-- On the html element --> | |
<head> | |
<title>Quote-Demo</title> | |
</head> | |
<body> | |
<!-- or on another element --> | |
<p lang="de">Luke führte weiter aus, <q>Und sie nannte ihn einen <q>total blöd-aussehenen Idioten</q>! Ich denke ich habe eine Chance!</q> Dieser arme Idiot …</p> | |
<p lang="en">Luke conntinued, <q>And the she called him a <q>scruffy-looking nerf-herder</q>! I think I’ve got a chance!</q> The poor naive fool …</p> | |
<p lang="ja">彼女は<q>日本語に猫は<q>にゃん</q>と鳴く</q>と言った。</p> | |
</body> | |
</html> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Quotes for `q` in multiple languages | |
@mixin q-quotes($language, $quotes) { | |
:lang(#{$language}) > q, | |
.article-body q[lang|=#{$language}] { | |
quotes: $quotes; | |
// Japanese shouldn’t be italic | |
@if $language == "ja" { | |
font-style: normal; | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
q { | |
font-style: italic; | |
} | |
@include q-quotes(de, '»' '«' '›' '‹'); | |
@include q-quotes(en, '“' '”' '‘' '’'); | |
@include q-quotes(fr, '« ' ' »' '“' '”'); | |
@include q-quotes(ja, '「' '」' '『' '』'); | |
q:before { | |
content: open-quote; | |
} | |
q:after { | |
content: close-quote; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment