Moxkiriyaプロジェクト事前開発用の作業部屋
Revision | eb27190d0749569aa031ee382caf84fc6794ce10 (tree) |
---|---|
Time | 2018-08-30 22:09:41 |
Author | Harold_Andoh <andolloyd@gmai...> |
Commiter | Harold_Andoh |
[Moxkiriya7]
@@ -43,29 +43,7 @@ public class WikiBoldInlineParser extends WikiInlineParserBase { | ||
43 | 43 | .matcher(line); |
44 | 44 | |
45 | 45 | if(startMatcher.find() == true) { |
46 | - /* | |
47 | - * PATTERN_STARTの開始位置を取得 | |
48 | - */ | |
49 | - int startIndex = startMatcher.start(); | |
50 | - | |
51 | - /* | |
52 | - * PATTERN_ENDの開始位置を取得 | |
53 | - */ | |
54 | - String subline = line.substring(startIndex); | |
55 | - Matcher boldEndMatcher = Pattern.compile(WikiBoldInlineParser.PATTERN_END) | |
56 | - .matcher(subline); | |
57 | - Matcher italicEndMatcher = Pattern.compile(WikiBoldInlineParser.PATTERN_ITALIC_END) | |
58 | - .matcher(subline); | |
59 | - | |
60 | - if( (boldEndMatcher.find() == true) | |
61 | - && (italicEndMatcher.find() == true)) { | |
62 | - int boldEndIndex = boldEndMatcher.start(); | |
63 | - int italicEndIndex = italicEndMatcher.start(); | |
64 | - | |
65 | - isMatch = (boldEndIndex <= italicEndIndex) | |
66 | - ? true | |
67 | - : false; | |
68 | - } | |
46 | + isMatch = true; | |
69 | 47 | } |
70 | 48 | |
71 | 49 | return isMatch; |
@@ -84,7 +62,10 @@ public class WikiBoldInlineParser extends WikiInlineParserBase { | ||
84 | 62 | @Override |
85 | 63 | public String deleteWikiToken(String line) { |
86 | 64 | String deleteTop = line.replaceFirst(WIKI_TOKEN, ""); |
87 | - return deleteTop.substring(0, deleteTop.lastIndexOf(WIKI_TOKEN)); | |
65 | + if(deleteTop.contains(WIKI_TOKEN) == true) { | |
66 | + deleteTop = deleteTop.substring(0, deleteTop.lastIndexOf(WIKI_TOKEN)); | |
67 | + } | |
68 | + return deleteTop; | |
88 | 69 | } |
89 | 70 | |
90 | 71 | @Override |
@@ -107,6 +107,9 @@ public abstract class WikiInlineParserBase implements WikiInlineParser { | ||
107 | 107 | if(endMatcher.find() == true) { |
108 | 108 | matchString = startSub.substring(0, endMatcher.end()); |
109 | 109 | } |
110 | + else { | |
111 | + matchString = startSub; | |
112 | + } | |
110 | 113 | } |
111 | 114 | |
112 | 115 | if(matchString != null) { |
@@ -40,21 +40,7 @@ public class WikiItalicInlineParser extends WikiInlineParserBase { | ||
40 | 40 | .matcher(line); |
41 | 41 | |
42 | 42 | if(startMatcher.find() == true) { |
43 | - /* | |
44 | - * PATTERN_STARTの開始位置を取得 | |
45 | - */ | |
46 | - int startIndex = startMatcher.start(); | |
47 | - | |
48 | - /* | |
49 | - * PATTERN_ENDの開始位置を取得 | |
50 | - */ | |
51 | - String subline = line.substring(startIndex); | |
52 | - Matcher endMatcher = Pattern.compile(WikiItalicInlineParser.PATTERN_END) | |
53 | - .matcher(subline); | |
54 | - | |
55 | - if(endMatcher.find() == true) { | |
56 | - isMatch = true; | |
57 | - } | |
43 | + isMatch = true; | |
58 | 44 | } |
59 | 45 | |
60 | 46 | return isMatch; |
@@ -73,7 +59,10 @@ public class WikiItalicInlineParser extends WikiInlineParserBase { | ||
73 | 59 | @Override |
74 | 60 | public String deleteWikiToken(String line) { |
75 | 61 | String deleteTop = line.replaceFirst(WIKI_TOKEN, ""); |
76 | - return deleteTop.substring(0, deleteTop.lastIndexOf(WIKI_TOKEN)); | |
62 | + if(deleteTop.contains(WIKI_TOKEN) == true) { | |
63 | + deleteTop = deleteTop.substring(0, deleteTop.lastIndexOf(WIKI_TOKEN)); | |
64 | + } | |
65 | + return deleteTop; | |
77 | 66 | } |
78 | 67 | |
79 | 68 | @Override |