Skip to content

Commit 0b0e5be

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/2.2.0-dev'
2 parents 040e0b7 + 4d934ef commit 0b0e5be

File tree

6 files changed

+68
-9
lines changed

6 files changed

+68
-9
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<!--
33
Description: Solo POM.
4-
Version: 3.17.1.40, Jun 25, 2017
4+
Version: 3.17.1.41, Jun 27, 2017
55
Author: <a href="http://88250.b3log.org">Liang Ding</a>
66
Author: <a href="http://www.annpeter.cn">Ann Peter</a>
77
Author: <a href="http://vanessa.b3log.org">Vanessa</a>
@@ -79,7 +79,7 @@
7979
<servlet.version>3.1.0</servlet.version>
8080
<slf4j.version>1.7.5</slf4j.version>
8181
<jsoup.version>1.9.1</jsoup.version>
82-
<flexmark.version>0.19.5</flexmark.version>
82+
<flexmark.version>0.20.0</flexmark.version>
8383
<qiniu.version>7.0.4.1</qiniu.version>
8484
<jetty.version>9.2.7.v20150116</jetty.version>
8585
<commons-cli.version>1.3.1</commons-cli.version>

src/main/java/org/b3log/solo/service/ImportService.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright (c) 2010-2017, b3log.org & hacpai.com
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package org.b3log.solo.service;
217

318
import org.apache.commons.io.FileUtils;
@@ -50,6 +65,10 @@ public class ImportService {
5065
@Inject
5166
private UserQueryService userQueryService;
5267

68+
/**
69+
* Imports markdowns files as articles. See <a href="https://hacpai.com/article/1498490209748">Solo 支持 Hexo/Jekyll 数据导入</a> for
70+
* more details.
71+
*/
5372
public void importMarkdowns() {
5473
new Thread(() -> {
5574
final ServletContext servletContext = SoloServletListener.getServletContext();
@@ -147,7 +166,8 @@ private JSONObject parseArticle(final String fileName, final String fileContent)
147166
final String content = StringUtils.substringAfter(fileContent, frontMatter);
148167
ret.put(Article.ARTICLE_CONTENT, content);
149168

150-
ret.put(Article.ARTICLE_ABSTRACT, Article.getAbstract(content));
169+
final String abs = parseAbstract(elems, content);
170+
ret.put(Article.ARTICLE_ABSTRACT, abs);
151171

152172
final Date date = parseDate(elems);
153173
ret.put(Article.ARTICLE_CREATE_DATE, date);
@@ -172,6 +192,21 @@ private JSONObject parseArticle(final String fileName, final String fileContent)
172192
return ret;
173193
}
174194

195+
private String parseAbstract(final Map map, final String content) {
196+
String ret = (String) map.get("description");
197+
if (null == ret) {
198+
ret = (String) map.get("summary");
199+
}
200+
if (null == ret) {
201+
ret = (String) map.get("abstract");
202+
}
203+
if (StringUtils.isNotBlank(ret)) {
204+
return ret;
205+
}
206+
207+
return Article.getAbstract(content);
208+
}
209+
175210
private Date parseDate(final Map map) {
176211
Object date = map.get("date");
177212
if (null == date) {

src/main/webapp/admin-index.ftl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
</a>
2121

2222
<span class="right">
23-
<a href="${servePath}" title='${indexLabel}'>${indexLabel}</a><a href='javascript:admin.logout();' title='${logoutLabel}'>${logoutLabel}</a>
23+
<a href="${servePath}" title='${indexLabel}'>
24+
<div class="avatar" style="background-image: url(${gravatar})"></div>
25+
${userName}
26+
</a>
27+
<a href='javascript:admin.logout();' title='${logoutLabel}'>${logoutLabel}</a>
2428
</span>
2529
</div>
2630
<div id="tabs">

src/main/webapp/css/default-admin.css

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -680,18 +680,30 @@ a[class*=" icon-"]:hover {
680680

681681
#top > .right a{
682682
color: #555;
683-
line-height: 50px;
684-
margin: 0 10px;
683+
line-height: 32px;
684+
margin: 8px 10px;
685685
border: 1px solid #f6f6f6;
686686
background-color: #f6f6f6;
687687
border-radius: 100px;
688-
padding: 10px;
688+
padding: 0 10px;
689689
text-decoration: none;
690+
display: inline-block;
690691
}
691692

692693
#top > .right a:hover {
693694
color: #333;
694695
}
696+
697+
#top .avatar {
698+
height: 25px;
699+
width: 25px;
700+
border-radius: 20px;
701+
background-size: cover;
702+
background-repeat: no-repeat;
703+
background-position: center center;
704+
float: left;
705+
margin: 3px 6px 0 0;
706+
}
695707
/* end top-nav */
696708

697709
/* start first tab */

0 commit comments

Comments
 (0)