فهرست منبع

Merge pull request #724 from visuddhinanda/laravel

:wrench: add redis namespace
visuddhinanda 4 سال پیش
والد
کامیت
b1501791a4

+ 4 - 2
.env.example

@@ -59,5 +59,7 @@ RPC_SERVER="https://rpc.wikipali.org"
 ASSETS_SERVER="https://assets-hk.wikipali.org"
 
 
-SNOWFLAKE_DATA_CENTER_ID = 1
-SNOWFLAKE_WORKER_ID = 1
+SNOWFLAKE_DATA_CENTER_ID=1
+SNOWFLAKE_WORKER_ID=1
+
+REDIS_NAMESPACE=

+ 5 - 0
change-logs.md

@@ -52,3 +52,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - remove HELP_SERVER GRAMMAR_SERVER from .env.example
 - remove HELP_SERVER GRAMMAR_SERVER from config.sample.php
 - remove HELP_SERVER GRAMMAR_SERVER from config.sample.php
+
+## [1.0.7] - 2022-02-01
+
+- add REDIS_NAMESPACE to .env.example
+- add redis namespace to config.sample.php

+ 10 - 2
public/app/article/article.js

@@ -51,8 +51,14 @@ function articel_load(id, collection_id) {
 						$("#contents").html(note_init(result.content,"",result.owner,result.lang));
 						//处理<code>标签作为气泡注释
 						popup_init();
-						guide_init();						
-						note_refresh_new();
+						guide_init();
+						note_refresh_new(function(){
+                            $.get('templiates/glossary.tpf',function(data){
+                                let TermData = term_get_used();
+                                let rendered = Mustache.render(data,TermData);
+                                $("#glossary").html(rendered);                                
+                            });
+                        });
 
 
 					}
@@ -66,6 +72,8 @@ function articel_load(id, collection_id) {
 	);
 }
 
+
+
 function collect_load(id) {
 	if (id == "") {
 		return;

+ 3 - 2
public/app/article/index.php

@@ -147,8 +147,8 @@ require_once "../pcdl/html_head.php";
 <link href="../../node_modules/jquery.fancytree/dist/skin-win7/ui.fancytree.css" rel="stylesheet" type="text/css" class="skinswitcher">
 <script src="../tree/jquery.fancytree.js" type="text/javascript"></script>
 <script src="../article/my_collect.js" type="text/javascript"></script>
-<script language="javascript" src="../article/article_add_dlg.js"></script>
-
+<script src="../article/article_add_dlg.js"></script>
+<script src="../../node_modules/mustache/mustache.js"></script>
 
 <style>
 ul.fancytree-container{
@@ -388,6 +388,7 @@ function set_toc_visible(isVisible){
 			<div id="contents" class="content_inner <?php echo $contentClass;?>">
 				<?php echo $_local->gui->loading; ?>...
 			</div>
+            <div id="glossary"></div>
 			<div id="contents_foot">
 				<div id="contents_nav" style="display:flex;justify-content: space-between;">
 					<div id="contents_nav_left" class="nav_bnt nav_left" onclick="goto_prev()">

+ 6 - 0
public/app/article/templiates/glossary.tpl

@@ -0,0 +1,6 @@
+<h2>Glossary</h2>
+{{#glossary}}
+<div>
+<b>{{pali}}</b>:{{meaning}}
+</div>
+{{/glossary}}

+ 22 - 0
public/app/article/templiates/main.tpl

@@ -0,0 +1,22 @@
+<div>
+{{title}}
+</div>
+<div>
+{{subtitle}}
+</div>
+<div>
+{{editor.name}} at {{updated_at}}
+</div>
+<div class="content">
+{{content}}
+</div>
+
+<h2>Glossary</h2>
+{{#glossary}}
+<b>{{pali}}</b>:{{meaning}}
+{{/glossary}}
+
+<h2>ref</h2>
+{{#ref}}
+{{path}}
+{{/ref}}

+ 55 - 0
public/app/article/templiates/readme.md

@@ -0,0 +1,55 @@
+# 标题
+
+正文
+
+{{1-2-3-4}}
+
+<h1>标题</h1>
+<p></p>
+<p>{{1-2-3-4}}</p>
+
+<h1>标题</h1>
+<p></p>
+<p>
+<div class='sent'>
+    <div class='org'>
+        {{1-2-3-4.org}}
+    </div>
+    <div class='translation'>
+        {{#1-2-3-4.translation}}
+            <div>{{text}}</div>
+        {{/1-2-3-4.translation}}
+    </div>
+</div>
+</p>
+
+{
+    1-2-3-4:{
+        org:"pali text"
+        translation:[
+            {
+                text:"一句译文[[bhikkhu]]",
+                channel:"channel1"
+            },
+            {
+                text:"另一句译文[[bhikkhu]]",
+                channel:"channel2"
+            },
+        ]
+    }
+}
+
+<h1>标题</h1>
+<p></p>
+<p>
+<div class='sent'>
+    <div class='org'>
+        pali text
+    </div>
+    <div class='translation'>
+        <div>一句译文{{term.bhikkhu.channel1}}</div>
+        <div>一句译文{{term.bhikkhu.channel2}}</div>
+    </div>
+</div>
+</p>
+

+ 10 - 0
public/app/article/templiates/sent.tpl

@@ -0,0 +1,10 @@
+<div class='sent'>
+    <div class='org'>
+        {{org}}
+    </div>
+    <div class='translation'>
+        {{#translation}}
+            <div>{{text}}</div>
+        {{/translation}}
+    </div>
+</div>

+ 1 - 1
public/app/config.sample.php

@@ -46,7 +46,7 @@ define("Redis",[
 	"host" => "127.0.0.1",
 	"port" => 6379,
 	"password" => "",
-	"prefix"=>"aaa://"
+	"namespace"=>"aaa://"
 ]);
 
 #目录设置,不能更改

+ 3 - 2
public/app/term/note.js

@@ -199,11 +199,12 @@ function note_refresh_new(callback = null) {
 						splite_pali_word();
 						//处理编辑框消息
 						tran_sent_textarea_event_init();
-						//初始化mermaid
-						mermaid.initialize();
 						if (callback) {
 							callback();
 						}
+						//初始化mermaid
+						mermaid.initialize();
+
 					} catch (e) {
 						console.error(e);
 					}

+ 12 - 0
public/app/term/term.js

@@ -716,6 +716,18 @@ function term_get_dict() {
 	);
 }
 
+function term_get_used(){
+    let output = [];
+    $("term").each(function () {
+        output.push({
+            pali:$(this).attr("pali"),
+            meaning:$(this).attr("mean")
+        });
+    });
+    return {
+        glossary:output
+    }
+}
 /*
 function term_popup_init() {
   $(".term_link").each(function () {

+ 2 - 1
public/package.json

@@ -14,8 +14,9 @@
 		"jquery.fancytree": "^2.38.0",
 		"marked": "^2.1.3",
 		"mermaid": "^8.12.0",
-		"pqgridf": "^3.5.1",
 		"moment": "^2.29.1",
+		"mustache": "^4.2.0",
+		"pqgridf": "^3.5.1",
 		"tributejs": "^5.1.3",
 		"vue": "^3.2.8"
 	}