Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added support for poorly formed internal urls.

Cases added: [[ url ]], [[ url | label ]], [[ url label ]]
Tests added and passing
  • Loading branch information...
commit 56e9a94eca41d3d8f04c65aba1e65ff22b0b134c 1 parent 4d091b0
Ryan Blue authored

Showing 2 changed files with 27 additions and 4 deletions. Show diff stats Hide diff stats

  1. +13 4 lib/marker/language.treetop
  2. +14 0 test/links_test.rb
17 lib/marker/language.treetop
@@ -382,14 +382,23 @@ module Marker
382 382 # [ external [[internal]] ]
383 383 # MediaWiki: <a href="external"></a><a href="internal">internal</a>
384 384 # Marker: <a href="external">[[internal]]</a>
  385 + #
  386 + # also use this rule to match bad internal link syntax [[ url | label ]]
  387 + # because the rendering rules are the same
385 388 rule external_link
386   - external_link_start ws t:url rws l:external_link_enclosed_text ws external_link_end <ExternalLink>
387   - /
388   - external_link_start ws t:url ws external_link_end <ExternalLink>
389   - /
  389 +# external_link_start ws t:url rws l:external_link_enclosed_text ws external_link_end <ExternalLink>
  390 +# /
  391 +# external_link_start ws t:url ws external_link_end <ExternalLink>
  392 +# /
390 393 external_link_start ws t:implicit_url rws l:external_link_enclosed_text ws external_link_end <ExternalLink>
391 394 /
392 395 external_link_start ws t:implicit_url ws external_link_end <ExternalLink>
  396 + /
  397 + internal_link_start ws t:implicit_url rws l:internal_link_enclosed_text ws internal_link_end <ExternalLink>
  398 + /
  399 + internal_link_start ws t:implicit_url ws arg_delimiter ws l:internal_link_enclosed_text ws internal_link_end <ExternalLink>
  400 + /
  401 + internal_link_start ws t:implicit_url ws internal_link_end <ExternalLink>
393 402 end
394 403
395 404 rule external_link_enclosed_text
14 test/links_test.rb
@@ -34,6 +34,20 @@ def test_internal_link_with_sanitization

0 comments on commit 56e9a94

Please sign in to comment.
Something went wrong with that request. Please try again.