devtools-snippets icon indicating copy to clipboard operation
devtools-snippets copied to clipboard

Update 'all on one page' snippets

Open ljcl opened this issue 10 years ago • 6 comments

The querystrings.js on the github page differs slightly from the source on github, and returns an error when run whereas the source does not.

Might be worth an update!

ljcl avatar Sep 08 '14 02:09 ljcl

The code, or the screenshot? I think the code is in sync unless if I'm missing something

bgrins avatar Sep 08 '14 16:09 bgrins

The searchvalue argument in replace function. "//g" and "/+/g"

return { "Key": qs.split("=")[0], "Value": qs.split("=")[1], "Pretty Value": decodeURIComponent(qs.split("=")[1]).replace(//g," ") }

return { "Key": qs.split("=")[0], "Value": qs.split("=")[1], "Pretty Value": decodeURIComponent(qs.split("=")[1]).replace(/+/g," ") }

hvsw avatar Sep 08 '14 16:09 hvsw

Ah I see that now, thanks. Maybe is a bug with the rakefile at: https://github.com/bgrins/devtools-snippets/blob/master/Rakefile, because gh-pages is up to date after running rake build

bgrins avatar Sep 08 '14 16:09 bgrins

Hm, well running pygmentize -f html snippets/querystringvalues/querystringvalues.js seems to produce the correct output so it's not that

bgrins avatar Sep 08 '14 16:09 bgrins

And it appears OK in the snippets.json file: https://bgrins.github.io/devtools-snippets/snippets.json

bgrins avatar Sep 08 '14 16:09 bgrins

Well, I'm not sure why but the /+/g is still there in the markup variable before the call to with_markup = template.gsub(regex, markup) in the rakefile: https://github.com/bgrins/devtools-snippets/blob/d40168097306bea3546d66fd8fc68ac8e201f63f/Rakefile#L40. After this line, with_markup seems to be //g as far as I can tell.

bgrins avatar Sep 09 '14 20:09 bgrins