Skip to content

Commit

Permalink
Added support for links without text
Browse files Browse the repository at this point in the history
  • Loading branch information
lahdekorpi committed Jan 13, 2012
1 parent 2e0b761 commit af46f56
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It's basically an attempt to recreate [wiky.js](https://github.com/tanin47/wiky.
* * Unordered list (up to four levels "**** text")
* # Ordered list (up to four levels "#### text")
* [[file:http://example.com/image.jpg title]] an image ([[file|img:http|https|ftp://example.com/image.jpg optional]])
* [http://example.com An Example Link] a link ([http|https|ftp://example.com mandatory])
* [http://example.com An Example Link] a link ([http|https|ftp://example.com optional])

## Known issues
* Unordered and ordered lists can not be mixed (any help and/or ideas would be great)
Expand Down
1 change: 1 addition & 0 deletions input.wiki
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ This is a link: [http://www.google.com Google blaah blaahg].
This is a bold link: '''[http://www.google.com Google]'''.
This is a bold-italic link: '''''[http://www.google.com Google]'''''.
This is '''bold''', '''''bold-italic''''', and ''italic''
This here is a link without text [http://lygon.net]

Some more lines1
:A line with indent
Expand Down
4 changes: 3 additions & 1 deletion wiky.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public function __construct() {
// Special
"/^----+(\s*)$/m", // Horizontal line
"/\[\[(file|img):((ht|f)tp(s?):\/\/(.+?))( (.+))*\]\]/i", // (File|img):(http|https|ftp) aka image
"/\[((news|(ht|f)tp(s?)|irc):\/\/(.+?))( (.+))?\]/i", // Other urls
"/\[((news|(ht|f)tp(s?)|irc):\/\/(.+?))( (.+))\]/i", // Other urls with text
"/\[((news|(ht|f)tp(s?)|irc):\/\/(.+?))\]/i", // Other urls without text

// Indentations
"/[\n\r]: *.+([\n\r]:+.+)*/", // Indentation first pass
Expand Down Expand Up @@ -69,6 +70,7 @@ public function __construct() {
"<hr/>",
"<img src=\"$2\" alt=\"$6\"/>",
"<a href=\"$1\">$7</a>",
"<a href=\"$1\">$1</a>",

// Indentations
"\n<dl>$0\n</dl>", // Newline is here to make the second pass easier
Expand Down

0 comments on commit af46f56

Please sign in to comment.