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
d4ae54a0
Unverified
Commit
d4ae54a0
authored
Jan 25, 2020
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
Markdown 支持改进 #54
parent
608548d5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
34 deletions
+49
-34
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+9
-2
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
...in/java/org/b3log/solo/service/PreferenceMgmtService.java
+40
-26
src/main/resources/admin/admin-preference.ftl
src/main/resources/admin/admin-preference.ftl
+0
-6
No files found.
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
d4ae54a0
...
...
@@ -41,7 +41,7 @@ import org.json.JSONObject;
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="https://github.com/hzchendou">hzchendou</a>
* @version 1.2.0.2
5, Jun 13, 2019
* @version 1.2.0.2
6, Jan 25, 2020
* @since 0.4.0
*/
@RequestProcessor
...
...
@@ -243,7 +243,14 @@ public class PreferenceConsole {
* "faviconURL": "",
* "syncGitHub": boolean,
* "pullGitHub": boolean,
* "customVars" "", // 支持配置自定义参数 https://github.com/b3log/solo/issues/12535
* "customVars": "", // 支持配置自定义参数 https://github.com/b3log/solo/issues/12535
* "showCodeBlockLn": boolean, // 支持代码块行号显示 https://github.com/88250/solo/issues/4
* "footnotes": boolean, // Markdown 支持改进 https://github.com/88250/solo/issues/54
* "showToC": boolean, // Markdown 支持改进 https://github.com/88250/solo/issues/54
* "autoSpace": boolean, // Markdown 支持改进 https://github.com/88250/solo/issues/54
* "fixTermTypo": boolean, // Markdown 支持改进 https://github.com/88250/solo/issues/54
* "chinesePunct": boolean, // Markdown 支持改进 https://github.com/88250/solo/issues/54
* "inlineMathAllowDigitAfterOpenMarker": boolean, // Markdown 支持改进 https://github.com/88250/solo/issues/54
* }
* }
* </pre>
...
...
src/main/java/org/b3log/solo/service/PreferenceMgmtService.java
View file @
d4ae54a0
...
...
@@ -40,7 +40,7 @@ import java.util.Locale;
* Preference management service.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.4.0.
4, Jan 24
, 2020
* @version 1.4.0.
5, Jan 25
, 2020
* @since 0.4.0
*/
@Service
...
...
@@ -221,38 +221,38 @@ public class PreferenceMgmtService {
hljsThemeOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_HLJS_THEME
));
optionRepository
.
update
(
Option
.
ID_C_HLJS_THEME
,
hljsThemeOpt
);
JSONObject
showCodeBlockLnOpt
=
optionRepository
.
get
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
);
final
String
showCodeBlockLnVal
=
preference
.
optString
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
);
if
(
null
==
showCodeBlockLnOpt
)
{
showCodeBlockLnOpt
=
new
JSONObject
();
showCodeBlockLnOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_SHOW_CODE_BLOCK_LN
);
showCodeBlockLnOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
showCodeBlockLnOpt
.
put
(
Option
.
OPTION_VALUE
,
showCodeBlockLnVal
);
optionRepository
.
add
(
showCodeBlockLnOpt
);
}
else
{
showCodeBlockLnOpt
.
put
(
Option
.
OPTION_VALUE
,
showCodeBlockLnVal
);
optionRepository
.
update
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
,
showCodeBlockLnOpt
);
}
emptyPreferenceOptSave
(
Option
.
ID_C_SHOW_CODE_BLOCK_LN
,
showCodeBlockLnVal
);
Markdowns
.
SHOW_CODE_BLOCK_LN
=
"true"
.
equalsIgnoreCase
(
showCodeBlockLnVal
);
JSONObject
showToCOpt
=
optionRepository
.
get
(
Option
.
ID_C_SHOW_TOC
);
final
String
showToCVal
=
preference
.
optString
(
Option
.
ID_C_SHOW_TOC
);
if
(
null
==
showToCOpt
)
{
showToCOpt
=
new
JSONObject
();
showToCOpt
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_SHOW_TOC
);
showToCOpt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
showToCOpt
.
put
(
Option
.
OPTION_VALUE
,
showToCVal
);
optionRepository
.
add
(
showToCOpt
);
}
else
{
showToCOpt
.
put
(
Option
.
OPTION_VALUE
,
showToCVal
);
optionRepository
.
update
(
Option
.
ID_C_SHOW_TOC
,
showToCOpt
);
}
Markdowns
.
SHOW_TOC
=
"true"
.
equalsIgnoreCase
(
showToCVal
);
final
JSONObject
customVarsOpt
=
optionRepository
.
get
(
Option
.
ID_C_CUSTOM_VARS
);
customVarsOpt
.
put
(
Option
.
OPTION_VALUE
,
preference
.
optString
(
Option
.
ID_C_CUSTOM_VARS
));
optionRepository
.
update
(
Option
.
ID_C_CUSTOM_VARS
,
customVarsOpt
);
final
String
footnotesVal
=
preference
.
optString
(
Option
.
ID_C_FOOTNOTES
);
emptyPreferenceOptSave
(
Option
.
ID_C_FOOTNOTES
,
footnotesVal
);
Markdowns
.
FOOTNOTES
=
"true"
.
equalsIgnoreCase
(
footnotesVal
);
final
String
showToCVal
=
preference
.
optString
(
Option
.
ID_C_SHOW_TOC
);
emptyPreferenceOptSave
(
Option
.
ID_C_SHOW_TOC
,
showToCVal
);
Markdowns
.
SHOW_TOC
=
"true"
.
equalsIgnoreCase
(
showToCVal
);
final
String
autoSpaceVal
=
preference
.
optString
(
Option
.
ID_C_AUTO_SPACE
);
emptyPreferenceOptSave
(
Option
.
ID_C_AUTO_SPACE
,
autoSpaceVal
);
Markdowns
.
AUTO_SPACE
=
"true"
.
equalsIgnoreCase
(
autoSpaceVal
);
final
String
fixTermTypoVal
=
preference
.
optString
(
Option
.
ID_C_FIX_TERM_TYPO
);
emptyPreferenceOptSave
(
Option
.
ID_C_FIX_TERM_TYPO
,
fixTermTypoVal
);
Markdowns
.
FIX_TERM_TYPO
=
"true"
.
equalsIgnoreCase
(
fixTermTypoVal
);
final
String
chinesePunctVal
=
preference
.
optString
(
Option
.
ID_C_CHINESE_PUNCT
);
emptyPreferenceOptSave
(
Option
.
ID_C_CHINESE_PUNCT
,
chinesePunctVal
);
Markdowns
.
CHINESE_PUNCT
=
"true"
.
equalsIgnoreCase
(
chinesePunctVal
);
final
String
IMADAOMVal
=
preference
.
optString
(
Option
.
ID_C_IMADAOM
);
emptyPreferenceOptSave
(
Option
.
ID_C_IMADAOM
,
IMADAOMVal
);
Markdowns
.
IMADAOM
=
"true"
.
equalsIgnoreCase
(
IMADAOMVal
);
transaction
.
commit
();
Markdowns
.
clearCache
();
...
...
@@ -267,4 +267,18 @@ public class PreferenceMgmtService {
LOGGER
.
log
(
Level
.
DEBUG
,
"Updates preference successfully"
);
}
private
void
emptyPreferenceOptSave
(
final
String
optID
,
final
String
val
)
throws
Exception
{
JSONObject
opt
=
optionRepository
.
get
(
optID
);
if
(
null
==
opt
)
{
opt
=
new
JSONObject
();
opt
.
put
(
Keys
.
OBJECT_ID
,
optID
);
opt
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_PREFERENCE
);
opt
.
put
(
Option
.
OPTION_VALUE
,
val
);
optionRepository
.
add
(
opt
);
}
else
{
opt
.
put
(
Option
.
OPTION_VALUE
,
val
);
optionRepository
.
update
(
optID
,
opt
);
}
}
}
src/main/resources/admin/admin-preference.ftl
View file @
d4ae54a0
...
...
@@ -188,12 +188,6 @@
<input id="showCodeBlockLn" type="checkbox" class="normalInput"/>
</div>
</label>
<label>
<div class="fn__flex-inline">
${supportToCLabel}
<input id="showToC" type="checkbox" class="normalInput"/>
</div>
</label>
</div>
<div class="fn__margin12"></div>
<div class="fn__flex-1">
...
...
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