Skip to content

Instantly share code, notes, and snippets.

@dviererbe
Created April 12, 2023 15:57
Show Gist options
  • Save dviererbe/8e3a31bc3fd12f254744c44517534440 to your computer and use it in GitHub Desktop.
Save dviererbe/8e3a31bc3fd12f254744c44517534440 to your computer and use it in GitHub Desktop.
A document that describes how Launchpad parses bug comments.

Launchpad Comment Parsing

Whitespace

Launchpad will

  • cut off any whitespace to the right and
  • keep any whitespace to the left and
  • reduce any whitespace between non-whitespace characters to just one.

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

Examples

This   sentence  has varying     amounts  of   whitespace    between       its  words.

will look like this

This sentence has varying amounts of whitespace between its words.


here is a code sample written in Python:
    def messageCount(self):
        """See IRosettaStats."""
        return self.potemplate.messageCount()

    def currentCount(self, language=None):
        """See IRosettaStats."""
        return self.currentCount

will look like this

This is a code sample written in Python:
    def messageCount(self):
        """See IRosettaStats."""
        return self.potemplate.messageCount()

    def currentCount(self, language=None):
        """See IRosettaStats."""
        return self.currentCount


Keep in mind that you have a bad time writing tables

| 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 |

because any whitespace between non-whitespace characters gets reduced to just one

Paragraphs

Just like the whitespace between words. Multiple new-line characters will be reduced to one.

Example

Here are two paragraphs with lots of whitespace between them.




But they're still just two paragraphs

will look like this

Here are two paragraphs with lots of whitespace between them.

But they're still just two paragraphs

Mention Launchpad Items

Mention a single Launchpad Bug

Synopsis

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>

Note that these patterns are case invariant.

Examples

bug 123
bug    123
bug #123
bug number 123
bug number. 123
bug num 123
bug num. 123
bug no 123
bug report 123
bug no. 123
bug#123
bug-123
bug-report-123
bug=123
bug
#123
debug #52

will look like this

bug 123
bug 123
bug #123
bug number 123
bug number. 123
bug num 123
bug num. 123
bug no 123
bug report 123
bug no. 123
bug#123
bug-123
bug-report-123
bug=123
bug
#123

debug #52

Mention multiple Launchpad Bugs

Synopsis

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

Note that these patterns are case invariant. The amount of whitespace can be variable, but if you place whitespace anywhere else; the regular expression might not parse the input correctly.

Examples

LP: #1
(LP: #1)
LP: #1, #2.
LP:
#1,
#2,
#3,
#4
lp: #1
(lp: #1)
lp: #1, #2.
LP #1
LP: #1 , #2
LP: #1, #2,

#3

will look like this

LP: #1
(LP: #1)
LP: #1, #2.
LP:
#1,
#2,
#3,
#4
lp: #1
(lp: #1)
lp: #1, #2.
LP #1 LP: #1 , #2
LP: #1, #2,

#3

Mention a Branch

You can link a launchpad branch by mentioning it with the lp URI syntax. lp will expand to https://bugs.launchpad.net/+code/

Synopsis

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

Note that these pattern is case invariant.

Examples

lp:~foo/bar/baz
lp:~foo/bar/bug-123
lp:~foo/+junk/baz
lp:~foo/ubuntu/jaunty/evolution/baz
lp:foo/bar
lp:foo
lp:foo,
lp:foo/bar.
lp:foo/bar/baz
lp:///foo
lp:/foo

will look like this

lp:~foo/bar/baz
lp:~foo/bar/bug-123
lp:~foo/+junk/baz
lp:~foo/ubuntu/jaunty/evolution/baz
lp:foo/bar
lp:foo
lp:foo,
lp:foo/bar.
lp:foo/bar/baz
lp:///foo
lp:/foo

Mention an FAQ Thread

You can link a launchpad FAQ thread by mentioning the number.

Synopsis

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

Note that these patterns are case invariant.

Examples

faq 1
faq #2
faq-2
faq=2
faq item 1
faq  number  2
faq
1

will look like this

faq 1
faq #2
faq-2
faq=2
faq item 1
faq number 2
faq
1

URIs

Launchpad can recognize http, https, ftp, sftp, mailto, news, irc and jabber URIs.

tel, urn, telnet, ldap URIs, relative URLs like "example.com" and E-Mails like "test@example.com" are NOT recognized.

Examples:

http://localhost:8086/bar/baz/foo.html
ftp://localhost:8086/bar/baz/foo.bar.html
sftp://localhost:8086/bar/baz/foo.bar.html.
http://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/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://www.searchtools.com/test/urls/(parens).html
http://www.searchtools.com/test/urls/-dash.html
http://www.searchtools.com/test/urls/_underscore.html
http://www.searchtools.com/test/urls/period.x.html
http://www.searchtools.com/test/urls/!exclamation.html
http://www.searchtools.com/test/urls/~tilde.html
http://www.searchtools.com/test/urls/*asterisk.html
irc://chat.freenode.net/launchpad
irc://chat.freenode.net/%23launchpad,isserver
mailto:noreply@launchpad.net
jabber:noreply@launchpad.net
http://localhost/foo?xxx&
http://localhost?testing=[square-brackets-in-query]

will look like this

http://localhost:8086/bar/baz/foo.html
ftp://localhost:8086/bar/baz/foo.bar.html
sftp://localhost:8086/bar/baz/foo.bar.html.
http://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/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://www.searchtools.com/test/urls/(parens).html
http://www.searchtools.com/test/urls/-dash.html
http://www.searchtools.com/test/urls/_underscore.html
http://www.searchtools.com/test/urls/period.x.html
http://www.searchtools.com/test/urls/!exclamation.html
http://www.searchtools.com/test/urls/~tilde.html
http://www.searchtools.com/test/urls/*asterisk.html
irc://chat.freenode.net/launchpad
irc://chat.freenode.net/%23launchpad,isserver
mailto:noreply@launchpad.net
jabber:noreply@launchpad.net
http://localhost/foo?xxx&
http://localhost?testing=[square-brackets-in-query]

Other

" Removal

If the entire comment is encapsulated in " like this:

"Content"

Launchpad will remove the "

Content

Markdown?

There already exists bug tickets (like LP: #391780, #30002, #392123) that ask for more formatting support. Feel free to "upvote" these bug reports.

BUT, even if markdown (or any other formatting language) support will come to Launchpad; existing comments will not be reformatted in fear of accidentally breaking old comments :/

Author

Dominik Viererbe (~dviererbe) <dominik.viererbe@canonical.com>

License

Based on this launchpad document.

Therefore this document is licensed under the same GNU Affero General Public License, version 3 ("AGPLv3").

@dviererbe
Copy link
Author

This was adapted into the official Launchpad documentation: https://help.launchpad.net/Comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment