This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-family: Helvetica, arial, freesans, clean, sans-serif; | |
font-size: 14px; | |
line-height: 1.6; | |
color: #333; | |
background-color: #fff; | |
padding: 20px; | |
max-width: 960px; | |
margin: 0 auto; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.pegdown.*; | |
import org.pegdown.ast.RootNode; | |
import org.pegdown.ast.VerbatimNode; | |
public class PegdownUtils { | |
public static String asHtml(String source) { | |
PegDownProcessor p = new PegDownProcessor(Extensions.ALL - Extensions.SMARTYPANTS); | |
RootNode root = p.parseMarkdown(source.toCharArray()); | |
return new HighlightHtmlSerializer().toHtml(root); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String autolist(String html) { | |
Document document = Jsoup.parse(html); | |
Elements headers = document.select("h1,h2,h3,h4,h5,h6"); | |
int n[] = new int[] { 0, 0, 0, 0, 0, 0, 0 }; | |
for (Element header : headers) { | |
String tag = header.tagName().toLowerCase(); | |
String text = header.text(); | |
if ("h1".equals(tag)) { | |
header.text((++n[1]) + " " + text); | |
n[2] = n[3] = n[4] = n[5] = n[6] = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/****************************************** | |
* jetbrick.widget.scrolltop.js | |
******************************************/ | |
(function (window, $) { | |
/** | |
* 单击此处,返回到顶部 | |
*/ | |
var scrolltop = function() { | |
var $dom = $('img[jw-scrolltop]'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 | |
http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.github.subchen</groupId> | |
<artifactId>jetbrick-template</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0.0</version> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
maven.group.id = com.github.subchen | |
maven.artifact.id = jetbrick-template | |
maven.version = 1.0.0 | |
product.name = ${maven.artifact.id} | |
product.version = ${maven.version} | |
product.author = Guoqiang Chen | |
product.vendor = [email protected] | |
build.dir = ${basedir}/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
import javax.swing.*; | |
public class HeaderCommentsGenerator { | |
private static int count = 0; | |
//@formatter:off | |
private static String DEFAULT_HEADER_COMMENT = | |
"/*\n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
import java.io.FilenameFilter; | |
import java.util.HashMap; | |
import java.util.Map; | |
import javax.servlet.ServletContext; | |
import jetbrick.template.runtime.JetPageContext; | |
import jetbrick.template.web.JetWebContext; | |
public class AssetsUrlFunctions { | |
private static Map<String, String> mapping = new HashMap<String, String>(128); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class WildCharUtils { | |
private static final char ESCAPES[] = { '$', '^', '[', ']', '(', ')', '{', '|', '+', '\\', '.', '<', '>' }; | |
private final String regexp; | |
public static Pattern compile(String pattern) { | |
return new Pattern(pattern); | |
} | |
private Pattern(String pattern) { | |
regexp = wildcardToRegexp(pattern); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.nio.charset.Charset; | |
import java.util.Properties; | |
import org.apache.commons.io.IOUtils; | |
import org.apache.commons.lang3.StringEscapeUtils; | |
public class ExtendPropertiesLoader { | |
private static final Properties EMPTY_PROPERTIES = new Properties(); | |
private static final String DEFAULT_ENCODING = "utf-8"; |
OlderNewer