Просмотр исходного кода

巴利文渲染使用渲染函数

visuddhinanda 4 лет назад
Родитель
Сommit
b5551a1cee
1 измененных файлов с 24 добавлено и 23 удалено
  1. 24 23
      app/term/note.js

+ 24 - 23
app/term/note.js

@@ -204,21 +204,33 @@ function note_refresh_new(callback = null) {
 	}
 }
 
-//渲染阅读模式句子
-function render_read_mode_sent(iterator) {
-	let id = iterator.id;
-	let strPalitext =
+//渲染巴利原文句子
+function render_pali_sent(palitext){
+	let output = "";
+	output =
 		"<pali book='" +
-		iterator.book +
+		palitext.book +
 		"' para='" +
-		iterator.para +
+		palitext.para +
 		"' begin='" +
-		iterator.begin +
+		palitext.begin +
 		"' end='" +
-		iterator.end +
-		"' >" +
-		iterator.palitext +
-		"</pali>";
+		palitext.end +
+		"' >";
+	if(palitext.book<1000){
+		output += palitext.palitext;
+	}
+	else{
+		output += marked(palitext.palitext);
+	}
+		
+	output +="</pali>";
+	return output;
+}
+//渲染阅读模式句子
+function render_read_mode_sent(iterator) {
+	let id = iterator.id;
+	let strPalitext =render_pali_sent(iterator);
 
 	if (
 		$("#" + id)
@@ -588,18 +600,7 @@ function note_json_html(in_json) {
 	output += "</div>";
 	output += " </div>";
 
-	let strPalitext =
-		"<pali book='" +
-		in_json.book +
-		"' para='" +
-		in_json.para +
-		"' begin='" +
-		in_json.begin +
-		"' end='" +
-		in_json.end +
-		"' >" +
-		in_json.palitext +
-		"</pali>";
+	let strPalitext = render_pali_sent(in_json);
 
 	output += "<div class='note_body'>";
 	output += "<div class='palitext_div'>";