Skip to content

Commit

Permalink
Add prefix to Biaodian h-char class names (fix #81)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethantw committed Aug 20, 2015
1 parent f379507 commit 56612eb
Show file tree
Hide file tree
Showing 31 changed files with 691 additions and 1,970 deletions.
1,241 changes: 299 additions & 942 deletions dist/han.css

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions dist/han.js
Original file line number Diff line number Diff line change
Expand Up @@ -1369,10 +1369,10 @@ function createBdGroup( portion, match ) {
function createBdChar( char ) {
var div = $.create( 'div' )
var unicode = char.charCodeAt( 0 ).toString( 16 )
var clazz = 'biaodian cjk ' + ( char.match( TYPESET.char.biaodian.open ) ? 'open' :
char.match( TYPESET.char.biaodian.close ) ? 'close end' :
char.match( TYPESET.char.biaodian.end ) ? 'end' :
char.match( new RegExp( '(' + UNICODE.biaodian.liga + ')' )) ? 'liga' : '' )
var clazz = 'biaodian cjk ' + ( char.match( TYPESET.char.biaodian.open ) ? 'bd-open' :
char.match( TYPESET.char.biaodian.close ) ? 'bd-close bd-end' :
char.match( TYPESET.char.biaodian.end ) ? 'bd-end' :
char.match( new RegExp( '(' + UNICODE.biaodian.liga + ')' )) ? 'bd-liga' : '' )

div.innerHTML = '<h-char unicode="' + unicode + '" class="' + clazz + '">' + char + '</h-char>'
return div.firstChild
Expand Down Expand Up @@ -2318,7 +2318,7 @@ Han.renderHanging = function( context ) {
TYPESET.jinze.hanging,
function( portion, match ) {
var elem = $.create( 'h-hangable' )
elem.innerHTML = match[2] + '<h-cs><h-inner hidden> </h-inner><h-char class="biaodian close end cjk">' + match[3] + '</h-char></h-cs>'
elem.innerHTML = match[2] + '<h-cs><h-inner hidden> </h-inner><h-char class="biaodian bd-close bd-end cjk">' + match[3] + '</h-char></h-cs>'
return portion.index === 0 ? elem : ''
}
)
Expand Down Expand Up @@ -2377,12 +2377,12 @@ Han.renderJiya = function( context ) {
// The reason we're doing this instead of using pseudo elements in CSS
// is because WebKit has problem rendering pseudo elements containing only
// space.
$.qsa( 'h-char.biaodian.open, h-char.biaodian.end', context )
$.qsa( 'h-char.biaodian.bd-open, h-char.biaodian.bd-end', context )
.forEach(function( elem ) {
if ( Han.find.matches( elem, 'h-cs *' )) return
var html = '<h-inner>' + elem.innerHTML + '</h-inner>'
var hcs = '<h-cs hidden> </h-cs>'
var isOpen = elem.classList.contains( 'open' )
var isOpen = elem.classList.contains( 'bd-open' )
elem.innerHTML = isOpen ? hcs + html : html + hcs
})

Expand All @@ -2407,11 +2407,11 @@ $.extend( Han.fn, {

var mdot

mdot = $.create( 'h-char', 'biaodian cjk middle' )
mdot = $.create( 'h-char', 'biaodian cjk bd-middle' )
mdot.setAttribute( 'unicode', 'b7' )

Han.correctBasicBD = function( context, all ) {
if ( Han.support.unicoderange && !all ) return
if ( Han.support.unicoderange && !all ) return

var context = context || document
var finder
Expand Down
2 changes: 1 addition & 1 deletion dist/han.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/han.min.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src/js/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ function createBdGroup( portion, match ) {
function createBdChar( char ) {
var div = $.create( 'div' )
var unicode = char.charCodeAt( 0 ).toString( 16 )
var clazz = 'biaodian cjk ' + ( char.match( TYPESET.char.biaodian.open ) ? 'open' :
char.match( TYPESET.char.biaodian.close ) ? 'close end' :
char.match( TYPESET.char.biaodian.end ) ? 'end' :
char.match( new RegExp( '(' + UNICODE.biaodian.liga + ')' )) ? 'liga' : '' )
var clazz = 'biaodian cjk ' + ( char.match( TYPESET.char.biaodian.open ) ? 'bd-open' :
char.match( TYPESET.char.biaodian.close ) ? 'bd-close bd-end' :
char.match( TYPESET.char.biaodian.end ) ? 'bd-end' :
char.match( new RegExp( '(' + UNICODE.biaodian.liga + ')' )) ? 'bd-liga' : '' )

div.innerHTML = '<h-char unicode="' + unicode + '" class="' + clazz + '">' + char + '</h-char>'
return div.firstChild
Expand Down
4 changes: 2 additions & 2 deletions src/js/inline/basic-bd.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ define([

var mdot

mdot = $.create( 'h-char', 'biaodian cjk middle' )
mdot = $.create( 'h-char', 'biaodian cjk bd-middle' )
mdot.setAttribute( 'unicode', 'b7' )

Han.correctBasicBD = function( context, all ) {
if ( Han.support.unicoderange && !all ) return
if ( Han.support.unicoderange && !all ) return

var context = context || document
var finder
Expand Down
2 changes: 1 addition & 1 deletion src/js/inline/hanging.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Han.renderHanging = function( context ) {
TYPESET.jinze.hanging,
function( portion, match ) {
var elem = $.create( 'h-hangable' )
elem.innerHTML = match[2] + '<h-cs><h-inner hidden> </h-inner><h-char class="biaodian close end cjk">' + match[3] + '</h-char></h-cs>'
elem.innerHTML = match[2] + '<h-cs><h-inner hidden> </h-inner><h-char class="biaodian bd-close bd-end cjk">' + match[3] + '</h-char></h-cs>'
return portion.index === 0 ? elem : ''
}
)
Expand Down
4 changes: 2 additions & 2 deletions src/js/inline/jiya.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ Han.renderJiya = function( context ) {
// The reason we're doing this instead of using pseudo elements in CSS
// is because WebKit has problem rendering pseudo elements containing only
// space.
$.qsa( 'h-char.biaodian.open, h-char.biaodian.end', context )
$.qsa( 'h-char.biaodian.bd-open, h-char.biaodian.bd-end', context )
.forEach(function( elem ) {
if ( Han.find.matches( elem, 'h-cs *' )) return
var html = '<h-inner>' + elem.innerHTML + '</h-inner>'
var hcs = '<h-cs hidden> </h-cs>'
var isOpen = elem.classList.contains( 'open' )
var isOpen = elem.classList.contains( 'bd-open' )
elem.innerHTML = isOpen ? hcs + html : html + hcs
})

Expand Down
3 changes: 2 additions & 1 deletion src/sass/inline/_basic-bd.sass
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
/**
* Basic Biaodian correction for Firefox
*/
h-char.biaodian.liga,
h-char.bd-liga,
h-char.biaodian[unicode='b7']
.no-unicoderange &
@extend %han-ligature
font-family: 'Biaodian Basic', 'Han Heiti'

1 change: 1 addition & 0 deletions src/sass/inline/_em.sass
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ em:lang(ja)
$color: $han-text-emphasis-color-ja

+han-text-emphasis( $posi, $mark, $shape, $color, $skip, false )

4 changes: 2 additions & 2 deletions src/sass/inline/_hanging.sass
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// Hide the collapsable spaces of closing brackets for we are sure
// they ain't in use.
h-char.biaodian.close h-cs
h-char.bd-close h-cs
display: none

> h-cs
Expand All @@ -43,7 +43,7 @@
// typography
font: 1em 'Han Space', $han-mono

> h-cs h-char.end
> h-cs h-char.bd-end
+han-typo-reset
// positioning
position: absolute
Expand Down
20 changes: 10 additions & 10 deletions src/sass/inline/_jiya.sass
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ h-cs[hidden]
// *
h-char.biaodian
&.open > h-inner
&.bd-open > h-inner
margin-left: -.5em

&.close,
&.bd-close,
&[unicode='3001'],
&[unicode='3002'],
&[unicode='ff0c'],
&[unicode='ff0e']
> h-inner
letter-spacing: -.5em

&.open,
&.close,
&.bd-open,
&.bd-close,
&[unicode='3001'],
&[unicode='3002'],
&[unicode='ff0c'],
Expand All @@ -53,10 +53,10 @@ h-char.biaodian
// *
h-char-group,
h-hangable
&.portion .open:first-child h-cs,
&.portion .end:last-child h-cs,
.open + .open h-cs,
.end:not(:last-child) h-cs
&.portion .bd-open:first-child h-cs,
&.portion .bd-end:last-child h-cs,
.bd-open + .bd-open h-cs,
.bd-end:not(:last-child) h-cs
display: none

[unicode='3001'],
Expand All @@ -66,7 +66,7 @@ h-hangable
&:lang(zh-Hant),
&:lang(zh-TW),
&:lang(zh-HK)
& + .open h-cs
& + .bd-open h-cs
display: none

h-char-group
Expand All @@ -79,6 +79,6 @@ h-char-group

// * Handle ‘……「漢字’ situation
// *
.liga:not(:last-child)
.bd-liga:not(:last-child)
margin-right: -.25em

1 change: 1 addition & 0 deletions src/sass/inline/_subst.sass
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ h-char[display-as]

&.comb-liga:after
font-family: 'Romanization Sans', 'Zhuyin Kaiti'

1 change: 1 addition & 0 deletions src/sass/locale/_enhancement.sass
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ h-word
// box
display: inline-block
text-indent: 0

2 changes: 1 addition & 1 deletion src/styl/inline/basic-bd.styl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/*
* Basic Biaodian correction for Firefox
*/
h-char.biaodian.liga,
h-char.biaodian.bd-liga,
h-char.biaodian[unicode='b7']
.no-unicoderange &
@extend $han-ligature
Expand Down
1 change: 1 addition & 0 deletions src/styl/inline/em.styl
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ em:lang(ja)
if $han-text-emphasis-color-ja != $HAN-TEXT-EMPHASIS-COLOR-JA
$color = $han-text-emphasis-color-ja
han-text-emphasis($posi, $mark, $shape, $color, $skip, false)

4 changes: 2 additions & 2 deletions src/styl/inline/hanging.styl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ unless $han-hanging-hant
display: inline
// Hide the collapsable spaces of closing brackets for we are sure
// they ain't in use.
h-char.biaodian.close h-cs
h-char.biaodian.bd-close h-cs
display: none
> h-cs
// positioning
Expand All @@ -39,7 +39,7 @@ unless $han-hanging-hant
visibility: hidden
// typography
font: 1em "Han Space", $han-mono
> h-cs h-char.end
> h-cs h-char.bd-end
han-typo-reset()
// positioning
position: absolute
Expand Down
1 change: 1 addition & 0 deletions src/styl/inline/hws.styl
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ h-hws[hidden]
samp &,
pre &
display: none

20 changes: 10 additions & 10 deletions src/styl/inline/jiya.styl
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ h-cs[hidden]
// * Handle line start/end Biaodian (行首行尾標點擠壓)
// *
h-char.biaodian
&.open > h-inner
&.bd-open > h-inner
margin-left: -.5em

&.close,
&.bd-close,
&[unicode='3001'],
&[unicode='3002'],
&[unicode='ff0c'],
&[unicode='ff0e']
> h-inner
letter-spacing: -.5em

&.open,
&.close,
&.bd-open,
&.bd-close,
&[unicode='3001'],
&[unicode='3002'],
&[unicode='ff0c'],
Expand All @@ -51,10 +51,10 @@ h-char.biaodian
// *
h-char-group,
h-hangable
&.portion .open:first-child h-cs,
&.portion .end:last-child h-cs,
.open + .open h-cs,
.end:not(:last-child) h-cs
&.portion .bd-open:first-child h-cs,
&.portion .bd-end:last-child h-cs,
.bd-open + .bd-open h-cs,
.bd-end:not(:last-child) h-cs
display: none

[unicode='3001'],
Expand All @@ -64,7 +64,7 @@ h-hangable
&:lang(zh-Hant),
&:lang(zh-TW),
&:lang(zh-HK)
& + .open h-cs
& + .bd-open h-cs
display: none

h-char-group
Expand All @@ -77,6 +77,6 @@ h-char-group

// * Handle ‘……「漢字’ situation
// *
.liga:not(:last-child)
.bd-liga:not(:last-child)
margin-right: -.25em

1 change: 1 addition & 0 deletions src/styl/inline/subst.styl
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ h-char[display-as]

&.comb-liga:after
font-family: 'Romanization Sans', 'Zhuyin Kaiti'

Loading

0 comments on commit 56612eb

Please sign in to comment.