فهرست منبع

Fix live examples in primitives.html.

Michael Herzog 1 سال پیش
والد
کامیت
7d725b61f9
1فایلهای تغییر یافته به همراه14 افزوده شده و 7 حذف شده
  1. 14 7
      manual/resources/lesson.js

+ 14 - 7
manual/resources/lesson.js

@@ -48,15 +48,22 @@
 
 	}
 
-	let text = document.body.innerHTML;
+	const parts = window.location.href.split( '/' );
+	const filename = parts[ parts.length - 1 ];
 
-	text = text.replace( /\[link:([\w\:\/\.\-\_\(\)\?\#\=\!\~]+)\]/gi, '<a href="$1" target="_blank">$1</a>' ); // [link:url]
-	text = text.replace( /\[link:([\w:/.\-_()?#=!~]+) ([\w\p{L}:/.\-_'\s]+)\]/giu, '<a href="$1" target="_blank">$2</a>' ); // [link:url title]
-	text = text.replace( /\[example:([\w\_]+)\]/gi, '[example:$1 $1]' ); // [example:name] to [example:name title]
-	text = text.replace( /\[example:([\w\_]+) ([\w\:\/\.\-\_ \s]+)\]/gi, '<a href="../../examples/#$1" target="_blank">$2</a>' ); // [example:name title]
-	text = text.replace( /\`(.*?)\`/gs, '<code class="notranslate" translate="no">$1</code>' ); // `code`
+	if ( filename !== 'primitives.html' ) {
 
-	document.body.innerHTML = text;
+		let text = document.body.innerHTML;
+
+		text = text.replace( /\[link:([\w\:\/\.\-\_\(\)\?\#\=\!\~]+)\]/gi, '<a href="$1" target="_blank">$1</a>' ); // [link:url]
+		text = text.replace( /\[link:([\w:/.\-_()?#=!~]+) ([\w\p{L}:/.\-_'\s]+)\]/giu, '<a href="$1" target="_blank">$2</a>' ); // [link:url title]
+		text = text.replace( /\[example:([\w\_]+)\]/gi, '[example:$1 $1]' ); // [example:name] to [example:name title]
+		text = text.replace( /\[example:([\w\_]+) ([\w\:\/\.\-\_ \s]+)\]/gi, '<a href="../../examples/#$1" target="_blank">$2</a>' ); // [example:name title]
+		text = text.replace( /\`(.*?)\`/gs, '<code class="notranslate" translate="no">$1</code>' ); // `code`
+
+		document.body.innerHTML = text;
+
+	}
 
 	if ( window.prettyPrint ) {
 

粤ICP备19079148号