package transform import ( "bytes" "github.com/spf13/hugo/helpers" "strings" "testing" ) const H5_JS_CONTENT_DOUBLE_QUOTE = "
content foobar. Follow up
" const H5_JS_CONTENT_SINGLE_QUOTE = "
content foobar. Follow up
" const H5_JS_CONTENT_ABS_URL = "
content foobar. Follow up
" const H5_JS_CONTENT_ABS_URL_SCHEMALESS = "
content foobar. Follow up
" const CORRECT_OUTPUT_SRC_HREF_SQ = "
content foobar. Follow up
" const H5_XML_CONTENT_ABS_URL = "<p><a href="/foobar">foobar</a></p> <p>A video: <iframe src='/foo'></iframe></p>" const CORRECT_OUTPUT_SRC_HREF_IN_XML = "<p><a href="http://base/foobar">foobar</a></p> <p>A video: <iframe src='http://base/foo'></iframe></p>" const H5_XML_CONTENT_GUARDED = "<p><a href="//foobar">foobar</a></p> <p>A video: <iframe src='//foo'></iframe></p>" // additional sanity tests for replacements testing const REPLACE_1 = "No replacements." const REPLACE_2 = "ᚠᛇᚻ ᛒᛦᚦ ᚠᚱᚩᚠᚢᚱ\nᚠᛁᚱᚪ ᚷᛖᚻᚹᛦᛚᚳᚢᛗ" // Issue: 816, schemaless links combined with others const REPLACE_SCHEMALESS_HTML = `Pre. src='//schemaless' src='/normal' Schemaless. normal. Post.` const REPLACE_SCHEMALESS_HTML_CORRECT = `Pre. src='//schemaless' src='http://base/normal' Schemaless. normal. Post.` const REPLACE_SCHEMALESS_XML = `Pre. src='//schemaless' src='/normal' Schemaless. normal. Post.` const REPLACE_SCHEMALESS_XML_CORRECT = `Pre. src='//schemaless' src='http://base/normal' Schemaless. normal. Post.` // srcset= const SRCSET_BASIC = `Pre. text` const SRCSET_BASIC_CORRECT = `Pre. text` const SRCSET_SINGLE_QUOTE = `Pre. text POST.` const SRCSET_SINGLE_QUOTE_CORRECT = `Pre. text POST.` const SRCSET_XML_BASIC = `Pre. "text"` const SRCSET_XML_BASIC_CORRECT = `Pre. "text"` const SRCSET_XML_SINGLE_QUOTE = `Pre. "text"` const SRCSET_XML_SINGLE_QUOTE_CORRECT = `Pre. "text"` const SRCSET_VARIATIONS = `Pre. Missing start quote: text src='/img/foo.jpg'> FOO. schemaless: schemaless2: text src='http://base/img/foo.jpg'> FOO. schemaless: schemaless2: