index++ ;
}
output += "_" ;
} ;
output += "" ;
}
else if (bold && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
// plain text or a > that isn't part of a link
//
} else {
bold = false;
output += "";
}
else {
output += "*" ;
} ;
} else if (textBlocks.get(index).matches("_")) {
TagType tagType = tagType(textBlocks, index) ;
TagType tagType = tagType(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1) {
// ClosingTag() makes sure tags aren't opened multiple times in a row.
bold = true ;
linkText = convertAmpChars(linkText) ;
//
<<<<<<< HEAD
// if ($linkText =~ /^(?:mailto\:)?((?:[a-z0-9\-_]+\.)*[a-z0-9\-_]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4})$/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(.+?) at (?:mailto\:)?((?:[a-z0-9\-_]+\.)*[a-z0-9\-_]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4})$/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(?:http|https|ftp|news|file)\:/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(.+?) at ((?:http|https|ftp|news|file)\:.+)/i)
// { $output .= ''; }
// else
// { $output .= ''; };
{
output += String.format("", linkText, linkText, linkText) ;
}
} else { // it's not a link.
output += "<" ;
}
} else if (textBlocks.get(index).matches("~")) {
TagType tagType = tagType(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1) {
// ClosingTag() makes sure tags aren't opened multiple times in a row.
bold = true ;
output += "" ;
}
else if (bold && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
bold = false;
output += "";
}
else {
output += "~" ;
} ;
} else if (textBlocks.get(index).matches("\\*")) {
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1)
{
// ClosingTag() makes sure tags aren't opened multiple times in a row.
underline = true ;
// underlineHasWhitespace is set by ClosingTag().
output += "";
}
else if (underline && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
underline = false ;
// underlineHasWhitespace will be reset by the next opening underline.
output += "";
}
else if (underline && !underlineHasWhitespace)
{
// If there's no whitespace between underline tags, all underscores are replaced by spaces so
Tuple closingTagTuple = closingTag(textBlocks, index) ;
output += convertAmpChars(textBlocks.get(index)) ;
} ;
TagType tagType = tagType(textBlocks, index) ;
// _some_underlined_text_ becomes some underlined text. The standard _some underlined text_
// will work too.
output += " " ;
}
else
{
output += "_" ;
} ;
// plain text or a > that isn't part of a link
//
} else {
// fLog.debug(ILogLevel.LEVEL_MID, "ricFormatTextBlock: end") ;
// fLog.debug(ILogLevel.LEVEL_MID, "------------------------------------") ;
// fLog.debug(ILogLevel.LEVEL_MID, output) ;
// fLog.debug(ILogLevel.LEVEL_MID, "------------------------------------") ;
return output ;
}
=======
// if ($linkText =~ /^(?:mailto\:)?((?:[a-z0-9\-_]+\.)*[a-z0-9\-_]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4})$/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(.+?) at (?:mailto\:)?((?:[a-z0-9\-_]+\.)*[a-z0-9\-_]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4})$/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(?:http|https|ftp|news|file)\:/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(.+?) at ((?:http|https|ftp|news|file)\:.+)/i)
// { $output .= ''; }
// else
// { $output .= ''; };
{
output += String.format("", linkText, linkText, linkText) ;
}
} else { // it's not a link.
output += "<" ;
}
} else if (textBlocks.get(index).matches("~")) {
TagType tagType = tagType(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1) {
// ClosingTag() makes sure tags aren't opened multiple times in a row.
bold = true ;
output += "" ;
}
else if (bold && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
bold = false;
output += "";
}
else {
output += "~" ;
} ;
} else if (textBlocks.get(index).matches("\\*")) {
TagType tagType = tagType(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1) {
// ClosingTag() makes sure tags aren't opened multiple times in a row.
bold = true ;
output += "" ;
}
else if (bold && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
bold = false;
output += "";
}
else {
output += "*" ;
} ;
} else if (textBlocks.get(index).matches("_")) {
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1)
{
// ClosingTag() makes sure tags aren't opened multiple times in a row.
underline = true ;
// underlineHasWhitespace is set by ClosingTag().
output += "";
}
else if (underline && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
underline = false ;
// underlineHasWhitespace will be reset by the next opening underline.
output += "";
}
else if (underline && !underlineHasWhitespace)
{
// If there's no whitespace between underline tags, all underscores are replaced by spaces so
// _some_underlined_text_ becomes some underlined text. The standard _some underlined text_
// will work too.
output += " " ;
}
else
{
output += convertAmpChars(textBlocks.get(index)) ;
} ;
index++ ;
}
// fLog.debug(ILogLevel.LEVEL_MID, "ricFormatTextBlock: end") ;
// fLog.debug(ILogLevel.LEVEL_MID, "------------------------------------") ;
// fLog.debug(ILogLevel.LEVEL_MID, output) ;
// fLog.debug(ILogLevel.LEVEL_MID, "------------------------------------") ;
return output ;
}
>>>>>>> 6366cce2880d7c2f9688f9ad1d8ffeeb89466c32
//
Solution content
linkText = convertAmpChars(linkText) ;
//
// fLog.debug(ILogLevel.LEVEL_MID, output) ;
// fLog.debug(ILogLevel.LEVEL_MID, "ricFormatTextBlock: end") ;
// fLog.debug(ILogLevel.LEVEL_MID, "------------------------------------") ;
// if ($linkText =~ /^(?:mailto\:)?((?:[a-z0-9\-_]+\.)*[a-z0-9\-_]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4})$/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(.+?) at (?:mailto\:)?((?:[a-z0-9\-_]+\.)*[a-z0-9\-_]+@(?:[a-z0-9\-]+\.)+[a-z]{2,4})$/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(?:http|https|ftp|news|file)\:/i)
// { $output .= ''; }
// elsif ($linkText =~ /^(.+?) at ((?:http|https|ftp|news|file)\:.+)/i)
// { $output .= ''; }
// else
// { $output .= ''; };
{
output += String.format("", linkText, linkText, linkText) ;
}
} else { // it's not a link.
output += "<" ;
}
} else if (textBlocks.get(index).matches("~")) {
TagType tagType = tagType(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1) {
// ClosingTag() makes sure tags aren't opened multiple times in a row.
bold = true ;
output += "" ;
}
else if (bold && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
bold = false;
output += "";
}
else {
output += "~" ;
} ;
} else if (textBlocks.get(index).matches("\\*")) {
TagType tagType = tagType(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1) {
// ClosingTag() makes sure tags aren't opened multiple times in a row.
bold = true ;
output += "" ;
}
else if (bold && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
bold = false;
output += "";
}
else {
output += "*" ;
} ;
} else if (textBlocks.get(index).matches("_")) {
TagType tagType = tagType(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_OPENING_TAG && closingTagTuple.first() != -1)
{
// ClosingTag() makes sure tags aren't opened multiple times in a row.
underline = true ;
// underlineHasWhitespace is set by ClosingTag().
output += "";
}
else if (underline && tagType == TagType.POSSIBLE_CLOSING_TAG)
{
underline = false ;
// underlineHasWhitespace will be reset by the next opening underline.
output += "";
}
else if (underline && !underlineHasWhitespace)
{
// If there's no whitespace between underline tags, all underscores are replaced by spaces so
// _some_underlined_text_ becomes some underlined text. The standard _some underlined text_
// will work too.
output += " " ;
}
else
{
output += "_" ;
} ;
// plain text or a > that isn't part of a link
//
} else {
output += convertAmpChars(textBlocks.get(index)) ;
} ;
index++ ;
}
// fLog.debug(ILogLevel.LEVEL_MID, "------------------------------------") ;
return output ;
}
//
File
DocCommentParser.java
Developer's decision
Version 1
Kind of conflict
Comment
If statement
Method invocation
Return statement
Variable
Chunk
Conflicting content
//
else if ( ( textBlocks.get(index).matches("^[\\*_\\>~]$")) &&
<<<<<<< HEAD
// // After it must be whitespace, the end of the text, or )}].,!?"';:-/*_.
// ( $index + 1 == scalar @$textBlocks || $textBlocks->[$index+1] =~ /^[ \t\n\)\]\}\.\,\!\?\"\'\;\:\-\/\*\_]/ ||
// # Links also get plurals, like s, es, 's, and '.
// ( $textBlocks->[$index] eq '>' && $textBlocks->[$index+1] =~ /^(?:es|s|\')/ ) ) &&
( index+1 == textBlocks.size() || textBlocks.get(index+1).matches("^[ \\t\\n\\)\\]\\}\\.\\,\\!\\?\"\'\\;\\:\\-\\/\\*\\_].*")) &&
=======
// // After it must be whitespace, the end of the text, or )}].,!?"';:-/*_.
// ( $index + 1 == scalar @$textBlocks || $textBlocks->[$index+1] =~ /^[ \t\n\)\]\}\.\,\!\?\"\'\;\:\-\/\*\_]/ ||
// # Links also get plurals, like s, es, 's, and '.
// ( $textBlocks->[$index] eq '>' && $textBlocks->[$index+1] =~ /^(?:es|s|\')/ ) ) &&
( index+1 == textBlocks.size() || textBlocks.get(index+1).matches("^[ \\t\\n\\)\\]\\}\\.\\,\\!\\?\"\'\\;\\:\\-\\/\\*\\_].*")) &&
>>>>>>> 6366cce2880d7c2f9688f9ad1d8ffeeb89466c32
// Notes for 2.0: Include closing quotes (99) and apostrophes (9). Look into Unicode character classes as well.
Solution content
//
else if ( ( textBlocks.get(index).matches("^[\\*_\\>~]$")) &&
// // After it must be whitespace, the end of the text, or )}].,!?"';:-/*_.
// ( $index + 1 == scalar @$textBlocks || $textBlocks->[$index+1] =~ /^[ \t\n\)\]\}\.\,\!\?\"\'\;\:\-\/\*\_]/ ||
// # Links also get plurals, like s, es, 's, and '.
// ( $textBlocks->[$index] eq '>' && $textBlocks->[$index+1] =~ /^(?:es|s|\')/ ) ) &&
( index+1 == textBlocks.size() || textBlocks.get(index+1).matches("^[ \\t\\n\\)\\]\\}\\.\\,\\!\\?\"\'\\;\\:\\-\\/\\*\\_].*")) &&
// Notes for 2.0: Include closing quotes (99) and apostrophes (9). Look into Unicode character classes as well.
File
DocCommentParser.java
Developer's decision
Version 1
Kind of conflict
Comment
Method invocation
Variable
Chunk
Conflicting content
// becomes the new link opening.
if (closingTag.equals("\\>"))
{
return result ;
}
if (textBlocks.get(index).matches("\\<") && tagType(textBlocks, index) == TagType.POSSIBLE_OPENING_TAG) {
// hasWhitespaceRef if it was specified. If the tag is not closed, it returns -1 and doesn't touch the variable pointed to by
// hasWhitespaceRef.
//
<<<<<<< HEAD
// If the tag is closed, it returns the index of the closing tag and puts whether there was whitespace between the tags in
// hasWhitespaceRef if it was specified. If the tag is not closed, it returns -1 and doesn't touch the variable pointed to by
// hasWhitespaceRef.
//
Tuple closingTag(ArrayList textBlocks, int index) {
Tuple result = new Tuple(-1,false) ;
try {
boolean hasWhitespace = false ;
String closingTag = null ;
if (textBlocks.get(index).matches("\\*"))
{ closingTag = ("\\*") ; }
else if(textBlocks.get(index).matches("~"))
{ closingTag = textBlocks.get(index) ; }
else if(textBlocks.get(index).matches("_"))
{ closingTag = textBlocks.get(index) ; }
else if (textBlocks.get(index).matches("\\<"))
{ closingTag = "\\>" ; }
else
{
return result ;
} ;
int beginningIndex = index ;
index++ ;
while (index < textBlocks.size())
{
// If we hit a < and we're checking whether a link is closed, it's not. The first < becomes literal and the second one
// becomes the new link opening.
if (closingTag.equals("\\>"))
{
return result ;
}
// If we're not searching for the end of a link, we have to skip the link because formatting tags cannot appear within
// them. That's of course provided it's closed.
else
{
// boolean linkHasWhitespace;
// int $endIndex = $self->ClosingTag($textBlocks, $index,
// ($hasWhitespaceRef && !$hasWhitespace ? \$linkHasWhitespace : undef) );
// int $endIndex = closingTag(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
int endIndex = closingTagTuple.first() ;
boolean linkHasWhitespace = closingTagTuple.second() ;
if (endIndex != -1) {
if (linkHasWhitespace)
{ hasWhitespace = true ; };
while (index < textBlocks.size())
{
// index will be incremented again at the end of the loop, which will bring us past the link's >.
index = endIndex;
}
}
if (textBlocks.get(index).matches("\\<") && tagType(textBlocks, index) == TagType.POSSIBLE_OPENING_TAG) {
// If we hit a < and we're checking whether a link is closed, it's not. The first < becomes literal and the second one
} else if (textBlocks.get(index).matches(closingTag)) {
} else if (textBlocks.get(index).matches(closingTag)) {
TagType tagType = tagType(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_CLOSING_TAG) {
// There needs to be something between the tags for them to count.
if (index == beginningIndex + 1) {
return result ;
}
else {
// Success!
//
result.setFirst(index) ;
result.setSecond(hasWhitespace) ;
}
// If there are two opening tags of the same type, the first becomes literal and the next becomes part of a tag.
//
} else if (tagType == TagType.POSSIBLE_OPENING_TAG) {
return result ;
}
} else if (!result.second()) {
if (textBlocks.get(index).matches("[ \t\n]")) {
result.setSecond(true) ;
}
}
index++;
} ;
}
catch (Exception e){
fLog.error("Exception caught looking for closing tag", e) ;
}
// Hit the end of the text blocks if we're here.
return result ;
}
=======
Tuple closingTag(ArrayList textBlocks, int index) {
Tuple result = new Tuple(-1,false) ;
try {
boolean hasWhitespace = false ;
String closingTag = null ;
if (textBlocks.get(index).matches("\\*"))
{ closingTag = ("\\*") ; }
else if(textBlocks.get(index).matches("~"))
{ closingTag = textBlocks.get(index) ; }
else if(textBlocks.get(index).matches("_"))
{ closingTag = textBlocks.get(index) ; }
else if (textBlocks.get(index).matches("\\<"))
{ closingTag = "\\>" ; }
else
{
return result ;
} ;
int beginningIndex = index ;
index++ ;
// If we're not searching for the end of a link, we have to skip the link because formatting tags cannot appear within
// them. That's of course provided it's closed.
else
{
// boolean linkHasWhitespace;
// int $endIndex = $self->ClosingTag($textBlocks, $index,
// ($hasWhitespaceRef && !$hasWhitespace ? \$linkHasWhitespace : undef) );
// int $endIndex = closingTag(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
int endIndex = closingTagTuple.first() ;
boolean linkHasWhitespace = closingTagTuple.second() ;
if (endIndex != -1) {
if (linkHasWhitespace)
{ hasWhitespace = true ; };
// index will be incremented again at the end of the loop, which will bring us past the link's >.
index = endIndex;
}
}
TagType tagType = tagType(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_CLOSING_TAG) {
// There needs to be something between the tags for them to count.
if (index == beginningIndex + 1) {
return result ;
}
else {
// Success!
//
result.setFirst(index) ;
result.setSecond(hasWhitespace) ;
}
// If there are two opening tags of the same type, the first becomes literal and the next becomes part of a tag.
//
} else if (tagType == TagType.POSSIBLE_OPENING_TAG) {
return result ;
}
} else if (!result.second()) {
if (textBlocks.get(index).matches("[ \t\n]")) {
result.setSecond(true) ;
}
}
index++;
} ;
}
catch (Exception e){
fLog.error("Exception caught looking for closing tag", e) ;
}
// Hit the end of the text blocks if we're here.
return result ;
}
>>>>>>> 6366cce2880d7c2f9688f9ad1d8ffeeb89466c32
// ###############################################################################
// #
Solution content
// Hit the end of the text blocks if we're here.
return result ;
}
// ###############################################################################
// hasWhitespaceRef if it was specified. If the tag is not closed, it returns -1 and doesn't touch the variable pointed to by
// hasWhitespaceRef.
//
Tuple closingTag(ArrayList textBlocks, int index) {
Tuple result = new Tuple(-1,false) ;
try {
boolean hasWhitespace = false ;
String closingTag = null ;
if (textBlocks.get(index).matches("\\*"))
{ closingTag = ("\\*") ; }
else if(textBlocks.get(index).matches("~"))
{ closingTag = textBlocks.get(index) ; }
else if(textBlocks.get(index).matches("_"))
{ closingTag = textBlocks.get(index) ; }
else if (textBlocks.get(index).matches("\\<"))
{ closingTag = "\\>" ; }
else
{
return result ;
} ;
int beginningIndex = index ;
index++ ;
while (index < textBlocks.size())
{
if (textBlocks.get(index).matches("\\<") && tagType(textBlocks, index) == TagType.POSSIBLE_OPENING_TAG) {
// If we hit a < and we're checking whether a link is closed, it's not. The first < becomes literal and the second one
// becomes the new link opening.
if (closingTag.equals("\\>"))
{
return result ;
}
// If we're not searching for the end of a link, we have to skip the link because formatting tags cannot appear within
// them. That's of course provided it's closed.
else
{
// boolean linkHasWhitespace;
// int $endIndex = $self->ClosingTag($textBlocks, $index,
// ($hasWhitespaceRef && !$hasWhitespace ? \$linkHasWhitespace : undef) );
// int $endIndex = closingTag(textBlocks, index) ;
Tuple closingTagTuple = closingTag(textBlocks, index) ;
int endIndex = closingTagTuple.first() ;
boolean linkHasWhitespace = closingTagTuple.second() ;
if (endIndex != -1) {
if (linkHasWhitespace)
{ hasWhitespace = true ; };
// index will be incremented again at the end of the loop, which will bring us past the link's >.
index = endIndex;
}
}
} else if (textBlocks.get(index).matches(closingTag)) {
TagType tagType = tagType(textBlocks, index) ;
if (tagType == TagType.POSSIBLE_CLOSING_TAG) {
// There needs to be something between the tags for them to count.
if (index == beginningIndex + 1) {
return result ;
}
else {
// Success!
//
result.setFirst(index) ;
result.setSecond(hasWhitespace) ;
// #
}
// If there are two opening tags of the same type, the first becomes literal and the next becomes part of a tag.
//
} else if (tagType == TagType.POSSIBLE_OPENING_TAG) {
return result ;
}
} else if (!result.second()) {
if (textBlocks.get(index).matches("[ \t\n]")) {
result.setSecond(true) ;
}
}
index++;
} ;
}
catch (Exception e){
fLog.error("Exception caught looking for closing tag", e) ;
}