瀏覽代碼

Markdown display fixes + error pages

NGPixel 8 年之前
父節點
當前提交
593481c7e1
共有 11 個文件被更改,包括 46 次插入25 次删除
  1. 1 0
      .travis.yml
  2. 3 3
      README.md
  3. 1 1
      agent.js
  4. 0 0
      assets/css/app.css
  5. 0 0
      assets/css/error.css
  6. 9 0
      client/scss/error.scss
  7. 2 0
      config.sample.yml
  8. 14 1
      libs/markdown.js
  9. 1 1
      views/common/footer.pug
  10. 7 9
      views/error-forbidden.pug
  11. 8 10
      views/error-notexist.pug

+ 1 - 0
.travis.yml

@@ -20,6 +20,7 @@ before_script:
 - npm install -g snyk
 - npm install -g snyk
 - snyk auth $SNYK_TOKEN
 - snyk auth $SNYK_TOKEN
 before_deploy:
 before_deploy:
+- npm install github:requarks/core -f
 - npm install -g gulp
 - npm install -g gulp
 - gulp deploy
 - gulp deploy
 - snyk monitor
 - snyk monitor

+ 3 - 3
README.md

@@ -1,8 +1,8 @@
 <a href="https://github.com/Requarks/wiki">
 <a href="https://github.com/Requarks/wiki">
-    <img src="https://raw.githubusercontent.com/Requarks/wiki/master/assets/favicons/favicon-96x96.png" alt="Requarks Wiki" title="Requarks Wiki" align="right" />
+    <img src="https://raw.githubusercontent.com/Requarks/wiki/master/assets/favicons/favicon-96x96.png" alt="Wiki.js" title="Wiki.js" align="right" />
 </a>
 </a>
 
 
-# Requarks Wiki
+# Wiki.js
 
 
 [![Release](https://img.shields.io/github/release/Requarks/wiki.svg?maxAge=86400)](https://github.com/Requarks/wiki/releases)
 [![Release](https://img.shields.io/github/release/Requarks/wiki.svg?maxAge=86400)](https://github.com/Requarks/wiki/releases)
 [![License](https://img.shields.io/badge/license-AGPLv3-blue.svg)](https://github.com/requarks/wiki/blob/master/LICENSE)
 [![License](https://img.shields.io/badge/license-AGPLv3-blue.svg)](https://github.com/requarks/wiki/blob/master/LICENSE)
@@ -16,7 +16,7 @@
 
 
 ### Documentation
 ### Documentation
 
 
-- [Installation Guide](https://requarks-wiki.readme.io/docs/prerequisites)
+- [Installation Guide](https://wiki.requarks.io/install)
 
 
 ##### Milestones
 ##### Milestones
 - [ ] Account Management
 - [ ] Account Management

+ 1 - 1
agent.js

@@ -91,7 +91,7 @@ var job = new cron({
 						});
 						});
 
 
 				fs.walk(repoPath).on('data', function (item) {
 				fs.walk(repoPath).on('data', function (item) {
-					if(path.extname(item.path) === '.md') {
+					if(path.extname(item.path) === '.md' && path.basename(item.path) !== 'README.md') {
 
 
 						let entryPath = entries.parsePath(entries.getEntryPathFromFullPath(item.path));
 						let entryPath = entries.parsePath(entries.getEntryPathFromFullPath(item.path));
 						let cachePath = entries.getCachePath(entryPath);
 						let cachePath = entries.getCachePath(entryPath);

文件差異過大導致無法顯示
+ 0 - 0
assets/css/app.css


文件差異過大導致無法顯示
+ 0 - 0
assets/css/error.css


+ 9 - 0
client/scss/error.scss

@@ -0,0 +1,9 @@
+
+$primary: 'indigo';
+
+@import 'core-client/scss/core';
+@import 'core-client/scss/components/button';
+@import 'core-client/scss/components/grid';
+@import 'core-client/scss/components/typography';
+
+@import 'core-client/scss/pages/error';

+ 2 - 0
config.sample.yml

@@ -35,6 +35,8 @@ paths:
 # Site Authentication
 # Site Authentication
 # ---------------------------------------------------------------------
 # ---------------------------------------------------------------------
 
 
+public: false
+
 auth:
 auth:
   local:
   local:
     enabled: true
     enabled: true

+ 14 - 1
libs/markdown.js

@@ -55,7 +55,7 @@ var mkdown = md({
 // Rendering rules
 // Rendering rules
 
 
 mkdown.renderer.rules.emoji = function(token, idx) {
 mkdown.renderer.rules.emoji = function(token, idx) {
-	return '<i class="twa twa-' + token[idx].markup + '"></i>';
+	return '<i class="twa twa-' + _.replace(token[idx].markup, /_/g, '-') + '"></i>';
 };
 };
 
 
 /**
 /**
@@ -171,6 +171,19 @@ const parseContent = (content)  => {
 		cr(elm).replaceWith(txtLink);
 		cr(elm).replaceWith(txtLink);
 	});
 	});
 
 
+	//-> Re-attach blockquote styling classes to their parents
+	
+	cr.root().children('blockquote').each((i, elm) => {
+		if(cr(elm).children().length > 0) {
+			let bqLastChild = cr(elm).children().last()[0];
+			let bqLastChildClasses = cr(bqLastChild).attr('class');
+			if(bqLastChildClasses.length > 0) {
+				cr(bqLastChild).removeAttr('class');
+				cr(elm).addClass(bqLastChildClasses);
+			}
+		}
+	});
+
 	output = cr.html();
 	output = cr.html();
 
 
 	return output;
 	return output;

+ 1 - 1
views/common/footer.pug

@@ -1,7 +1,7 @@
 footer.footer
 footer.footer
 	span
 	span
 		= t('footer.poweredby') + ' '
 		= t('footer.poweredby') + ' '
-		a(href='https://github.com/Requarks/wiki') Requarks Wiki
+		a(href='https://github.com/Requarks/wiki') Wiki.js
 		| .
 		| .
 	ul
 	ul
 		li: a(href='/')= t('footer.home')
 		li: a(href='/')= t('footer.home')

+ 7 - 9
views/error-forbidden.pug

@@ -19,13 +19,11 @@ html
 
 
 		// CSS
 		// CSS
 		link(type='text/css', rel='stylesheet', href='/css/libs.css')
 		link(type='text/css', rel='stylesheet', href='/css/libs.css')
-		link(type='text/css', rel='stylesheet', href='/css/app.css')
+		link(type='text/css', rel='stylesheet', href='/css/error.css')
 
 
-	body(class='server-error')
-		section.hero.is-danger.is-fullheight
-			.hero-body
-				.container
-					a(href='/'): img(src='/favicons/android-icon-96x96.png')
-					h1.title(style={ 'margin-top': '30px'}) Forbidden
-					h2.subtitle(style={ 'margin-bottom': '50px'}) Sorry, you don't have the necessary permissions to access this page.
-					a.button.is-dark.is-inverted(href='/') Go Home
+	body(class='is-forbidden')
+		.container
+			a(href='/'): img(src='/favicons/android-icon-96x96.png')
+			h1.title(style={ 'margin-top': '30px'}) Forbidden
+			h2.subtitle(style={ 'margin-bottom': '50px'}) Sorry, you don't have the necessary permissions to access this page.
+			a.button.is-amber.is-inverted(href='/') Go Home

+ 8 - 10
views/error-notexist.pug

@@ -19,14 +19,12 @@ html
 
 
 		// CSS
 		// CSS
 		link(type='text/css', rel='stylesheet', href='/css/libs.css')
 		link(type='text/css', rel='stylesheet', href='/css/libs.css')
-		link(type='text/css', rel='stylesheet', href='/css/app.css')
+		link(type='text/css', rel='stylesheet', href='/css/error.css')
 
 
-	body(class='server-error')
-		section.hero.is-dark.is-fullheight
-			.hero-body
-				.container
-					a(href='/'): img(src='/favicons/android-icon-96x96.png')
-					h1.title(style={ 'margin-top': '30px'})= message
-					h2.subtitle(style={ 'margin-bottom': '50px'}) Would you like to create this entry?
-					a.button.is-dark.is-inverted(href='/create/' + newpath, style={'margin-right': '5px'}) Create
-					a.button.is-dark.is-inverted(href='/') Go Home
+	body(class='is-notexist')
+		.container
+			a(href='/'): img(src='/favicons/android-icon-96x96.png')
+			h1= message
+			h2 Would you like to create this entry?
+			a.button.is-amber.is-inverted(href='/create/' + newpath) Create
+			a.button.is-amber.is-inverted(href='/') Go Home

部分文件因文件數量過多而無法顯示