codePreviews: account for C in line selection (github)
This commit is contained in:
		
							parent
							
								
									3289367e31
								
							
						
					
					
						commit
						7ef3c95533
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -60,12 +60,12 @@ async function processFile(link, originalLink, spoiler = false, linkFile = false
 | 
			
		|||
    fileName = `[${fileName}](<${originalLink}>)`;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  const lineStr = urlObj.hash.match(/#L\d+(-L?\d+)?/)?.[0];
 | 
			
		||||
  const lineStr = urlObj.hash.match(/#L\d+(C\d+)?(-L?\d+)?(C\d+)?/)?.[0];
 | 
			
		||||
  let startLine, endLine;
 | 
			
		||||
  let entireFile = false;
 | 
			
		||||
 | 
			
		||||
  if (lineStr) {
 | 
			
		||||
    const [start, end] = lineStr.match(/\d+/g);
 | 
			
		||||
    const [start, end] = lineStr.match(/(?<=L-)\d+/g);
 | 
			
		||||
    if (!end) {
 | 
			
		||||
      startLine = endLine = start;
 | 
			
		||||
    } else {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue