forked from sheetjs/sheetjs
		
	fix parse_si for Japanese excel files
fixes #141 h/t @tgfjt . Original message: using #parse_si 'Phonetic Properties' items for Japanese excel files, the Phonetic items(KATAKANA) represents pronunciation hints of String(KANJI). ```xml <si> <t>漢字(japanese KANJI)</t> <rPh> <t>フリガナ(this is KATAKANA for pronounciation:漢字)</t> </rPh> </si> ``` It expected get '漢字' . but got '漢字フリガナ'. so replace these string, because this can be caused by only `<rPh>`.
This commit is contained in:
		
							parent
							
								
									ba1d2ea2be
								
							
						
					
					
						commit
						d4829476f7
					
				| @ -157,7 +157,7 @@ function parse_si(x, opts) { | ||||
| 	/* 18.4.4 r CT_RElt (Rich Text Run) */ | ||||
| 	else if((y = x.match(sirregex))) { | ||||
| 		z.r = utf8read(x); | ||||
| 		z.t = utf8read(unescapexml((x.match(sitregex)||[]).join("").replace(tagregex,""))); | ||||
| 		z.t = utf8read(unescapexml((x.replace(/<rPh.*?>(.*?)<\/rPh>/g, '').match(sitregex)||[]).join("").replace(tagregex,""))); | ||||
| 		if(html) z.h = parse_rs(z.r); | ||||
| 	} | ||||
| 	/* 18.4.3 phoneticPr CT_PhoneticPr (TODO: needed for Asian support) */ | ||||
|  | ||||
| @ -4581,7 +4581,7 @@ function parse_si(x, opts) { | ||||
| 	/* 18.4.4 r CT_RElt (Rich Text Run) */ | ||||
| 	else if((y = x.match(sirregex))) { | ||||
| 		z.r = utf8read(x); | ||||
| 		z.t = utf8read(unescapexml((x.match(sitregex)||[]).join("").replace(tagregex,""))); | ||||
| 		z.t = utf8read(unescapexml((x.replace(/<rPh.*?>(.*?)<\/rPh>/g, '').match(sitregex)||[]).join("").replace(tagregex,""))); | ||||
| 		if(html) z.h = parse_rs(z.r); | ||||
| 	} | ||||
| 	/* 18.4.3 phoneticPr CT_PhoneticPr (TODO: needed for Asian support) */ | ||||
|  | ||||
							
								
								
									
										2
									
								
								xlsx.js
									
									
									
									
									
								
							
							
								
								
								
								
								
									
									
								
							
						
						
									
										2
									
								
								xlsx.js
									
									
									
									
									
								
							| @ -4539,7 +4539,7 @@ function parse_si(x, opts) { | ||||
| 	/* 18.4.4 r CT_RElt (Rich Text Run) */ | ||||
| 	else if((y = x.match(sirregex))) { | ||||
| 		z.r = utf8read(x); | ||||
| 		z.t = utf8read(unescapexml((x.match(sitregex)||[]).join("").replace(tagregex,""))); | ||||
| 		z.t = utf8read(unescapexml((x.replace(/<rPh.*?>(.*?)<\/rPh>/g, '').match(sitregex)||[]).join("").replace(tagregex,""))); | ||||
| 		if(html) z.h = parse_rs(z.r); | ||||
| 	} | ||||
| 	/* 18.4.3 phoneticPr CT_PhoneticPr (TODO: needed for Asian support) */ | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user