Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
0b0e5bed
Commit
0b0e5bed
authored
Jun 27, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'refs/remotes/origin/2.2.0-dev'
parents
040e0b7b
4d934eff
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
68 additions
and
9 deletions
+68
-9
pom.xml
pom.xml
+2
-2
src/main/java/org/b3log/solo/service/ImportService.java
src/main/java/org/b3log/solo/service/ImportService.java
+36
-1
src/main/webapp/admin-index.ftl
src/main/webapp/admin-index.ftl
+5
-1
src/main/webapp/css/default-admin.css
src/main/webapp/css/default-admin.css
+15
-3
src/main/webapp/css/default-admin.min.css
src/main/webapp/css/default-admin.min.css
+1
-1
src/main/webapp/skins/9IPHP/article.ftl
src/main/webapp/skins/9IPHP/article.ftl
+9
-1
No files found.
pom.xml
View file @
0b0e5bed
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--
<!--
Description: Solo POM.
Description: Solo POM.
Version: 3.17.1.4
0, Jun 25
, 2017
Version: 3.17.1.4
1, 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>
...
...
src/main/java/org/b3log/solo/service/ImportService.java
View file @
0b0e5bed
/*
* 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
)
{
...
...
src/main/webapp/admin-index.ftl
View file @
0b0e5bed
...
@@ -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"
>
...
...
src/main/webapp/css/default-admin.css
View file @
0b0e5bed
...
@@ -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
:
50
px
;
line-height
:
32
px
;
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 */
...
...
src/main/webapp/css/default-admin.min.css
View file @
0b0e5bed
This diff is collapsed.
Click to expand it.
src/main/webapp/skins/9IPHP/article.ftl
View file @
0b0e5bed
...
@@ -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>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment