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"?>
<!--
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://www.annpeter.cn">Ann Peter</a>
Author: <a href="http://vanessa.b3log.org">Vanessa</a>
......@@ -79,7 +79,7 @@
<servlet.version>3.1.0</servlet.version>
<slf4j.version>1.7.5</slf4j.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>
<jetty.version>9.2.7.v20150116</jetty.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;
import org.apache.commons.io.FileUtils;
......@@ -50,6 +65,10 @@ public class ImportService {
@Inject
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() {
new Thread(() -> {
final ServletContext servletContext = SoloServletListener.getServletContext();
......@@ -147,7 +166,8 @@ public class ImportService {
final String content = StringUtils.substringAfter(fileContent, frontMatter);
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);
ret.put(Article.ARTICLE_CREATE_DATE, date);
......@@ -172,6 +192,21 @@ public class ImportService {
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) {
Object date = map.get("date");
if (null == date) {
......
......@@ -20,7 +20,11 @@
</a>
<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>
</div>
<div id="tabs">
......
......@@ -680,18 +680,30 @@ a[class*=" icon-"]:hover {
#top > .right a{
color: #555;
line-height: 50px;
margin: 0 10px;
line-height: 32px;
margin: 8px 10px;
border: 1px solid #f6f6f6;
background-color: #f6f6f6;
border-radius: 100px;
padding: 10px;
padding: 0 10px;
text-decoration: none;
display: inline-block;
}
#top > .right a:hover {
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 */
/* start first tab */
......
This diff is collapsed.
......@@ -99,8 +99,10 @@
</#if>
</div>
</footer>
<div id="externalRelevantArticles" class="list"></div>
<@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>
</main>
<#include "side.ftl">
......@@ -109,10 +111,16 @@
<#include "footer.ftl">
<@comment_script oId=article.oId>
page.tips.externalRelevantArticlesDisplayCount = "${externalRelevantArticlesDisplayCount}";
<#if 0 != randomArticlesDisplayCount>
page.loadRandomArticles();
</#if>
<#if 0 != externalRelevantArticlesDisplayCount>
page.loadExternalRelevantArticles("<#list article.articleTags?split(",") as articleTag>${articleTag}<#if articleTag_has_next>,</#if></#list>"
, "<header class='title'><h2>${externalRelevantArticlesLabel}</h2></header>");
</#if>
<#if 0 != relevantArticlesDisplayCount>
page.loadRelevantArticles('${article.oId}', '<h4>${relevantArticlesLabel}</h4>');
</#if>
</@comment_script>
</body>
</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