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
aa23d013
Commit
aa23d013
authored
Nov 11, 2017
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🎨
#12372
parent
7ab27dd9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
README.md
README.md
+1
-1
src/main/java/org/b3log/solo/processor/console/AdminConsole.java
...n/java/org/b3log/solo/processor/console/AdminConsole.java
+2
-2
src/main/java/org/b3log/solo/service/ExportService.java
src/main/java/org/b3log/solo/service/ExportService.java
+4
-2
No files found.
README.md
View file @
aa23d013
...
...
@@ -36,8 +36,8 @@ Solo 沉淀至今的**每一个功能你应该都会用到**。我们不会将
*
上传七牛云
*
友情链接管理
*
多用户写作,团队博客
*
SQL 文件导出
*
[
Hexo/Jekyll 导入
](
https://hacpai.com/article/1498490209748
)
*
SQL / JSON / Markdown 导出
*
插件系统
*
Atom / RSS 订阅
*
Sitemap
...
...
src/main/java/org/b3log/solo/processor/console/AdminConsole.java
View file @
aa23d013
...
...
@@ -572,8 +572,8 @@ public class AdminConsole {
private
void
exportHexoMd
(
final
List
<
JSONObject
>
articles
,
final
String
dirPath
)
{
articles
.
forEach
(
article
->
{
final
String
filename
=
sanitizeFilename
(
article
.
optString
(
"title"
));
final
String
text
=
article
.
optString
(
"front"
)
+
"
\n-
---\n"
+
article
.
optString
(
"content"
);
final
String
filename
=
sanitizeFilename
(
article
.
optString
(
"title"
))
+
".md"
;
final
String
text
=
article
.
optString
(
"front"
)
+
"---\n"
+
article
.
optString
(
"content"
);
try
{
final
OutputStream
output
=
new
FileOutputStream
(
dirPath
+
File
.
separator
+
filename
);
...
...
src/main/java/org/b3log/solo/service/ExportService.java
View file @
aa23d013
...
...
@@ -30,6 +30,7 @@ import org.b3log.solo.model.*;
import
org.b3log.solo.repository.*
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.yaml.snakeyaml.Yaml
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -159,7 +160,8 @@ public class ExportService {
final
Map
<
String
,
Object
>
front
=
new
LinkedHashMap
<>();
final
String
title
=
article
.
optString
(
Article
.
ARTICLE_TITLE
);
front
.
put
(
"title"
,
title
);
front
.
put
(
"date"
,
DateFormatUtils
.
format
((
Date
)
article
.
opt
(
Article
.
ARTICLE_CREATE_DATE
),
"yyyy-MM-dd HH:mm:ss"
));
final
String
date
=
DateFormatUtils
.
format
((
Date
)
article
.
opt
(
Article
.
ARTICLE_CREATE_DATE
),
"yyyy-MM-dd HH:mm:ss"
);
front
.
put
(
"date"
,
date
);
front
.
put
(
"updated"
,
DateFormatUtils
.
format
((
Date
)
article
.
opt
(
Article
.
ARTICLE_UPDATE_DATE
),
"yyyy-MM-dd HH:mm:ss"
));
final
List
<
String
>
tags
=
Arrays
.
stream
(
article
.
optString
(
Article
.
ARTICLE_TAGS_REF
).
split
(
","
)).
filter
(
StringUtils:
:
isNotBlank
).
map
(
String:
:
trim
).
collect
(
Collectors
.
toList
());
if
(
tags
.
isEmpty
())
{
...
...
@@ -168,7 +170,7 @@ public class ExportService {
front
.
put
(
"tags"
,
tags
);
front
.
put
(
"permalink"
,
article
.
optString
(
Article
.
ARTICLE_PERMALINK
));
final
JSONObject
one
=
new
JSONObject
();
one
.
put
(
"front"
,
front
);
one
.
put
(
"front"
,
new
Yaml
().
dump
(
front
)
);
one
.
put
(
"title"
,
title
);
one
.
put
(
"content"
,
article
.
optString
(
Article
.
ARTICLE_CONTENT
));
...
...
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