Launchpad comment parsing

Launchpad automatically parses and formats comment text, creating links to bugs, branches, and other resources when you use specific syntax patterns.

Whitespaces

Launchpad reduces any whitespace between non-whitespace characters to a single space, keeps whitespace to the left, and removes whitespace to the right.

Note

Technically Launchpad passes whitespace through and the browser just ignores the whitespace.

Examples

Input

Output

This sentence has varying amounts of whitespace between its words.

This sentence has varying amounts of whitespace between its words.

| Column 1   | Column 2 | Column 3    |
|------------+----------+-------------|
| Lorem      | ipsum    | dolor       |
| sit        | amet     | consectetur |
| adipiscing | elit     | sed         |
| Column 1 | Column 2 | Column 3 |
|------------+----------+-------------|
| Lorem | ipsum | dolor |
| sit | amet | consectetur |
| adipiscing | elit | sed |

Paragraphs

Multiple newline characters will be reduced to one.

Examples

Input

Output

Here are two paragraphs with lots of whitespace between them.




But they're still just two paragraphs
Here are two paragraphs with lots of whitespace between them.

But they're still just two paragraphs

Mention a single Launchpad bug

Use any of these patterns to link to a bug. These patterns are case-insensitive.

Patterns:

bug <LP-Bug-Number>
bug #<LP-Bug-Number>
bug number <LP-Bug-Number>
bug num <LP-Bug-Number>
bug num. <LP-Bug-Number>
bug no <LP-Bug-Number>
bug no. <LP-Bug-Number>
bug report <LP-Bug-Number>
bug-report <LP-Bug-Number>
bug-<LP-Bug-Number>
bug=<LP-Bug-Number>

Examples

Input

Output

bug 123

bug 123

bug    123

bug 123

bug #123

bug #123

bug number 123

bug number 123

bug number. 123

bug number. 123

bug num 123

bug num 123

bug num. 123

bug num. 123

bug no 123

bug no 123

bug report 123

bug report 123

bug no. 123

bug no. 123

bug#123

bug#123

bug-123

bug-123

bug-report-123

bug-report-123

bug=123

bug=123

debug #52

debug #52

Mention multiple Launchpad bugs

Use this pattern to link to multiple bugs. These patterns are case-insensitive. The amount of whitespace can be variable, but whitespace in other positions may prevent parsing.

Pattern:

LP: #<LP-Bug-Number>[, #<LP-Bug-Number>]...

Examples

Input

Output

LP: #1

LP: #1

(LP: #1)

(LP: #1

LP: #1, #2.

LP: #1, #2.

LP:
#1,
#2,
#3,
#4
LP:

lp: #1

lp: #1

(lp: #1)

(lp: #1

lp: #1, #2.

lp: #1, #2.

LP #1

LP #1

LP: #1 , #2

LP: #1 , #2

LP: #1, #2,

#3
LP: #1, #2,

1. 3

Mention a branch

Link to a Launchpad branch using the lp URI syntax. The lp: prefix will expand to https://bugs.launchpad.net/+code/. These patterns are case-insensitive.

Patterns:

lp:<Relative-URL>
lp:/<Relative-URL>
lp:///<Relative-URL>

Examples

Input

Output

lp:~foo/bar/baz

lp:~foo/bar/baz

lp:~foo/bar/bug-123

lp:~foo/bar/bug-123

lp:~foo/+junk/baz

lp:~foo/+junk/baz

lp:~foo/ubuntu/jaunty/evolution/baz

lp:~foo/ubuntu/jaunty/evolution/baz

lp:foo/bar

lp:foo/bar

lp:foo

lp:foo

lp:foo,

lp:foo,

lp:foo/bar.

lp:foo/bar.

lp:foo/bar/baz

lp:foo/bar/baz

lp:///foo

lp:///foo

lp:/foo

lp:///foo

Mention an FAQ thread

Link to a Launchpad FAQ thread by mentioning its number. These patterns are case-insensitive.

Patterns:

faq <faq-number>
faq #<faq-number>
faq-<faq-number>
faq=<faq-number>
faq item <faq-number>
faq number <faq-number>

Examples

Input

Output

faq 3041

faq 3041

faq #3041

faq #3041

faq-3041

faq-3041

faq=3041

faq=3041

faq item 3041

faq item 3041

faq  number  3041

faq number 3041

URIs

Launchpad automatically recognizes and links http, https, ftp, sftp, mailto, news, irc, and jabber URIs.

Not recognized: tel, urn, telnet, ldap URIs, relative URLs (e.g., example.com), and plain email addresses (e.g., test@example.com).

Examples

Input

Output

http://localhost:8086/bar/baz/foo.html

http://localhost:8086/bar/baz/foo.html

ftp://localhost:8086/bar/baz/foo.bar.html

ftp://localhost:8086/bar/baz/foo.bar.html

sftp://localhost:8086/bar/baz/foo.bar.html.

sftp://localhost:8086/bar/baz/foo.bar.html.

http://localhost:8086/bar/baz/foo.bar.html;

http://localhost:8086/bar/baz/foo.bar.html;

news://localhost:8086/bar/baz/foo.bar.html:

news://localhost:8086/bar/baz/foo.bar.html:

http://localhost:8086/bar/baz/foo.bar.html?

http://localhost:8086/bar/baz/foo.bar.html?

http://localhost:8086/bar/baz/foo.bar.html,

http://localhost:8086/bar/baz/foo.bar.html,

<http://localhost:8086/bar/baz/foo.bar.html>

<http://localhost:8086/bar/baz/foo.bar.html>

<http://localhost:8086/bar/baz/foo.bar.html>,

<http://localhost:8086/bar/baz/foo.bar.html>,

<http://localhost:8086/bar/baz/foo.bar.html>.

<http://localhost:8086/bar/baz/foo.bar.html>.

<http://localhost:8086/bar/baz/foo.bar.html>;

<http://localhost:8086/bar/baz/foo.bar.html>;

<http://localhost:8086/bar/baz/foo.bar.html>:

<http://localhost:8086/bar/baz/foo.bar.html>:

<http://localhost:8086/bar/baz/foo.bar.html>?

<http://localhost:8086/bar/baz/foo.bar.html>?

(http://localhost:8086/bar/baz/foo.bar.html)

(http://localhost:8086/bar/baz/foo.bar.html)

(http://localhost:8086/bar/baz/foo.bar.html),

(http://localhost:8086/bar/baz/foo.bar.html),

(http://localhost:8086/bar/baz/foo.bar.html).

(http://localhost:8086/bar/baz/foo.bar.html).

(http://localhost:8086/bar/baz/foo.bar.html);

(http://localhost:8086/bar/baz/foo.bar.html);

(http://localhost:8086/bar/baz/foo.bar.html):

(http://localhost:8086/bar/baz/foo.bar.html):

http://localhost/bar/baz/foo.bar.html?a=b&b=a

http://localhost/bar/baz/foo.bar.html?a=b&b=a

http://localhost/bar/baz/foo.bar.html?a=b&b=a.

http://localhost/bar/baz/foo.bar.html?a=b&b=a.

http://localhost/bar/baz/foo.bar.html?a=b&b=a,

http://localhost/bar/baz/foo.bar.html?a=b&b=a,

http://localhost/bar/baz/foo.bar.html?a=b&b=a;

http://localhost/bar/baz/foo.bar.html?a=b&b=a;

http://localhost/bar/baz/foo.bar.html?a=b&b=a:

http://localhost/bar/baz/foo.bar.html?a=b&b=a:

http://localhost/bar/baz/foo.bar.html?a=b&b=a:b;c@d_e%f~g#h,j!k-l+m$n*o'p

http://localhost/bar/baz/foo.bar.html?a=b&b=a:b;c@d_e%f~g#h,j!k-l+m$n*o’p

http://www.searchtools.com/test/urls/(parens).html

http://www.searchtools.com/test/urls/(parens).html

http://www.searchtools.com/test/urls/-dash.html

http://www.searchtools.com/test/urls/-dash.html

http://www.searchtools.com/test/urls/_underscore.html

http://www.searchtools.com/test/urls/_underscore.html

http://www.searchtools.com/test/urls/period.x.html

http://www.searchtools.com/test/urls/period.x.html

http://www.searchtools.com/test/urls/!exclamation.html

http://www.searchtools.com/test/urls/!exclamation.html

http://www.searchtools.com/test/urls/~tilde.html

http://www.searchtools.com/test/urls/~tilde.html

http://www.searchtools.com/test/urls/*asterisk.html

http://www.searchtools.com/test/urls/*asterisk.html

irc://chat.freenode.net/launchpad

irc://chat.freenode.net/launchpad

irc://chat.freenode.net/%23launchpad,isserver

irc://chat.freenode.net/%23launchpad,isserver

mailto:noreply@launchpad.net

mailto:noreply@launchpad.net

jabber:noreply@launchpad.net

jabber:noreply@launchpad.net

http://localhost/foo?xxx&

http://localhost/foo?xxx&

http://localhost?testing=[square-brackets-in-query]

http://localhost?testing=%5Bsquare-brackets-in-query]

Quote removal

If a comment is entirely enclosed in double quotes ("Content"), Launchpad will drop the quotes.

Examples

Input

Output

"Content"

Content