From 726314a77a2138f8d6bca200af9972e006f43311 Mon Sep 17 00:00:00 2001 From: rsiddharth Date: Tue, 26 Jun 2012 22:06:51 +0530 Subject: conversion/FileSieve.java: modified the regex to ignore backup file (#*#). parsers/Footer.java: Aesthetic modification. parsers/Header.java: add "meta" tags for the html output, mainly for compliance sake. I have also re-arranged the html tags a bit -- the "back button" is now the last thing in the
block. parsers/Images.java (bug-fix): The regex had small precisely deducting images, so the regex was slightly modified to make all work properly. There was another significant change made to the way the image tag is created -- "alt" is mandatory now, even if the markup doesn't give a "alt" for the tag, a default "alt" is created -- the image-file-name. parsers/Links.java: From now on, the links generated will not have 'target="_blank"`, I felt that the reader must choose whether to open the link in a new window/tab, so the change. Period. In the last revision, link description was made optional in the link mark-up, the regex was slightly erroneous, I rectified it. parsers/Paragraphs.java: As of this revision, the

generation is still rough around the edges, I need to smoothen it in future revisions. parsers/ParserList.java: Order of parser list was modified -- now, Paragraphs comes before Headings, it was the reverse before. --- parsers/Links.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'parsers/Links.java') diff --git a/parsers/Links.java b/parsers/Links.java index 87e4109..0253846 100644 --- a/parsers/Links.java +++ b/parsers/Links.java @@ -4,10 +4,10 @@ import java.util.regex.*; public class Links implements Parser { // set of strings to build the html link - private String openTag = ""; + private String openTag = ""; private String closeTag = ""; public String parse(String fileContent) { - Pattern pattern = Pattern.compile("\\[\\[(.+?)(\\|(.+?))\\]\\]", Pattern.DOTALL); + Pattern pattern = Pattern.compile("\\[\\[(.+?)(\\|(.+?))?\\]\\]", Pattern.DOTALL); Matcher matcher = pattern.matcher(fileContent); StringBuffer sbuffer = new StringBuffer(); StringBuilder replacementString = new StringBuilder(); @@ -20,6 +20,9 @@ public class Links implements Parser { if(matcher.group(3)!=null) { replacementString.append(matcher.group(3)); } + else { + replacementString.append(matcher.group(1)); + } // close the tag replacementString.append(closeTag); matcher.appendReplacement(sbuffer,replacementString.toString()); -- cgit v1.2.3