From 02073f827bbc8afe58b48b1d6154cb0d583e9df4 Mon Sep 17 00:00:00 2001 From: Jussi Malinen Date: Mon, 23 Apr 2012 20:08:24 +0300 Subject: [PATCH] add id to whitelisted attributes. The transformers still seem to work and prefix ids with wiki-. Uncommented relevant tests. --- lib/gollum/sanitization.rb | 2 +- test/test_markup.rb | 42 +++++++++++++++++++------------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/gollum/sanitization.rb b/lib/gollum/sanitization.rb index 424e85bd..6632e75b 100644 --- a/lib/gollum/sanitization.rb +++ b/lib/gollum/sanitization.rb @@ -30,7 +30,7 @@ module Gollum 'compact', 'coords', 'datetime', 'dir', 'disabled', 'enctype', 'for', 'frame', 'headers', 'height', 'hreflang', - 'hspace', 'ismap', 'label', 'lang', + 'hspace', 'id', 'ismap', 'label', 'lang', 'longdesc', 'maxlength', 'media', 'method', 'multiple', 'name', 'nohref', 'noshade', 'nowrap', 'prompt', 'readonly', 'rel', 'rev', diff --git a/test/test_markup.rb b/test/test_markup.rb index 263175c1..f9f176c3 100644 --- a/test/test_markup.rb +++ b/test/test_markup.rb @@ -546,29 +546,29 @@ np.array([[2,2],[1,3]],np.float) compare(content, output, 'org') end - # test "id with prefix ok" do - # content = "h2(example#wiki-foo). xxxx" - # output = %(

xxxx

) - # compare(content, output, :textile) - # end + test "id with prefix ok" do + content = "h2(example#wiki-foo). xxxx" + output = %(

xxxx

) + compare(content, output, :textile) + end - # test "id prefix added" do - # content = "h2(#foo). xxxx[1]\n\nfn1.footnote" - # output = "

xxxx" + - # "1

" + - # "\n

1 footnote

" - # compare(content, output, :textile) - # end + test "id prefix added" do + content = "h2(#foo). xxxx[1]\n\nfn1.footnote" + output = "

xxxx" + + "1

" + + "\n

1 footnote

" + compare(content, output, :textile) + end - # test "name prefix added" do - # content = "abc\n\n__TOC__\n\n==Header==\n\nblah" - # compare content, '', :mediawiki, [ - # /id="wiki-toc"/, - # /href="#wiki-Header"/, - # /id="wiki-Header"/, - # /name="wiki-Header"/ - # ] - # end + test "name prefix added" do + content = "abc\n\n__TOC__\n\n==Header==\n\nblah" + compare content, '', :mediawiki, [ + /id="wiki-toc"/, + /href="#wiki-Header"/, + /id="wiki-Header"/, + /name="wiki-Header"/ + ] + end ######################################################################### #