diff options
| author | shedaniel <daniel@shedaniel.me> | 2023-06-01 17:27:50 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2024-04-16 00:38:18 +0900 |
| commit | 4d6bcee0dc0354c3778ad44157e1afe27e36d5fd (patch) | |
| tree | ab1b6af91014ca43cc755623431f8aed3f21c2f6 /runtime | |
| parent | 99d2202b77e808daf2c2023c32d9f6ee9d371e7b (diff) | |
| download | RoughlyEnoughItems-4d6bcee0dc0354c3778ad44157e1afe27e36d5fd.tar.gz RoughlyEnoughItems-4d6bcee0dc0354c3778ad44157e1afe27e36d5fd.tar.bz2 RoughlyEnoughItems-4d6bcee0dc0354c3778ad44157e1afe27e36d5fd.zip | |
Remove REI Changelog
Diffstat (limited to 'runtime')
9 files changed, 3 insertions, 1611 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/changelog/ChangelogLoader.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/changelog/ChangelogLoader.java deleted file mode 100644 index eeaf59ce7..000000000 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/changelog/ChangelogLoader.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.impl.client.gui.changelog; - -import com.google.gson.JsonObject; -import com.google.gson.JsonParser; -import dev.architectury.platform.Platform; -import me.shedaniel.rei.impl.client.gui.error.ErrorsEntryListWidget; -import me.shedaniel.rei.impl.client.gui.error.ErrorsScreen; -import net.minecraft.client.Minecraft; -import net.minecraft.network.chat.Component; -import org.apache.commons.io.IOUtils; - -import java.io.*; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import java.util.function.Function; - -public class ChangelogLoader { - public interface Builder { - default void add(Component component) { - add(width -> new ErrorsEntryListWidget.TextEntry(component, width)); - } - - void add(Function<Integer, ErrorsEntryListWidget.Entry> function); - } - - private static Boolean visited = null; - - public static boolean hasVisited() { - if (visited == null) { - visited = false; - File file = Platform.getConfigFolder().resolve("roughlyenoughitems/changelog.txt").toFile(); - if (file.exists()) { - try (InputStreamReader reader = new FileReader(file)) { - String version = IOUtils.toString(reader).trim(); - - InputStream changesJsonStream = ChangelogLoader.class.getClassLoader().getResourceAsStream("roughlyenoughitems.changes.json"); - if (changesJsonStream != null) { - JsonObject object = JsonParser.parseReader(new InputStreamReader(changesJsonStream)) - .getAsJsonObject(); - String currentVersion = object.getAsJsonPrimitive("version").getAsString(); - if (currentVersion.equals(version)) { - visited = true; - } - } - } catch (IOException e) { - } - } - } - - return visited; - } - - public static void show() { - class BuilderImpl implements Builder { - private final List<Object> components = new ArrayList<>(); - - @Override - public void add(Function<Integer, ErrorsEntryListWidget.Entry> function) { - components.add(function); - } - } - - visited = true; - BuilderImpl builder = new BuilderImpl(); - - InputStream changesJsonStream = ChangelogLoader.class.getClassLoader().getResourceAsStream("roughlyenoughitems.changes.json"); - if (changesJsonStream == null) { - builder.add(Component.translatable("rei.changelog.error.missingChangelogFile")); - } else { - JsonObject object = JsonParser.parseReader(new InputStreamReader(changesJsonStream)) - .getAsJsonObject(); - String version = object.getAsJsonPrimitive("version").getAsString(); - Path file = Platform.getConfigFolder().resolve("roughlyenoughitems/changelog.txt"); - try { - Files.write(file, version.getBytes(StandardCharsets.UTF_8), StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING); - } catch (IOException e) { - e.printStackTrace(); - } - - InputStream changelogStream = ChangelogLoader.class.getClassLoader().getResourceAsStream("roughlyenoughitems/" + version + "/changelog.md"); - - if (changelogStream == null) { - builder.add(Component.translatable("rei.changelog.error.missingChangelogFile")); - } else { - try { - JParseDown parseDown = new JParseDown(); - LinkedList<JParseDown.Block> blocks = parseDown.linesElements(IOUtils.readLines(changelogStream, StandardCharsets.UTF_8).toArray(new String[0])); - for (JParseDown.Block block : blocks) { - if (block.autoBreak) { - builder.add(width -> new ErrorsEntryListWidget.EmptyEntry(6)); - } - Builder blockBuilder = builder; - if (block instanceof JParseDown.BlockHeader) { - blockBuilder = function -> { - builder.add(width -> new ErrorsEntryListWidget.ScaledEntry(function.apply(Math.round(width / 1.5F)), 1.5F)); - }; - } - JParseDownToMinecraft.build(blockBuilder, block); - if (block.autoBreak) { - builder.add(width -> new ErrorsEntryListWidget.EmptyEntry(6)); - } - } - } catch (IOException e) { - builder.add(Component.translatable("rei.changelog.error.failedToReadChangelogFile")); - } - } - } - - Minecraft.getInstance().setScreen(new ErrorsScreen(Component.translatable("text.rei.changelog.title"), builder.components, Minecraft.getInstance().screen, true)); - } -} diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/changelog/JParseDown.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/changelog/JParseDown.java deleted file mode 100644 index 85c43e8bd..000000000 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/changelog/JParseDown.java +++ /dev/null @@ -1,1316 +0,0 @@ -/* - * This file is licensed under the MIT License, part of Roughly Enough Items. - * Copyright (c) 2018, 2019, 2020, 2021, 2022, 2023 shedaniel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -package me.shedaniel.rei.impl.client.gui.changelog; - -import java.util.*; -import java.util.function.Function; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; - -/* -Copyright (c) 2019 Ashur Rafiev -https://github.com/ashurrafiev/JParsedown -MIT Licence: https://github.com/ashurrafiev/JParsedown/blob/master/LICENSE - -This work is derived from Parsedown version 1.8.0-beta-5: -Copyright (c) 2013-2018 Emanuil Rusev -http://parsedown.org -*/ -@SuppressWarnings("RegExpRedundantEscape") -public class JParseDown { - public static final String version = "1.0.4"; - - public static class ReferenceData { - public String url; - public String title; - - public ReferenceData(String url, String title) { - this.url = url; - this.title = title; - } - } - - public static class Line { - public String body; - public String text; - public int indent; - - public Line(String line) { - body = line; - text = line.replaceFirst("^\\s+", ""); - indent = line.length() - text.length(); - } - } - - public abstract static class Component { - public String markup = null; - public boolean hidden = false; - public HashSet<Class<?>> nonNestables = new HashSet<>(); - } - - public interface BlockType<B extends Block> { - Block startBlock(JParseDown parseDown, Line line, Block block); - } - - public interface InlineType<L extends Inline> { - Inline inline(JParseDown parseDown, String text, String context); - } - - public abstract static class Block extends Component { - public boolean identified = false; - public int interrupted = 0; - public List<Inline> inlines; - public Boolean autoBreak = null; - - public boolean isContinuable() { - return false; - } - - public boolean isCompletable() { - return false; - } - - public Block continueBlock(Line line) { - return null; - } - - public Block completeBlock() { - return null; - } - - public abstract Collection<Inline> inline(JParseDown parseDown); - } - - public static class BlockParagraph extends Block { - public String text; - - public BlockParagraph(String text) { - this.text = text; - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - return new BlockParagraph(line.text); - } - - @Override - public boolean isContinuable() { - return false; - } - - @Override - public Block continueBlock(Line line) { - if (interrupted > 0) - return null; - text += "\n" + line.text; - return this; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - return parseDown.lineElements(text, nonNestables); - } - - @Override - public String toString() { - return "BlockParagraph{" + - "text='" + text + '\'' + - '}'; - } - } - - public static class BlockCode extends Block { - public String text; - - public BlockCode(String text) { - this.text = text; - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - if (block != null && block instanceof BlockParagraph && block.interrupted == 0) - return null; - if (line.indent >= 4) { - return new BlockCode(line.body.substring(4)); - } else - return null; - } - - @Override - public boolean isContinuable() { - return true; - } - - @Override - public Block continueBlock(Line line) { - if (line.indent >= 4) { - while (interrupted > 0) { - text += "\n"; - interrupted--; - } - text += "\n"; - text += line.body.substring(4); - return this; - } else - return null; - } - - @Override - public boolean isCompletable() { - return true; - } - - @Override - public Block completeBlock() { - return this; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - return parseDown.lineElements(text, nonNestables); - } - - @Override - public String toString() { - return "BlockCode{" + - "text='" + text + '\'' + - '}'; - } - } - - public static class BlockComment extends Block { - public String text; - public boolean closed = false; - - public BlockComment(String text) { - this.text = text; - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - if (parseDown.markupEscaped || parseDown.safeMode) - return null; - if (line.text.indexOf("<!--") == 0) { - BlockComment b = new BlockComment(line.body); - if (line.text.contains("-->")) - b.closed = true; - return b; - } else - return null; - } - - @Override - public boolean isContinuable() { - return true; - } - - @Override - public Block continueBlock(Line line) { - if (closed) - return null; - text += "\n" + line.body; - if (line.text.contains("-->")) - closed = true; - return this; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - return parseDown.lineElements(text, nonNestables); - } - - @Override - public String toString() { - return "BlockComment{" + - "text='" + text + '\'' + - '}'; - } - } - - public static class BlockFencedCode extends Block { - public final char marker; - public final int openerLength; - public final String infoString; - public String text = ""; - public boolean complete = false; - - public BlockFencedCode(char marker, int openerLength, String infoString) { - this.marker = marker; - this.openerLength = openerLength; - this.infoString = infoString; - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - char marker = line.text.charAt(0); - int openerLength = startSpan(line.text, marker); - if (openerLength < 3) - return null; - String infoString = line.text.substring(openerLength).trim(); - if (infoString.contains("`")) - return null; - return new BlockFencedCode(marker, openerLength, infoString); - } - - @Override - public boolean isContinuable() { - return true; - } - - @Override - public Block continueBlock(Line line) { - if (complete) - return null; - while (interrupted > 0) { - text += "\n"; - interrupted--; - } - int len = startSpan(line.text, marker); - if (len >= openerLength && line.text.substring(len).trim().isEmpty()) { - if (!text.isEmpty()) - text = text.substring(1); - complete = true; - return this; - } - text += "\n" + line.body; - return this; - } - - @Override - public boolean isCompletable() { - return true; - } - - @Override - public Block completeBlock() { - return this; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - return parseDown.lineElements(text, nonNestables); - } - - @Override - public String toString() { - return "BlockFencedCode{" + - "infoString='" + infoString + '\'' + - ", text='" + text + '\'' + - '}'; - } - } - - public static class BlockHeader extends Block { - public final int level; - public final String line; - - public BlockHeader(int level, String line) { - this.level = level; - this.line = line; - this.autoBreak = true; - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - int level = startSpan(line.text, '#'); - if (level > 6) - return null; - - String text = line.text.substring(level); - if (parseDown.strictMode && !text.isEmpty() && text.charAt(0) != ' ') - return null; - text = text.trim(); - - return new BlockHeader(level, text); - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - return parseDown.lineElements(line, nonNestables); - } - - @Override - public String toString() { - return "BlockHeader{" + - "level=" + level + - ", line='" + line + '\'' + - '}'; - } - } - - public class BlockList extends Block { - public int indent; - public String pattern; - public boolean loose = false; - - public boolean ordered; - public String marker; - public String markerType; - public String markerTypeRegex; - - public LinkedList<String> lines = new LinkedList<>(); - - public BlockList() { - autoBreak = true; - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - boolean ordered; - String pattern; - if (Character.isDigit(line.text.charAt(0))) { - ordered = true; // ol - pattern = "[0-9]{1,9}+[.\\)]"; - } else { - ordered = false; // ul - pattern = "[*+-]"; - } - Matcher m = Pattern.compile("^(" + pattern + "([ ]++|$))(.*+)").matcher(line.text); - if (m.find()) { - String marker = m.group(1); - String body = m.group(3); - - int contentIndent = m.group(2).length(); - if (contentIndent >= 5) { - contentIndent--; - marker = marker.substring(0, -contentIndent); - while (contentIndent > 0) { - body = " " + body; - contentIndent--; - } - } else if (contentIndent == 0) { - marker += " "; - } - String markerWithoutWhitespace = marker.substring(0, marker.indexOf(' ')); - - BlockList b = parseDown.new BlockList(); - b.indent = line.indent; - b.pattern = pattern; - b.ordered = ordered; - b.marker = marker; - b.markerType = !ordered ? - markerWithoutWhitespace : - markerWithoutWhitespace.substring(markerWithoutWhitespace.length() - 1, markerWithoutWhitespace.length()); - b.markerTypeRegex = Pattern.quote(b.markerType); - - b.lines.add(body); - - return b; - } else - return null; - } - - @Override - public boolean isContinuable() { - return true; - } - - @Override - public Block continueBlock(Line line) { - if (interrupted > 0 && lines.isEmpty()) - return null; - - int requiredIndent = indent + marker.length(); - Matcher m; - if (line.indent < requiredIndent && ( - (ordered && (m = Pattern.compile("^[0-9]++" + markerTypeRegex + "(?:[ ]++(.*)|$)").matcher(line.text)).find()) || - (!ordered && (m = Pattern.compile("^" + markerTypeRegex + "(?:[ ]++(.*)|$)").matcher(line.text)).find()) - )) { - if (interrupted > 0) { - lines.add(""); - loose = true; - interrupted = 0; - } - String text = m.group(1) != null ? m.group(1) : ""; - indent = line.indent; - lines.add(text); - return this; - } else if (line.indent < requiredIndent && BlockList.startBlock(JParseDown.this, line, null) != null) { - return null; - } - - if (line.text.charAt(0) == '[' && BlockReference.startBlock(JParseDown.this, line, null) != null) { - return this; - } - - if (line.indent >= requiredIndent) { - if (interrupted > 0) { - lines.add(""); - loose = true; - interrupted = 0; - } - String text = line.body.substring(requiredIndent); - lines.add(text); - return this; - } - - if (interrupted == 0) { - String text = line.body.replaceAll("^[ ]{0," + requiredIndent + "}+", ""); - lines.add(text); - return this; - } - - return null; - } - - @Override - public boolean isCompletable() { - return true; - } - - @Override - public Block completeBlock() { - if (loose) { - if (!lines.getLast().isEmpty()) - lines.add(""); - } - return this; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - LinkedList<Inline> inlines = new LinkedList<>(); - for (String line : lines) { - if (!inlines.isEmpty()) - inlines.add(new InlineLineBreak()); - inlines.addAll(parseDown.lineElements(line, nonNestables)); - } - return inlines; - } - - @Override - public String toString() { - return "BlockList{" + - "lines=[" + String.join(", ", lines) + - "]}"; - } - } - - public static class BlockQuote extends Block { - public final LinkedList<String> lines = new LinkedList<>(); - - public BlockQuote(String text) { - if (text != null) - lines.add(text); - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - Matcher m; - if ((m = Pattern.compile("^>[ ]?+(.*+)").matcher(line.text)).find()) { - return new BlockQuote(m.group(1)); - } else - return null; - } - - @Override - public boolean isContinuable() { - return true; - } - - @Override - public Block continueBlock(Line line) { - if (interrupted > 0) - return null; - Matcher m; - if (line.text.charAt(0) == '>' && (m = Pattern.compile("^>[ ]?+(.*+)").matcher(line.text)).find()) { - lines.add(m.group(1)); - return this; - } - if (interrupted == 0) { - lines.add(line.text); - return this; - } - return null; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - LinkedList<Inline> inlines = new LinkedList<>(); - for (String line : lines) { - if (!inlines.isEmpty()) - inlines.add(new InlineLineBreak()); - inlines.addAll(parseDown.lineElements(line, nonNestables)); - } - return inlines; - } - - @Override - public String toString() { - return "BlockQuote{" + - "lines=[" + String.join(", ", lines) + - "]}"; - } - } - - public static class BlockRule { - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - char marker = line.text.charAt(0); - int count = startSpan(line.text, marker); - if (count >= 3 && line.text.trim().length() == count) { - return new BlockHorizontalRule(); - } else - return null; - } - } - - public static class BlockHorizontalRule extends Block { - public BlockHorizontalRule() { - autoBreak = true; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - return Collections.singletonList(new InlineHorizontalRule()); - } - - @Override - public String toString() { - return "BlockHorizontalRule{}"; - } - } - - public static class InlineLineBreak extends Inline { - @Override - public String toString() { - return "InlineLineBreak{}"; - } - } - - public static class InlineHorizontalRule extends Inline { - @Override - public String toString() { - return "InlineHorizontalRule{}"; - } - } - - public static String regexHtmlAttribute = "[a-zA-Z_:][\\w:.-]*+(?:\\s*+=\\s*+(?:[^\"\\'=<>`\\s]+|\"[^\"]*+\"|\\'[^\\']*+\\'))?+"; - - public static class BlockReference extends Block { - public final String id; - public final ReferenceData data; - - public BlockReference(String id, ReferenceData data) { - this.id = id; - this.data = data; - } - - public static Block startBlock(JParseDown parseDown, Line line, Block block) { - Matcher m; - if (line.text.indexOf(']') >= 0 && (m = Pattern.compile("^\\[(.+?)\\]:[ ]*+<?(\\S+?)>?(?:[ ]+[\"\\'(](.+)[\"\\')])?[ ]*+$").matcher(line.text)).find()) { - String id = m.group(1).toLowerCase(); - ReferenceData data = new ReferenceData(parseDown.convertUrl(m.group(2)), m.group(3)); - parseDown.referenceDefinitions.put(id, data); - return new BlockReference(id, data); - } else - return null; - } - - @Override - public Collection<Inline> inline(JParseDown parseDown) { - return Collections.emptyList(); - } - - @Override - public String toString() { - return "BlockReference{" + - "id='" + id + '\'' + - '}'; - } - } - - public abstract static class Inline extends Component { - public int extent; - public int position = -1; - - public Inline() { - } - - public Inline setExtent(String s) { - this.extent = s.length(); - return this; - } - - public Inline setExtent(int len) { - this.extent = len; - return this; - } - } - - public static class InlineText extends Inline { - public final String text; - - public InlineText(String text) { - this.text = text; - } - - public static Collection<Inline> inline(JParseDown parseDown, String text, String context) { - return replaceAllElements( - parseDown.breaksEnabled ? "[ ]*+\\n" : "(?:[ ]*+\\\\|[ ]{2,}+)\\n", - new Inline[]{ - new InlineLineBreak() - }, - text, - t -> { - InlineText inlineText = new InlineText(text); - inlineText.setExtent(text); - return inlineText; - }).stream().filter(inline -> !(inline instanceof InlineText) || !((InlineText) inline).text.isEmpty()) - .collect(Collectors.toList()); - } - - @Override - public String toString() { - return "InlineText{" + - "text='" + text + '\'' + - '}'; - } - } - - public static class InlineCode extends Inline { - public final String text; - - public InlineCode(String text) { - this.text = text; - } - - public static Inline inline(JParseDown parseDown, String text, String context) { - char marker = text.charAt(0); - Pattern regex = Pattern.compile("^([" + marker + "]++)[ ]*+(.+?)[ ]*+(?<![" + marker + "])\\1(?!" + marker + ")", Pattern.DOTALL); - Matcher m = regex.matcher(text); - if (m.find()) { - text = m.group(2).replaceAll("[ ]*+\\n", " "); - return new InlineCode(text).setExtent(m.group(0)); - } else - return null; - } - - @Override - public String toString() { - return "InlineCode{" + - "text='" + text + '\'' + - '}'; - } - } - - public static class InlineEmailTag extends Inline { - public final String url; - - public InlineEmailTag(String url) { - this.url = url; - } - - public static Inline inline(JParseDown parseDown, String text, String context) { - if (text.indexOf('>') < 0) - return null; - String hostnameLabel = "[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?"; - String commonMarkEmail = "[a-zA-Z0-9.!#$%&\\'*+\\/=?^_`{|}~-]++@" - + hostnameLabel + "(?:\\." + hostnameLabel + ")*"; - - Matcher m = Pattern.compile("^<((mailto:)?" + commonMarkEmail + ")>", Pattern.CASE_INSENSITIVE).matcher(text); - if (m.find()) { - String url = m.group(1); - return new InlineEmailTag(url).setExtent(m.group(0)); - } else - return null; - } - - @Override - public String toString() { - return "InlineEmailTag{" + - "url='" + url + '\'' + - '}'; - } - } - - public static Pattern[] strongRegex = { - Pattern.compile("^[*]{2}((?:\\\\\\*|[^*]|[*][^*]*+[*])+?)[*]{2}(?![*])", Pattern.DOTALL), - Pattern.compile("^__((?:\\\\_|[^_]|_[^_]*+_)+?)__(?!_)", Pattern.DOTALL | Pattern.UNICODE_CHARACTER_CLASS), - }; - - public static Pattern[] emRegex = { - Pattern.compile("^[*]((?:\\\\\\ |
