Commit 0b0e5bed authored by Liang Ding's avatar Liang Ding

Merge remote-tracking branch 'refs/remotes/origin/2.2.0-dev'

parents 040e0b7b 4d934eff
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- <!--
Description: Solo POM. Description: Solo POM.
Version: 3.17.1.40, Jun 25, 2017 Version: 3.17.1.41, Jun 27, 2017
Author: <a href="http://88250.b3log.org">Liang Ding</a> Author: <a href="http://88250.b3log.org">Liang Ding</a>
Author: <a href="http://www.annpeter.cn">Ann Peter</a> Author: <a href="http://www.annpeter.cn">Ann Peter</a>
Author: <a href="http://vanessa.b3log.org">Vanessa</a> Author: <a href="http://vanessa.b3log.org">Vanessa</a>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<servlet.version>3.1.0</servlet.version> <servlet.version>3.1.0</servlet.version>
<slf4j.version>1.7.5</slf4j.version> <slf4j.version>1.7.5</slf4j.version>
<jsoup.version>1.9.1</jsoup.version> <jsoup.version>1.9.1</jsoup.version>
<flexmark.version>0.19.5</flexmark.version> <flexmark.version>0.20.0</flexmark.version>
<qiniu.version>7.0.4.1</qiniu.version> <qiniu.version>7.0.4.1</qiniu.version>
<jetty.version>9.2.7.v20150116</jetty.version> <jetty.version>9.2.7.v20150116</jetty.version>
<commons-cli.version>1.3.1</commons-cli.version> <commons-cli.version>1.3.1</commons-cli.version>
......
/*
* Copyright (c) 2010-2017, b3log.org & hacpai.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.b3log.solo.service; package org.b3log.solo.service;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
...@@ -50,6 +65,10 @@ public class ImportService { ...@@ -50,6 +65,10 @@ public class ImportService {
@Inject @Inject
private UserQueryService userQueryService; private UserQueryService userQueryService;
/**
* Imports markdowns files as articles. See <a href="https://hacpai.com/article/1498490209748">Solo 支持 Hexo/Jekyll 数据导入</a> for
* more details.
*/
public void importMarkdowns() { public void importMarkdowns() {
new Thread(() -> { new Thread(() -> {
final ServletContext servletContext = SoloServletListener.getServletContext(); final ServletContext servletContext = SoloServletListener.getServletContext();
...@@ -147,7 +166,8 @@ public class ImportService { ...@@ -147,7 +166,8 @@ public class ImportService {
final String content = StringUtils.substringAfter(fileContent, frontMatter); final String content = StringUtils.substringAfter(fileContent, frontMatter);
ret.put(Article.ARTICLE_CONTENT, content); ret.put(Article.ARTICLE_CONTENT, content);
ret.put(Article.ARTICLE_ABSTRACT, Article.getAbstract(content)); final String abs = parseAbstract(elems, content);
ret.put(Article.ARTICLE_ABSTRACT, abs);
final Date date = parseDate(elems); final Date date = parseDate(elems);
ret.put(Article.ARTICLE_CREATE_DATE, date); ret.put(Article.ARTICLE_CREATE_DATE, date);
...@@ -172,6 +192,21 @@ public class ImportService { ...@@ -172,6 +192,21 @@ public class ImportService {
return ret; return ret;
} }
private String parseAbstract(final Map map, final String content) {
String ret = (String) map.get("description");
if (null == ret) {
ret = (String) map.get("summary");
}
if (null == ret) {
ret = (String) map.get("abstract");
}
if (StringUtils.isNotBlank(ret)) {
return ret;
}
return Article.getAbstract(content);
}
private Date parseDate(final Map map) { private Date parseDate(final Map map) {
Object date = map.get("date"); Object date = map.get("date");
if (null == date) { if (null == date) {
......
...@@ -20,7 +20,11 @@ ...@@ -20,7 +20,11 @@
</a> </a>
<span class="right"> <span class="right">
<a href="${servePath}" title='${indexLabel}'>${indexLabel}</a><a href='javascript:admin.logout();' title='${logoutLabel}'>${logoutLabel}</a> <a href="${servePath}" title='${indexLabel}'>
<div class="avatar" style="background-image: url(${gravatar})"></div>
${userName}
</a>
<a href='javascript:admin.logout();' title='${logoutLabel}'>${logoutLabel}</a>
</span> </span>
</div> </div>
<div id="tabs"> <div id="tabs">
......
...@@ -680,18 +680,30 @@ a[class*=" icon-"]:hover { ...@@ -680,18 +680,30 @@ a[class*=" icon-"]:hover {
#top > .right a{ #top > .right a{
color: #555; color: #555;
line-height: 50px; line-height: 32px;
margin: 0 10px; margin: 8px 10px;
border: 1px solid #f6f6f6; border: 1px solid #f6f6f6;
background-color: #f6f6f6; background-color: #f6f6f6;
border-radius: 100px; border-radius: 100px;
padding: 10px; padding: 0 10px;
text-decoration: none; text-decoration: none;
display: inline-block;
} }
#top > .right a:hover { #top > .right a:hover {
color: #333; color: #333;
} }
#top .avatar {
height: 25px;
width: 25px;
border-radius: 20px;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
float: left;
margin: 3px 6px 0 0;
}
/* end top-nav */ /* end top-nav */
/* start first tab */ /* start first tab */
......
This diff is collapsed.
...@@ -99,8 +99,10 @@ ...@@ -99,8 +99,10 @@
</#if> </#if>
</div> </div>
</footer> </footer>
<div id="externalRelevantArticles" class="list"></div>
<@comments commentList=articleComments article=article></@comments> <@comments commentList=articleComments article=article></@comments>
<div id="externalRelevantArticles" class="list"></div>
<div id="relevantArticles" class="list"></div>
<div id="randomArticles" class="list"></div>
</article> </article>
</main> </main>
<#include "side.ftl"> <#include "side.ftl">
...@@ -109,10 +111,16 @@ ...@@ -109,10 +111,16 @@
<#include "footer.ftl"> <#include "footer.ftl">
<@comment_script oId=article.oId> <@comment_script oId=article.oId>
page.tips.externalRelevantArticlesDisplayCount = "${externalRelevantArticlesDisplayCount}"; page.tips.externalRelevantArticlesDisplayCount = "${externalRelevantArticlesDisplayCount}";
<#if 0 != randomArticlesDisplayCount>
page.loadRandomArticles();
</#if>
<#if 0 != externalRelevantArticlesDisplayCount> <#if 0 != externalRelevantArticlesDisplayCount>
page.loadExternalRelevantArticles("<#list article.articleTags?split(",") as articleTag>${articleTag}<#if articleTag_has_next>,</#if></#list>" page.loadExternalRelevantArticles("<#list article.articleTags?split(",") as articleTag>${articleTag}<#if articleTag_has_next>,</#if></#list>"
, "<header class='title'><h2>${externalRelevantArticlesLabel}</h2></header>"); , "<header class='title'><h2>${externalRelevantArticlesLabel}</h2></header>");
</#if> </#if>
<#if 0 != relevantArticlesDisplayCount>
page.loadRelevantArticles('${article.oId}', '<h4>${relevantArticlesLabel}</h4>');
</#if>
</@comment_script> </@comment_script>
</body> </body>
</html> </html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment