• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Moxkiriyaプロジェクト事前開発用の作業部屋


Commit MetaInfo

Revision6fdbb9035a145682d848f15a12331b99b02892b0 (tree)
Zeit2018-08-21 06:40:32
AutorHarold_Andoh <andolloyd@gmai...>
CommiterHarold_Andoh

Log Message

[Moxkiriya7]

  • 内部リンクにtextNodeを指定し表示する処理を追加
  • 画像リンクにalt属性、title属性を付加する処理を追加

Ändern Zusammenfassung

Diff

--- a/src/com/wiki/standalone/moxkiriya/parser/inlineparser/WikiInternalLinkInlineParser.java
+++ b/src/com/wiki/standalone/moxkiriya/parser/inlineparser/WikiInternalLinkInlineParser.java
@@ -41,6 +41,8 @@ public class WikiInternalLinkInlineParser extends WikiInlineParserBase {
4141
4242 private static final String PANGENAME_PREFIX_COLONFILE = ":File:";
4343
44+ private static final String PAGENAME_HASH_TITLE = "#title";
45+
4446 /** リンク先のページ名 */
4547 private String pagename_;
4648
@@ -98,7 +100,13 @@ public class WikiInternalLinkInlineParser extends WikiInlineParserBase {
98100 buf.append(IMAGE_START_TAG);
99101 buf.append("\"");
100102 buf.append(file.toURI().toURL());
101- buf.append("\">");
103+ buf.append("\"");
104+ buf.append(" alt=\"");
105+ buf.append(textNode);
106+ buf.append("\"");
107+ buf.append(" title=\"");
108+ buf.append(textNode);
109+ buf.append("\" >");
102110 buf.append(IMAGE_END_TAG);
103111 } catch (Exception e) {
104112 e.printStackTrace();
@@ -159,9 +167,23 @@ public class WikiInternalLinkInlineParser extends WikiInlineParserBase {
159167
160168 @Override
161169 public String deleteWikiToken(String line) {
162- String deleteTop = line.replaceFirst(Pattern.quote(WIKI_TOKEN_START), "");
163- pagename_ = deleteTop.substring(0, deleteTop.lastIndexOf(WIKI_TOKEN_END));
164- return pagename_;
170+ String deleteTop = line.replaceFirst(Pattern.quote(WIKI_TOKEN_START), "");
171+ String deleteToken = deleteTop.substring(0, deleteTop.lastIndexOf(WIKI_TOKEN_END));
172+ String textNode = deleteToken;
173+
174+ if(deleteToken.contains("|") == true) {
175+ pagename_ = deleteToken.substring(0, deleteToken.indexOf("|"));
176+ textNode = deleteToken.substring(deleteToken.indexOf("|") + "|".length());
177+
178+ if(textNode.equals(PAGENAME_HASH_TITLE) == true) {
179+ textNode = pagename_.substring(pagename_.lastIndexOf(".") + ".".length());
180+ }
181+ }
182+ else {
183+ pagename_ = deleteToken;
184+ }
185+
186+ return textNode;
165187 }
166188
167189 @Override