fix bug: string escape
This commit is contained in:
		
							parent
							
								
									5ab8ec04a6
								
							
						
					
					
						commit
						1f3eab6593
					
				
					 1 changed files with 2 additions and 3 deletions
				
			
		| 
						 | 
					@ -57,8 +57,7 @@ export class DocParser {
 | 
				
			||||||
            let [key, value] = splitTwo(line, ':');
 | 
					            let [key, value] = splitTwo(line, ':');
 | 
				
			||||||
            value = value.trimStart();
 | 
					            value = value.trimStart();
 | 
				
			||||||
            if (value.startsWith('"') && value.endsWith('"')) {
 | 
					            if (value.startsWith('"') && value.endsWith('"')) {
 | 
				
			||||||
                value = value.substring(1, value.length - 1);
 | 
					                value = JSON.parse( value );
 | 
				
			||||||
                value = value.replace('\\"', '"');
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            key = key.trimEnd();
 | 
					            key = key.trimEnd();
 | 
				
			||||||
            switch(key){
 | 
					            switch(key){
 | 
				
			||||||
| 
						 | 
					@ -110,7 +109,7 @@ ${doc.from_url ? `from_url: ${doc.from_url}\n` : ''}name: "${doc.name}"
 | 
				
			||||||
author: "${doc.author}"
 | 
					author: "${doc.author}"
 | 
				
			||||||
star: ${doc.star}
 | 
					star: ${doc.star}
 | 
				
			||||||
fork: ${doc.fork}
 | 
					fork: ${doc.fork}
 | 
				
			||||||
desc: "${doc.desc.replaceAll("\"", "\\\"")}"
 | 
					desc: ${JSON.stringify(doc.desc)}
 | 
				
			||||||
url: ${doc.url}
 | 
					url: ${doc.url}
 | 
				
			||||||
tags: ${JSON.stringify(doc.tags)}
 | 
					tags: ${JSON.stringify(doc.tags)}
 | 
				
			||||||
---
 | 
					---
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue