Commit 3e582b37 authored by Liang Ding's avatar Liang Ding

Markdown 支持 [ToC] #52

parent cf9167d1
......@@ -20,8 +20,11 @@ package org.b3log.solo.plugin;
import org.apache.commons.lang.StringUtils;
import org.b3log.latke.event.AbstractEventListener;
import org.b3log.latke.event.Event;
import org.b3log.latke.event.EventManager;
import org.b3log.latke.http.RequestContext;
import org.b3log.latke.ioc.BeanManager;
import org.b3log.latke.plugin.NotInteractivePlugin;
import org.b3log.latke.plugin.PluginStatus;
import org.b3log.solo.event.EventTypes;
import org.b3log.solo.model.Article;
import org.json.JSONObject;
......@@ -39,16 +42,24 @@ import java.util.Map;
* ToC event handler.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 2.0.0.0, Jul 29, 2019
* @version 2.0.1.0, Jan 24, 2020
* @since 0.6.7
*/
public class ToCPlugin extends NotInteractivePlugin {
/**
* Public constructor.
*/
public ToCPlugin() {
addEventListener(new ToCEventHandler());
private ToCEventHandler handler = new ToCEventHandler();
@Override
public void changeStatus() {
super.changeStatus();
final EventManager eventManager = BeanManager.getInstance().getReference(EventManager.class);
final PluginStatus status = getStatus();
if (PluginStatus.DISABLED == status) {
eventManager.unregisterListener(handler);
} else {
eventManager.registerListener(handler);
}
}
@Override
......
......@@ -24,7 +24,7 @@
# Author: Dongxu Wang
#
showToCLabel=Support Markdown [ToC]:
showToCLabel=Support Markdown [TOC] (need&nbsp;<a href="https://hacpai.com/article/1569240189601" target="_blank">Lute-HTTP</a>):
showCodeBlockLnLabel=Show code block line num:
siteURLLabel=Site URL:
siteGenedLabel=Site generated, target dir is [{dir}]
......
......@@ -24,7 +24,7 @@
# Author: Dongxu Wang
#
showToCLabel=\u652F\u6301 Markdown [ToC]\uFF1A
showToCLabel=\u652F\u6301 Markdown [TOC]\uFF08\u9700\u542F\u7528&nbsp;<a href="https://hacpai.com/article/1569240189601" target="_blank">Lute-HTTP</a>\uFF09\uFF1A
showCodeBlockLnLabel=\u4EE3\u7801\u5757\u663E\u793A\u884C\u53F7\uFF1A
siteURLLabel=\u7AD9\u70B9\u5730\u5740\uFF1A
siteGenedLabel=\u7AD9\u70B9\u751F\u6210\u5B8C\u6BD5\uFF0C\u8BF7\u67E5\u770B\u76EE\u5F55 [{dir}]
......
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