parserTests.txt 928 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825
  1. # MediaWiki Parser test cases
  2. # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
  3. # All (C) their respective authors and released under the GPL
  4. #
  5. # The syntax should be fairly self-explanatory.
  6. #
  7. # Currently supported test options:
  8. # One of the following three:
  9. #
  10. # (default) generate HTML output
  11. # pst apply pre-save transform
  12. # msg apply message transform
  13. #
  14. # Plus any combination of these:
  15. #
  16. # cat add category links
  17. # (ignored by Parsoid, since it emits <link>s)
  18. # ill add inter-language links
  19. # (ignored by Parsoid, since it emits <link>s)
  20. # subpage enable subpages (disabled by default)
  21. # title=[[XXX]] run test using article title XXX
  22. # language=XXX set content language to XXX for this test
  23. # variant=XXX set the variant of language for this test (eg zh-tw)
  24. # disabled do not run test
  25. # parsoid parsoid-specific options (not run by PHP parser unless
  26. # the test includes an html/php section)
  27. # php php-only test (not run by the parsoid parser unless
  28. # the test includes an html/parsoid section)
  29. # showtitle make the first line the title
  30. # showindicators make the first lines the page status indicators
  31. # comment run through Linker::formatComment() instead of main parser
  32. # local format section links in edit comment text as local links
  33. # notoc disable table of contents
  34. # thumbsize=NNN set the default thumb size to NNNpx for this test
  35. # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
  36. #
  37. # You can also set the following parser properties via test options:
  38. # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
  39. # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
  40. # wgEnableMagicLinks
  41. #
  42. # For testing purposes, temporary articles can created:
  43. # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
  44. # where '/' denotes a newline.
  45. # This is the standard article assumed to exist.
  46. !! article
  47. Main Page
  48. !! text
  49. blah blah
  50. !! endarticle
  51. !!article
  52. Foo
  53. !!text
  54. FOO
  55. !!endarticle
  56. !!article
  57. Template:Foo
  58. !!text
  59. FOO
  60. !!endarticle
  61. !! article
  62. Template:Blank
  63. !! text
  64. !! endarticle
  65. !! article
  66. Template:pipe
  67. !! text
  68. |
  69. !! endarticle
  70. !! article
  71. Template:=
  72. !! text
  73. <nowiki>=</nowiki>
  74. !! endarticle
  75. !!article
  76. MediaWiki:bad image list
  77. !!text
  78. * [[File:Bad.jpg]] except [[Nasty page]]
  79. !!endarticle
  80. !! article
  81. Template:inner list
  82. !! text
  83. * item 1
  84. !! endarticle
  85. !! article
  86. Template:tbl-start
  87. !! text
  88. {|
  89. !! endarticle
  90. !! article
  91. Template:tbl-end
  92. !! text
  93. |}
  94. !! endarticle
  95. !! article
  96. Template:echo
  97. !! text
  98. {{{1}}}
  99. !! endarticle
  100. // For Serbian; localize Template namespace
  101. !! article
  102. Шаблон:Echo
  103. !! text
  104. {{{1}}}
  105. !! endarticle
  106. !! article
  107. Template:echo_with_span
  108. !! text
  109. <span>{{{1}}}</span>
  110. !! endarticle
  111. !! article
  112. Template:echo_with_div
  113. !! text
  114. <div>{{{1}}}</div>
  115. !! endarticle
  116. !! article
  117. Template:blank_param
  118. !! text
  119. {{{1}}}
  120. {{{}}}
  121. !! endarticle
  122. !! article
  123. Template:table_attribs
  124. !! text
  125. <noinclude>
  126. |</noinclude>style="color:red;"|Foo
  127. !! endarticle
  128. !! article
  129. Template:table_attribs_2
  130. !! text
  131. <noinclude>
  132. |</noinclude>style="color:red;"|Foo
  133. |Bar||Baz
  134. !! endarticle
  135. !! article
  136. Template:table_attribs_3
  137. !! text
  138. <noinclude>
  139. |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo
  140. !! endarticle
  141. !! article
  142. Template:table_attribs_4
  143. !! text
  144. | style="background-color:#DC241f;" width="10px" |
  145. !! endarticle
  146. !! article
  147. Template:table_attribs_5
  148. !! text
  149. <noinclude>
  150. |</noinclude>style="color:red;"||Bar
  151. !! endarticle
  152. !! article
  153. Template:table_attribs_6
  154. !! text
  155. style="background: <nowiki>
  156. red;</nowiki>" |
  157. !! endarticle
  158. !! article
  159. Template:table_attribs_7
  160. !! text
  161. <noinclude>
  162. |</noinclude>style{{=}}"background:&#35;f9f9f9;"|Foo<ref>foo</ref>
  163. !! endarticle
  164. !! article
  165. Template:table_header_cells
  166. !! text
  167. {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
  168. !! endarticle
  169. !! article
  170. Template:table_cells
  171. !! text
  172. {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
  173. !! endarticle
  174. !! article
  175. Template:PartialTable
  176. !! text
  177. {|
  178. |-
  179. !! endarticle
  180. !! article
  181. Template:image_attribs
  182. !! text
  183. <noinclude>
  184. [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
  185. !! endarticle
  186. ## See T48811 for details
  187. !! article
  188. Template:mixed_attr_content_template
  189. !! text
  190. style="color:red;" title="T48811"
  191. |-
  192. |foo
  193. !! endarticle
  194. !! article
  195. Template:definition_list
  196. !! text
  197. one
  198. ::two
  199. !! endarticle
  200. !! article
  201. A?b
  202. !! text
  203. Weirdo titles!
  204. !! endarticle
  205. !!article
  206. Template:Bullet
  207. !!text
  208. * Bar
  209. !!endarticle
  210. !!article
  211. Template:OpenTable
  212. !!text
  213. {|
  214. !!endarticle
  215. !!article
  216. Template:EmptyLITest
  217. !!text
  218. *a
  219. *
  220. *
  221. *b
  222. !!endarticle
  223. !!article
  224. Template:EmptyTRTest
  225. !!text
  226. {|
  227. |-
  228. |-
  229. |foo
  230. |-
  231. |-
  232. |bar
  233. |}
  234. !!endarticle
  235. !!article
  236. Template:EmptyTRWithHTMLAttrTest
  237. !!text
  238. <table>
  239. <tr align="center"></tr>
  240. <tr><td>foo</td></tr>
  241. <tr align="center"></tr>
  242. <tr><td>bar</td></tr>
  243. </table>
  244. !!endarticle
  245. !! article
  246. Template:With: Colon
  247. !! text
  248. Template with colon
  249. !! endarticle
  250. ###
  251. ### Basic tests
  252. ###
  253. !! test
  254. Blank input
  255. !! wikitext
  256. !! html
  257. !! end
  258. !! test
  259. Simple paragraph
  260. !! wikitext
  261. This is a simple paragraph.
  262. !! html
  263. <p>This is a simple paragraph.
  264. </p>
  265. !! end
  266. !! test
  267. Paragraphs with extra newline spacing
  268. !! wikitext
  269. foo
  270. bar
  271. baz
  272. booz
  273. !! html
  274. <p>foo
  275. </p><p>bar
  276. </p><p><br />
  277. baz
  278. </p><p><br />
  279. </p><p>booz
  280. </p>
  281. !! end
  282. !! test
  283. Paragraphs with newline spacing with comment lines in between
  284. !! wikitext
  285. ----
  286. a
  287. <!--foo-->
  288. b
  289. ----
  290. a
  291. <!--foo--><!--More than 1 comment, still stripped-->
  292. b
  293. ----
  294. a
  295. <!--foo--> <!----> <!-- bar -->
  296. b
  297. ----
  298. a
  299. <!--foo-->
  300. b
  301. ----
  302. a
  303. <!--foo-->
  304. b
  305. ----
  306. a
  307. <!--foo-->
  308. b
  309. ----
  310. a
  311. <!--foo-->
  312. b
  313. ----
  314. !! html
  315. <hr />
  316. <p>a
  317. b
  318. </p>
  319. <hr />
  320. <p>a
  321. b
  322. </p>
  323. <hr />
  324. <p>a
  325. b
  326. </p>
  327. <hr />
  328. <p>a
  329. </p><p>b
  330. </p>
  331. <hr />
  332. <p>a
  333. </p><p>b
  334. </p>
  335. <hr />
  336. <p>a
  337. </p><p><br />
  338. b
  339. </p>
  340. <hr />
  341. <p>a
  342. </p><p><br />
  343. b
  344. </p>
  345. <hr />
  346. !! end
  347. !! test
  348. Paragraphs with newline spacing with non-empty white-space lines in between
  349. !! wikitext
  350. ----
  351. a
  352. b
  353. ----
  354. a
  355. b
  356. ----
  357. !! html
  358. <hr />
  359. <p>a
  360. </p><p>b
  361. </p>
  362. <hr />
  363. <p>a
  364. </p><p><br />
  365. b
  366. </p>
  367. <hr />
  368. !! end
  369. !! test
  370. Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
  371. !! wikitext
  372. ----
  373. a
  374. <!--foo-->
  375. b
  376. ----
  377. a
  378. <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
  379. b
  380. ----
  381. a
  382. <!--foo-->
  383. <!--bar-->
  384. b
  385. ----
  386. a
  387. <!--foo-->
  388. <!--bar-->
  389. b
  390. ----
  391. !! html
  392. <hr />
  393. <p>a
  394. b
  395. </p>
  396. <hr />
  397. <p>a
  398. b
  399. </p>
  400. <hr />
  401. <p>a
  402. </p><p>b
  403. </p>
  404. <hr />
  405. <p>a
  406. </p><p><br />
  407. b
  408. </p>
  409. <hr />
  410. !! end
  411. !! test
  412. Extra newlines: More paragraphs with indented comment
  413. !! wikitext
  414. a
  415. <!--boo-->
  416. b
  417. !! html
  418. <p>a
  419. </p><p><br />
  420. b
  421. </p>
  422. !!end
  423. !! test
  424. Extra newlines followed by heading
  425. !! wikitext
  426. a
  427. =b=
  428. [[a]]
  429. =b=
  430. !! html
  431. <p>a
  432. </p><p><br />
  433. </p>
  434. <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  435. <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
  436. </p><p><br />
  437. </p>
  438. <h1><span class="mw-headline" id="b_2">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  439. !! end
  440. !! test
  441. Extra newlines between heading and content are swallowed
  442. !! wikitext
  443. =b=
  444. [[a]]
  445. !! html
  446. <h1><span class="mw-headline" id="b">b</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  447. <p><a href="/index.php?title=A&amp;action=edit&amp;redlink=1" class="new" title="A (page does not exist)">a</a>
  448. </p>
  449. !! end
  450. !! test
  451. Heading with line break in nowiki
  452. !! options
  453. parsoid=wt2html
  454. !! config
  455. wgFragmentMode=[ 'html5', 'legacy' ]
  456. !! wikitext
  457. ==A <nowiki>B
  458. C</nowiki>==
  459. !! html/php
  460. <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
  461. C">A B
  462. C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A B&#10;C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  463. !! html/parsoid
  464. <h2 id="A_B
  465. C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
  466. C</span></h2>
  467. !! end
  468. !! test
  469. Parsing an URL
  470. !! wikitext
  471. http://fr.wikipedia.org/wiki/🍺
  472. <!-- EasterEgg we love beer, better be able be able to link to it -->
  473. !! html
  474. <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
  475. </p>
  476. !! end
  477. !! test
  478. Simple list
  479. !! wikitext
  480. *Item 1
  481. *Item 2
  482. !! html
  483. <ul><li>Item 1</li>
  484. <li>Item 2</li></ul>
  485. !! end
  486. !! test
  487. Italics and bold
  488. !! wikitext
  489. *plain
  490. *plain''italic''plain
  491. *plain''italic''plain''italic''plain
  492. *plain'''bold'''plain
  493. *plain'''bold'''plain'''bold'''plain
  494. *plain''italic''plain'''bold'''plain
  495. *plain'''bold'''plain''italic''plain
  496. *plain''italic'''bold-italic'''italic''plain
  497. *plain'''bold''bold-italic''bold'''plain
  498. *plain'''''bold-italic'''italic''plain
  499. *plain'''''bold-italic''bold'''plain
  500. *plain''italic'''bold-italic'''''plain
  501. *plain'''bold''bold-italic'''''plain
  502. *plain l'''italic''plain
  503. *plain l''''bold''' plain
  504. !! html
  505. <ul><li>plain</li>
  506. <li>plain<i>italic</i>plain</li>
  507. <li>plain<i>italic</i>plain<i>italic</i>plain</li>
  508. <li>plain<b>bold</b>plain</li>
  509. <li>plain<b>bold</b>plain<b>bold</b>plain</li>
  510. <li>plain<i>italic</i>plain<b>bold</b>plain</li>
  511. <li>plain<b>bold</b>plain<i>italic</i>plain</li>
  512. <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
  513. <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
  514. <li>plain<i><b>bold-italic</b>italic</i>plain</li>
  515. <li>plain<b><i>bold-italic</i>bold</b>plain</li>
  516. <li>plain<i>italic<b>bold-italic</b></i>plain</li>
  517. <li>plain<b>bold<i>bold-italic</i></b>plain</li>
  518. <li>plain l'<i>italic</i>plain</li>
  519. <li>plain l'<b>bold</b> plain</li></ul>
  520. !! end
  521. # this example taken from the [[simple:Moon]] article (T49326)
  522. !! test
  523. Italics and possessives (1)
  524. !! wikitext
  525. obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
  526. !! html
  527. <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&amp;action=edit&amp;redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
  528. </p>
  529. !! end
  530. # this example taken from [[en:Flaming Pie]] (T51926)
  531. !! test
  532. Italics and possessives (2)
  533. !! wikitext
  534. '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
  535. !! html
  536. <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
  537. </p>
  538. !! end
  539. # this example taken from [[en:Dictionary]] (T51926)
  540. !! test
  541. Italics and possessives (3)
  542. !! wikitext
  543. The first monolingual dictionary written in a Romance language was ''Sebastián Covarrubias''' ''Tesoro de la lengua castellana o española'', published in 1611 in Madrid. In 1612 the first edition of the ''Vocabolario dell'[[Accademia della Crusca]]'', for Italian, was published. In 1690 in Rotterdam was published, posthumously, the ''Dictionnaire Universel''.
  544. !! html
  545. <p>The first monolingual dictionary written in a Romance language was <i>Sebastián Covarrubias'</i> <i>Tesoro de la lengua castellana o española</i>, published in 1611 in Madrid. In 1612 the first edition of the <i>Vocabolario dell'<a href="/index.php?title=Accademia_della_Crusca&amp;action=edit&amp;redlink=1" class="new" title="Accademia della Crusca (page does not exist)">Accademia della Crusca</a></i>, for Italian, was published. In 1690 in Rotterdam was published, posthumously, the <i>Dictionnaire Universel</i>.
  546. </p>
  547. !! end
  548. ###
  549. ### 2-quote opening sequence tests
  550. ###
  551. !! test
  552. Italics and bold: 2-quote opening sequence: (2,2)
  553. !! wikitext
  554. ''foo''
  555. !! html
  556. <p><i>foo</i>
  557. </p>
  558. !!end
  559. !! test
  560. Italics and bold: 2-quote opening sequence: (2,3)
  561. !! wikitext
  562. ''foo'''
  563. !! html/*
  564. <p><i>foo'</i>
  565. </p>
  566. !!end
  567. !! test
  568. Italics and bold: 2-quote opening sequence: (2,4)
  569. !! options
  570. parsoid=wt2html
  571. !! wikitext
  572. ''foo''''
  573. !! html/*
  574. <p><i>foo''</i>
  575. </p>
  576. !!end
  577. # same html as previous, but wikitext adjusted to match parsoid html2wt
  578. !! test
  579. Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
  580. !! wikitext
  581. ''foo<nowiki>''</nowiki>''
  582. !! html
  583. <p><i>foo''</i>
  584. </p>
  585. !! end
  586. # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
  587. !! test
  588. Italics and bold: 2-quote opening sequence: (2,5)
  589. !! options
  590. parsoid=wt2html
  591. !! wikitext
  592. ''foo'''''
  593. !! html/php
  594. <p><i>foo</i>
  595. </p>
  596. !! html/parsoid
  597. <p><i>foo</i><b></b>
  598. </p>
  599. !!end
  600. # same html as previous, but wikitext adjusted to match parsoid html2wt
  601. !! test
  602. Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
  603. !! wikitext
  604. ''foo'''''<nowiki/>'''
  605. !! html/php
  606. <p><i>foo</i>
  607. </p>
  608. !! html/parsoid
  609. <p><i>foo</i><b></b>
  610. </p>
  611. !! end
  612. ###
  613. ### 3-quote opening sequence tests
  614. ###
  615. !! test
  616. Italics and bold: 3-quote opening sequence: (3,2)
  617. !! wikitext
  618. '''foo''
  619. !! html/*
  620. <p>'<i>foo</i>
  621. </p>
  622. !!end
  623. !! test
  624. Italics and bold: 3-quote opening sequence: (3,3)
  625. !! wikitext
  626. '''foo'''
  627. !! html
  628. <p><b>foo</b>
  629. </p>
  630. !!end
  631. !! test
  632. Italics and bold: 3-quote opening sequence: (3,4)
  633. !! wikitext
  634. '''foo''''
  635. !! html/*
  636. <p><b>foo'</b>
  637. </p>
  638. !!end
  639. # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
  640. !! test
  641. Italics and bold: 3-quote opening sequence: (3,5)
  642. !! options
  643. parsoid=wt2html
  644. !! wikitext
  645. '''foo'''''
  646. !! html/php
  647. <p><b>foo</b>
  648. </p>
  649. !! html/parsoid
  650. <p><b>foo</b><i></i>
  651. </p>
  652. !!end
  653. # same html as previous, but wikitext adjusted to match parsoid html2wt
  654. !! test
  655. Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
  656. !! wikitext
  657. '''foo'''''<nowiki/>''
  658. !! html/php
  659. <p><b>foo</b>
  660. </p>
  661. !! html/parsoid
  662. <p><b>foo</b><i></i>
  663. </p>
  664. !! end
  665. ###
  666. ### 4-quote opening sequence tests
  667. ###
  668. !! test
  669. Italics and bold: 4-quote opening sequence: (4,2)
  670. !! options
  671. parsoid=wt2html
  672. !! wikitext
  673. ''''foo''
  674. !! html/*
  675. <p>''<i>foo</i>
  676. </p>
  677. !!end
  678. # same html as previous, but wikitext adjusted to match parsoid html2wt
  679. !! test
  680. Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
  681. !! wikitext
  682. <nowiki>''</nowiki>''foo''
  683. !! html
  684. <p>''<i>foo</i>
  685. </p>
  686. !! end
  687. !! test
  688. Italics and bold: 4-quote opening sequence: (4,3)
  689. !! wikitext
  690. ''''foo'''
  691. !! html/*
  692. <p>'<b>foo</b>
  693. </p>
  694. !!end
  695. !! test
  696. Italics and bold: 4-quote opening sequence: (4,4)
  697. !! options
  698. parsoid=wt2html
  699. !! wikitext
  700. ''''foo''''
  701. !! html/*
  702. <p>'<b>foo'</b>
  703. </p>
  704. !!end
  705. # same html as previous, but wikitext adjusted to match parsoid html2wt
  706. !! test
  707. Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
  708. !! wikitext
  709. '<nowiki/>'''foo''''
  710. !! html
  711. <p>'<b>foo'</b>
  712. </p>
  713. !! end
  714. # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
  715. !! test
  716. Italics and bold: 4-quote opening sequence: (4,5)
  717. !! options
  718. parsoid=wt2html
  719. !! wikitext
  720. ''''foo'''''
  721. !! html/php
  722. <p>'<b>foo</b>
  723. </p>
  724. !! html/parsoid
  725. <p>'<b>foo</b><i></i>
  726. </p>
  727. !!end
  728. # same html as previous, but wikitext adjusted to match parsoid html2wt
  729. !! test
  730. Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
  731. !! wikitext
  732. '<nowiki/>'''foo'''''<nowiki/>''
  733. !! html/php
  734. <p>'<b>foo</b>
  735. </p>
  736. !! html/parsoid
  737. <p>'<b>foo</b><i></i>
  738. </p>
  739. !! end
  740. ###
  741. ### 5-quote opening sequence tests
  742. ###
  743. !! test
  744. Italics and bold: 5-quote opening sequence: (5,2)
  745. !! options
  746. parsoid=wt2html
  747. !! wikitext
  748. '''''foo''
  749. !! html/*
  750. <p><b><i>foo</i></b>
  751. </p>
  752. !!end
  753. # same html as previous, but wikitext adjusted to match parsoid html2wt
  754. !! test
  755. Italics and bold: 5-quote opening sequence: (5,2+3)
  756. !! wikitext
  757. '''''foo'''''
  758. !! html/*
  759. <p><i><b>foo</b></i>
  760. </p>
  761. !! end
  762. !! test
  763. Italics and bold: 5-quote opening sequence: (5,3)
  764. !! options
  765. parsoid=wt2html
  766. !! wikitext
  767. '''''foo'''
  768. !! html/*
  769. <p><i><b>foo</b></i>
  770. </p>
  771. !!end
  772. # same html as previous, but wikitext adjusted to match parsoid html2wt
  773. !! test
  774. Italics and bold: 5-quote opening sequence: (5,3+2)
  775. !! wikitext
  776. '''''foo'''''
  777. !! html
  778. <p><i><b>foo</b></i>
  779. </p>
  780. !! end
  781. !! test
  782. Italics and bold: 5-quote opening sequence: (5,4)
  783. !! options
  784. parsoid=wt2html
  785. !! wikitext
  786. '''''foo''''
  787. !! html/*
  788. <p><i><b>foo'</b></i>
  789. </p>
  790. !!end
  791. !! test
  792. Italics and bold: 5-quote opening sequence: (5,5)
  793. !! wikitext
  794. '''''foo'''''
  795. !! html
  796. <p><i><b>foo</b></i>
  797. </p>
  798. !!end
  799. !! test
  800. Italics and bold: 5-quote opening sequence: (5,6)
  801. !! wikitext
  802. '''''foo''''''
  803. !! html/*
  804. <p><i><b>foo'</b></i>
  805. </p>
  806. !! end
  807. ###
  808. ### multiple quote sequences in a line
  809. ###
  810. !! test
  811. Italics and bold: multiple quote sequences: (2,4,2)
  812. !! options
  813. parsoid=wt2html
  814. !! wikitext
  815. ''foo''''bar''
  816. !! html/*
  817. <p><i>foo'<b>bar</b></i>
  818. </p>
  819. !! end
  820. # same html as previous, but wikitext adjusted to match parsoid html2wt
  821. !! test
  822. Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
  823. !! wikitext
  824. ''foo'<nowiki/>'''bar'''''
  825. !! html
  826. <p><i>foo'<b>bar</b></i>
  827. </p>
  828. !! end
  829. !! test
  830. Italics and bold: multiple quote sequences: (2,4,3)
  831. !! options
  832. parsoid=wt2html
  833. !! wikitext
  834. ''foo''''bar'''
  835. !! html/*
  836. <p><i>foo'<b>bar</b></i>
  837. </p>
  838. !! end
  839. # same html as previous, but wikitext adjusted to match parsoid html2wt
  840. !! test
  841. Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
  842. !! wikitext
  843. ''foo'<nowiki/>'''bar'''''
  844. !! html
  845. <p><i>foo'<b>bar</b></i>
  846. </p>
  847. !! end
  848. !! test
  849. Italics and bold: multiple quote sequences: (2,4,4)
  850. !! options
  851. parsoid=wt2html
  852. !! wikitext
  853. ''foo''''bar''''
  854. !! html/*
  855. <p><i>foo'<b>bar'</b></i>
  856. </p>
  857. !! end
  858. # same html as previous, but wikitext adjusted to match parsoid html2wt
  859. !! test
  860. Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
  861. !! wikitext
  862. ''foo'<nowiki/>'''bar'<nowiki/>'''''
  863. !! html
  864. <p><i>foo'<b>bar'</b></i>
  865. </p>
  866. !! end
  867. # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
  868. !! test
  869. Italics and bold: multiple quote sequences: (3,4,2)
  870. !! options
  871. parsoid=wt2html
  872. !! wikitext
  873. '''foo''''bar''
  874. !! html/php
  875. <p><b>foo'</b>bar
  876. </p>
  877. !! html/parsoid
  878. <p><b>foo'</b>bar<i></i>
  879. </p>
  880. !! end
  881. # same html as previous, but wikitext adjusted to match parsoid html2wt
  882. !! test
  883. Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
  884. !! wikitext
  885. '''foo''''bar''<nowiki/>''
  886. !! html/php
  887. <p><b>foo'</b>bar
  888. </p>
  889. !! html/parsoid
  890. <p><b>foo'</b>bar<i></i>
  891. </p>
  892. !! end
  893. # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
  894. !! test
  895. Italics and bold: multiple quote sequences: (3,4,3)
  896. !! options
  897. parsoid=wt2html
  898. !! wikitext
  899. '''foo''''bar'''
  900. !! html/php
  901. <p><b>foo'</b>bar
  902. </p>
  903. !! html/parsoid
  904. <p><b>foo'</b>bar<b></b>
  905. </p>
  906. !! end
  907. # same html as previous, but wikitext adjusted to match parsoid html2wt
  908. !! test
  909. Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
  910. !! wikitext
  911. '''foo''''bar'''<nowiki/>'''
  912. !! html/php
  913. <p><b>foo'</b>bar
  914. </p>
  915. !! html/parsoid
  916. <p><b>foo'</b>bar<b></b>
  917. </p>
  918. !! end
  919. ###
  920. ### other quote tests
  921. ###
  922. !! test
  923. Italics and bold: other quote tests: (2,3,5)
  924. !! wikitext
  925. ''this is about '''foo's family'''''
  926. !! html
  927. <p><i>this is about <b>foo's family</b></i>
  928. </p>
  929. !!end
  930. !! test
  931. Italics and bold: other quote tests: (2,(3,3),2)
  932. !! wikitext
  933. ''this is about '''foo's''' family''
  934. !! html
  935. <p><i>this is about <b>foo's</b> family</i>
  936. </p>
  937. !!end
  938. !! test
  939. Italics and bold: other quote tests: (3,2,3,2)
  940. !! options
  941. parsoid=wt2html
  942. !! wikitext
  943. '''this is about ''foo'''s family''
  944. !! html/*
  945. <p><b>this is about <i>foo</i></b><i>s family</i>
  946. </p>
  947. !!end
  948. # same html as previous, but wikitext adjusted to match parsoid html2wt
  949. !! test
  950. Italics and bold: other quote tests: (3,2,3+2+2,2)
  951. !! wikitext
  952. '''this is about ''foo'''''<nowiki/>''s family''
  953. !! html
  954. <p><b>this is about <i>foo</i></b><i>s family</i>
  955. </p>
  956. !! end
  957. !! test
  958. Italics and bold: other quote tests: (3,2,3,3)
  959. !! wikitext
  960. '''this is about ''foo'''s family'''
  961. !! html/*
  962. <p>'<i>this is about </i>foo<b>s family</b>
  963. </p>
  964. !!end
  965. !! test
  966. Italics and bold: other quote tests: (3,(2,2),3)
  967. !! wikitext
  968. '''this is about ''foo's'' family'''
  969. !! html
  970. <p><b>this is about <i>foo's</i> family</b>
  971. </p>
  972. !!end
  973. !! test
  974. Italicized possessive
  975. !! wikitext
  976. The ''[[Main Page]]'''s talk page.
  977. !! html/php
  978. <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
  979. </p>
  980. !! html/parsoid
  981. <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
  982. !! end
  983. !! test
  984. Quote balancing context should be restricted to td/th cells on the same wikitext line
  985. !! options
  986. parsoid=wt2html,wt2wt
  987. !! wikitext
  988. {|
  989. !''a!!''b
  990. |''a||''b
  991. |}
  992. !! html+tidy
  993. <table>
  994. <tbody><tr>
  995. <th><i>a</i></th>
  996. <th><i>b</i>
  997. </th>
  998. <td><i>a</i></td>
  999. <td><i>b</i>
  1000. </td></tr></tbody></table>
  1001. !! end
  1002. ###
  1003. ### Non-html5 tags
  1004. ###
  1005. !! test
  1006. Non-html5 tags should be accepted
  1007. !! wikitext
  1008. <center>''foo''</center>
  1009. <big>''foo''</big>
  1010. <font>''foo''</font>
  1011. <strike>''foo''</strike>
  1012. <tt>''foo''</tt>
  1013. !! html
  1014. <center><i>foo</i></center>
  1015. <p><big><i>foo</i></big>
  1016. <font><i>foo</i></font>
  1017. <strike><i>foo</i></strike>
  1018. <tt><i>foo</i></tt>
  1019. </p>
  1020. !! end
  1021. !! test
  1022. <wbr> is valid wikitext (T54468)
  1023. !! wikitext
  1024. <wbr>
  1025. !! html
  1026. <p><wbr />
  1027. </p>
  1028. !! end
  1029. # <strike> is HTML4, <s> is HTML4/5.
  1030. !! test
  1031. <s> or <strike> for strikethrough
  1032. !! wikitext
  1033. <strike>strike</strike>
  1034. <s>s</s>
  1035. !! html
  1036. <p><strike>strike</strike>
  1037. </p><p><s>s</s>
  1038. </p>
  1039. !! end
  1040. ## a not permitted
  1041. ## i,b,br omitted
  1042. !! test
  1043. Text-level semantic html elements in wikitext
  1044. !! wikitext
  1045. <em>text</em>
  1046. <strong>text</strong>
  1047. <small>text</small>
  1048. <s>text</s>
  1049. <cite>text</cite>
  1050. <q>text</q>
  1051. <dfn>text</dfn>
  1052. <abbr>text</abbr>
  1053. <data>text</data>
  1054. <time>text</time>
  1055. <code>text</code>
  1056. <var>text</var>
  1057. <samp>text</samp>
  1058. <kbd>text</kbd>
  1059. <sub>text</sub>
  1060. <u>text</u>
  1061. <mark>text</mark>
  1062. <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
  1063. <bdi>text</bdi>
  1064. <bdo>text</bdo>
  1065. <span>text</span>
  1066. <wbr />
  1067. !! html
  1068. <p><em>text</em>
  1069. <strong>text</strong>
  1070. <small>text</small>
  1071. <s>text</s>
  1072. <cite>text</cite>
  1073. <q>text</q>
  1074. <dfn>text</dfn>
  1075. <abbr>text</abbr>
  1076. <data>text</data>
  1077. <time>text</time>
  1078. <code>text</code>
  1079. <var>text</var>
  1080. <samp>text</samp>
  1081. <kbd>text</kbd>
  1082. <sub>text</sub>
  1083. <u>text</u>
  1084. <mark>text</mark>
  1085. <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
  1086. <bdi>text</bdi>
  1087. <bdo>text</bdo>
  1088. <span>text</span>
  1089. <wbr />
  1090. </p>
  1091. !! end
  1092. # test cases taken from
  1093. # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
  1094. !! test
  1095. Ruby markup (W3C-style)
  1096. !! wikitext
  1097. ;Mono-ruby for individual base characters
  1098. :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
  1099. ;Group ruby
  1100. :<ruby>今日<rt>きょう</rt></ruby>
  1101. ;Jukugo ruby
  1102. :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
  1103. ;Inline ruby
  1104. :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
  1105. ;Double-sided ruby
  1106. :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
  1107. <ruby>
  1108. <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
  1109. <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
  1110. <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
  1111. </ruby>
  1112. !! html
  1113. <dl><dt>Mono-ruby for individual base characters</dt>
  1114. <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
  1115. <dt>Group ruby</dt>
  1116. <dd><ruby>今日<rt>きょう</rt></ruby></dd>
  1117. <dt>Jukugo ruby</dt>
  1118. <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
  1119. <dt>Inline ruby</dt>
  1120. <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
  1121. <dt>Double-sided ruby</dt>
  1122. <dd><ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby></dd></dl>
  1123. <p><ruby>
  1124. <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
  1125. <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
  1126. <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
  1127. </ruby>
  1128. </p>
  1129. !! end
  1130. # The next two test different paths in the sanitizer.
  1131. !! test
  1132. Non-word characters don't terminate tag names (T19663, T42670, T54022)
  1133. !! wikitext
  1134. <blockquote|>a</blockquote>
  1135. <b→> doesn't terminate </b→>
  1136. <bä> doesn't terminate </bä>
  1137. <boo> doesn't terminate </boo>
  1138. <s.foo> doesn't terminate </s.foo>
  1139. <sub-ID#1>
  1140. !! html
  1141. <p>&lt;blockquote|&gt;a&lt;/blockquote&gt;
  1142. </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
  1143. </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
  1144. </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
  1145. </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
  1146. </p><p>&lt;sub-ID#1&gt;
  1147. </p>
  1148. !! end
  1149. !! test
  1150. Non-word characters don't terminate tag names
  1151. !! wikitext
  1152. <blockquote|>a</blockquote>
  1153. <b→> doesn't terminate </b→>
  1154. <bä> doesn't terminate </bä>
  1155. <boo> doesn't terminate </boo>
  1156. <s.foo> doesn't terminate </s.foo>
  1157. <sub-ID#1>
  1158. !! html+tidy
  1159. <p>&lt;blockquote|&gt;a
  1160. </p><p>&lt;b→&gt; doesn't terminate &lt;/b→&gt;
  1161. </p><p>&lt;bä&gt; doesn't terminate &lt;/bä&gt;
  1162. </p><p>&lt;boo&gt; doesn't terminate &lt;/boo&gt;
  1163. </p><p>&lt;s.foo&gt; doesn't terminate &lt;/s.foo&gt;
  1164. </p><p>&lt;sub-ID#1&gt;
  1165. </p>
  1166. !! end
  1167. ###
  1168. ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
  1169. ### This checks that HTML5 tags (with non-word characters in the tag
  1170. ### name) make it safely through the parser -- the Sanitizer will
  1171. ### munge them later, as it should.
  1172. ###
  1173. !! test
  1174. Non-word characters are valid in extension tags (T19663)
  1175. !! wikitext
  1176. <tåg>tåg</tåg>
  1177. !! html/php
  1178. <pre>
  1179. 'tåg'
  1180. array (
  1181. )
  1182. </pre>
  1183. !! html/parsoid
  1184. <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
  1185. !! end
  1186. !! test
  1187. Isolated close tags should be treated as literal text (T54760)
  1188. !! options
  1189. parsoid=wt2html
  1190. !! wikitext
  1191. </b>
  1192. <s.foo>s</s>
  1193. !! html/php+tidy
  1194. <p class="mw-empty-elt">
  1195. </p><p>&lt;s.foo&gt;s
  1196. </p>
  1197. !! html/parsoid
  1198. <p>&lt;s.foo&gt;s</p>
  1199. !! end
  1200. ###
  1201. ### Special characters
  1202. ###
  1203. !! test
  1204. Bare pipe character (T54363)
  1205. !! wikitext
  1206. |
  1207. !! html
  1208. <p>|
  1209. </p>
  1210. !! end
  1211. !! test
  1212. Bare pipe character from a template (T54363)
  1213. !! wikitext
  1214. {{pipe}}
  1215. !! html
  1216. <p>|
  1217. </p>
  1218. !! end
  1219. ###
  1220. ### <nowiki> test cases
  1221. ###
  1222. !! test
  1223. <nowiki> unordered list
  1224. !! wikitext
  1225. <nowiki>* This is not an unordered list item.</nowiki>
  1226. !! html/php
  1227. <p>* This is not an unordered list item.
  1228. </p>
  1229. !! html/parsoid
  1230. <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
  1231. !! end
  1232. !! test
  1233. <nowiki> spacing
  1234. !! wikitext
  1235. <nowiki>Lorem ipsum dolor
  1236. sed abit.
  1237. sed nullum.
  1238. :and a colon
  1239. </nowiki>
  1240. !! html/php
  1241. <p>Lorem ipsum dolor
  1242. sed abit.
  1243. sed nullum.
  1244. :and a colon
  1245. </p>
  1246. !! html/parsoid
  1247. <p><span typeof="mw:Nowiki">Lorem ipsum dolor
  1248. sed abit.
  1249. sed nullum.
  1250. :and a colon
  1251. </span></p>
  1252. !! end
  1253. !! test
  1254. Don't parse <nowiki><span class="error"></nowiki> (T149622)
  1255. !! wikitext
  1256. <nowiki><span class="error"></nowiki>
  1257. !! html/php
  1258. <p>&lt;span class="error"&gt;
  1259. </p>
  1260. !! html/parsoid
  1261. <p><span typeof="mw:Nowiki">&lt;span class="error"></span></p>
  1262. !! end
  1263. !! test
  1264. nowiki 3
  1265. !! wikitext
  1266. :There is not nowiki.
  1267. :There is <nowiki>nowiki</nowiki>.
  1268. #There is not nowiki.
  1269. #There is <nowiki>nowiki</nowiki>.
  1270. *There is not nowiki.
  1271. *There is <nowiki>nowiki</nowiki>.
  1272. !! html/php
  1273. <dl><dd>There is not nowiki.</dd>
  1274. <dd>There is nowiki.</dd></dl>
  1275. <ol><li>There is not nowiki.</li>
  1276. <li>There is nowiki.</li></ol>
  1277. <ul><li>There is not nowiki.</li>
  1278. <li>There is nowiki.</li></ul>
  1279. !! html/parsoid
  1280. <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
  1281. <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
  1282. <ol><li data-parsoid='{}'>There is not nowiki.</li>
  1283. <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
  1284. <ul><li data-parsoid='{}'>There is not nowiki.</li>
  1285. <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
  1286. !! end
  1287. !! test
  1288. Entities inside <nowiki>
  1289. !! wikitext
  1290. <nowiki>&lt;</nowiki>
  1291. !! html/php
  1292. <p>&lt;
  1293. </p>
  1294. !! html/parsoid
  1295. <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span></span></p>
  1296. !! end
  1297. !! test
  1298. Entities inside template parameters
  1299. !! wikitext
  1300. {{echo|&ndash;}}
  1301. !! html/php+tidy
  1302. <p>&#8211;
  1303. </p>
  1304. !! html/parsoid
  1305. <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&amp;ndash;"}},"i":0}}]}'>&ndash;</span></p>
  1306. !! end
  1307. !! test
  1308. Properly escape nowiki when combined with other wiki markup
  1309. !! options
  1310. parsoid=html2wt
  1311. !! html/parsoid
  1312. <p>* &lt;/nowiki&gt; tag</p>
  1313. !! wikitext
  1314. <nowiki>*</nowiki> <nowiki>&lt;/nowiki&gt;</nowiki> tag
  1315. !! end
  1316. !! test
  1317. T93824: Put escaped HTML tags inside nowiki
  1318. !! options
  1319. parsoid=html2wt
  1320. !! html/parsoid
  1321. <p>&lt;h2&gt;foo&lt;/h2&gt;</p>
  1322. !! wikitext
  1323. <nowiki><h2>foo</h2></nowiki>
  1324. !! end
  1325. !! test
  1326. T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
  1327. !! options
  1328. parsoid=html2wt
  1329. !! html/parsoid
  1330. <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
  1331. This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
  1332. This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
  1333. !! wikitext
  1334. This text: L'[[Foo]]
  1335. This text: L<nowiki>''</nowiki>[[Foo]]
  1336. This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
  1337. !! end
  1338. # This test fails because wikitext whitespace is not normalized before comparing.
  1339. !! test
  1340. T71950: 2. Put nowiki as close to cause as possible, after ' :'
  1341. !! options
  1342. parsoid=html2wt
  1343. !! html/parsoid
  1344. <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
  1345. </p>
  1346. !! wikitext
  1347. This text : L<nowiki>''</nowiki>[[Foo]]
  1348. !! end
  1349. # This test and the next one are html2wt only as they test that incorrect wikitext
  1350. # passed in template arguments gets escaped or wrapped in nowikis where required.
  1351. !! test
  1352. T71482: Use {{!}} instead of nowiki for single pipe in template argument
  1353. !! options
  1354. parsoid=html2wt
  1355. !! html/parsoid
  1356. <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
  1357. <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo|bar |[[&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></p>
  1358. !! wikitext
  1359. {{echo|foo{{!}}bar}}
  1360. {{echo|<nowiki>foo|bar |[[</nowiki>}}
  1361. !! end
  1362. !! test
  1363. T53961: Output correct nowikis in template arguments
  1364. !! options
  1365. parsoid=html2wt
  1366. !! html/parsoid
  1367. <p><span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt1"></span>
  1368. <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }} b&quot;}},&quot;i&quot;:0}}]}" about="#mwt2"></span>
  1369. <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a [[ b&quot;}},&quot;i&quot;:0}}]}" about="#mwt3"></span>
  1370. <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a | {{ ]]&quot;}},&quot;i&quot;:0}}]}" about="#mwt4"></span>
  1371. <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;a }&quot;}},&quot;i&quot;:0}}]}" about="#mwt5"></span></p>
  1372. !! wikitext
  1373. {{echo|a [ b}}
  1374. {{echo|<nowiki>a }} b</nowiki>}}
  1375. {{echo|<nowiki>a [[ b</nowiki>}}
  1376. {{echo|<nowiki>a | {{ ]]</nowiki>}}
  1377. {{echo|a <nowiki>}</nowiki>}}
  1378. !! end
  1379. !! test
  1380. Cases where "!!" needs nowiki protection
  1381. !! options
  1382. parsoid=html2wt
  1383. !! html/parsoid
  1384. <table>
  1385. <tr><th>this needs protection !! here</th></tr>
  1386. </table>
  1387. <table>
  1388. <tr><th>this does not need
  1389. protection !! here</th></tr>
  1390. </table>
  1391. !! wikitext
  1392. {|
  1393. !<nowiki>this needs protection !! here</nowiki>
  1394. |}
  1395. {|
  1396. !this does not need
  1397. protection !! here
  1398. |}
  1399. !! end
  1400. ###
  1401. ### Comments
  1402. ###
  1403. !! test
  1404. Comments and Indent-Pre
  1405. !! wikitext
  1406. <!-- comment 1 --> asdf
  1407. <!-- comment 1 --> asdf
  1408. <!-- comment 2 -->
  1409. <!-- comment 1 --> asdf
  1410. <!-- comment 2 -->xyz
  1411. <!-- comment 1 --> asdf
  1412. <!-- comment 2 --> xyz
  1413. !! html
  1414. <pre>asdf
  1415. </pre>
  1416. <pre>asdf
  1417. </pre>
  1418. <pre>asdf
  1419. </pre>
  1420. <p>xyz
  1421. </p>
  1422. <pre>asdf
  1423. xyz
  1424. </pre>
  1425. !! end
  1426. !! test
  1427. Comment test 2a
  1428. !! wikitext
  1429. asdf
  1430. <!-- comment 1 -->
  1431. jkl
  1432. !! html
  1433. <p>asdf
  1434. jkl
  1435. </p>
  1436. !! end
  1437. !! test
  1438. Comment test 2b
  1439. !! wikitext
  1440. asdf
  1441. <!-- comment 1 -->
  1442. jkl
  1443. !! html
  1444. <p>asdf
  1445. </p><p>jkl
  1446. </p>
  1447. !! end
  1448. !! test
  1449. Comment test 3
  1450. !! wikitext
  1451. asdf
  1452. <!-- comment 1 -->
  1453. <!-- comment 2 -->
  1454. jkl
  1455. !! html
  1456. <p>asdf
  1457. jkl
  1458. </p>
  1459. !! end
  1460. !! test
  1461. Comment test 4
  1462. !! wikitext
  1463. asdf<!-- comment 1 -->jkl
  1464. !! html
  1465. <p>asdfjkl
  1466. </p>
  1467. !! end
  1468. !! test
  1469. Comment spacing
  1470. !! wikitext
  1471. a
  1472. <!-- foo --> b <!-- bar -->
  1473. c
  1474. !! html
  1475. <p>a
  1476. </p>
  1477. <pre> b
  1478. </pre>
  1479. <p>c
  1480. </p>
  1481. !! end
  1482. !! test
  1483. Comment whitespace
  1484. !! wikitext
  1485. <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
  1486. !! html
  1487. !! end
  1488. !! test
  1489. Comment semantics and delimiters
  1490. !! wikitext
  1491. <!-- --><!----><!-----><!------>
  1492. !! html/php
  1493. !! html/parsoid
  1494. <!-- --><!----><!--&#x2D;--><!--&#x2D;&#x2D;-->
  1495. !! end
  1496. !! test
  1497. Comment semantics and delimiters, redux
  1498. !! wikitext
  1499. <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
  1500. -- foo -- funky huh? ... -->
  1501. !! html/php
  1502. !! html/parsoid
  1503. <!-- In SGML every "foo" here would actually show up in the text &#x2D;&#x2D; foo &#x2D;&#x2D; bar
  1504. &#x2D;&#x2D; foo &#x2D;&#x2D; funky huh? ... -->
  1505. !! end
  1506. !! test
  1507. Comment semantics and delimiters: directors cut
  1508. !! wikitext
  1509. <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
  1510. everything starting with < followed by !-- until the first -- and > we see,
  1511. that wouldn't be valid XML however, since in XML -- has to terminate a comment
  1512. -->-->
  1513. !! html/php
  1514. <p>--&gt;
  1515. </p>
  1516. !! html/parsoid
  1517. <!-- ... However we like to keep things simple and somewhat XML&#x2D;ish so we eat
  1518. everything starting with < followed by !&#x2D;&#x2D; until the first &#x2D;&#x2D; and &#x3E; we see,
  1519. that wouldn't be valid XML however, since in XML &#x2D;&#x2D; has to terminate a comment
  1520. --><p>--></p>
  1521. !! end
  1522. !! test
  1523. Comment semantics: nesting
  1524. !! wikitext
  1525. <!--<!-- no, we're not going to do anything fancy here -->-->
  1526. !! html/php
  1527. <p>--&gt;
  1528. </p>
  1529. !! html/parsoid
  1530. <!--<!&#x2D;&#x2D; no, we're not going to do anything fancy here --><p>--></p>
  1531. !! end
  1532. # Parsoid closes the unclosed comment, even if it means a slight
  1533. # round-trip diff.
  1534. !! test
  1535. Comment semantics: unclosed comment at end
  1536. !! options
  1537. parsoid=wt2html,html2html
  1538. !! wikitext
  1539. <!--This comment will run out to the end of the document
  1540. !! html/php
  1541. !! html/parsoid
  1542. <!--This comment will run out to the end of the document-->
  1543. !! end
  1544. !! test
  1545. Comment semantics: normalize comments to play nice with XML and browsers
  1546. !! wikitext
  1547. <!-- Browsers --!> think this is closed -->
  1548. <!--> This would normally be text -->
  1549. <!---> As would this -->
  1550. <!-- XML doesn't like trailing dashes -------->
  1551. <!-- Nor doubled hyphens -- anywhere in the data -->
  1552. But this is not a comment.
  1553. !! html/php
  1554. <p>But this is not a comment.
  1555. </p>
  1556. !! html/parsoid
  1557. <!-- Browsers &#x2D;&#x2D;!&#x3E; think this is closed -->
  1558. <!--&#x3E; This would normally be text -->
  1559. <!--&#x2D;&#x3E; As would this -->
  1560. <!-- XML doesn't like trailing dashes &#x2D;&#x2D;&#x2D;&#x2D;&#x2D;&#x2D;-->
  1561. <!-- Nor doubled hyphens &#x2D;&#x2D; anywhere in the data -->
  1562. <p>But this is not a comment.</p>
  1563. !! end
  1564. !! test
  1565. Comment semantics: round-trip even text which contains encoded -->
  1566. !! wikitext
  1567. <!-- hello & goodbye - > --&gt; --&amp;gt; --&xx -->
  1568. !! html/parsoid
  1569. <!-- hello &#x26; goodbye &#x2D; &#x3E; &#x2D;&#x2D;&#x3E; &#x2D;&#x2D;&#x26;gt; &#x2D;&#x2D;&#x26;xx -->
  1570. !! end
  1571. !! test
  1572. Comment in template title
  1573. !! wikitext
  1574. {{f<!---->oo}}
  1575. !! html
  1576. <p>FOO
  1577. </p>
  1578. !! end
  1579. !! test
  1580. Comment on its own line post-expand
  1581. !! wikitext
  1582. a
  1583. {{blank}}<!---->
  1584. b
  1585. !! html
  1586. <p>a
  1587. </p><p>b
  1588. </p>
  1589. !! end
  1590. !! test
  1591. Comment on its own line post-expand with non-significant whitespace
  1592. !! wikitext
  1593. a
  1594. {{blank}} <!---->
  1595. b
  1596. !! html
  1597. <p>a
  1598. </p><p>b
  1599. </p>
  1600. !! end
  1601. !! test
  1602. Multiple comments should still parse as SOL-transparent
  1603. !! options
  1604. parsoid=wt2html,wt2wt
  1605. !! wikitext
  1606. <!--c1-->*a
  1607. <!--c2--><!--c3--><!--c4-->*b
  1608. !! html/php
  1609. <ul><li>a</li>
  1610. <li>b</li></ul>
  1611. !! html/parsoid
  1612. <!--c1--><ul>
  1613. <li>a
  1614. </li>
  1615. <!--c2--><!--c3--><!--c4-->
  1616. <li>b
  1617. </li>
  1618. </ul>
  1619. !! end
  1620. ## Make sure ">" gets escaped in comments to avoid XSS
  1621. !! test
  1622. IE conditional comments
  1623. !! wikitext
  1624. <!--[if lt IE 9]>
  1625. <script>alert('hi');</script>
  1626. <![endif]-->
  1627. !! html/parsoid
  1628. <!--[if lt IE 9]&#x3E;
  1629. <script&#x3E;alert('hi');</script&#x3E;
  1630. <![endif]-->
  1631. !! end
  1632. ###
  1633. ### paragraph wrapping tests
  1634. ###
  1635. !! test
  1636. No block tags
  1637. !! wikitext
  1638. a
  1639. b
  1640. !! html
  1641. <p>a
  1642. </p><p>b
  1643. </p>
  1644. !! end
  1645. !! test
  1646. Block tag on one line (<div>)
  1647. !! wikitext
  1648. a <div>foo</div>
  1649. b
  1650. !! html
  1651. a <div>foo</div>
  1652. <p>b
  1653. </p>
  1654. !! html+tidy
  1655. <p>a </p><div>foo</div>
  1656. <p>b
  1657. </p>
  1658. !! end
  1659. # Remex wraps empty tag runs with p-tags.
  1660. # Parsoid strips them out during p-wrapping.
  1661. !! test
  1662. No p-wrappable content
  1663. !! wikitext
  1664. <span><div>x</div></span>
  1665. <span><s><div>x</div></s></span>
  1666. <small><em></em></small><span><s><div>x</div></s></span>
  1667. !! html/php+tidy
  1668. <span><div>x</div></span>
  1669. <span><s><div>x</div></s></span>
  1670. <p><small><em></em></small></p><span><s><div>x</div></s></span>
  1671. !! html/parsoid
  1672. <span><div>x</div></span>
  1673. <span><s><div>x</div></s></span>
  1674. <small><em></em></small><span><s><div>x</div></s></span>
  1675. !! end
  1676. # T177612: Parsoid-only test
  1677. !! test
  1678. Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
  1679. !! wikitext
  1680. {{echo|<span><div>x</div></span>}}
  1681. x
  1682. !! html/parsoid
  1683. <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>&lt;div>x&lt;/div>&lt;/span>"}},"i":0}}]}'><div>x</div></span>
  1684. <p>x</p>
  1685. !! end
  1686. !! test
  1687. Block tag on one line (<blockquote>)
  1688. !! wikitext
  1689. a <blockquote>foo</blockquote>
  1690. b
  1691. !! html
  1692. a <blockquote>foo</blockquote>
  1693. <p>b
  1694. </p>
  1695. !! html+tidy
  1696. <p>a </p><blockquote><p>foo</p></blockquote>
  1697. <p>b
  1698. </p>
  1699. !! end
  1700. !! test
  1701. Block tag on both lines (<div>)
  1702. !! wikitext
  1703. a <div>foo</div>
  1704. b <div>foo</div>
  1705. !! html
  1706. a <div>foo</div>
  1707. b <div>foo</div>
  1708. !! html+tidy
  1709. <p>a </p><div>foo</div><p>
  1710. b </p><div>foo</div>
  1711. !! end
  1712. !! test
  1713. Block tag on both lines (<blockquote>)
  1714. !! wikitext
  1715. a <blockquote>foo</blockquote>
  1716. b <blockquote>foo</blockquote>
  1717. !! html
  1718. a <blockquote>foo</blockquote>
  1719. b <blockquote>foo</blockquote>
  1720. !! html+tidy
  1721. <p>a </p><blockquote><p>foo</p></blockquote><p>
  1722. b </p><blockquote><p>foo</p></blockquote>
  1723. !! end
  1724. !! test
  1725. Multiple lines without block tags
  1726. !! wikitext
  1727. <div>foo</div> a
  1728. b
  1729. c
  1730. d<!--foo--> e
  1731. x <div>foo</div> z
  1732. !! html
  1733. <div>foo</div> a
  1734. <p>b
  1735. c
  1736. d e
  1737. </p>
  1738. x <div>foo</div> z
  1739. !! html+tidy
  1740. <div>foo</div><p> a
  1741. </p><p>b
  1742. c
  1743. d e
  1744. </p><p>
  1745. x </p><div>foo</div><p> z
  1746. </p>
  1747. !! end
  1748. # The difference between Parsoid & Remex here
  1749. # is because of Parsoid's Tidy-emulation code
  1750. # for p-wrapping. We'll start work to remove this
  1751. # emulation code in Parsoid sooner than later.
  1752. # Remex wraps empty tag runs with p-tags.
  1753. # Parsoid strips them out in a separate pass.
  1754. !! test
  1755. Empty lines between lines with block tags
  1756. !! wikitext
  1757. <div></div>
  1758. <div></div>a
  1759. b
  1760. <div>a</div>b
  1761. <div>b</div>d
  1762. <div>e</div>
  1763. !! html
  1764. <div></div>
  1765. <p><br />
  1766. </p>
  1767. <div></div>a
  1768. <p>b
  1769. </p>
  1770. <div>a</div>b
  1771. <div>b</div>d
  1772. <p><br />
  1773. </p>
  1774. <div>e</div>
  1775. !! html+tidy
  1776. <div></div>
  1777. <p><br />
  1778. </p>
  1779. <div></div><p>a
  1780. </p><p>b
  1781. </p>
  1782. <div>a</div><p>b
  1783. </p><div>b</div><p>d
  1784. </p><p><br />
  1785. </p>
  1786. <div>e</div>
  1787. !! html/parsoid
  1788. <div data-parsoid='{"stx":"html"}'></div>
  1789. <p><br /></p>
  1790. <div data-parsoid='{"stx":"html"}'></div><p>a</p>
  1791. <p>b</p>
  1792. <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
  1793. <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
  1794. <p><br /></p>
  1795. <div data-parsoid='{"stx":"html"}'>e</div>
  1796. !! end
  1797. !! test
  1798. Unclosed HTML p-tags should be handled properly
  1799. !! wikitext
  1800. <div><p>foo</div>
  1801. a
  1802. b
  1803. !! html/php+tidy
  1804. <div><p>foo</p></div>
  1805. <p>a
  1806. </p><p>b
  1807. </p>
  1808. !! html/parsoid
  1809. <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
  1810. <p>a</p>
  1811. <p>b</p>
  1812. !! end
  1813. ## SSS FIXME: I can come up with other scenarios where this doesn't work because
  1814. ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
  1815. ## them for now.
  1816. !! test
  1817. 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
  1818. !! options
  1819. parsoid=wt2html
  1820. !! wikitext
  1821. a [[Category:A1]] [[Category:A2]]
  1822. [[Category:A3]]
  1823. [[Category:A4]]
  1824. !! html/parsoid
  1825. <p>a</p>
  1826. <link rel="mw:PageProp/Category" href="./Category:A1"/> <link rel="mw:PageProp/Category" href="./Category:A2"/> <link rel="mw:PageProp/Category" href="./Category:A3"/> <link rel="mw:PageProp/Category" href="./Category:A4"/>
  1827. !! end
  1828. !! test
  1829. 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
  1830. !! options
  1831. parsoid=wt2html
  1832. !! wikitext
  1833. [[Category:A1]]a
  1834. !! html/parsoid
  1835. <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
  1836. !! end
  1837. !! test
  1838. No paragraph necessary for SOL transparent template
  1839. !! wikitext
  1840. <span><div>foo</div></span>
  1841. [[Category:Foo]]
  1842. <span><div>foo</div></span>
  1843. {{echo|[[Category:Foo]]}}
  1844. !! html/php
  1845. <span><div>foo</div></span>
  1846. <span><div>foo</div></span>
  1847. !! html/parsoid
  1848. <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
  1849. <link rel="mw:PageProp/Category" href="./Category:Foo"/>
  1850. <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
  1851. <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]"}},"i":0}}]}'/>
  1852. !! end
  1853. !! test
  1854. Avoid expanding multiline sol transparent template ranges unnecessarily
  1855. !! wikitext
  1856. hi
  1857. {{echo|<br/>
  1858. }}
  1859. [[Category:Ho]]
  1860. !! html/php
  1861. <p>hi
  1862. </p><p><br />
  1863. <br />
  1864. </p>
  1865. !! html/parsoid
  1866. <p>hi</p>
  1867. <p><br />
  1868. <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;br/>\n"}},"i":0}}]}'/><span about="#mwt1">
  1869. </span></p>
  1870. <link rel="mw:PageProp/Category" href="./Category:Ho" />
  1871. !! end
  1872. ###
  1873. ### Preformatted text
  1874. ###
  1875. !! test
  1876. Preformatted text
  1877. !! wikitext
  1878. This is some
  1879. Preformatted text
  1880. With ''italic''
  1881. And '''bold'''
  1882. And a [[Main Page|link]]
  1883. !! html
  1884. <pre>This is some
  1885. Preformatted text
  1886. With <i>italic</i>
  1887. And <b>bold</b>
  1888. And a <a href="/wiki/Main_Page" title="Main Page">link</a>
  1889. </pre>
  1890. !! end
  1891. !! test
  1892. Tabs don't trigger preformatted text
  1893. !! wikitext
  1894. This is not
  1895. preformatted text.
  1896. This is preformatted text.
  1897. So is this.
  1898. !! html/php
  1899. <p> This is not
  1900. preformatted text.
  1901. </p>
  1902. <pre>This is preformatted text.
  1903. So is this.
  1904. </pre>
  1905. !! html/parsoid
  1906. <p> This is not
  1907. preformatted text.</p>
  1908. <pre>This is preformatted text.
  1909. So is this.</pre>
  1910. !! end
  1911. !! test
  1912. Space before tab needs nowiki pre protection
  1913. !! options
  1914. parsoid=html2wt
  1915. !! html/parsoid
  1916. <p> a</p>
  1917. !! wikitext
  1918. <nowiki> </nowiki> a
  1919. !! end
  1920. !! test
  1921. Ident preformatting with inline content
  1922. !! wikitext
  1923. a
  1924. ''b''
  1925. !! html
  1926. <pre>a
  1927. <i>b</i>
  1928. </pre>
  1929. !! end
  1930. !! test
  1931. <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
  1932. !! wikitext
  1933. <pre><nowiki>
  1934. <b>
  1935. <cite>
  1936. <em>
  1937. </nowiki></pre>
  1938. !! html
  1939. <pre>
  1940. &lt;b&gt;
  1941. &lt;cite&gt;
  1942. &lt;em&gt;
  1943. </pre>
  1944. !! end
  1945. !! test
  1946. Regression with preformatted in <center>
  1947. !! wikitext
  1948. <center>
  1949. Blah
  1950. </center>
  1951. !! html
  1952. <center>
  1953. <pre>Blah
  1954. </pre>
  1955. </center>
  1956. !! end
  1957. !! test
  1958. T54763: Preformatted in <blockquote>
  1959. !! wikitext
  1960. <blockquote>
  1961. Blah
  1962. {|
  1963. |
  1964. indented cell (no pre-wrapping!)
  1965. |}
  1966. </blockquote>
  1967. !! html
  1968. <blockquote>
  1969. <p> Blah
  1970. </p>
  1971. <table>
  1972. <tr>
  1973. <td>
  1974. <p> indented cell (no pre-wrapping!)
  1975. </p>
  1976. </td></tr></table>
  1977. </blockquote>
  1978. !! end
  1979. !! test
  1980. T53086: Double newlines in blockquotes should be turned into paragraphs
  1981. !! wikitext
  1982. <blockquote>
  1983. Foo
  1984. Bar
  1985. </blockquote>
  1986. !! html
  1987. <blockquote>
  1988. <p>Foo
  1989. </p><p>Bar
  1990. </p>
  1991. </blockquote>
  1992. !! end
  1993. !! test
  1994. T17491: <ins>/<del> in blockquote
  1995. !! wikitext
  1996. <blockquote>
  1997. Foo <del>bar</del> <ins>baz</ins> quux
  1998. </blockquote>
  1999. !! html
  2000. <blockquote>
  2001. <p>Foo <del>bar</del> <ins>baz</ins> quux
  2002. </p>
  2003. </blockquote>
  2004. !! end
  2005. !! test
  2006. T17491: <ins>/<del> in blockquote (2)
  2007. !! wikitext
  2008. <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
  2009. </blockquote>
  2010. !! html
  2011. <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
  2012. </blockquote>
  2013. !! html+tidy
  2014. <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
  2015. </p></blockquote>
  2016. !! end
  2017. !! test
  2018. <pre> with attributes (T5202)
  2019. !! wikitext
  2020. <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
  2021. !! html
  2022. <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
  2023. !! end
  2024. !! test
  2025. <pre> with width attribute (T5202)
  2026. !! wikitext
  2027. <pre width="8">Narrow screen goodies</pre>
  2028. !! html
  2029. <pre width="8">Narrow screen goodies</pre>
  2030. !! end
  2031. !! test
  2032. <pre> with forbidden attribute (T5202)
  2033. !! wikitext
  2034. <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
  2035. !! html
  2036. <pre width="8">Narrow screen goodies</pre>
  2037. !! end
  2038. !! test
  2039. Entities inside <pre>
  2040. !! wikitext
  2041. <pre>&lt;</pre>
  2042. !! html
  2043. <pre>&lt;</pre>
  2044. !! end
  2045. !! test
  2046. <pre> with forbidden attribute values (T5202)
  2047. !! wikitext
  2048. <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
  2049. !! html
  2050. <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
  2051. !! end
  2052. !! test
  2053. <nowiki> inside <pre> (T15238)
  2054. !! wikitext
  2055. <pre>
  2056. <nowiki>
  2057. </pre>
  2058. <pre>
  2059. <nowiki></nowiki>
  2060. </pre>
  2061. <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
  2062. !! html
  2063. <pre>
  2064. &lt;nowiki&gt;
  2065. </pre>
  2066. <pre>
  2067. </pre>
  2068. <pre>&lt;nowiki&gt;Foo&lt;/nowiki&gt;</pre>
  2069. !! end
  2070. !! test
  2071. <nowiki> inside of #tag:pre
  2072. !! wikitext
  2073. {{#tag:pre|Foo <nowiki>&rarr;bar</nowiki>}}
  2074. !! html/php
  2075. <pre>Foo &#8594;bar</pre>
  2076. !! html/parsoid
  2077. <pre about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:pre","function":"tag"},"params":{"1":{"wt":"Foo &lt;nowiki>&amp;rarr;bar&lt;/nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
  2078. !! end
  2079. ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
  2080. ## aren't enclosed in nowikis.
  2081. !! test
  2082. <nowiki> and <pre> preference (first one wins)
  2083. !! options
  2084. parsoid=wt2html
  2085. !! wikitext
  2086. <pre>
  2087. <nowiki>
  2088. </pre>
  2089. </nowiki>
  2090. </pre>
  2091. <nowiki>
  2092. <pre>
  2093. <nowiki>
  2094. </pre>
  2095. </nowiki>
  2096. </pre>
  2097. !! html/php
  2098. <pre>
  2099. &lt;nowiki&gt;
  2100. </pre>
  2101. <p>&lt;/nowiki&gt;
  2102. &lt;/pre&gt;
  2103. </p><p>
  2104. &lt;pre&gt;
  2105. &lt;nowiki&gt;
  2106. &lt;/pre&gt;
  2107. &lt;/pre&gt;
  2108. </p>
  2109. !! html/parsoid
  2110. <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n&lt;nowiki>\n"}}'>&lt;nowiki>
  2111. </pre>
  2112. <p>&lt;/nowiki></p>
  2113. <p><span typeof="mw:Nowiki">
  2114. &lt;pre>
  2115. &lt;nowiki>
  2116. &lt;/pre>
  2117. </span></p>
  2118. !! end
  2119. !! test
  2120. </pre> inside nowiki
  2121. !! wikitext
  2122. <nowiki></pre></nowiki>
  2123. !! html
  2124. <p>&lt;/pre&gt;
  2125. </p>
  2126. !! end
  2127. !! test
  2128. Empty pre; pre inside other HTML tags (T56946)
  2129. !! wikitext
  2130. a
  2131. <div><pre>
  2132. foo
  2133. </pre></div>
  2134. <pre></pre>
  2135. !! html/php+tidy
  2136. <p>a
  2137. </p>
  2138. <div><pre>foo
  2139. </pre></div>
  2140. <pre></pre>
  2141. !! html/parsoid
  2142. <p>a</p>
  2143. <div data-parsoid='{"stx":"html"}'><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
  2144. </pre></div>
  2145. <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
  2146. !! end
  2147. !! test
  2148. HTML pre followed by indent-pre
  2149. !! wikitext
  2150. <pre>foo</pre>
  2151. bar
  2152. !! html
  2153. <pre>foo</pre>
  2154. <pre>bar
  2155. </pre>
  2156. !! end
  2157. !! test
  2158. Block tag pre
  2159. !! wikitext
  2160. <p><pre>foo</pre></p>
  2161. !! html/php+tidy
  2162. <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
  2163. !! html/parsoid
  2164. <p class='mw-empty-elt' data-parsoid='{"stx":"html","autoInsertedEnd":true}'></p><pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre><p class='mw-empty-elt' data-parsoid='{"autoInsertedStart":true,"stx":"html"}'></p>
  2165. !! end
  2166. !!test
  2167. Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
  2168. !! wikitext
  2169. {{echo|}}
  2170. !! html
  2171. !!end
  2172. !!test
  2173. Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
  2174. !! wikitext
  2175. {{echo|
  2176. foo}}
  2177. !! html
  2178. <p>foo
  2179. </p>
  2180. !!end
  2181. !! test
  2182. Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
  2183. !! wikitext
  2184. {{echo|a
  2185. b}}
  2186. !! html
  2187. <pre>a
  2188. </pre>
  2189. <p>b
  2190. </p>
  2191. !!end
  2192. !! test
  2193. Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
  2194. !! wikitext
  2195. {{echo|a
  2196. b
  2197. c
  2198. d
  2199. e
  2200. }}
  2201. !! html
  2202. <pre>a
  2203. </pre>
  2204. <p>b
  2205. c
  2206. </p>
  2207. <pre>d
  2208. </pre>
  2209. <p>e
  2210. </p>
  2211. !!end
  2212. !!test
  2213. Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
  2214. !! wikitext
  2215. {{echo| foo}}
  2216. {{echo| foo}}{{echo| bar}}
  2217. {{echo| foo}}
  2218. {{echo| bar}}
  2219. {{echo|<!--cmt--> foo}}
  2220. <!--cmt-->{{echo| foo}}
  2221. {{echo|{{echo| }}bar}}
  2222. !! html
  2223. <pre>foo
  2224. </pre>
  2225. <pre>foo bar
  2226. </pre>
  2227. <pre>foo
  2228. bar
  2229. </pre>
  2230. <pre>foo
  2231. </pre>
  2232. <pre>foo
  2233. </pre>
  2234. <pre>bar
  2235. </pre>
  2236. !!end
  2237. !! test
  2238. Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
  2239. !! wikitext
  2240. {{echo| }}a
  2241. {{echo|
  2242. }}a
  2243. {{echo|
  2244. b}}
  2245. {{echo|a
  2246. }}b
  2247. {{echo|a
  2248. }} b
  2249. !! html
  2250. <pre>a
  2251. </pre>
  2252. <p><br />
  2253. </p>
  2254. <pre>a
  2255. </pre>
  2256. <p><br />
  2257. </p>
  2258. <pre>b
  2259. </pre>
  2260. <p>a
  2261. </p>
  2262. <pre>b
  2263. </pre>
  2264. <p>a
  2265. </p>
  2266. <pre>b
  2267. </pre>
  2268. !!end
  2269. ## Hmm, should Parsoid rt this?
  2270. !! test
  2271. Pres with newline attributes
  2272. !! options
  2273. parsoid=wt2html,html2html
  2274. !! wikitext
  2275. <pre class="one
  2276. two">hi</pre>
  2277. !! html/php
  2278. <pre class="one two">hi</pre>
  2279. !! html/parsoid
  2280. <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
  2281. !! end
  2282. !! test
  2283. Things that look like <pre> tags aren't treated as such
  2284. !! wikitext
  2285. Barack Obama <President> of the United States
  2286. <President></President>
  2287. !! html
  2288. <p>Barack Obama &lt;President&gt; of the United States
  2289. &lt;President&gt;&lt;/President&gt;
  2290. </p>
  2291. !! end
  2292. !! test
  2293. Handle broken pre-like tags (T66025)
  2294. !! options
  2295. parsoid=wt2html
  2296. !! wikitext
  2297. {{echo|<pre <pre>x</pre>}}
  2298. <table><pre </table>
  2299. !! html/php
  2300. <pre>x</pre>
  2301. <table>&lt;pre </table>
  2302. !! html/php+tidy
  2303. <pre>x</pre>
  2304. &lt;pre <table></table>
  2305. !! html/parsoid
  2306. <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"&lt;pre":null},"sa":{"&lt;pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre &lt;pre>x&lt;/pre>"}},"i":0}}]}'>x</pre>
  2307. <p>&lt;pre </p>
  2308. <table></table>
  2309. !! end
  2310. !! test
  2311. Parsoid: handle pre with space after attribute
  2312. !! options
  2313. parsoid=wt2html
  2314. !! wikitext
  2315. <pre style="width:50%;" >{{echo|foo}}</pre>
  2316. !! html/php
  2317. <pre style="width:50%;">{{echo|foo}}</pre>
  2318. !! html/parsoid
  2319. <pre typeof="mw:Extension/pre" about="#mwt2" style="width:50%;" data-mw='{"name":"pre","attrs":{"style":"width:50%;"},"body":{"extsrc":"{{echo|foo}}"}}'>{{echo|foo}}</pre>
  2320. !! end
  2321. # TODO / maybe: fix wt2wt for this
  2322. !! test
  2323. Parsoid: Don't paragraph-wrap fosterable content
  2324. !! options
  2325. parsoid=wt2html
  2326. !! wikitext
  2327. {|
  2328. <td></td>
  2329. <td></td>
  2330. |}
  2331. !! html
  2332. <table>
  2333. <tbody>
  2334. <tr>
  2335. <td></td>
  2336. <td></td></tr>
  2337. </tbody></table>
  2338. !! end
  2339. !! test
  2340. Self-closed pre
  2341. !! wikitext
  2342. <pre />
  2343. !! html/php
  2344. <pre></pre>
  2345. !! html/parsoid
  2346. <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
  2347. !! end
  2348. !! test
  2349. Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
  2350. !! options
  2351. parsoid=wt2html
  2352. !! wikitext
  2353. {|
  2354. <td>
  2355. <td>
  2356. </td>
  2357. |}
  2358. !! html
  2359. <table>
  2360. <tbody>
  2361. <tr>
  2362. <td></td>
  2363. <td>
  2364. </td></tr>
  2365. </tbody></table>
  2366. !! end
  2367. #--------------------------------------------------------------------
  2368. # Transclusion parameter whitespace stripping tests
  2369. # Behavior is different for positional and named parameters
  2370. #--------------------------------------------------------------------
  2371. !! test
  2372. Templates: Strip leading and trailing whitespace from named-param values
  2373. !! wikitext
  2374. {{echo|1= a }}
  2375. {{echo|1= {{echo|b}} }}
  2376. {{echo| 1 =
  2377. c }}
  2378. {{echo| 1 =
  2379. * d
  2380. }}
  2381. !! html
  2382. <p>a
  2383. </p><p>b
  2384. </p><p>c
  2385. </p>
  2386. <ul><li>d</li></ul>
  2387. !! end
  2388. !! test
  2389. Templates: Don't strip whitespace from positional-param values
  2390. !! wikitext
  2391. {{echo|a }}
  2392. {{echo|{{echo|b}} }}
  2393. {{echo| c
  2394. }}
  2395. {{echo| {{echo|d}}
  2396. }}
  2397. {{echo|
  2398. e}}
  2399. {{echo|
  2400. *f}}
  2401. {{echo|
  2402. }}g
  2403. !! html
  2404. <p>a
  2405. </p><p>b
  2406. </p>
  2407. <pre>c
  2408. </pre>
  2409. <p><br />
  2410. </p>
  2411. <pre>d
  2412. </pre>
  2413. <p><br />
  2414. </p>
  2415. <pre>e
  2416. </pre>
  2417. <p><br />
  2418. </p>
  2419. <ul><li>f</li></ul>
  2420. <p><br />
  2421. </p>
  2422. <pre>g
  2423. </pre>
  2424. !! end
  2425. !! test
  2426. Templates: Don't recognize targets split by newlines
  2427. !! options
  2428. parsoid=wt2html
  2429. !! wikitext
  2430. {{ech
  2431. o|foo}}
  2432. !! html/php
  2433. <p>{{ech
  2434. o|foo}}
  2435. </p>
  2436. !! html/parsoid
  2437. <p>{{ech
  2438. o|foo}}</p>
  2439. !! end
  2440. !! test
  2441. Templates: Recognize targets when newlines and comments don't split the target
  2442. !! options
  2443. parsoid=wt2html
  2444. !! wikitext
  2445. {{
  2446. <!--X--> ech<!--X-->o<!--X-->
  2447. <!--X--> <!--X-->
  2448. |foo}}
  2449. !! html/php
  2450. <p>foo
  2451. </p>
  2452. !! html/parsoid
  2453. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech&lt;!--X-->o&lt;!--X--> \n &lt;!--X--> &lt;!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
  2454. !! end
  2455. !! test
  2456. Templates: Handle empty comment-and-ws-only lines correctly
  2457. !! wikitext
  2458. {{echo|foo
  2459. <!--should be ignored-->
  2460. <!--should be ignored as well-->
  2461. bar}}
  2462. !! html/php
  2463. <p>foo
  2464. bar
  2465. </p>
  2466. !! html/parsoid
  2467. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n&lt;!--should be ignored-->\n &lt;!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
  2468. !! end
  2469. !! test
  2470. Templates: Handle comments in the target
  2471. !! wikitext
  2472. {{echo
  2473. <!-- should be ignored -->
  2474. |foo}}
  2475. {{echo
  2476. <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
  2477. |foo}}
  2478. {{echo<!-- should be ignored -->
  2479. |foo}}
  2480. {{echo<!-- should be ignored -->|foo}}
  2481. {{<!-- should be ignored -->echo|foo}}
  2482. !! html/php
  2483. <p>foo
  2484. </p><p>foo
  2485. </p><p>foo
  2486. </p><p>foo
  2487. </p><p>foo
  2488. </p>
  2489. !! html/parsoid
  2490. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
  2491. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n&lt;!-- should be ignored and spaces on next line should not trip us up (T147742) -->\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
  2492. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
  2493. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo&lt;!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
  2494. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
  2495. !! end
  2496. !! test
  2497. Templates: Handle comments in parameter names (T69657)
  2498. !! wikitext
  2499. {{echo|1
  2500. <!-- should be ignored -->
  2501. =foo}}
  2502. {{echo|
  2503. <!-- should be ignored -->
  2504. 1 = foo}}
  2505. {{echo|1<!-- should be ignored -->=foo}}
  2506. {{echo|<!-- should be ignored -->1=foo}}
  2507. !! html/php
  2508. <p>foo
  2509. </p><p>foo
  2510. </p><p>foo
  2511. </p><p>foo
  2512. </p>
  2513. !! html/parsoid
  2514. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
  2515. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
  2516. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1&lt;!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
  2517. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"&lt;!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
  2518. !! end
  2519. !! test
  2520. Templates: Other wikitext in parameter names (T69657)
  2521. !! wikitext
  2522. {{echo|''1''=foo}}
  2523. !! html/php
  2524. <p>{{{1}}}
  2525. </p>
  2526. !! html/parsoid
  2527. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"&#39;&#39;1&#39;&#39;":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
  2528. !! end
  2529. !! test
  2530. Templates: With colons
  2531. !! wikitext
  2532. {{With: Colon}}
  2533. !! html/php
  2534. <p>Template with colon
  2535. </p>
  2536. !! html/parsoid
  2537. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"With: Colon","href":"./Template:With:_Colon"},"params":{},"i":0}}]}'>Template with colon</p>
  2538. !! end
  2539. #--------------------------------------------------------------------
  2540. # Transclusion parameter escaping tests
  2541. #--------------------------------------------------------------------
  2542. !! test
  2543. Templates: Parsoid parameter escaping test 1
  2544. !! wikitext
  2545. {{echo|[foo]|{{echo|[bar]}}}}
  2546. !! html/php+tidy
  2547. <p>[foo]
  2548. </p>
  2549. !! html/parsoid
  2550. <p about="#mwt1" typeof="mw:Transclusion"
  2551. data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
  2552. !! end
  2553. !! test
  2554. Parsoid: Pipes in external links in template parameter
  2555. !! wikitext
  2556. {{echo|[{{echo|http://example.com}} link]}}
  2557. !! html/php+tidy
  2558. <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
  2559. </p>
  2560. !! html/parsoid
  2561. <p><a rel="mw:ExtLink" class="external text" href="http://example.com" about="#mwt31" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{echo|http://example.com}} link]"}},"i":0}}]}'>link</a></p>
  2562. !! end
  2563. !! test
  2564. Parsoid: pipe in transclusion parameter
  2565. !! wikitext
  2566. {{echo|http://foo.com/a&#124;b}}
  2567. !! html/php+tidy
  2568. <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
  2569. </p>
  2570. !! html/parsoid
  2571. <p><a rel="mw:ExtLink" class="external free" href="http://foo.com/a%7Cb" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://foo.com/a&amp;#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
  2572. !! end
  2573. !! test
  2574. Parsoid: Pipe in external link target and content in template parameter
  2575. !! options
  2576. parsoid=html2wt,wt2wt
  2577. !! wikitext
  2578. {{echo|[http://foo.com/a&#124;b a&#124;b]}}
  2579. !! html/php+tidy
  2580. <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a&#124;b</a>
  2581. </p>
  2582. !! html/parsoid
  2583. <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
  2584. typeof="mw:Transclusion"
  2585. data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
  2586. "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
  2587. !! end
  2588. !! test
  2589. Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
  2590. !! options
  2591. parsoid
  2592. !! wikitext
  2593. {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
  2594. !! html
  2595. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]"}},"i":0}}]}'>[Main Page bar]</p>
  2596. !! end
  2597. !! test
  2598. Templates: Don't escape already nowiki-escaped text in template parameters
  2599. !! options
  2600. parsoid=html2wt,wt2wt
  2601. !! wikitext
  2602. {{echo|foo<nowiki>|</nowiki>bar}}
  2603. {{echo|<nowiki>&lt;div&gt;</nowiki>}}
  2604. {{echo|<nowiki></nowiki>}}
  2605. !! html/php+tidy
  2606. <p>foo|bar
  2607. &lt;div&gt;
  2608. </p>
  2609. !! html/parsoid
  2610. <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<nowiki>|</nowiki>bar"}},"i":0}}]}'}'>foo</span><span typeof="mw:Nowiki" about="#mwt1">|</span><span about="#mwt1">bar</span>
  2611. <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&amp;lt;div&amp;gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity">&lt;</span>div<span typeof="mw:Entity">&gt;</span></span>
  2612. <span typeof="mw:Transclusion mw:Nowiki" about="#mwt3" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki></nowiki>"}},"i":0}}]}'></span>
  2613. </p>
  2614. !! end
  2615. ## T54824
  2616. !! test
  2617. Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
  2618. !! options
  2619. parsoid=html2wt,wt2wt
  2620. !! wikitext
  2621. {{echo|{{echo|1=bar}}}}
  2622. !! html/php+tidy
  2623. <p>bar
  2624. </p>
  2625. !! html/parsoid
  2626. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{echo|1=bar}}"}},"i":0}}]}'>bar</p>
  2627. !! end
  2628. ## T58733
  2629. !! test
  2630. Templates parameters with special tokenizing behavior dont get modified because of arg escaping
  2631. !! wikitext
  2632. {{echo|a : b}}
  2633. !! html/php+tidy
  2634. <p>a&#160;: b
  2635. </p>
  2636. !! html/parsoid
  2637. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a : b"}},"i":0}}]}'>a<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"isDisplayHack":true}'> </span>: b</p>
  2638. !! end
  2639. ## T73412
  2640. !! test
  2641. Templates: Preserve blank parameter names
  2642. !! wikitext
  2643. {{echo|=foo}}
  2644. !! html/php+tidy
  2645. <p>{{{1}}}
  2646. </p>
  2647. !! html/parsoid
  2648. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
  2649. !! end
  2650. !! test
  2651. Templates: Preserve blank parameter names in other positions
  2652. !! wikitext
  2653. {{blank_param|bar|=foo}}
  2654. !! html/php+tidy
  2655. <p>bar
  2656. foo
  2657. </p>
  2658. !! html/parsoid
  2659. <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"blank_param","href":"./Template:Blank_param"},"params":{"1":{"wt":"bar"},"":{"wt":"foo"}},"i":0}}]}'>bar
  2660. foo</p>
  2661. !! end
  2662. ###
  2663. ### Parsoid-centric tests for testing RT edge cases for pre
  2664. ###
  2665. !!test
  2666. 1a. Indent-Pre and Comments
  2667. !! wikitext
  2668. a
  2669. <!--a-->
  2670. c
  2671. !! html
  2672. <pre>a
  2673. </pre>
  2674. <p>c
  2675. </p>
  2676. !!end
  2677. !!test
  2678. 1b. Indent-Pre and Comments
  2679. !! wikitext
  2680. a
  2681. <!--a-->
  2682. c
  2683. !! html
  2684. <pre>a
  2685. </pre>
  2686. <p>c
  2687. </p>
  2688. !!end
  2689. !!test
  2690. 1c. Indent-Pre and Comments
  2691. !! wikitext
  2692. <!--a--> a
  2693. <!--a--> a
  2694. !! html
  2695. <pre> a
  2696. </pre>
  2697. <pre> a
  2698. </pre>
  2699. !!end
  2700. !!test
  2701. 1d. Indent-Pre and Comments
  2702. (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
  2703. !! wikitext
  2704. <!--a--> a
  2705. <!--b-->b
  2706. !! html
  2707. <pre>a
  2708. </pre>
  2709. <pre>b
  2710. </pre>
  2711. !!end
  2712. !!test
  2713. 2a. Indent-Pre and tables
  2714. !! wikitext
  2715. {|
  2716. |-
  2717. !h1!!h2
  2718. |foo||bar
  2719. |}
  2720. !! html
  2721. <table>
  2722. <tr>
  2723. <th>h1</th>
  2724. <th>h2
  2725. </th>
  2726. <td>foo</td>
  2727. <td>bar
  2728. </td></tr></table>
  2729. !!end
  2730. !!test
  2731. 2b. Indent-Pre and tables
  2732. !! wikitext
  2733. {|
  2734. |-
  2735. |foo
  2736. |}
  2737. !! html
  2738. <table>
  2739. <tr>
  2740. <td>foo
  2741. </td></tr></table>
  2742. !!end
  2743. !!test
  2744. 2c. Indent-Pre and tables (T44252)
  2745. !! wikitext
  2746. {|
  2747. |+foo
  2748. ! |bar
  2749. |}
  2750. !! html
  2751. <table>
  2752. <caption>foo
  2753. </caption>
  2754. <tr>
  2755. <th>bar
  2756. </th></tr></table>
  2757. !!end
  2758. !!test
  2759. 2d. Indent-Pre and tables
  2760. !! wikitext
  2761. a
  2762. {|
  2763. |b
  2764. |}
  2765. !! html/php
  2766. <pre>a
  2767. </pre>
  2768. <table>
  2769. <tr>
  2770. <td>b
  2771. </td></tr></table>
  2772. !! html/parsoid
  2773. <pre>a</pre>
  2774. <table>
  2775. <tbody><tr><td> b</td></tr>
  2776. </tbody></table>
  2777. !!end
  2778. !!test
  2779. 2e. Indent-Pre and table-line syntax
  2780. !! wikitext
  2781. a
  2782. | b
  2783. | c
  2784. !! html/php
  2785. <pre>a
  2786. | b
  2787. | c
  2788. </pre>
  2789. !!end
  2790. !!test
  2791. 2f. Indent-pre started by table-line syntax
  2792. !! wikitext
  2793. a
  2794. | b
  2795. | c
  2796. !! html/php
  2797. <p>a
  2798. </p>
  2799. <pre>| b
  2800. | c
  2801. </pre>
  2802. !! html/parsoid
  2803. <p>a</p>
  2804. <pre>
  2805. | b
  2806. | c</pre>
  2807. !!end
  2808. !! test
  2809. 2g. Indented table markup mixed with indented pre content (proposed in T8200)
  2810. !! wikitext
  2811. <table>
  2812. <tr>
  2813. <td>
  2814. Text that should be rendered preformatted
  2815. </td>
  2816. </tr>
  2817. </table>
  2818. !! html
  2819. <table>
  2820. <tr>
  2821. <td>
  2822. <pre>Text that should be rendered preformatted
  2823. </pre>
  2824. </td>
  2825. </tr>
  2826. </table>
  2827. !! end
  2828. !!test
  2829. 3a. Indent-Pre and block tags (single-line html)
  2830. !! wikitext
  2831. a <p> foo </p>
  2832. b <div> foo </div>
  2833. c <blockquote> foo </blockquote>
  2834. <span> foo </span>
  2835. !! html
  2836. a <p> foo </p>
  2837. b <div> foo </div>
  2838. c <blockquote> foo </blockquote>
  2839. <pre><span> foo </span>
  2840. </pre>
  2841. !! html/parsoid
  2842. <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
  2843. <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
  2844. <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
  2845. <pre><span> foo </span>
  2846. </pre>
  2847. !! html/php+tidy
  2848. <p> a </p><p> foo </p><p>
  2849. b </p><div> foo </div><p>
  2850. c </p><blockquote><p> foo </p></blockquote>
  2851. <pre><span> foo </span>
  2852. </pre>
  2853. !! end
  2854. !!test
  2855. 3b. Indent-Pre and block tags (multi-line html)
  2856. !! wikitext
  2857. a <span>foo</span>
  2858. b <div> foo </div>
  2859. !! html
  2860. <pre>a <span>foo</span>
  2861. </pre>
  2862. b <div> foo </div>
  2863. !! html/parsoid
  2864. <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
  2865. b <div data-parsoid='{"stx":"html"}'> foo </div>
  2866. !! html/php+tidy
  2867. <pre>a <span>foo</span>
  2868. </pre><p>
  2869. b </p><div> foo </div>
  2870. !!end
  2871. !!test
  2872. 3c. Indent-Pre and block tags (pre-content on separate line)
  2873. !! wikitext
  2874. <p>
  2875. foo
  2876. </p>
  2877. <div>
  2878. foo
  2879. </div>
  2880. <center>
  2881. foo
  2882. </center>
  2883. <blockquote>
  2884. foo
  2885. </blockquote>
  2886. <blockquote>
  2887. <pre>
  2888. foo
  2889. </pre>
  2890. </blockquote>
  2891. <table><tr><td>
  2892. foo
  2893. </td></tr></table>
  2894. <ul><li>
  2895. foo
  2896. </li></ul>
  2897. !! html
  2898. <p>
  2899. foo
  2900. </p>
  2901. <div>
  2902. <pre>foo
  2903. </pre>
  2904. </div>
  2905. <center>
  2906. <pre>foo
  2907. </pre>
  2908. </center>
  2909. <blockquote>
  2910. <p> foo
  2911. </p>
  2912. </blockquote>
  2913. <blockquote>
  2914. <pre>
  2915. foo
  2916. </pre>
  2917. </blockquote>
  2918. <table><tr><td>
  2919. <pre>foo
  2920. </pre>
  2921. </td></tr></table>
  2922. <ul><li>
  2923. foo
  2924. </li></ul>
  2925. !!end
  2926. !! test
  2927. 4. Indent-Pre and extension tags
  2928. !! wikitext
  2929. a <tag />
  2930. !! html/php
  2931. a <pre>
  2932. NULL
  2933. array (
  2934. )
  2935. </pre>
  2936. !! html/parsoid
  2937. a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
  2938. !! end
  2939. !! test
  2940. 5. Indent-Pre and html pre
  2941. !! wikitext
  2942. <pre class="123">hi</pre>
  2943. !! html/php
  2944. <pre class="123">hi</pre>
  2945. !! html/parsoid
  2946. <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
  2947. !! end
  2948. !!test
  2949. Render paragraphs when indent-pre is suppressed in blocklevels
  2950. !! wikitext
  2951. <blockquote>
  2952. foo
  2953. bar
  2954. </blockquote>
  2955. !! html
  2956. <blockquote>
  2957. <p> foo
  2958. </p><p> bar
  2959. </p>
  2960. </blockquote>
  2961. !!end
  2962. !!test
  2963. 4. Multiple spaces at start-of-line
  2964. !! wikitext
  2965. <p> foo </p>
  2966. foo
  2967. {|
  2968. |foo
  2969. |}
  2970. !! html
  2971. <p> foo </p>
  2972. <pre> foo
  2973. </pre>
  2974. <table>
  2975. <tr>
  2976. <td>foo
  2977. </td></tr></table>
  2978. !!end
  2979. ## NOTE: the leading white-space chars on empty line are significant
  2980. !! test
  2981. 5a. White-space in indent-pre
  2982. !! wikitext
  2983. a<br />
  2984. b
  2985. !! html
  2986. <pre>a<br />
  2987. b
  2988. </pre>
  2989. !! end
  2990. ## NOTE: the leading white-space chars on empty line are significant
  2991. !! test
  2992. 5b. White-space in indent-pre
  2993. !! wikitext
  2994. a
  2995. b
  2996. c
  2997. !! html
  2998. <pre>a
  2999. b
  3000. c
  3001. </pre>
  3002. !! end
  3003. !! test
  3004. 5c. White-space in indent-pre
  3005. !! wikitext
  3006. ''a''
  3007. ''b''
  3008. ''c''
  3009. !! html
  3010. <pre><i>a</i>
  3011. <i>b</i>
  3012. <i>c</i>
  3013. </pre>
  3014. !! end
  3015. !! test
  3016. 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
  3017. !! wikitext
  3018. a
  3019. <!-- continue -->
  3020. b
  3021. c
  3022. d
  3023. !! html
  3024. <pre>a
  3025. b
  3026. </pre>
  3027. <pre>c
  3028. </pre>
  3029. <p>d
  3030. </p>
  3031. !! end
  3032. !! test
  3033. 7a. Indent-pre and category links
  3034. !! options
  3035. parsoid=wt2html,wt2wt
  3036. !! wikitext
  3037. [[Category:foo]] <!-- No pre-wrapping -->
  3038. {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
  3039. !! html/php+tidy
  3040. !! html/parsoid
  3041. <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre&#x2D;wrapping -->
  3042. <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":" [[Category:foo]]"}},"i":0}}]}'> </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1"> <!-- No pre&#x2D;wrapping -->
  3043. !! end
  3044. ## We used to, but no longer wt2wt this test since the default serializer
  3045. ## will normalize all categories to serialize on their own line.
  3046. ## This wikitext usage is going to be fairly uncommon in production and
  3047. ## selser will take care of preserving formatting in those scenarios.
  3048. !! test
  3049. 7b. Indent-pre and category links
  3050. !! options
  3051. parsoid=wt2html
  3052. !! wikitext
  3053. [[Category:foo]] a
  3054. [[Category:foo]] {{echo|b}}
  3055. !! html/parsoid
  3056. <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
  3057. <link rel="mw:PageProp/Category" href="./Category:Foo"> <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b"}},"i":0}}]}'>b</span></pre>
  3058. !! end
  3059. !! test
  3060. Indent-Pre: Newlines in comments shouldn't affect sol state
  3061. !! wikitext
  3062. a <!--
  3063. foo
  3064. --> b
  3065. !! html/php+tidy
  3066. <p>a b
  3067. </p>
  3068. !! html/parsoid
  3069. <p>a <!--
  3070. foo
  3071. --> b</p>
  3072. !! end
  3073. ###
  3074. ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
  3075. ###
  3076. !!test
  3077. HTML-pre: 1. embedded newlines
  3078. !! wikitext
  3079. <pre>foo</pre>
  3080. <pre>
  3081. foo
  3082. </pre>
  3083. <pre>
  3084. foo
  3085. </pre>
  3086. <pre>
  3087. foo
  3088. </pre>
  3089. !! html/php+tidy
  3090. <pre>foo</pre>
  3091. <pre>foo
  3092. </pre>
  3093. <pre>
  3094. foo
  3095. </pre>
  3096. <pre>
  3097. foo
  3098. </pre>
  3099. !! html/parsoid
  3100. <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
  3101. <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
  3102. </pre>
  3103. <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
  3104. foo
  3105. </pre>
  3106. <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
  3107. foo
  3108. </pre>
  3109. !!end
  3110. !! test
  3111. HTML-pre: big spaces
  3112. !! wikitext
  3113. <pre>
  3114. haha
  3115. haha
  3116. </pre>
  3117. !! html/php+tidy
  3118. <pre>
  3119. haha
  3120. haha
  3121. </pre>
  3122. !! html/parsoid
  3123. <pre typeof="mw:Extension/pre" about="#mwt2" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\n\n\nhaha\n\n\n\n\nhaha\n\n\n\n\n"}}'>
  3124. haha
  3125. haha
  3126. </pre>
  3127. !! end
  3128. !!test
  3129. HTML-pre: 2: indented text
  3130. !! wikitext
  3131. <pre>
  3132. foo
  3133. </pre>
  3134. !! html
  3135. <pre>
  3136. foo
  3137. </pre>
  3138. !!end
  3139. !!test
  3140. HTML-pre: 3: other wikitext
  3141. !! wikitext
  3142. <pre>
  3143. * foo
  3144. # bar
  3145. = no-h =
  3146. '' no-italic ''
  3147. [[ NoLink ]]
  3148. </pre>
  3149. !! html/php
  3150. <pre>
  3151. * foo
  3152. # bar
  3153. = no-h =
  3154. '' no-italic ''
  3155. [[ NoLink ]]
  3156. </pre>
  3157. !! html/parsoid
  3158. <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n&#39;&#39; no-italic &#39;&#39;\n[[ NoLink ]]\n"}}'>* foo
  3159. # bar
  3160. = no-h =
  3161. '' no-italic ''
  3162. [[ NoLink ]]
  3163. </pre>
  3164. !!end
  3165. ###
  3166. ### Definition lists
  3167. ###
  3168. !! test
  3169. Simple definition
  3170. !! wikitext
  3171. ;name :Definition
  3172. !! html
  3173. <dl><dt>name&#160;</dt>
  3174. <dd>Definition</dd></dl>
  3175. !! end
  3176. !! test
  3177. Definition list for indentation only
  3178. !! wikitext
  3179. :Indented text
  3180. !! html
  3181. <dl><dd>Indented text</dd></dl>
  3182. !! end
  3183. !! test
  3184. Definition list with no space
  3185. !! wikitext
  3186. ;name:Definition
  3187. !! html
  3188. <dl><dt>name</dt>
  3189. <dd>Definition</dd></dl>
  3190. !!end
  3191. !! test
  3192. Definition list with URL link
  3193. !! wikitext
  3194. ;http://example.com/ :definition
  3195. !! html
  3196. <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&#160;</dt>
  3197. <dd>definition</dd></dl>
  3198. !! end
  3199. !! test
  3200. Definition list with bracketed URL link
  3201. !! wikitext
  3202. ;[http://www.example.com/ Example]:Something about it
  3203. !! html
  3204. <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
  3205. <dd>Something about it</dd></dl>
  3206. !! end
  3207. !! test
  3208. Definition list with wikilink containing colon
  3209. !! wikitext
  3210. ; [[Help:FAQ]]:The least-read page on Wikipedia
  3211. !! html
  3212. <dl><dt><a href="/index.php?title=Help:FAQ&amp;action=edit&amp;redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
  3213. <dd>The least-read page on Wikipedia</dd></dl>
  3214. !! end
  3215. # At Brion's and JeLuF's insistence... :)
  3216. !! test
  3217. Definition list with news link containing colon
  3218. !! wikitext
  3219. ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
  3220. !! html/php
  3221. <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
  3222. <dd>This isn't even a real newsgroup!</dd></dl>
  3223. !! html/parsoid
  3224. <dl><dt> <a rel="mw:ExtLink" class="external free" href="news:alt.wikipedia.rox" data-parsoid='{"stx":"url"}'>news:alt.wikipedia.rox</a></dt><dd data-parsoid='{"stx":"row"}'>This isn't even a real newsgroup!</dd></dl>
  3225. !! end
  3226. !! test
  3227. Malformed definition list with colon
  3228. !! wikitext
  3229. ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
  3230. !! html
  3231. <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a> -- don't crash or enter an infinite loop</dt></dl>
  3232. !! end
  3233. !! test
  3234. Definition lists: colon in external link text
  3235. !! wikitext
  3236. ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
  3237. !! html
  3238. <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia&#160;:The Next Generation</a>&#160;</dt>
  3239. <dd>OK, I made that up</dd></dl>
  3240. !! end
  3241. !! test
  3242. Definition lists: colon in HTML attribute
  3243. !! wikitext
  3244. ;<b style="display: inline">bold</b>
  3245. !! html
  3246. <dl><dt><b style="display: inline">bold</b></dt></dl>
  3247. !! end
  3248. !! test
  3249. Definition lists: self-closed tag
  3250. !! wikitext
  3251. ;one<br/>two :two-line fun
  3252. !! html
  3253. <dl><dt>one<br />two&#160;</dt>
  3254. <dd>two-line fun</dd></dl>
  3255. !! end
  3256. !! test
  3257. Definition lists: ignore colons inside tags
  3258. !! wikitext
  3259. ;one <b>two : tag <i>fun:</i>:</b>:def
  3260. !! html
  3261. <dl><dt>one <b>two&#160;: tag <i>fun:</i>:</b></dt>
  3262. <dd>def</dd></dl>
  3263. !! end
  3264. !! test
  3265. Definition lists: excess closed tags
  3266. !! wikitext
  3267. ;one</b>two :bad tag fun
  3268. !! html/php+tidy
  3269. <dl><dt>onetwo&#160;</dt>
  3270. <dd>bad tag fun</dd></dl>
  3271. !! html/parsoid
  3272. <dl>
  3273. <dt>onetwo</dt>
  3274. <dd>bad tag fun</dd>
  3275. </dl>
  3276. !! end
  3277. !! test
  3278. T13748: Literal closing tags
  3279. !! wikitext
  3280. <dl>
  3281. <dt>test 1</dt>
  3282. <dd>test test test test test</dd>
  3283. <dt>test 2</dt>
  3284. <dd>test test test test test</dd>
  3285. </dl>
  3286. !! html
  3287. <dl>
  3288. <dt>test 1</dt>
  3289. <dd>test test test test test</dd>
  3290. <dt>test 2</dt>
  3291. <dd>test test test test test</dd>
  3292. </dl>
  3293. !! end
  3294. !! test
  3295. Definition and unordered list using wiki syntax nested in unordered list using html tags.
  3296. !! wikitext
  3297. <ul><li>
  3298. ;term :description
  3299. *unordered
  3300. </li></ul>
  3301. !! html
  3302. <ul><li>
  3303. <dl><dt>term&#160;</dt>
  3304. <dd>description</dd></dl>
  3305. <ul><li>unordered</li></ul>
  3306. </li></ul>
  3307. !! end
  3308. !! test
  3309. Definition list with empty definition and following paragraph
  3310. !! wikitext
  3311. ;term:
  3312. Paragraph text
  3313. !! html
  3314. <dl><dt>term</dt>
  3315. <dd></dd></dl>
  3316. <p>Paragraph text
  3317. </p>
  3318. !! end
  3319. !! test
  3320. Nested definition lists using html syntax
  3321. !! wikitext
  3322. <dl><dt>x</dt>
  3323. <dd>a</dd>
  3324. <dd>b</dd></dl>
  3325. !! html
  3326. <dl><dt>x</dt>
  3327. <dd>a</dd>
  3328. <dd>b</dd></dl>
  3329. !! end
  3330. !! test
  3331. Definition Lists: No nesting: Multiple dd's
  3332. !! wikitext
  3333. ;x
  3334. :a
  3335. :b
  3336. !! html
  3337. <dl><dt>x</dt>
  3338. <dd>a</dd>
  3339. <dd>b</dd></dl>
  3340. !! end
  3341. !! test
  3342. Definition Lists: Indentation: Regular
  3343. !! wikitext
  3344. :i1
  3345. ::i2
  3346. :::i3
  3347. !! html
  3348. <dl><dd>i1
  3349. <dl><dd>i2
  3350. <dl><dd>i3</dd></dl></dd></dl></dd></dl>
  3351. !! end
  3352. !! test
  3353. Definition Lists: Indentation: Missing 1st level
  3354. !! wikitext
  3355. ::i2
  3356. :::i3
  3357. !! html
  3358. <dl><dd><dl><dd>i2
  3359. <dl><dd>i3</dd></dl></dd></dl></dd></dl>
  3360. !! end
  3361. !! test
  3362. Definition Lists: Indentation: Multi-level indent
  3363. !! wikitext
  3364. :::i3
  3365. !! html
  3366. <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
  3367. !! end
  3368. !! test
  3369. Definition Lists: Hacky use to indent tables
  3370. !! wikitext
  3371. ::{|
  3372. |foo
  3373. |bar
  3374. |}
  3375. this text
  3376. should be left alone
  3377. !! html
  3378. <dl><dd><dl><dd><table>
  3379. <tr>
  3380. <td>foo
  3381. </td>
  3382. <td>bar
  3383. </td></tr></table></dd></dl></dd></dl>
  3384. <p>this text
  3385. should be left alone
  3386. </p>
  3387. !! end
  3388. !! test
  3389. Definition Lists: Hacky use to indent tables (with content following table)
  3390. !! wikitext
  3391. :{|
  3392. |foo
  3393. |bar
  3394. |} <!--c1--> this text should be part of the dl
  3395. !! html/php+tidy
  3396. <dl><dd><table>
  3397. <tbody><tr>
  3398. <td>foo
  3399. </td>
  3400. <td>bar
  3401. </td></tr></tbody></table> this text should be part of the dl</dd></dl>
  3402. !! html/parsoid
  3403. <dl><dd><table>
  3404. <tbody><tr>
  3405. <td>foo
  3406. </td>
  3407. <td>bar
  3408. </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
  3409. !! end
  3410. !! test
  3411. Definition Lists: Hacky use to indent tables, with comments (T65979)
  3412. !! wikitext
  3413. <!-- foo -->
  3414. ::{|
  3415. |foo
  3416. |bar
  3417. |}<!-- bar -->
  3418. this text
  3419. should be left alone
  3420. !! html/parsoid
  3421. <!-- foo -->
  3422. <dl><dd><dl><dd><table><tr>
  3423. <td>foo</td>
  3424. <td>bar</td>
  3425. </tr></table><!-- bar --></dd></dl></dd></dl>
  3426. <p>this text
  3427. should be left alone</p>
  3428. !! end
  3429. !! test
  3430. Definition Lists: Hacky use to indent tables, with comment before table
  3431. !! wikitext
  3432. ::<!-- foo -->{|
  3433. |foo
  3434. |}
  3435. !! html/parsoid
  3436. <dl><dd><dl><dd><!-- foo --><table><tr>
  3437. <td>foo</td>
  3438. </tr></table></dd></dl></dd></dl>
  3439. !! end
  3440. # The trailing whitespace in this test is to catch a regression in
  3441. # Parsoid after T54473.
  3442. !! test
  3443. Definition Lists: Hacky use to indent tables (WS-insensitive)
  3444. !! wikitext
  3445. : {|
  3446. |a
  3447. |}
  3448. !! html/php
  3449. <dl><dd><table>
  3450. <tr>
  3451. <td>a
  3452. </td></tr></table></dd></dl>
  3453. !! html/parsoid
  3454. <dl><dd> <table>
  3455. <tbody><tr><td>a</td></tr>
  3456. </tbody></table> </dd></dl>
  3457. !! end
  3458. ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
  3459. ## as an empty dt item. It also ignores all but the last ";" when followed
  3460. ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
  3461. ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
  3462. ## ";"s.
  3463. ##
  3464. ## Ex: ";;t2 ::d2" is transformed into:
  3465. ##
  3466. ## <dl>
  3467. ## <dt>t2 </dt>
  3468. ## <dd>
  3469. ## <dl>
  3470. ## <dt></dt>
  3471. ## <dd>d2</dd>
  3472. ## </dl>
  3473. ## </dd>
  3474. ## </dl>
  3475. ##
  3476. ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
  3477. ## So, the same wikitext above (;;t2 ::d2) is transformed into:
  3478. ##
  3479. ## <dl>
  3480. ## <dt>
  3481. ## <dl>
  3482. ## <dt>t2 </dt>
  3483. ## <dd>:d2</dd>
  3484. ## </dl>
  3485. ## </dt>
  3486. ## </dl>
  3487. ##
  3488. ## All Parsoid only definition list tests have this difference.
  3489. ##
  3490. ## See also: https://phabricator.wikimedia.org/T8569
  3491. ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
  3492. !! test
  3493. Table / list interaction: indented table with lists in table contents
  3494. !! wikitext
  3495. :{|
  3496. |-
  3497. |a
  3498. *b
  3499. |-
  3500. |c
  3501. *d
  3502. |}
  3503. !! html
  3504. <dl><dd><table>
  3505. <tr>
  3506. <td>a
  3507. <ul><li>b</li></ul>
  3508. </td></tr>
  3509. <tr>
  3510. <td>c
  3511. <ul><li>d</li></ul>
  3512. </td></tr></table></dd></dl>
  3513. !! end
  3514. !!test
  3515. Table / list interaction: lists nested in tables nested in indented lists
  3516. !! wikitext
  3517. :{|
  3518. |
  3519. :a
  3520. :b
  3521. |
  3522. *c
  3523. *d
  3524. |}
  3525. *e
  3526. *f
  3527. !! html
  3528. <dl><dd><table>
  3529. <tr>
  3530. <td>
  3531. <dl><dd>a</dd>
  3532. <dd>b</dd></dl>
  3533. </td>
  3534. <td>
  3535. <ul><li>c</li>
  3536. <li>d</li></ul>
  3537. </td></tr></table></dd></dl>
  3538. <ul><li>e</li>
  3539. <li>f</li></ul>
  3540. !!end
  3541. !! test
  3542. Definition Lists: Nesting: Multi-level (Parsoid only)
  3543. !! wikitext
  3544. ;t1 :d1
  3545. ;;t2 ::d2
  3546. ;;;t3 :::d3
  3547. !! html/parsoid
  3548. <dl>
  3549. <dt>t1 </dt>
  3550. <dd>d1</dd>
  3551. <dt>
  3552. <dl>
  3553. <dt>t2 </dt>
  3554. <dd>:d2</dd>
  3555. <dt>
  3556. <dl>
  3557. <dt>t3 </dt>
  3558. <dd>::d3</dd>
  3559. </dl>
  3560. </dt>
  3561. </dl>
  3562. </dt>
  3563. </dl>
  3564. !! end
  3565. !! test
  3566. Definition Lists: Nesting: Test 2
  3567. !! wikitext
  3568. ;t1
  3569. ::d2
  3570. !! html+tidy
  3571. <dl><dt>t1</dt>
  3572. <dd>
  3573. <dl><dd>d2</dd></dl></dd></dl>
  3574. !! end
  3575. !! test
  3576. Definition Lists: Nesting: Test 3
  3577. !! wikitext
  3578. :;t1
  3579. ::::d2
  3580. !! html+tidy
  3581. <dl><dd><dl><dt>t1</dt>
  3582. <dd>
  3583. <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
  3584. !! end
  3585. !! test
  3586. Definition Lists: Nesting: Test 4
  3587. !! wikitext
  3588. ::;t3
  3589. :::d3
  3590. !! html
  3591. <dl><dd><dl><dd><dl><dt>t3</dt>
  3592. <dd>d3</dd></dl></dd></dl></dd></dl>
  3593. !! end
  3594. ## The Parsoid team believes the following three test exposes a
  3595. ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
  3596. ## wrong to close the <dl> after the <dt> containing the <ul>.)
  3597. ## It also exposes a "misfeature" in tidy, which doesn't like
  3598. ## <dl> tags with a single <dt> child; it converts the <dt> into
  3599. ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
  3600. !! test
  3601. Definition Lists: Mixed Lists: Test 1
  3602. !! wikitext
  3603. :;*foo
  3604. ::*bar
  3605. :;baz
  3606. !! html/php
  3607. <dl><dd><dl><dt><ul><li>foo</li>
  3608. <li>bar</li></ul></dt></dl>
  3609. <dl><dt>baz</dt></dl></dd></dl>
  3610. !! html/php+tidy
  3611. <dl><dd><dl><dt><ul><li>foo</li>
  3612. <li>bar</li></ul></dt></dl>
  3613. <dl><dt>baz</dt></dl></dd></dl>
  3614. !! html/parsoid
  3615. <dl>
  3616. <dd><dl>
  3617. <dt><ul>
  3618. <li>foo
  3619. </li>
  3620. </ul></dt>
  3621. <dd><ul>
  3622. <li>bar
  3623. </li>
  3624. </ul></dd>
  3625. <dt>baz</dt>
  3626. </dl></dd>
  3627. </dl>
  3628. !! end
  3629. !! test
  3630. Definition Lists: Mixed Lists: Test 2
  3631. !! wikitext
  3632. *:d1
  3633. *:d2
  3634. !! html
  3635. <ul><li><dl><dd>d1</dd>
  3636. <dd>d2</dd></dl></li></ul>
  3637. !! end
  3638. !! test
  3639. Definition Lists: Mixed Lists: Test 3
  3640. !! wikitext
  3641. *:::d1
  3642. *:::d2
  3643. !! html
  3644. <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
  3645. <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
  3646. !! end
  3647. !! test
  3648. Definition Lists: Mixed Lists: Test 4
  3649. !! wikitext
  3650. *;d1 :d2
  3651. *;d3 :d4
  3652. !! html
  3653. <ul><li><dl><dt>d1&#160;</dt>
  3654. <dd>d2</dd>
  3655. <dt>d3&#160;</dt>
  3656. <dd>d4</dd></dl></li></ul>
  3657. !! end
  3658. !! test
  3659. Definition Lists: Mixed Lists: Test 5
  3660. !! wikitext
  3661. *:d1
  3662. *::d2
  3663. !! html
  3664. <ul><li><dl><dd>d1
  3665. <dl><dd>d2</dd></dl></dd></dl></li></ul>
  3666. !! end
  3667. !! test
  3668. Definition Lists: Mixed Lists: Test 6
  3669. !! wikitext
  3670. #*:d1
  3671. #*:::d3
  3672. !! html
  3673. <ol><li><ul><li><dl><dd>d1
  3674. <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
  3675. !! end
  3676. !! test
  3677. Definition Lists: Mixed Lists: Test 7
  3678. !! wikitext
  3679. :*d1
  3680. :*d2
  3681. !! html
  3682. <dl><dd><ul><li>d1</li>
  3683. <li>d2</li></ul></dd></dl>
  3684. !! end
  3685. !! test
  3686. Definition Lists: Mixed Lists: Test 8
  3687. !! wikitext
  3688. :*d1
  3689. ::*d2
  3690. !! html
  3691. <dl><dd><ul><li>d1</li></ul>
  3692. <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
  3693. !! end
  3694. !! test
  3695. Definition Lists: Mixed Lists: Test 9
  3696. !! wikitext
  3697. *;foo :bar
  3698. !! html
  3699. <ul><li><dl><dt>foo&#160;</dt>
  3700. <dd>bar</dd></dl></li></ul>
  3701. !! end
  3702. !! test
  3703. Definition Lists: Mixed Lists: Test 10
  3704. !! wikitext
  3705. *#;foo :bar
  3706. !! html
  3707. <ul><li><ol><li><dl><dt>foo&#160;</dt>
  3708. <dd>bar</dd></dl></li></ol></li></ul>
  3709. !! end
  3710. # The Parsoid team disagrees with the PHP parser's seemingly-random
  3711. # rules regarding dd/dt on the next few tests. Parsoid is more
  3712. # consistent, and recognizes the shared nesting and keeps the
  3713. # still-open tags around until the nesting is complete.
  3714. # This is a regression test for T175099
  3715. !! test
  3716. Definition Lists: Mixed Lists: Test 11
  3717. !! wikitext
  3718. ;a
  3719. :*b
  3720. !! html/php
  3721. <dl><dt>a</dt>
  3722. <dd>
  3723. <ul><li>b</li></ul></dd></dl>
  3724. !! html/parsoid
  3725. <dl><dt>a
  3726. <dd><ul><li>b</li></ul></dd></dl>
  3727. !! end
  3728. # FIXME: Maybe get rid of this test?
  3729. !! test
  3730. Definition Lists: Mixed Lists: Test 12
  3731. !! wikitext
  3732. *#*#;*;;foo :bar
  3733. *#*#;boo :baz
  3734. !! html/php
  3735. <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
  3736. <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
  3737. <dl><dt>boo&#160;</dt>
  3738. <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
  3739. !! html/php+tidy
  3740. <ul><li><ol><li><ul><li><ol><li><dl><dt>foo&#160;</dt>
  3741. <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
  3742. <dl><dt>boo&#160;</dt>
  3743. <dd>baz</dd></dl></li></ol></li></ul>
  3744. !! html/parsoid
  3745. <ul>
  3746. <li>
  3747. <ol>
  3748. <li>
  3749. <ul>
  3750. <li>
  3751. <ol>
  3752. <li>
  3753. <dl>
  3754. <dt>
  3755. <ul>
  3756. <li>
  3757. <dl>
  3758. <dt>
  3759. <dl>
  3760. <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
  3761. <dd data-parsoid='{"stx":"row"}'>bar</dd>
  3762. </dl></dt>
  3763. </dl></li>
  3764. </ul></dt>
  3765. <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'>&nbsp;</span></dt>
  3766. <dd data-parsoid='{"stx":"row"}'>baz</dd>
  3767. </dl></li>
  3768. </ol></li>
  3769. </ul></li>
  3770. </ol></li>
  3771. </ul>
  3772. !! end
  3773. # FIXME: Maybe get rid of this test?
  3774. # From whitelist:
  3775. # * The test is wrong, there are two colons where there should be :;
  3776. # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
  3777. !! test
  3778. Definition Lists: Weird Ones: Test 1
  3779. !! wikitext
  3780. *#;*::;;foo :bar (who uses this?)
  3781. !! html/php+tidy
  3782. <ul><li><ol><li><dl><dt>foo&#160;</dt>
  3783. <dd><ul><li><dl><dd><dl><dd><dl><dt><dl><dt>bar (who uses this?)</dt></dl></dt></dl></dd></dl></dd></dl></li></ul></dd></dl></li></ol></li></ul>
  3784. !! html/parsoid
  3785. <ul>
  3786. <li>
  3787. <ol>
  3788. <li>
  3789. <dl>
  3790. <dt>
  3791. <ul>
  3792. <li>
  3793. <dl>
  3794. <dd>
  3795. <dl>
  3796. <dd>
  3797. <dl>
  3798. <dt>
  3799. <dl>
  3800. <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
  3801. <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
  3802. </dl></dt>
  3803. </dl></dd>
  3804. </dl></dd>
  3805. </dl></li>
  3806. </ul></dt>
  3807. </dl></li>
  3808. </ol></li>
  3809. </ul>
  3810. !! end
  3811. !! test
  3812. Definition Lists: colons occurring in tags
  3813. !! wikitext
  3814. ;a:b
  3815. ;'''a:b'''
  3816. ;<i>a:b</i>
  3817. ;<span>a:b</span>
  3818. ;<div>a:b</div>
  3819. ;<div>a
  3820. :b</div>
  3821. ;{{echo|a:b}}
  3822. ;{{echo|''a:b''}}
  3823. ;;;''a:b''
  3824. !! html+tidy
  3825. <dl><dt>a</dt>
  3826. <dd>b</dd>
  3827. <dt><b>a:b</b></dt>
  3828. <dt><i>a:b</i></dt>
  3829. <dt><span>a:b</span></dt>
  3830. <dt><div>a:b</div></dt>
  3831. <dt><div>a</div></dt>
  3832. <dd>b</dd>
  3833. <dt>a</dt>
  3834. <dd>b</dd>
  3835. <dt><i>a:b</i></dt></dl>
  3836. <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
  3837. !! html/parsoid
  3838. <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
  3839. <dt><b>a:b</b></dt>
  3840. <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
  3841. <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
  3842. <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
  3843. <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
  3844. <dd>b</dd>
  3845. <dt><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a:b"}},"i":0}}]}'>a:b</span></dt>
  3846. <dt><i about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;a:b&#39;&#39;"}},"i":0}}]}'>a:b</i>
  3847. <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
  3848. !! end
  3849. # Parsoid's output differs here again because it shares
  3850. # nesting between the two lists unlike the PHP parser.
  3851. # Unsure which is more desirable.
  3852. !! test
  3853. Definition Lists: colons and tables 1
  3854. !! wikitext
  3855. :{|
  3856. |x
  3857. |}
  3858. :{|
  3859. |y
  3860. |}
  3861. !! html/php
  3862. <dl><dd><table>
  3863. <tr>
  3864. <td>x
  3865. </td></tr></table></dd></dl>
  3866. <dl><dd><table>
  3867. <tr>
  3868. <td>y
  3869. </td></tr></table></dd></dl>
  3870. !! html/parsoid
  3871. <dl><dd><table>
  3872. <tr>
  3873. <td>x
  3874. </td></tr></table></dd>
  3875. <dd><table>
  3876. <tr>
  3877. <td>y
  3878. </td></tr></table></dd></dl>
  3879. !! end
  3880. # FIXME: Does this need a html/php section?
  3881. !! test
  3882. Definition Lists: template interaction
  3883. !! wikitext
  3884. ::{{definition_list}}
  3885. :one
  3886. ::{{definition_list}}
  3887. :::two
  3888. :::three
  3889. ::four
  3890. !! html/parsoid
  3891. <dl><dd><dl data-parsoid='{}'><dd about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[":",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}}]}'>one</dd><span about="#mwt1">
  3892. </span><dd about="#mwt1">two</dd></dl></dd></dl>
  3893. <dl><dd data-parsoid='{}'>one
  3894. <dl><dd about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":["::",{"template":{"target":{"wt":"definition_list","href":"./Template:Definition_list"},"params":{},"i":0}},"\n:::two\n:::three"]}'>one</dd><span about="#mwt2">
  3895. </span><dd about="#mwt2">two
  3896. <dl><dd>two</dd>
  3897. <dd>three</dd></dl></dd>
  3898. <dd data-parsoid='{}'>four</dd></dl></dd></dl>
  3899. !! end
  3900. ###
  3901. ### External links
  3902. ###
  3903. !! test
  3904. External links: non-bracketed
  3905. !! wikitext
  3906. Non-bracketed: http://example.com
  3907. !! html
  3908. <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
  3909. </p>
  3910. !! end
  3911. # parsoid doesn't explicitly mark autonumbered links, see T55505
  3912. !! test
  3913. External links: numbered
  3914. !! wikitext
  3915. Numbered: [http://example.com]
  3916. Numbered: [http://example.net]
  3917. Numbered: [http://example.com]
  3918. !! html/php
  3919. <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
  3920. Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
  3921. Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
  3922. </p>
  3923. !! html/parsoid
  3924. <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
  3925. Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
  3926. Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
  3927. !!end
  3928. !! test
  3929. External links: specified text
  3930. !! wikitext
  3931. Specified text: [http://example.com link]
  3932. !! html
  3933. <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
  3934. </p>
  3935. !!end
  3936. !! test
  3937. External links: trail
  3938. !! wikitext
  3939. Linktrails should not work for external links: [http://example.com link]s
  3940. !! html
  3941. <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
  3942. </p>
  3943. !! end
  3944. !! test
  3945. External links: dollar sign in URL
  3946. !! wikitext
  3947. http://example.com/1$2345
  3948. !! html
  3949. <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
  3950. </p>
  3951. !! end
  3952. # parsoid doesn't explicitly mark autonumbered links, see T55505
  3953. !! test
  3954. External links: dollar sign in URL (autonumber)
  3955. !! wikitext
  3956. [http://example.com/1$2345]
  3957. !! html/php
  3958. <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
  3959. </p>
  3960. !! html/parsoid
  3961. <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
  3962. !!end
  3963. !! test
  3964. External links: open square bracket forbidden in URL (T6377)
  3965. !! options
  3966. parsoid=wt2html,wt2wt,html2html
  3967. !! wikitext
  3968. http://example.com/1[2345
  3969. !! html/php
  3970. <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
  3971. </p>
  3972. !! html/parsoid
  3973. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
  3974. !! end
  3975. !! test
  3976. External links: open square bracket forbidden in URL (named) (T6377)
  3977. !! options
  3978. parsoid=wt2html,html2html
  3979. !! wikitext
  3980. [http://example.com/1[2345]
  3981. !! html/php
  3982. <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
  3983. </p>
  3984. !! html/parsoid
  3985. <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
  3986. !!end
  3987. # parsoid adds a space before the link name
  3988. !! test
  3989. External links: open square bracket forbidden in URL (named) (T6377)
  3990. Parsoid variant.
  3991. !! wikitext
  3992. [http://example.com/1 [2345]
  3993. !! html
  3994. <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
  3995. </p>
  3996. !!end
  3997. !! test
  3998. External links: nowiki in URL link text (T8230)
  3999. !! wikitext
  4000. [http://example.com/ <nowiki>''example site''</nowiki>]
  4001. !! html
  4002. <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
  4003. </p>
  4004. !! end
  4005. !! test
  4006. External links: newline forbidden in text (T8230 regression check)
  4007. !! wikitext
  4008. [http://example.com/ first
  4009. second]
  4010. !! html
  4011. <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
  4012. second]
  4013. </p>
  4014. !!end
  4015. !! test
  4016. External links: Pipe char between url and text
  4017. !! wikitext
  4018. [http://example.com | link]
  4019. !! html
  4020. <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
  4021. </p>
  4022. !!end
  4023. !! test
  4024. External links: protocol-relative URL in brackets
  4025. !! wikitext
  4026. [//example.com/ Test]
  4027. !! html
  4028. <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
  4029. </p>
  4030. !! end
  4031. # parsoid doesn't explicitly mark autonumbered links, see T55505
  4032. !! test
  4033. External links: protocol-relative URL in brackets without text
  4034. !! wikitext
  4035. [//example.com]
  4036. !! html/php
  4037. <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
  4038. </p>
  4039. !! html/parsoid
  4040. <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
  4041. !! end
  4042. !! test
  4043. External links: protocol-relative URL in free text is left alone
  4044. !! wikitext
  4045. //example.com/Foo
  4046. !! html
  4047. <p>//example.com/Foo
  4048. </p>
  4049. !!end
  4050. !! test
  4051. External links: protocol-relative URL in the middle of a word is left alone (T32269)
  4052. !! wikitext
  4053. foo//example.com/Foo
  4054. !! html
  4055. <p>foo//example.com/Foo
  4056. </p>
  4057. !! end
  4058. ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
  4059. !! test
  4060. External links: with no contents
  4061. !! options
  4062. parsoid=wt2html,wt2wt
  4063. !! wikitext
  4064. [http://en.wikipedia.org/wiki/Foo]
  4065. [[wikipedia:Foo|Bar]]
  4066. [[wikipedia:Foo|<span>Bar</span>]]
  4067. !! html/php
  4068. <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
  4069. </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
  4070. </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
  4071. </p>
  4072. !! html/parsoid
  4073. <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
  4074. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
  4075. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
  4076. !! end
  4077. !! test
  4078. External links: Free with trailing punctuation
  4079. !! wikitext
  4080. http://example.com,
  4081. http://example.com;
  4082. http://example.com\
  4083. http://example.com.
  4084. http://example.com:
  4085. http://example.com!
  4086. http://example.com?
  4087. http://example.com)
  4088. http://example.com/url_with_(brackets)
  4089. (http://example.com/url_without_brackets)
  4090. http://example.com/url_with_entity&amp;
  4091. http://example.com/url_with_entity&#x26;
  4092. http://example.com/url_with_entity&#038;
  4093. http://example.com/url_with_entity&nbsp;
  4094. http://example.com/url_with_entity&#xA0;
  4095. http://example.com/url_with_entity&#160;
  4096. http://example.com/url_with_entity&lt;
  4097. http://example.com/url_with_entity&#x3C;
  4098. http://example.com/url_with_entity&#60;
  4099. !! html/php
  4100. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
  4101. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
  4102. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
  4103. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
  4104. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
  4105. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
  4106. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
  4107. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
  4108. <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
  4109. (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
  4110. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
  4111. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
  4112. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
  4113. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
  4114. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#xa0;
  4115. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#160;
  4116. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&lt;
  4117. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#x3c;
  4118. <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a>&#60;
  4119. </p>
  4120. !! html/parsoid
  4121. <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
  4122. <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
  4123. <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
  4124. <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
  4125. <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
  4126. <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
  4127. <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
  4128. <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
  4129. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
  4130. (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
  4131. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
  4132. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
  4133. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;">http://example.com/url_with_entity&amp;</a>
  4134. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>
  4135. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>
  4136. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>
  4137. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>
  4138. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x3C;","srcContent":"&lt;"}'>&lt;</span>
  4139. <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#60;","srcContent":"&lt;"}'>&lt;</span></p>
  4140. !! end
  4141. !! test
  4142. External links: tricky Parsoid html2html case
  4143. !! options
  4144. parsoid=wt2html,wt2wt,html2html
  4145. !! wikitext
  4146. http://example.com/url_with_entity&amp;amp;
  4147. !! html/php
  4148. <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;
  4149. </p>
  4150. !! html/parsoid
  4151. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp;amp">http://example.com/url_with_entity&amp;amp</a>;</p>
  4152. !! end
  4153. !! test
  4154. External links: Free with trailing quotes (T113666)
  4155. !! wikitext
  4156. '''News:''' Stuff here
  4157. news:'a'b''c''d e
  4158. !! html/php
  4159. <p><b>News:</b> Stuff here
  4160. </p><p><a rel="nofollow" class="external free" href="news:&#39;a&#39;b">news:'a'b</a><i>c</i>d e
  4161. </p>
  4162. !! html/parsoid
  4163. <p><b>News:</b> Stuff here</p>
  4164. <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
  4165. !! end
  4166. !! test
  4167. External links: with entity
  4168. !! wikitext
  4169. [http://&#x20;www.librarieswithoutborders.org Libraries without borders]
  4170. !! html/php
  4171. <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
  4172. </p>
  4173. !! html/parsoid
  4174. <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&amp;#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
  4175. !! end
  4176. !! test
  4177. External links: Lone protocols are never linked (T105697)
  4178. !! wikitext
  4179. http://
  4180. http://;
  4181. (http://)
  4182. bitcoin:
  4183. bitcoin:;
  4184. (bitcoin:)
  4185. !! html
  4186. <p>http://
  4187. http://;
  4188. (http://)
  4189. bitcoin:
  4190. bitcoin:;
  4191. (bitcoin:)
  4192. </p>
  4193. !! end
  4194. !! test
  4195. External links: No preceding word characters allowed (T67278)
  4196. !! wikitext
  4197. NOPEhttp://example.com
  4198. N0http://example.com
  4199. ok:http://example.com
  4200. ok-http://example.com
  4201. !! html
  4202. <p>NOPEhttp://example.com
  4203. N0http://example.com
  4204. ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
  4205. ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
  4206. </p>
  4207. !! end
  4208. !! test
  4209. External links: nofollow domain exception
  4210. !! wikitext
  4211. A [https://no-nofollow.org/foobar link], and another [https://example.org link].
  4212. !! html
  4213. <p>A <a class="external text" href="https://no-nofollow.org/foobar">link</a>, and another <a rel="nofollow" class="external text" href="https://example.org">link</a>.
  4214. </p>
  4215. !!end
  4216. !! test
  4217. External image
  4218. !! wikitext
  4219. External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
  4220. !! html
  4221. <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
  4222. </p>
  4223. !! end
  4224. !! test
  4225. External image from https
  4226. !! wikitext
  4227. External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
  4228. !! html
  4229. <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
  4230. </p>
  4231. !! end
  4232. !! test
  4233. External image (when not allowed)
  4234. !! options
  4235. wgAllowExternalImages=0
  4236. !! wikitext
  4237. External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
  4238. !! html
  4239. <p>External image: <a rel="nofollow" class="external free" href="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png">http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png</a>
  4240. </p>
  4241. !! end
  4242. !! test
  4243. Link to non-http image, no img tag
  4244. !! wikitext
  4245. Link to non-http image, no img tag: ftp://example.com/test.jpg
  4246. !! html
  4247. <p>Link to non-http image, no img tag: <a rel="nofollow" class="external free" href="ftp://example.com/test.jpg">ftp://example.com/test.jpg</a>
  4248. </p>
  4249. !! end
  4250. !! test
  4251. External links: terminating separator
  4252. !! wikitext
  4253. Terminating separator: http://example.com/thing,
  4254. !! html
  4255. <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
  4256. </p>
  4257. !! end
  4258. !! test
  4259. External links: intervening separator
  4260. !! wikitext
  4261. Intervening separator: http://example.com/1,2,3
  4262. !! html
  4263. <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
  4264. </p>
  4265. !! end
  4266. !! test
  4267. External links: old bug with URL in query
  4268. !! wikitext
  4269. Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
  4270. !! html
  4271. <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
  4272. </p>
  4273. !! end
  4274. !! test
  4275. External links: old URL-in-URL bug, mixed protocols
  4276. !! wikitext
  4277. And again with mixed protocols: [ftp://example.com?url=http://example.com link]
  4278. !! html
  4279. <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
  4280. </p>
  4281. !!end
  4282. # Since Parsoid is starting to emit canonical wikitext for links,
  4283. # [http://example.com http://example.com] will not RT back to that
  4284. # form anymore.
  4285. !! test
  4286. External links: URL in text
  4287. !! options
  4288. parsoid=wt2html
  4289. !! wikitext
  4290. URL in text: [http://example.com http://example.com]
  4291. !! html/php
  4292. <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
  4293. </p>
  4294. !! html/parsoid
  4295. <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
  4296. !! end
  4297. !! test
  4298. External links: Clickable images
  4299. !! wikitext
  4300. ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
  4301. !! html/php
  4302. <p>ja-style clickable images: <a rel="nofollow" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/></a>
  4303. </p>
  4304. !! html/parsoid
  4305. <p>ja-style clickable images: <a rel="mw:ExtLink" class="external text" href="http://example.com"><img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png" data-parsoid='{"type":"extlink"}'/></a></p>
  4306. !! end
  4307. !! test
  4308. External links: raw ampersand
  4309. !! wikitext
  4310. Old &amp; use: http://x&y
  4311. !! html
  4312. <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
  4313. </p>
  4314. !! end
  4315. !! test
  4316. External links: encoded ampersand
  4317. !! wikitext
  4318. Old &amp; use: http://x&amp;y
  4319. !! html/php
  4320. <p>Old &amp; use: <a rel="nofollow" class="external free" href="http://x&amp;y">http://x&amp;y</a>
  4321. </p>
  4322. !! html/parsoid
  4323. <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&amp;y">http://x&amp;y</a></p>
  4324. !! end
  4325. !! test
  4326. External links: encoded equals (T8102)
  4327. !! wikitext
  4328. http://example.com/?foo&#61;bar
  4329. !! html/php
  4330. <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
  4331. </p>
  4332. !! html/parsoid
  4333. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
  4334. !! end
  4335. ##
  4336. ## Note that parsoid doesn't explicit mark autonumbered links, nor
  4337. ## does it number them. As discussed in T55505, we can identify
  4338. ## autonumbered links via CSS.
  4339. ##
  4340. !! test
  4341. External links: [raw ampersand]
  4342. !! wikitext
  4343. Old &amp; use: [http://x&y]
  4344. !! html/php
  4345. <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
  4346. </p>
  4347. !! html/parsoid
  4348. <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
  4349. !! end
  4350. # note that parsoid html is identical to [raw ampersand] case; so html2wt
  4351. # mode will return the [raw ampersand] wikitext
  4352. !! test
  4353. External links: [encoded ampersand]
  4354. !! options
  4355. parsoid=wt2html,wt2wt,html2html
  4356. !! wikitext
  4357. Old &amp; use: [http://x&amp;y]
  4358. !! html/php
  4359. <p>Old &amp; use: <a rel="nofollow" class="external autonumber" href="http://x&amp;y">[1]</a>
  4360. </p>
  4361. !! html/parsoid
  4362. <p>Old <span typeof="mw:Entity">&amp;</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&amp;y"></a></p>
  4363. !! end
  4364. !! test
  4365. External links: [raw equals]
  4366. !! wikitext
  4367. [http://example.com/?foo=bar]
  4368. !! html/php
  4369. <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
  4370. </p>
  4371. !! html/parsoid
  4372. <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
  4373. !! end
  4374. # note that parsoid html is identical to [raw equals] case; so html2wt
  4375. # mode will return the [raw equals] wikitext
  4376. !! test
  4377. External links: [encoded equals] (T8102)
  4378. !! options
  4379. parsoid=wt2html,wt2wt,html2html
  4380. !! wikitext
  4381. [http://example.com/?foo&#61;bar]
  4382. !! html/php
  4383. <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
  4384. </p>
  4385. !! html/parsoid
  4386. <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
  4387. !! end
  4388. # xxx parsoid strips the IDN character, so the round-trip tests will
  4389. # obviously fail and are disabled. --cscott
  4390. !! test
  4391. External links: [IDN ignored character reference in hostname; strip it right off]
  4392. !! options
  4393. parsoid=wt2html,wt2wt,html2html
  4394. !! wikitext
  4395. [http://e&zwnj;xample.com/]
  4396. !! html/php
  4397. <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
  4398. </p>
  4399. !! html/parsoid
  4400. <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
  4401. !! end
  4402. # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
  4403. # Where an external link could easily circumvent the sanitization of the text of
  4404. # a link like this (where an IDN-ignore character is in the URL somewhere), this
  4405. # test demands a higher standard. That's a bit strange.
  4406. #
  4407. # Example:
  4408. #
  4409. # http://e‌xample.com -> [http://example.com|http://example.com]
  4410. # [http://example.com|http://e‌xample.com] -> [http://example.com|http://e‌xample.com]
  4411. #
  4412. # The first example is sanitized, but the second is not. Any security benefits
  4413. # from this production are trivial to circumvent. Either remove this test and
  4414. # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
  4415. # the test accordingly.
  4416. #
  4417. # All our love,
  4418. # The Parsoid team.
  4419. # xxx parsoid strips the IDN character, so the round-trip tests will
  4420. # obviously fail and are disabled. --cscott
  4421. !! test
  4422. External links: IDN ignored character reference in hostname; strip it right off
  4423. !! options
  4424. parsoid=wt2html,html2html
  4425. !! wikitext
  4426. http://e&zwnj;xample.com/
  4427. !! html/php
  4428. <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
  4429. </p>
  4430. !! html/parsoid
  4431. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
  4432. !! end
  4433. !! test
  4434. External links: www.jpeg.org (T2554)
  4435. !! wikitext
  4436. http://www.jpeg.org
  4437. !! html
  4438. <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
  4439. </p>
  4440. !! end
  4441. # parsoid doesn't explicitly mark autonumbered links, see T55505
  4442. !! test
  4443. External links: URL within URL (T2002)
  4444. !! wikitext
  4445. [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
  4446. !! html/php
  4447. <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
  4448. </p>
  4449. !! html/parsoid
  4450. <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp"></a></p>
  4451. !! end
  4452. !! test
  4453. T2361: URL inside bracketed URL
  4454. !! wikitext
  4455. [http://www.example.com/foo http://www.example.com/bar]
  4456. !! html
  4457. <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
  4458. </p>
  4459. !! end
  4460. !! test
  4461. T2361: URL within URL, not bracketed
  4462. !! wikitext
  4463. http://www.example.com/foo?=http://www.example.com/bar
  4464. !! html
  4465. <p><a rel="nofollow" class="external free" href="http://www.example.com/foo?=http://www.example.com/bar">http://www.example.com/foo?=http://www.example.com/bar</a>
  4466. </p>
  4467. !! end
  4468. !! test
  4469. T2289: ">"-token in URL-tail
  4470. !! wikitext
  4471. http://www.example.com/<hello>
  4472. !! html
  4473. <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>&lt;hello&gt;
  4474. </p>
  4475. !!end
  4476. !! test
  4477. T2289: literal ">"-token in URL-tail
  4478. !! wikitext
  4479. http://www.example.com/<b>html</b>
  4480. !! html/php
  4481. <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
  4482. </p>
  4483. !! html/parsoid
  4484. <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/" data-parsoid='{"stx":"url"}'>http://www.example.com/</a><b data-parsoid='{"stx":"html"}'>html</b></p>
  4485. !! end
  4486. !! test
  4487. T2289: ">"-token in bracketed URL
  4488. !! wikitext
  4489. [http://www.example.com/<hello> stuff]
  4490. !! html
  4491. <p><a rel="nofollow" class="external text" href="http://www.example.com/">&lt;hello&gt; stuff</a>
  4492. </p>
  4493. !!end
  4494. !! test
  4495. T2289: literal ">"-token in bracketed URL
  4496. !! wikitext
  4497. [http://www.example.com/<b>html</b> stuff]
  4498. !! html
  4499. <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
  4500. </p>
  4501. !!end
  4502. !! test
  4503. T2289: literal double quote at end of URL
  4504. !! wikitext
  4505. http://www.example.com/"hello"
  4506. !! html
  4507. <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
  4508. </p>
  4509. !!end
  4510. !! test
  4511. T2289: literal double quote in bracketed URL
  4512. !! wikitext
  4513. [http://www.example.com/"hello" stuff]
  4514. !! html
  4515. <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
  4516. </p>
  4517. !!end
  4518. !! test
  4519. External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
  4520. !! wikitext
  4521. [http://www.example.com test]
  4522. !! html
  4523. <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
  4524. </p>
  4525. !! end
  4526. !! test
  4527. External links: link text with spaces
  4528. !! wikitext
  4529. [http://www.example.com a b c]
  4530. [http://www.example.com ''a'' ''b'']
  4531. !! html
  4532. <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
  4533. <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
  4534. </p>
  4535. !! end
  4536. # Note edge case difference between PHP and Parsoid here.
  4537. !! test
  4538. External links: wiki links within external link (T5695)
  4539. !! options
  4540. parsoid=wt2html,html2html
  4541. !! wikitext
  4542. [http://example.com [[wikilink]] embedded in ext link]
  4543. [http://example.com test [[wikilink]] embedded in ext link]
  4544. !! html/php
  4545. <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
  4546. </p><p><a rel="nofollow" class="external text" href="http://example.com">test </a><a href="/index.php?title=Wikilink&amp;action=edit&amp;redlink=1" class="new" title="Wikilink (page does not exist)">wikilink</a><a rel="nofollow" class="external text" href="http://example.com"> embedded in ext link</a>
  4547. </p>
  4548. !! html/parsoid
  4549. <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
  4550. <p><a rel="mw:ExtLink" class="external text" href="http://example.com">test </a><a rel="mw:WikiLink" href="./Wikilink" title="Wikilink">wikilink</a><span> embedded in ext link</span></p>
  4551. !! end
  4552. !! test
  4553. T2787: Links with one slash after the url protocol are invalid
  4554. !! wikitext
  4555. http:/example.com
  4556. [http:/example.com title]
  4557. !! html
  4558. <p>http:/example.com
  4559. </p><p>[http:/example.com title]
  4560. </p>
  4561. !! end
  4562. !! test
  4563. Bracketed external links with template-generated invalid target
  4564. !! wikitext
  4565. [{{echo|http:/example.com}} title]
  4566. !! html
  4567. <p>[http:/example.com title]
  4568. </p>
  4569. !! end
  4570. # wt2html only because Parsoid would want to add <nowiki>s coming from html
  4571. !! test
  4572. Broken wikilinks (but not external links) prevent templates from closing
  4573. !! options
  4574. parsoid=wt2html
  4575. !! wikitext
  4576. [http://example.com x
  4577. {{echo|[http://example.com x}}
  4578. [[Foo
  4579. {{echo|[[Foo}}
  4580. !! html/php
  4581. <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
  4582. </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
  4583. </p><p>[[Foo
  4584. </p><p>{{echo|[[Foo}}
  4585. </p>
  4586. !! html/parsoid
  4587. <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
  4588. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://example.com x"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
  4589. <p>[[Foo</p>
  4590. <p>{{echo|[[Foo}}</p>
  4591. !! end
  4592. !! test
  4593. Wikilinks with embedded newlines are not broken
  4594. !! wikitext
  4595. {{echo|[[ Foo
  4596. B
  4597. C]]}}
  4598. !! html/php
  4599. <p>[[ Foo
  4600. B
  4601. C]]
  4602. </p>
  4603. !! html/parsoid
  4604. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[ Foo\nB\nC]]"}},"i":0}}]}'>[[ Foo B C]]</p>
  4605. !! end
  4606. !! test
  4607. Broken templates
  4608. !! options
  4609. parsoid=wt2html
  4610. !! wikitext
  4611. {{echo|[[Foo|}}]]
  4612. [[Foo|{{echo|]]}}
  4613. !! html/php
  4614. <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
  4615. </p><p>[[Foo|]]
  4616. </p>
  4617. !! html/parsoid
  4618. <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
  4619. <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
  4620. !! end
  4621. !! test
  4622. T4702: Mismatched <i>, <b> and <a> tags are invalid
  4623. !! wikitext
  4624. ''[http://example.com text'']
  4625. [http://example.com '''text]'''
  4626. ''Something [http://example.com in italic'']
  4627. ''Something [http://example.com mixed''''', even bold]'''
  4628. '''''Now [http://example.com both''''']
  4629. !! html
  4630. <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
  4631. <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
  4632. <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
  4633. <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
  4634. <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
  4635. </p>
  4636. !! end
  4637. !! test
  4638. T6781: %26 in URL
  4639. !! wikitext
  4640. http://www.example.com/?title=AT%26T
  4641. !! html/php
  4642. <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
  4643. </p>
  4644. !! html/parsoid
  4645. <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a></p>
  4646. !! end
  4647. # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
  4648. # % is actually legal in HTML5. Any change in output would need testing though.
  4649. !! test
  4650. T6781, T7267: %25 in URL
  4651. !! wikitext
  4652. http://www.example.com/?title=100%25_Bran
  4653. !! html/php
  4654. <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a>
  4655. </p>
  4656. !! html/parsoid
  4657. <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=100%25_Bran">http://www.example.com/?title=100%25_Bran</a></p>
  4658. !! end
  4659. !! test
  4660. T6781, T7267: %28, %29 in URL
  4661. !! wikitext
  4662. http://www.example.com/?title=Ben-Hur_%281959_film%29
  4663. !! html/php
  4664. <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a>
  4665. </p>
  4666. !! html/parsoid
  4667. <p><a rel="mw:ExtLink" class="external free" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">http://www.example.com/?title=Ben-Hur_%281959_film%29</a></p>
  4668. !! end
  4669. !! test
  4670. T6781: %26 in autonumber URL
  4671. !! wikitext
  4672. [http://www.example.com/?title=AT%26T]
  4673. !! html/php
  4674. <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
  4675. </p>
  4676. !! html/parsoid
  4677. <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
  4678. !! end
  4679. !! test
  4680. T6781, T7267: %26 in autonumber URL
  4681. !! wikitext
  4682. [http://www.example.com/?title=100%25_Bran]
  4683. !! html/php
  4684. <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
  4685. </p>
  4686. !! html/parsoid
  4687. <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
  4688. !! end
  4689. !! test
  4690. T6781, T7267: %28, %29 in autonumber URL
  4691. !! wikitext
  4692. [http://www.example.com/?title=Ben-Hur_%281959_film%29]
  4693. !! html/php
  4694. <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
  4695. </p>
  4696. !! html/parsoid
  4697. <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
  4698. !! end
  4699. !! test
  4700. T6781: %26 in bracketed URL
  4701. !! wikitext
  4702. [http://www.example.com/?title=AT%26T link]
  4703. !! html/php
  4704. <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
  4705. </p>
  4706. !! html/parsoid
  4707. <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
  4708. !! end
  4709. !! test
  4710. T6781, T7267: %25 in bracketed URL
  4711. !! wikitext
  4712. [http://www.example.com/?title=100%25_Bran link]
  4713. !! html
  4714. <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
  4715. </p>
  4716. !! end
  4717. !! test
  4718. T6781, T7267: %28, %29 in bracketed URL
  4719. !! wikitext
  4720. [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
  4721. !! html/php
  4722. <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
  4723. </p>
  4724. !! html/parsoid
  4725. <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
  4726. !! end
  4727. !! test
  4728. External link containing a period in the anchor. (T65947)
  4729. !! wikitext
  4730. [//foo.org/bar#baz. bang]
  4731. [//foo.org/bar. bang]
  4732. !! html/php
  4733. <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
  4734. </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
  4735. </p>
  4736. !! html/parsoid
  4737. <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
  4738. <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
  4739. !! end
  4740. !! test
  4741. External link containing a single quote. (T65947)
  4742. !! wikitext
  4743. [//foo.org/bar'baz]
  4744. [//foo.org/bar'baz bang]
  4745. !! html/php
  4746. <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar&#39;baz">[1]</a>
  4747. </p><p><a rel="nofollow" class="external text" href="//foo.org/bar&#39;baz">bang</a>
  4748. </p>
  4749. !! html/parsoid
  4750. <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
  4751. <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
  4752. !! end
  4753. !! test
  4754. External link containing double-single-quotes in text '' (T6598 sanity check)
  4755. !! wikitext
  4756. Some [http://example.com/ pretty ''italics'' and stuff]!
  4757. !! html
  4758. <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
  4759. </p>
  4760. !! end
  4761. !! test
  4762. External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
  4763. !! wikitext
  4764. ''Some [http://example.com/ pretty ''italics'' and stuff]!''
  4765. !! html
  4766. <p><i>Some </i><a rel="nofollow" class="external text" href="http://example.com/"><i>pretty </i>italics<i> and stuff</i></a><i>!</i>
  4767. </p>
  4768. !! end
  4769. # Don't add the html/php section since the output is broken and there isn't any reason to spec it
  4770. !! test
  4771. External link containing double-single-quotes with no space separating the url from text in italics
  4772. !! wikitext
  4773. [http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm''La muerte de Casagemas'' (1901) en el sitio de [[Museo Picasso (París)|Museo Picasso]].]
  4774. !! html/php+tidy
  4775. <p><a rel="nofollow" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a href="/index.php?title=Museo_Picasso_(Par%C3%ADs)&amp;action=edit&amp;redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.
  4776. </p>
  4777. !! html/parsoid
  4778. <p><a rel="mw:ExtLink" class="external text" href="http://www.musee-picasso.fr/pages/page_id18528_u1l2.htm"><i>La muerte de Casagemas</i> (1901) en el sitio de </a><a rel="mw:WikiLink" href="./Museo_Picasso_(París)" title="Museo Picasso (París)">Museo Picasso</a><span>.</span></p>
  4779. !! end
  4780. !! test
  4781. External link with comments in link text
  4782. !! wikitext
  4783. [http://www.google.com Google <!-- comment -->]
  4784. !! html/php
  4785. <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
  4786. </p>
  4787. !! html/parsoid
  4788. <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
  4789. !! end
  4790. !! test
  4791. External link to bare IPv4 address
  4792. !! wikitext
  4793. [http://192.168.0.1 Link]
  4794. !! html/php
  4795. <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
  4796. </p>
  4797. !! html/parsoid
  4798. <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
  4799. !! end
  4800. !! test
  4801. URL-encoding in URL functions (single parameter)
  4802. !! wikitext
  4803. {{localurl:Some page|amp=&}}
  4804. !! html
  4805. <p>/index.php?title=Some_page&amp;amp=&amp;
  4806. </p>
  4807. !! end
  4808. !! test
  4809. URL-encoding in URL functions (multiple parameters)
  4810. !! wikitext
  4811. {{localurl:Some page|q=?&amp=&}}
  4812. !! html
  4813. <p>/index.php?title=Some_page&amp;q=?&amp;amp=&amp;
  4814. </p>
  4815. !! end
  4816. !! test
  4817. Brackets in urls
  4818. !! wikitext
  4819. http://example.com/index.php?foozoid%5B%5D=bar
  4820. http://example.com/index.php?foozoid&#x5B;&#x5D;=bar
  4821. !! html/php
  4822. <p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
  4823. </p><p><a rel="nofollow" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a>
  4824. </p>
  4825. !! html/parsoid
  4826. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar">http://example.com/index.php?foozoid%5B%5D=bar</a></p>
  4827. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/index.php?foozoid%5B%5D=bar" data-parsoid='{"stx":"url","a":{"href":"http://example.com/index.php?foozoid%5B%5D=bar"},"sa":{"href":"http://example.com/index.php?foozoid&amp;#x5B;&amp;#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
  4828. !! end
  4829. !! test
  4830. IPv6 urls, autolink format (T23261)
  4831. !! wikitext
  4832. http://[2404:130:0:1000::187:2]/index.php
  4833. Examples from RFC 2373, section 2.2:
  4834. *http://[1080::8:800:200C:417A]/unicast
  4835. *http://[FF01::101]/multicast
  4836. *http://[::1]/loopback
  4837. *http://[::]/unspecified
  4838. *http://[::13.1.68.3]/ipv4compat
  4839. *http://[::FFFF:129.144.52.38]/ipv4compat
  4840. Examples from RFC 2732, section 2:
  4841. *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
  4842. *http://[1080:0:0:0:8:800:200C:417A]/index.html
  4843. *http://[3ffe:2a00:100:7031::1]
  4844. *http://[1080::8:800:200C:417A]/foo
  4845. *http://[::192.9.5.5]/ipng
  4846. *http://[::FFFF:129.144.52.38]:80/index.html
  4847. *http://[2010:836B:4179::836B:4179]
  4848. !! html/php
  4849. <p><a rel="nofollow" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a>
  4850. </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
  4851. </p>
  4852. <ul><li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
  4853. <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
  4854. <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
  4855. <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
  4856. <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
  4857. <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
  4858. <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
  4859. </p>
  4860. <ul><li><a rel="nofollow" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
  4861. <li><a rel="nofollow" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
  4862. <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
  4863. <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
  4864. <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
  4865. <li><a rel="nofollow" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
  4866. <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
  4867. !! html/parsoid
  4868. <p><a rel="mw:ExtLink" class="external free" href="http://[2404:130:0:1000::187:2]/index.php">http://[2404:130:0:1000::187:2]/index.php</a></p>
  4869. <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
  4870. <ul><li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/unicast">http://[1080::8:800:200C:417A]/unicast</a></li>
  4871. <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
  4872. <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
  4873. <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
  4874. <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
  4875. <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]/ipv4compat">http://[::FFFF:129.144.52.38]/ipv4compat</a></li></ul>
  4876. <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
  4877. <ul><li><a rel="mw:ExtLink" class="external free" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html</a></li>
  4878. <li><a rel="mw:ExtLink" class="external free" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">http://[1080:0:0:0:8:800:200C:417A]/index.html</a></li>
  4879. <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
  4880. <li><a rel="mw:ExtLink" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
  4881. <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
  4882. <li><a rel="mw:ExtLink" class="external free" href="http://[::FFFF:129.144.52.38]:80/index.html">http://[::FFFF:129.144.52.38]:80/index.html</a></li>
  4883. <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
  4884. !! end
  4885. !! test
  4886. IPv6 urls, bracketed format (T23261)
  4887. !! wikitext
  4888. [http://[2404:130:0:1000::187:2]/index.php test]
  4889. Examples from RFC 2373, section 2.2:
  4890. *[http://[1080::8:800:200C:417A] unicast]
  4891. *[http://[FF01::101] multicast]
  4892. *[http://[::1]/ loopback]
  4893. *[http://[::] unspecified]
  4894. *[http://[::13.1.68.3] ipv4compat]
  4895. *[http://[::FFFF:129.144.52.38] ipv4compat]
  4896. Examples from RFC 2732, section 2:
  4897. *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
  4898. *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
  4899. *[http://[3ffe:2a00:100:7031::1] 3]
  4900. *[http://[1080::8:800:200C:417A]/foo 4]
  4901. *[http://[::192.9.5.5]/ipng 5]
  4902. *[http://[::FFFF:129.144.52.38]:80/index.html 6]
  4903. *[http://[2010:836B:4179::836B:4179] 7]
  4904. !! html/php
  4905. <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
  4906. </p><p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2373">RFC 2373</a>, section 2.2:
  4907. </p>
  4908. <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
  4909. <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
  4910. <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
  4911. <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
  4912. <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
  4913. <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
  4914. <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
  4915. </p>
  4916. <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
  4917. <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
  4918. <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
  4919. <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
  4920. <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
  4921. <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
  4922. <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
  4923. !! html/parsoid
  4924. <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
  4925. <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
  4926. <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
  4927. <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
  4928. <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
  4929. <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
  4930. <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
  4931. <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
  4932. <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
  4933. <ul><li><a rel="mw:ExtLink" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
  4934. <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
  4935. <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
  4936. <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
  4937. <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
  4938. <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
  4939. <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
  4940. !! end
  4941. !! test
  4942. Non-extlinks in brackets
  4943. !! wikitext
  4944. [foo]
  4945. [foo bar]
  4946. [foo ''bar'']
  4947. [fool's] errand
  4948. [fool's errand]
  4949. [{{echo|foo}}]
  4950. [{{echo|foo}} bar]
  4951. [{{echo|foo}} ''bar'']
  4952. [{{echo|foo}}l's] errand
  4953. [{{echo|foo}}l's errand]
  4954. [url={{echo|foo}}]
  4955. [url=http://example.com]
  4956. [http:// bare protocols don't count]
  4957. !! html/php
  4958. <p>[foo]
  4959. [foo bar]
  4960. [foo <i>bar</i>]
  4961. [fool's] errand
  4962. [fool's errand]
  4963. [foo]
  4964. [foo bar]
  4965. [foo <i>bar</i>]
  4966. [fool's] errand
  4967. [fool's errand]
  4968. [url=foo]
  4969. [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
  4970. [http:// bare protocols don't count]
  4971. </p>
  4972. !! html/parsoid
  4973. <p>[foo]
  4974. [foo bar]
  4975. [foo <i>bar</i>]
  4976. [fool's] errand
  4977. [fool's errand]
  4978. [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
  4979. [<span about="#mwt20" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> bar]
  4980. [<span about="#mwt21" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span> <i>bar</i>]
  4981. [<span about="#mwt22" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's] errand
  4982. [<span about="#mwt23" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>l's errand]
  4983. [url=<span about="#mwt24" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
  4984. [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
  4985. [http:// bare protocols don't count]</p>
  4986. !! end
  4987. !! test
  4988. Percent encoding in external links
  4989. !! wikitext
  4990. [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
  4991. !! html/php
  4992. <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a>
  4993. </p>
  4994. !! html/parsoid
  4995. <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&amp;q=ResourceLoader+%40wikimedia">Search</a></p>
  4996. !! end
  4997. !! test
  4998. Use url link syntax for links where the content is equal the link target
  4999. !! wikitext
  5000. http://example.com
  5001. !! html/php
  5002. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
  5003. </p>
  5004. !! html/parsoid
  5005. <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
  5006. !! end
  5007. !! test
  5008. Parenthesis in external links, especially URL links
  5009. !! wikitext
  5010. http://example.com)
  5011. http://example.com/test)
  5012. http://example.com/(test)
  5013. http://example.com/((test)
  5014. (http://example.com/(test))
  5015. (http://example.com/(test)))))
  5016. http://example.com/a)b
  5017. [http://example.com) foo]
  5018. !! html/php
  5019. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
  5020. </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
  5021. </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
  5022. </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
  5023. </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
  5024. </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
  5025. </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
  5026. </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
  5027. </p>
  5028. !! html/parsoid
  5029. <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
  5030. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
  5031. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
  5032. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
  5033. <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
  5034. <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
  5035. <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
  5036. <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
  5037. !! end
  5038. !! test
  5039. Parenthesis in external links, w/ transclusion or comment
  5040. !! wikitext
  5041. (http://example.com/{{echo|hi}})
  5042. (http://example.com<!-- hi -->)
  5043. !! html/php
  5044. <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
  5045. </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
  5046. </p>
  5047. !! html/parsoid
  5048. <p>(<a typeof="mw:ExpandedAttrs" about="#mwt2" rel="mw:ExtLink" class="external free" href="http://example.com/hi" data-parsoid='{"stx":"url","a":{"href":"http://example.com/hi"},"sa":{"href":"http://example.com/{{echo|hi}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"http://example.com/&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span>"}]]}'>http://example.com/hi</a>)</p>
  5049. <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url","a":{"href":"http://example.com"},"sa":{"href":"http://example.com&lt;!-- hi -->"}}'>http://example.com</a>)</p>
  5050. !! end
  5051. !! test
  5052. Serialize <a> tags with invalid link targets as plain text
  5053. !! options
  5054. parsoid={ "modes": ["html2wt"], "suppressErrors": true }
  5055. !! html/parsoid
  5056. <a rel="mw:WikiLink" href="[[foo]]">text</a>
  5057. <a rel="mw:WikiLink" href="[[foo]]">*text</a>
  5058. <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
  5059. <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
  5060. !! wikitext
  5061. text
  5062. <nowiki>*</nowiki>text
  5063. <nowiki>[[foo]]</nowiki>
  5064. <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
  5065. !! end
  5066. !! test
  5067. mw:ExtLink -vs- mw:WikiLink (T94723)
  5068. !! options
  5069. parsoid=html2wt
  5070. !! html/parsoid
  5071. <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
  5072. <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
  5073. <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
  5074. <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
  5075. <p>
  5076. <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
  5077. <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
  5078. </p>
  5079. !! wikitext
  5080. [[Foo|Bar]]
  5081. [[Foo|Bar]]
  5082. [[:en:Foo|Bar]]
  5083. [[:en:Foo|Bar]]
  5084. [[:en:European_Robin|European Robin]]
  5085. [[:en:European_Robin|European Robin]]
  5086. !! end
  5087. !! test
  5088. mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
  5089. !! options
  5090. parsoid=wt2wt
  5091. !! wikitext
  5092. [http://en.wikipedia.org/wiki/European_Robin European Robin]
  5093. !! html/parsoid
  5094. THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
  5095. !! end
  5096. ###
  5097. ### Quotes
  5098. ###
  5099. !! test
  5100. Quotes
  5101. !! wikitext
  5102. Normal text. '''Bold text.''' Normal text. ''Italic text.''
  5103. Normal text. '''''Bold italic text.''''' Normal text.
  5104. !! html
  5105. <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
  5106. </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
  5107. </p>
  5108. !! end
  5109. # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
  5110. # parser strips. The wikitext contains just the first half of the bold
  5111. # quote pair.
  5112. !! test
  5113. Unclosed and unmatched quotes
  5114. !! wikitext
  5115. '''''Bold italic text '''with bold deactivated''' in between.'''''
  5116. '''''Bold italic text ''with italic deactivated'' in between.'''''
  5117. '''Bold text..
  5118. ..spanning two paragraphs (should not work).'''
  5119. '''Bold tag left open
  5120. ''Italic tag left open
  5121. Normal text.
  5122. <!-- Unmatching number of opening, closing tags: -->
  5123. '''This year''''s election ''should'' beat '''last year''''s.
  5124. ''Tom'''s car is bigger than ''Susan'''s.
  5125. Plain ''italic'''s plain
  5126. !! html/php
  5127. <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
  5128. </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
  5129. </p><p><b>Bold text..</b>
  5130. </p><p>..spanning two paragraphs (should not work).
  5131. </p><p><b>Bold tag left open</b>
  5132. </p><p><i>Italic tag left open</i>
  5133. </p><p>Normal text.
  5134. </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
  5135. </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
  5136. </p><p>Plain <i>italic'</i>s plain
  5137. </p>
  5138. !! html/parsoid
  5139. <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
  5140. </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
  5141. </p><p><b>Bold text..</b>
  5142. </p><p>..spanning two paragraphs (should not work).<b></b>
  5143. </p><p><b>Bold tag left open</b>
  5144. </p><p><i>Italic tag left open</i>
  5145. </p><p>Normal text.
  5146. </p>
  5147. <!-- Unmatching number of opening, closing tags: -->
  5148. <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
  5149. </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
  5150. </p><p>Plain <i>italic'</i>s plain
  5151. </p>
  5152. !! end
  5153. ###
  5154. ### Tables
  5155. ###
  5156. ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
  5157. ###
  5158. # This should not produce <table></table> as <table><tr><td></td></tr></table>
  5159. # is the bare minimum required by the spec, see:
  5160. # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
  5161. # Parsoid team replies: empty table tags are legal in HTML5
  5162. !! test
  5163. A table with no data.
  5164. !! options
  5165. parsoid=wt2html
  5166. !! wikitext
  5167. {||}
  5168. !! html/php
  5169. !! html/parsoid
  5170. <table></table>
  5171. !! end
  5172. !! test
  5173. A table with stray table end tags on start tag line (wt2html)
  5174. !! options
  5175. parsoid=wt2html
  5176. !! wikitext
  5177. {|style="color: red;"|}
  5178. {|style="color: red;" |}
  5179. |foo
  5180. |}
  5181. {|style="color: red;"|} id="foo"
  5182. |foo
  5183. |}
  5184. {|style="color: red;" |} id="foo"
  5185. |foo
  5186. |}
  5187. !! html
  5188. <table style="color: red;"></table>
  5189. <table style="color: red;">
  5190. <tbody><tr>
  5191. <td>foo</td>
  5192. </tr></tbody>
  5193. </table>
  5194. <table style="color: red;" id="foo">
  5195. <tbody><tr>
  5196. <td>foo</td>
  5197. </tr></tbody>
  5198. </table>
  5199. <table style="color: red;" id="foo">
  5200. <tbody><tr>
  5201. <td>foo</td>
  5202. </tr></tbody>
  5203. </table>
  5204. !! end
  5205. !! test
  5206. A table with no data (take 2)
  5207. !! wikitext
  5208. {|
  5209. |}
  5210. !! html/parsoid
  5211. <table></table>
  5212. !! end
  5213. # A table with nothing but a caption is invalid XHTML, we might want to render
  5214. # this as <p>caption</p>
  5215. # Parsoid team replies: table with only a caption is legal in HTML5
  5216. !! test
  5217. A table with nothing but a caption
  5218. !! wikitext
  5219. {|
  5220. |+caption
  5221. |}
  5222. !! html/php
  5223. <table>
  5224. <caption>caption
  5225. </caption><tr><td></td></tr></table>
  5226. !! html/parsoid
  5227. <table><caption>caption</caption></table>
  5228. !! end
  5229. !! test
  5230. A table with caption with default-spaced attributes and a table row
  5231. !! wikitext
  5232. {|
  5233. |+ style="color: red;" | caption1
  5234. |-
  5235. |foo
  5236. |}
  5237. !! html
  5238. <table>
  5239. <caption style="color: red;">caption1
  5240. </caption>
  5241. <tr>
  5242. <td>foo
  5243. </td></tr></table>
  5244. !! end
  5245. !! test
  5246. A table with captions with non-default spaced attributes and a table row
  5247. !! wikitext
  5248. {|
  5249. |+style="color: red;"|caption2
  5250. |+ style="color: red;"|caption3
  5251. |-
  5252. |foo
  5253. |}
  5254. !! html
  5255. <table>
  5256. <caption style="color: red;">caption2
  5257. </caption>
  5258. <caption style="color: red;">caption3
  5259. </caption>
  5260. <tr>
  5261. <td>foo
  5262. </td></tr></table>
  5263. !! end
  5264. !! test
  5265. Table td-cell syntax variations
  5266. !! wikitext
  5267. {|
  5268. |foo bar foo|baz
  5269. |foo bar foo||baz
  5270. |style='color:red;'|baz
  5271. |style='color:red;'||baz
  5272. |}
  5273. !! html
  5274. <table>
  5275. <tr>
  5276. <td>baz
  5277. </td>
  5278. <td>foo bar foo</td>
  5279. <td>baz
  5280. </td>
  5281. <td style="color:red;">baz
  5282. </td>
  5283. <td>style='color:red;'</td>
  5284. <td>baz
  5285. </td></tr></table>
  5286. !! end
  5287. !! test
  5288. Simple table
  5289. !! wikitext
  5290. {|
  5291. |1||2
  5292. |-
  5293. |3||4
  5294. |}
  5295. !! html
  5296. <table>
  5297. <tr>
  5298. <td>1</td>
  5299. <td>2
  5300. </td></tr>
  5301. <tr>
  5302. <td>3</td>
  5303. <td>4
  5304. </td></tr></table>
  5305. !! end
  5306. !! test
  5307. Simple table but with multiple dashes for row wikitext
  5308. !! wikitext
  5309. {|
  5310. |foo
  5311. |-----
  5312. |bar
  5313. |}
  5314. !! html
  5315. <table>
  5316. <tr>
  5317. <td>foo
  5318. </td></tr>
  5319. <tr>
  5320. <td>bar
  5321. </td></tr></table>
  5322. !! end
  5323. !! test
  5324. Multiplication table
  5325. !! wikitext
  5326. {| border="1" cellpadding="2"
  5327. |+Multiplication table
  5328. |-
  5329. !&times;!!1!!2!!3
  5330. |-
  5331. !1
  5332. |1||2||3
  5333. |-
  5334. !2
  5335. |2||4||6
  5336. |-
  5337. !3
  5338. |3||6||9
  5339. |-
  5340. !4
  5341. |4||8||12
  5342. |-
  5343. !5
  5344. |5||10||15
  5345. |}
  5346. !! html
  5347. <table border="1" cellpadding="2">
  5348. <caption>Multiplication table
  5349. </caption>
  5350. <tr>
  5351. <th>&#215;</th>
  5352. <th>1</th>
  5353. <th>2</th>
  5354. <th>3
  5355. </th></tr>
  5356. <tr>
  5357. <th>1
  5358. </th>
  5359. <td>1</td>
  5360. <td>2</td>
  5361. <td>3
  5362. </td></tr>
  5363. <tr>
  5364. <th>2
  5365. </th>
  5366. <td>2</td>
  5367. <td>4</td>
  5368. <td>6
  5369. </td></tr>
  5370. <tr>
  5371. <th>3
  5372. </th>
  5373. <td>3</td>
  5374. <td>6</td>
  5375. <td>9
  5376. </td></tr>
  5377. <tr>
  5378. <th>4
  5379. </th>
  5380. <td>4</td>
  5381. <td>8</td>
  5382. <td>12
  5383. </td></tr>
  5384. <tr>
  5385. <th>5
  5386. </th>
  5387. <td>5</td>
  5388. <td>10</td>
  5389. <td>15
  5390. </td></tr></table>
  5391. !! end
  5392. !! test
  5393. Accept "||" in table headings
  5394. !! wikitext
  5395. {|
  5396. !h1||h2
  5397. |}
  5398. !! html
  5399. <table>
  5400. <tr>
  5401. <th>h1</th>
  5402. <th>h2
  5403. </th></tr></table>
  5404. !! end
  5405. !! test
  5406. Accept "!!" in table data
  5407. !! wikitext
  5408. {|
  5409. |Foo!!||
  5410. |}
  5411. !! html
  5412. <table>
  5413. <tr>
  5414. <td>Foo!!</td>
  5415. <td>
  5416. </td></tr></table>
  5417. !! html/parsoid
  5418. <table>
  5419. <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
  5420. </tbody></table>
  5421. !! end
  5422. !! test
  5423. Accept "||" in indented table headings
  5424. !! wikitext
  5425. :{|
  5426. !h1||h2
  5427. |}
  5428. !! html
  5429. <dl><dd><table>
  5430. <tr>
  5431. <th>h1</th>
  5432. <th>h2
  5433. </th></tr></table></dd></dl>
  5434. !! end
  5435. !! test
  5436. Accept "!!" in templates
  5437. !! wikitext
  5438. {|
  5439. !a {{echo|b!!c}}
  5440. |}
  5441. !! html/php
  5442. <table>
  5443. <tr>
  5444. <th>a b</th>
  5445. <th>c
  5446. </th></tr></table>
  5447. !! html/parsoid
  5448. <table>
  5449. <tbody><tr><th typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["!a ",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b!!c"}},"i":0}}]}'>a b</th><th about="#mwt1">c</th></tr>
  5450. !! end
  5451. !! test
  5452. Accept "!!" in table headings after newline
  5453. !! wikitext
  5454. {|
  5455. !a
  5456. b!!c
  5457. |}
  5458. !! html/php
  5459. <table>
  5460. <tr>
  5461. <th>a
  5462. <p>b!!c
  5463. </p>
  5464. </th></tr></table>
  5465. !! html/parsoid
  5466. <table>
  5467. <tbody><tr><th>a
  5468. <p>b!!c</p></th></tr>
  5469. </tbody></table>
  5470. !! end
  5471. !! test
  5472. Accept "!!" in table data of mixed wikitext / html syntax
  5473. !! wikitext
  5474. {|
  5475. !a
  5476. <tr><td>b!!c</td></tr>
  5477. |}
  5478. !! html/php+tidy
  5479. <table>
  5480. <tbody><tr>
  5481. <th>a
  5482. </th></tr><tr><td>b!!c</td></tr>
  5483. </tbody></table>
  5484. !! html/parsoid
  5485. <table>
  5486. <tbody><tr><th>a</th></tr>
  5487. <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
  5488. </tbody></table>
  5489. !! end
  5490. !! test
  5491. Accept empty attributes in td/th cells (td/th cells starting with leading ||)
  5492. !! wikitext
  5493. {|
  5494. !| h1
  5495. || a
  5496. |}
  5497. !! html
  5498. <table>
  5499. <tr>
  5500. <th>h1
  5501. </th>
  5502. <td>a
  5503. </td></tr></table>
  5504. !! end
  5505. !!test
  5506. Accept "| !" at start of line in tables (ignore !-attribute)
  5507. !! wikitext
  5508. {|
  5509. |-
  5510. |!style="color:red"|bar
  5511. |}
  5512. !! html
  5513. <table>
  5514. <tr>
  5515. <td>bar
  5516. </td></tr></table>
  5517. !!end
  5518. !!test
  5519. Allow +/- in 2nd and later cells in a row, in 1st cell when td-attrs are present, or in 1st cell when there is a space between "|" and +/-
  5520. !! wikitext
  5521. {|
  5522. |-
  5523. |style='color:red;'|+1
  5524. |style='color:blue;'|-1
  5525. |-
  5526. |1||2||3
  5527. |1||+2||-3
  5528. |-
  5529. | +1
  5530. | -1
  5531. |}
  5532. !! html
  5533. <table>
  5534. <tr>
  5535. <td style="color:red;">+1
  5536. </td>
  5537. <td style="color:blue;">-1
  5538. </td></tr>
  5539. <tr>
  5540. <td>1</td>
  5541. <td>2</td>
  5542. <td>3
  5543. </td>
  5544. <td>1</td>
  5545. <td>+2</td>
  5546. <td>-3
  5547. </td></tr>
  5548. <tr>
  5549. <td>+1
  5550. </td>
  5551. <td>-1
  5552. </td></tr></table>
  5553. !!end
  5554. !! test
  5555. Table rowspan
  5556. !! wikitext
  5557. {| border=1
  5558. |Cell 1, row 1
  5559. |rowspan=2|Cell 2, row 1 (and 2)
  5560. |Cell 3, row 1
  5561. |-
  5562. |Cell 1, row 2
  5563. |Cell 3, row 2
  5564. |}
  5565. !! html
  5566. <table border="1">
  5567. <tr>
  5568. <td>Cell 1, row 1
  5569. </td>
  5570. <td rowspan="2">Cell 2, row 1 (and 2)
  5571. </td>
  5572. <td>Cell 3, row 1
  5573. </td></tr>
  5574. <tr>
  5575. <td>Cell 1, row 2
  5576. </td>
  5577. <td>Cell 3, row 2
  5578. </td></tr></table>
  5579. !! end
  5580. !! test
  5581. Nested table
  5582. !! wikitext
  5583. {| border=1
  5584. | &alpha;
  5585. |
  5586. {| bgcolor=#ABCDEF border=2
  5587. |nested
  5588. |-
  5589. |table
  5590. |}
  5591. |the original table again
  5592. |}
  5593. !! html
  5594. <table border="1">
  5595. <tr>
  5596. <td>&#945;
  5597. </td>
  5598. <td>
  5599. <table bgcolor="#ABCDEF" border="2">
  5600. <tr>
  5601. <td>nested
  5602. </td></tr>
  5603. <tr>
  5604. <td>table
  5605. </td></tr></table>
  5606. </td>
  5607. <td>the original table again
  5608. </td></tr></table>
  5609. !! end
  5610. !! test
  5611. Invalid attributes in table cell (T3830)
  5612. !! wikitext
  5613. {|
  5614. |Cell:|broken
  5615. |}
  5616. !! html
  5617. <table>
  5618. <tr>
  5619. <td>broken
  5620. </td></tr></table>
  5621. !! end
  5622. !! test
  5623. Table cell attributes: Pipes protected by nowikis should be treated as a plain character
  5624. !! wikitext
  5625. {|
  5626. | title="foo" |bar
  5627. | title="foo<nowiki>|</nowiki>" |bar
  5628. | title="foo<nowiki>|</nowiki>" bar
  5629. |}
  5630. !! html/php
  5631. <table>
  5632. <tr>
  5633. <td title="foo">bar
  5634. </td>
  5635. <td title="foo&#124;">bar
  5636. </td>
  5637. <td>title="foo|" bar
  5638. </td></tr></table>
  5639. !! html/parsoid
  5640. <table>
  5641. <tbody><tr><td title="foo">bar</td>
  5642. <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo&lt;nowiki>|&lt;/nowiki>"},"autoInsertedEnd":true}'>bar</td>
  5643. <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
  5644. </tbody></table>
  5645. !! end
  5646. # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
  5647. # N.B. The "|}" to close the table is missing from the input, so parsoid's
  5648. # *2wt modes will fail.
  5649. !! test
  5650. Table security: embedded pipes
  5651. !! options
  5652. parsoid=wt2html,html2html
  5653. !! wikitext
  5654. {|
  5655. | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
  5656. !! html/php
  5657. <table>
  5658. <tr>
  5659. <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
  5660. <td>]" onmouseover="alert(document.cookie)"&gt;test
  5661. </td>
  5662. </tr>
  5663. </table>
  5664. !! html/parsoid
  5665. <table><tbody>
  5666. <tr>
  5667. <td data-parsoid='{"startTagSrc":"| ","attrSepSrc":"|","autoInsertedEnd":true}'>[<a rel="mw:ExtLink" class="external free" href="ftp://%7Cx" data-parsoid='{"stx":"url","a":{"href":"ftp://%7Cx"},"sa":{"href":"ftp://|x"}}'>ftp://%7Cx</a></td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>]" onmouseover="alert(document.cookie)">test</td></tr></tbody></table>
  5668. !! end
  5669. !! test
  5670. Element attributes with double ! should not be broken up by <th>
  5671. !! wikitext
  5672. {|
  5673. !hi <div class="!!">ha</div> ho
  5674. |}
  5675. !! html/php
  5676. <table>
  5677. <tr>
  5678. <th>hi <div class="!!">ha</div> ho
  5679. </th></tr></table>
  5680. !! html/parsoid
  5681. <table>
  5682. <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
  5683. </tbody></table>
  5684. !! end
  5685. !! test
  5686. ! and || in element attributes should not be parsed as <th>/<td>
  5687. !! wikitext
  5688. {|
  5689. |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
  5690. |}
  5691. !! html/php
  5692. <table>
  5693. <tr>
  5694. <td><div style="color: red !important;" data-contrived="put this here &#124;&#124;">hi</div>
  5695. </td></tr></table>
  5696. !! html/parsoid
  5697. <table>
  5698. <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
  5699. </tbody></table>
  5700. !! end
  5701. # FIXME: The output seems broken. Filed as T110268.
  5702. !! test
  5703. ! and || in td attributes should not be parsed as <th>/<td>
  5704. !! options
  5705. parsoid=wt2html
  5706. !! wikitext
  5707. {|
  5708. |style="color: red !important;" data-contrived="put this here ||"|foo
  5709. |}
  5710. !! html/php
  5711. <table>
  5712. <tr>
  5713. <td>style="color: red !important;" data-contrived="put this here</td>
  5714. <td>foo
  5715. </td></tr></table>
  5716. !! html/parsoid
  5717. <table>
  5718. <tbody><tr><td>style="color: red !important;" data-contrived="put this here</td><td data-parsoid='{"stx":"row","a":{"\"":null},"sa":{"\"":""},"autoInsertedEnd":true}'>foo</td></tr>
  5719. </tbody></table>
  5720. !! end
  5721. !! test
  5722. Break on | in element attribute in template
  5723. !! options
  5724. parsoid=wt2html,html2html
  5725. !! wikitext
  5726. {{echo|1=<div class="hi|ho">ha</div>}}
  5727. !! html/php
  5728. <p>ho"&gt;ha&lt;/div&gt;
  5729. </p>
  5730. !! html/parsoid
  5731. <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha&lt;/div>"}},"i":0}}]}'>ho">ha</span>
  5732. !! end
  5733. !! test
  5734. Break on | in element attribute name in template
  5735. !! wikitext
  5736. {{echo|<div cla|ss="hiho">ha</div>}}
  5737. !! html/parsoid
  5738. <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"},{"k":"ss","named":true}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div cla"},"ss":{"wt":"\"hiho\">ha&lt;/div>"}},"i":0}}]}'>&lt;div cla</p>
  5739. !! end
  5740. !! test
  5741. Don't break on | in extension attribute in template
  5742. !! wikitext
  5743. {{echo|<ref name="hi|ho">ha</ref>}}
  5744. <references />
  5745. !! html/parsoid
  5746. <p><sup about="#mwt2" class="mw-ref" id="cite_ref-hi|ho_1-0" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref name=\"hi|ho\">ha&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-hi|ho-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></p>
  5747. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-hi|ho-1" id="cite_note-hi|ho-1"><a href="./Main_Page#cite_ref-hi|ho_1-0" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-hi|ho-1" class="mw-reference-text">ha</span></li></ol>
  5748. !! end
  5749. ## We don't support roundtripping of these attributes in Parsoid.
  5750. ## Selective serialization takes care of preventing dirty diffs.
  5751. ## But, on edits, we dirty-diff the invalid attribute text.
  5752. !! test
  5753. Invalid text in table attributes should be discarded
  5754. !! options
  5755. parsoid=wt2html
  5756. !! wikitext
  5757. {| <span>boo</span> style='border:1px solid black'
  5758. | <span>boo</span> style='color:blue' |1
  5759. |<span>boo</span> style='color:blue'|2
  5760. |}
  5761. !! html/php
  5762. <table style="border:1px solid black">
  5763. <tr>
  5764. <td style="color:blue">1
  5765. </td>
  5766. <td style="color:blue">2
  5767. </td></tr></table>
  5768. !! html/parsoid
  5769. <table style="border:1px solid black">
  5770. <tr>
  5771. <td style="color:blue">1</td>
  5772. <td style="color:blue">2</td>
  5773. </tr>
  5774. </table>
  5775. !! end
  5776. !! test
  5777. Invalid text in table attributes should be preserved by selective serializer
  5778. !! options
  5779. parsoid={
  5780. "modes": ["selser"],
  5781. "changes": [
  5782. ["td:first-child", "text", "abc"],
  5783. ["td + td", "text", "xyz"]
  5784. ]
  5785. }
  5786. !! wikitext
  5787. {| <span>boo</span> style='border:1px solid black'
  5788. | <span>boo</span> style='color:blue' | 1
  5789. |<span>boo</span> style='color:blue'| 2
  5790. |}
  5791. !! wikitext/edited
  5792. {| <span>boo</span> style='border:1px solid black'
  5793. | <span>boo</span> style='color:blue' |abc
  5794. |<span>boo</span> style='color:blue'|xyz
  5795. |}
  5796. !! end
  5797. !! test
  5798. 1. Template-generated table cell attributes and cell content
  5799. !! wikitext
  5800. {|
  5801. |{{table_attribs}}
  5802. | {{table_attribs}}
  5803. || {{table_attribs_5}}
  5804. | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
  5805. |align=center {{table_attribs}}
  5806. | <!--foo--> align=center <!--bar--> {{table_attribs}}
  5807. |}
  5808. !! html
  5809. <table>
  5810. <tr>
  5811. <td style="color:red;">Foo
  5812. </td>
  5813. <td style="color:red;">Foo
  5814. </td>
  5815. <td>style="color:red;"</td>
  5816. <td>Bar
  5817. </td>
  5818. <td style="color:red;">Foo
  5819. </td>
  5820. <td align="center" style="color:red;">Foo
  5821. </td>
  5822. <td align="center" style="color:red;">Foo
  5823. </td></tr></table>
  5824. !! end
  5825. !! test
  5826. 2. Template-generated table cell attributes and cell content
  5827. !! wikitext
  5828. {|
  5829. |{{table_attribs_2}}
  5830. |}
  5831. !! html/php
  5832. <table>
  5833. <tr>
  5834. <td style="color:red;">Foo
  5835. </td>
  5836. <td>Bar</td>
  5837. <td>Baz
  5838. </td></tr></table>
  5839. !! html/parsoid
  5840. <table>
  5841. <tbody><tr><td about="#mwt1" typeof="mw:Transclusion" style="color:red;" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_2","href":"./Template:Table_attribs_2"},"params":{},"i":0}}]}'>Foo</td>
  5842. <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
  5843. </tbody></table>
  5844. !! end
  5845. !! test
  5846. 3. Template-generated table cell attributes and cell content
  5847. !! wikitext
  5848. {|
  5849. !align=center {{table_header_cells}}
  5850. |-
  5851. |align=center {{table_cells}}
  5852. |}
  5853. !! html/php
  5854. <table>
  5855. <tr>
  5856. <th align="center" style="color:red;">Foo</th>
  5857. <th style="color:red;"><i>Bar</i></th>
  5858. <th style="color:brown;"><i>Foo</i> and Baz
  5859. </th></tr>
  5860. <tr>
  5861. <td align="center" style="color:red;">Foo</td>
  5862. <td style="color:red;"><i>Bar</i></td>
  5863. <td style="color:brown;"><i>Foo</i> and Baz
  5864. </td></tr></table>
  5865. !! html/parsoid
  5866. <table>
  5867. <tbody><tr><th align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":0}}]}'>Foo</th><th about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></th><th about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</th></tr><tr>
  5868. <td align="center" style="color:red;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":0}}]}'>Foo</td><td about="#mwt1" style="color:red;"><i about="#mwt1">Bar</i></td><td about="#mwt1" style="color:brown;"><i about="#mwt1">Foo</i> and Baz</td></tr>
  5869. </tbody></table>
  5870. !! end
  5871. !! test
  5872. 4. Template-generated table cell attributes and cell content inside a templated table
  5873. !! wikitext
  5874. {{tbl-start}}
  5875. !align=center {{table_header_cells}}
  5876. |-
  5877. |align=center {{table_cells}}
  5878. {{tbl-end}}
  5879. !! html/php
  5880. <table>
  5881. <tr>
  5882. <th align="center" style="color:red;">Foo</th>
  5883. <th style="color:red;"><i>Bar</i></th>
  5884. <th style="color:brown;"><i>Foo</i> and Baz
  5885. </th></tr>
  5886. <tr>
  5887. <td align="center" style="color:red;">Foo</td>
  5888. <td style="color:red;"><i>Bar</i></td>
  5889. <td style="color:brown;"><i>Foo</i> and Baz
  5890. </td></tr></table>
  5891. !! html/parsoid
  5892. <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n!align=center ",{"template":{"target":{"wt":"table_header_cells","href":"./Template:Table_header_cells"},"params":{},"i":1}},"\n|-\n|align=center ",{"template":{"target":{"wt":"table_cells","href":"./Template:Table_cells"},"params":{},"i":2}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":3}}]}'>
  5893. <tbody><tr><th align="center" style="color:red;">Foo</th><th style="color:red;"><i>Bar</i></th><th style="color:brown;"><i>Foo</i> and Baz</th></tr>
  5894. <tr>
  5895. <td align="center" style="color:red;">Foo</td><td style="color:red;"><i>Bar</i></td><td style="color:brown;"><i>Foo</i> and Baz</td></tr>
  5896. </tbody></table>
  5897. !! end
  5898. ## Edge case fix to prevent future regressions
  5899. !! test
  5900. T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
  5901. !! wikitext
  5902. {|
  5903. |{{table_attribs_7}}
  5904. |}
  5905. <references />
  5906. !! html/parsoid
  5907. <table>
  5908. <tbody><tr><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_7","href":"./Template:Table_attribs_7"},"params":{},"i":0}}]}'>Foo<sup class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></s></td></tr>
  5909. </tbody></table>
  5910. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
  5911. !! end
  5912. !! test
  5913. Table with row followed by newlines and table heading
  5914. !! options
  5915. parsoid=wt2html,html2html
  5916. !! wikitext
  5917. {|
  5918. |-
  5919. !foo
  5920. |}
  5921. !! html/*
  5922. <table>
  5923. <tr>
  5924. <th>foo
  5925. </th></tr></table>
  5926. !! end
  5927. !! test
  5928. Table with empty line following the start tag
  5929. !! options
  5930. parsoid=wt2html,html2html
  5931. !! wikitext
  5932. {|
  5933. |-
  5934. |foo
  5935. |}
  5936. !! html/*
  5937. <table>
  5938. <tr>
  5939. <td>foo
  5940. </td></tr></table>
  5941. !! end
  5942. !! test
  5943. Table attributes with empty value
  5944. !! options
  5945. parsoid=wt2html,html2html
  5946. !! wikitext
  5947. {|
  5948. | style=|hello
  5949. |}
  5950. !! html/php
  5951. <table>
  5952. <tr>
  5953. <td style="">hello
  5954. </td></tr></table>
  5955. !! html/parsoid
  5956. <table>
  5957. <tbody><tr><td style="">hello</td></tr>
  5958. </tbody></table>
  5959. !! end
  5960. !! test
  5961. Wikitext table with a lot of comments
  5962. !! wikitext
  5963. {|
  5964. <!-- c0 -->
  5965. |foo
  5966. <!-- c1 -->
  5967. |-<!-- c2 -->
  5968. <!-- c3 -->
  5969. |<!-- c4 -->
  5970. <!-- c5 -->
  5971. |}
  5972. !! html
  5973. <table>
  5974. <tr>
  5975. <td>foo
  5976. </td></tr>
  5977. <tr>
  5978. <td>
  5979. </td></tr></table>
  5980. !! end
  5981. !! test
  5982. Wikitext table comments represented in parsoid dom
  5983. !! wikitext
  5984. {|<!--c1--><!--c2-->
  5985. |-<!--c3-->
  5986. |x
  5987. |}
  5988. !! html/php+tidy
  5989. <table>
  5990. <tbody><tr>
  5991. <td>x
  5992. </td></tr></tbody></table>
  5993. !! html/parsoid
  5994. <table><!--c1--><!--c2-->
  5995. <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
  5996. <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
  5997. </tbody></table>
  5998. !! end
  5999. !! test
  6000. Wikitext table with double-line table cell
  6001. !! wikitext
  6002. {|
  6003. |a
  6004. b
  6005. |}
  6006. !! html
  6007. <table>
  6008. <tr>
  6009. <td>a
  6010. <p>b
  6011. </p>
  6012. </td></tr></table>
  6013. !! end
  6014. !! test
  6015. Table cell with a single comment
  6016. !! wikitext
  6017. {|
  6018. | <!-- c1 -->
  6019. |a
  6020. |}
  6021. !! html
  6022. <table>
  6023. <tr>
  6024. <td>
  6025. </td>
  6026. <td>a
  6027. </td></tr></table>
  6028. !! end
  6029. !! test
  6030. Table-cell after a comment-only-empty-line
  6031. !! wikitext
  6032. {|
  6033. |a
  6034. <!--c1-->
  6035. <!--c2-->|b
  6036. |}
  6037. !! html
  6038. <table>
  6039. <tr>
  6040. <td>a
  6041. </td>
  6042. <td>b
  6043. </td></tr></table>
  6044. !! html/parsoid
  6045. <table>
  6046. <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
  6047. <!--c1-->
  6048. <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
  6049. </tbody></table>
  6050. !! end
  6051. !! test
  6052. Build table with {{!}}
  6053. !! wikitext
  6054. {{{!}} class="wikitable"
  6055. !header
  6056. !second header
  6057. {{!}}- style="color:red;"
  6058. {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
  6059. {{!}}}
  6060. !! html
  6061. <table class="wikitable">
  6062. <tr>
  6063. <th>header
  6064. </th>
  6065. <th>second header
  6066. </th></tr>
  6067. <tr style="color:red;">
  6068. <td>data</td>
  6069. <td style="color:red;">second data
  6070. </td></tr></table>
  6071. !! end
  6072. !! test
  6073. Build table with pipe as data
  6074. !! wikitext
  6075. {| class="wikitable"
  6076. !header
  6077. !second header
  6078. |- style="color:red;"
  6079. |data|| style="color:red;" |second data
  6080. |-
  6081. | style="color:red;" |data with | || style="color:red;" | second data with |
  6082. |-
  6083. ||data with | |||second data with |
  6084. |}
  6085. !! html
  6086. <table class="wikitable">
  6087. <tr>
  6088. <th>header
  6089. </th>
  6090. <th>second header
  6091. </th></tr>
  6092. <tr style="color:red;">
  6093. <td>data</td>
  6094. <td style="color:red;">second data
  6095. </td></tr>
  6096. <tr>
  6097. <td style="color:red;">data with |</td>
  6098. <td style="color:red;">second data with |
  6099. </td></tr>
  6100. <tr>
  6101. <td>data with |</td>
  6102. <td>second data with |
  6103. </td></tr></table>
  6104. !! end
  6105. !! test
  6106. Build table with wikilink
  6107. !! wikitext
  6108. {| class="wikitable"
  6109. !header||second header
  6110. |- style="color:red;"
  6111. |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
  6112. |-
  6113. |data||second data [[Main Page|link|text with pipe]]
  6114. |}
  6115. !! html
  6116. <table class="wikitable">
  6117. <tr>
  6118. <th>header</th>
  6119. <th>second header
  6120. </th></tr>
  6121. <tr style="color:red;">
  6122. <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
  6123. <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
  6124. </td></tr>
  6125. <tr>
  6126. <td>data</td>
  6127. <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
  6128. </td></tr></table>
  6129. !! end
  6130. # The expected HTML structure in this test is debatable. The PHP parser does
  6131. # not parse this kind of table at all. The main focus for Parsoid is on
  6132. # round-tripping, so this output is ok for now. TODO: revisit!
  6133. !! test
  6134. Wikitext table with html-syntax row
  6135. !! wikitext
  6136. {|
  6137. |-
  6138. <td>foo</td>
  6139. |}
  6140. !! html/parsoid
  6141. <table>
  6142. <tbody>
  6143. <tr>
  6144. <td>foo</td></tr></tbody></table>
  6145. !! end
  6146. !! test
  6147. Fostered content in tables: Plain text
  6148. !! options
  6149. parsoid=wt2html,html2html
  6150. !! wikitext
  6151. {|
  6152. |-
  6153. a
  6154. |}
  6155. !! html/php
  6156. <table>
  6157. a
  6158. </table>
  6159. !! html/php+tidy
  6160. a
  6161. <table></table>
  6162. !! html/parsoid
  6163. <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
  6164. <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
  6165. </tr></tbody></table>
  6166. !! end
  6167. !! test
  6168. Fostered content in tables: Lists
  6169. !! options
  6170. parsoid=wt2html,html2html
  6171. !! wikitext
  6172. {|
  6173. |-
  6174. *a
  6175. |}
  6176. !! html/php
  6177. <table>
  6178. <ul><li>a</li></ul>
  6179. </table>
  6180. !! html/php+tidy
  6181. <ul><li>a</li></ul><table>
  6182. </table>
  6183. !! html/parsoid
  6184. <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
  6185. <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
  6186. </tr></tbody></table>
  6187. !! end
  6188. !! test
  6189. Template generated table cell with attributes
  6190. !! wikitext
  6191. {|
  6192. |-
  6193. {{table_attribs_4}} ||a||b
  6194. |}
  6195. !! html/php+tidy
  6196. <table>
  6197. <tbody><tr>
  6198. <td style="background-color:#DC241f;" width="10px"></td>
  6199. <td>a</td>
  6200. <td>b
  6201. </td></tr></tbody></table>
  6202. !! html/parsoid
  6203. <table>
  6204. <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
  6205. <td style="background-color:#DC241f;" width="10px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"table_attribs_4","href":"./Template:Table_attribs_4"},"params":{},"i":0}}," ||a||b"]}'></td><td about="#mwt1">a</td><td about="#mwt1">b</td></tr>
  6206. !! end
  6207. !! test
  6208. Parsoid: Round-trip tables directly followed by content (T53219)
  6209. !! options
  6210. parsoid=wt2html,wt2wt
  6211. !! wikitext
  6212. {|
  6213. |foo
  6214. |} bar
  6215. {|
  6216. |baz
  6217. |}<b>quux</b>
  6218. !! html+tidy
  6219. <table>
  6220. <tbody><tr>
  6221. <td>foo
  6222. </td></tr></tbody></table><p> bar
  6223. </p><table>
  6224. <tbody><tr>
  6225. <td>baz
  6226. </td></tr></tbody></table><p><b>quux</b>
  6227. </p>
  6228. !! end
  6229. !! test
  6230. Parsoid: Default to a newline after tables in new content (T53219)
  6231. !! options
  6232. parsoid=html2wt
  6233. !! html/parsoid
  6234. <table><tbody>
  6235. <tr><td>foo</td></tr></tbody></table> bar
  6236. <table><tbody>
  6237. <tr><td>baz</td></tr></tbody></table><b>quux</b>
  6238. !! wikitext
  6239. {|
  6240. |foo
  6241. |}
  6242. <nowiki> </nowiki>bar
  6243. {|
  6244. |baz
  6245. |}
  6246. '''quux'''
  6247. !! end
  6248. !! test
  6249. Parsoid: newline inducing block nodes don't suppress <nowiki>
  6250. !! options
  6251. parsoid=html2wt
  6252. !! html/parsoid
  6253. a<h1>foo</h1>
  6254. !! wikitext
  6255. <nowiki> </nowiki>a
  6256. = foo =
  6257. !! end
  6258. !! test
  6259. Parsoid: Row-syntax table headings followed by comment & table cells
  6260. !! options
  6261. parsoid=wt2html,wt2wt
  6262. !! wikitext
  6263. {|
  6264. !foo||bar
  6265. <!-- foo --> ||baz||quux
  6266. |}
  6267. !! html/php
  6268. <table>
  6269. <tr>
  6270. <th>foo</th>
  6271. <th>bar
  6272. </th>
  6273. <td>baz</td>
  6274. <td>quux
  6275. </td></tr></table>
  6276. !! html/parsoid
  6277. <table>
  6278. <tbody><tr><th> foo </th><th> bar
  6279. <!-- foo --> </th><td> baz </td><td> quux</td></tr>
  6280. </tbody></table>
  6281. !! end
  6282. !!test
  6283. Parsoid: Recover better from broken table attributes
  6284. !!options
  6285. parsoid=wt2html
  6286. !!wikitext
  6287. {| class="foo
  6288. | class="bar" |
  6289. foo
  6290. |}
  6291. !!html/php+tidy
  6292. <table class="foo">
  6293. <tbody><tr>
  6294. <td class="bar">
  6295. <p>foo
  6296. </p>
  6297. </td></tr></tbody></table>
  6298. !!html/parsoid
  6299. <table class="foo">
  6300. <tr>
  6301. <td class="bar">
  6302. <p>foo</p></td></tr>
  6303. </tbody></table>
  6304. !!end
  6305. !! test
  6306. Tables: Digest broken attributes on table and tr tag
  6307. !! options
  6308. parsoid=wt2html
  6309. !! wikitext
  6310. {| || |} ++
  6311. |- || || ++ --
  6312. |- > [
  6313. |}
  6314. !! html
  6315. <table>
  6316. <tbody>
  6317. <tr class='mw-empty-elt'></tr>
  6318. <tr class='mw-empty-elt'></tr>
  6319. </tbody></table>
  6320. !! end
  6321. # T137406: Whitespace in the HTML
  6322. !! test
  6323. 1. Generate correct wikitext for tables with thead/tbody/tfoot
  6324. !! options
  6325. parsoid=html2wt
  6326. !! html/parsoid
  6327. <table>
  6328. <caption>Test</caption>
  6329. <thead>
  6330. <tr>
  6331. <th>Month</th>
  6332. <th>Savings</th>
  6333. </tr>
  6334. </thead>
  6335. <tbody>
  6336. <tr>
  6337. <td>January</td>
  6338. <td>$100</td>
  6339. </tr>
  6340. <tr>
  6341. <td>February</td>
  6342. <td>$80</td>
  6343. </tr>
  6344. </tbody>
  6345. <tfoot>
  6346. <tr>
  6347. <td>Sum</td>
  6348. <td>$180</td>
  6349. </tr>
  6350. </tfoot>
  6351. </table>
  6352. !! wikitext
  6353. {|
  6354. |+Test
  6355. !Month
  6356. !Savings
  6357. |-
  6358. |January
  6359. |$100
  6360. |-
  6361. |February
  6362. |$80
  6363. |-
  6364. |Sum
  6365. |$180
  6366. |}
  6367. !! html/php+tidy
  6368. <table>
  6369. <caption>Test
  6370. </caption>
  6371. <tbody><tr>
  6372. <th>Month
  6373. </th>
  6374. <th>Savings
  6375. </th></tr>
  6376. <tr>
  6377. <td>January
  6378. </td>
  6379. <td>$100
  6380. </td></tr>
  6381. <tr>
  6382. <td>February
  6383. </td>
  6384. <td>$80
  6385. </td></tr>
  6386. <tr>
  6387. <td>Sum
  6388. </td>
  6389. <td>$180
  6390. </td></tr></tbody></table>
  6391. !! end
  6392. # T137406: No whitespace in the HTML
  6393. !! test
  6394. 2. Generate correct wikitext for tables with thead/tbody/tfoot
  6395. !! options
  6396. parsoid=html2wt
  6397. !! html/parsoid
  6398. <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
  6399. !! wikitext
  6400. {|
  6401. !heading
  6402. |-
  6403. |foo
  6404. |}
  6405. !! end
  6406. !! test
  6407. Testing serialization after deletion in references
  6408. !! options
  6409. parsoid={
  6410. "modes": ["wt2wt"],
  6411. "changes": [
  6412. ["#x", "remove"]
  6413. ]
  6414. }
  6415. !! wikitext
  6416. hi <ref><div id="x">ho</div></ref>
  6417. <references />
  6418. !! wikitext/edited
  6419. hi <ref></ref>
  6420. <references />
  6421. !! end
  6422. !!test
  6423. Testing serialization after deletion of table cells
  6424. !!options
  6425. parsoid={
  6426. "modes": ["wt2wt", "selser"],
  6427. "changes": [
  6428. ["#x", "remove"]
  6429. ]
  6430. }
  6431. !!wikitext
  6432. {|
  6433. !h1 !!h2 !!h3
  6434. | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
  6435. |}
  6436. !! wikitext/edited
  6437. {|
  6438. !h1 !!h2 !!h3
  6439. |c2 |||c3
  6440. |}
  6441. !!end
  6442. !! test
  6443. Testing selser after addition of new row before first row (T125419)
  6444. !! options
  6445. parsoid={
  6446. "modes": ["wt2wt", "selser"],
  6447. "changes": [
  6448. [ "tr", "before", "<tr><td>X</td></tr>" ]
  6449. ]
  6450. }
  6451. !! wikitext
  6452. {|
  6453. |a
  6454. |}
  6455. !! wikitext/edited
  6456. {|
  6457. |X
  6458. |-
  6459. |a
  6460. |}
  6461. !! end
  6462. !! test
  6463. Serialize new table rows in a HTML table using HTML tags
  6464. !! options
  6465. parsoid={
  6466. "modes": ["wt2wt", "selser"],
  6467. "changes": [
  6468. [ "tr", "before", "<tr><td>X</td></tr>" ]
  6469. ]
  6470. }
  6471. !! wikitext
  6472. <table><tr><td>a</td></tr></table>
  6473. !! wikitext/edited
  6474. <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
  6475. !! end
  6476. !! test
  6477. Serialize new table cells in a HTML row using HTML tags
  6478. !! options
  6479. parsoid={
  6480. "modes": ["wt2wt", "selser"],
  6481. "changes": [
  6482. [ "td", "before", "<td>X</td>" ]
  6483. ]
  6484. }
  6485. !! wikitext
  6486. <table><tr><td>a</td></tr></table>
  6487. !! wikitext/edited
  6488. <table><tr><td>X</td><td>a</td></tr></table>
  6489. !! end
  6490. !! test
  6491. Wikitext tables can be nested inside HTML tables
  6492. !! options
  6493. parsoid=html2wt
  6494. !! html
  6495. <table data-parsoid='{"stx":"html"}'>
  6496. <tr><td>
  6497. <table>
  6498. <tr><td>foo</td></tr>
  6499. </table>
  6500. </td></tr>
  6501. </table>
  6502. !! wikitext
  6503. <table>
  6504. <tr><td>
  6505. {|
  6506. |foo
  6507. |}
  6508. </td></tr>
  6509. </table>
  6510. !! end
  6511. !! test
  6512. Serialize wikitext list items as HTML list items when embedded in a HTML list
  6513. !! options
  6514. parsoid=html2wt
  6515. !! html
  6516. <ul data-parsoid='{"stx": "html"}'>
  6517. <li data-parsoid='{}'>a</li>
  6518. <li>b</li>
  6519. </ul>
  6520. !! wikitext
  6521. <ul>
  6522. <li>a</li>
  6523. <li>b</li>
  6524. </ul>
  6525. !! end
  6526. # SSS FIXME: Is this actually a good thing given the
  6527. # odd nested list output that is generated by MW?
  6528. # <ul><li>foo<ul>..</ul></li></ul> instead of
  6529. # <ul><li>foo</li><ul>..</ul></ul>
  6530. !! test
  6531. Wikitext lists can be nested inside HTML lists
  6532. !! options
  6533. parsoid=html2wt
  6534. !! html
  6535. <ul data-parsoid='{"stx": "html"}'>
  6536. <li data-parsoid='{"stx": "html"}'>a
  6537. <ul><li>b</li></ul>
  6538. </li>
  6539. </ul>
  6540. <ul data-parsoid='{"stx": "html"}'>
  6541. <li>x
  6542. <ul><li>y</li></ul>
  6543. </li>
  6544. </ul>
  6545. !! wikitext
  6546. <ul>
  6547. <li>a
  6548. * b
  6549. </li>
  6550. </ul>
  6551. <ul>
  6552. <li>x
  6553. * y
  6554. </li>
  6555. </ul>
  6556. !! end
  6557. ###
  6558. ### Internal links
  6559. ###
  6560. !! test
  6561. Plain link, capitalized
  6562. !! wikitext
  6563. [[Main Page]]
  6564. !! html
  6565. <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  6566. </p>
  6567. !! end
  6568. !! test
  6569. Plain link, uncapitalized
  6570. !! wikitext
  6571. [[main Page]]
  6572. !! html
  6573. <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
  6574. </p>
  6575. !! end
  6576. !! test
  6577. Piped link
  6578. !! wikitext
  6579. [[Main Page|The Main Page]]
  6580. !! html
  6581. <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
  6582. </p>
  6583. !! end
  6584. !! test
  6585. Piped link with comment in link text
  6586. !! wikitext
  6587. [[Main Page|The Main<!--front--> Page]]
  6588. !! html
  6589. <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
  6590. </p>
  6591. !! end
  6592. !! test
  6593. Piped link with multiple pipe characters in link text
  6594. !! wikitext
  6595. [[Main Page||The|Main|Page|]]
  6596. !! html/php
  6597. <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
  6598. </p>
  6599. !! html/parsoid
  6600. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
  6601. !! end
  6602. !! test
  6603. Piped link with no link text
  6604. !! wikitext
  6605. [[Thomas Bek (bishop of St David's)|]]
  6606. !! html/php
  6607. <p>[[Thomas Bek (bishop of St David's)|]]
  6608. </p>
  6609. !! html/parsoid
  6610. <p>[[Thomas Bek (bishop of St David's)|]]</p>
  6611. !! end
  6612. !! test
  6613. Piped link with empty link text
  6614. !! wikitext
  6615. [[Main Page|<nowiki/>]] - empty nowiki
  6616. [[Main Page| ]] - empty space
  6617. [[Main Page|&nbsp;]] - empty non breaking space
  6618. !! html/php
  6619. <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
  6620. <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
  6621. <a href="/wiki/Main_Page" title="Main Page">&#160;</a> - empty non breaking space
  6622. </p>
  6623. !! html/parsoid
  6624. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
  6625. <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
  6626. <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
  6627. !! end
  6628. !! test
  6629. Broken link
  6630. !! wikitext
  6631. [[Zigzagzogzagzig]]
  6632. !! html
  6633. <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
  6634. </p>
  6635. !! end
  6636. !! test
  6637. Broken link with fragment
  6638. !! wikitext
  6639. [[Zigzagzogzagzig#zug]]
  6640. !! html
  6641. <p><a href="/index.php?title=Zigzagzogzagzig&amp;action=edit&amp;redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
  6642. </p>
  6643. !! end
  6644. !! test
  6645. Special page link with fragment
  6646. !! wikitext
  6647. [[Special:Version#anchor]]
  6648. !! html
  6649. <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
  6650. </p>
  6651. !! end
  6652. !! test
  6653. Nonexistent special page link with fragment
  6654. !! wikitext
  6655. [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
  6656. !! html
  6657. <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
  6658. </p>
  6659. !! end
  6660. !! test
  6661. Link with prefix
  6662. !! wikitext
  6663. xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
  6664. !! html
  6665. <p>xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a>, xxx<a href="/wiki/Main_Page" title="Main Page">Main Page</a>, Xxx<a href="/wiki/Main_Page" title="Main Page">main Page</a> XXX<a href="/wiki/Main_Page" title="Main Page">main Page</a>, XXX<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  6666. </p>
  6667. !! end
  6668. !! test
  6669. Link with suffix
  6670. !! wikitext
  6671. [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
  6672. !! html
  6673. <p><a href="/wiki/Main_Page" title="Main Page">Main Pagexxx</a>, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>XXX, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>!!!
  6674. </p>
  6675. !! end
  6676. !! article
  6677. prefixed article
  6678. !! text
  6679. Some text
  6680. !! endarticle
  6681. !! test
  6682. T45661: Piped links with identical prefixes
  6683. !! wikitext
  6684. [[prefixed article|prefixed articles with spaces]]
  6685. [[prefixed article|prefixed articlesaoeu]]
  6686. [[Main Page|Main Page test]]
  6687. !! html
  6688. <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
  6689. </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
  6690. </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
  6691. </p>
  6692. !! end
  6693. !! test
  6694. Link with HTML entity in suffix / tail
  6695. !! wikitext
  6696. [[Main Page]]&quot;, [[Main Page]]&#97;
  6697. !! html/php
  6698. <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>&quot;, <a href="/wiki/Main_Page" title="Main Page">Main Page</a>&#97;
  6699. </p>
  6700. !! html/parsoid
  6701. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#97;","srcContent":"a"}'>a</span></p>
  6702. !! end
  6703. !! test
  6704. Link with 3 brackets
  6705. !! wikitext
  6706. [[[Main Page]]]
  6707. Foo [[[Main Page]]]
  6708. !! html
  6709. <p>[[[Main Page]]]
  6710. Foo [[[Main Page]]]
  6711. </p>
  6712. !! end
  6713. !! test
  6714. Link with 4 brackets
  6715. !! wikitext
  6716. [[[[Main Page]]]]
  6717. !! html
  6718. <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
  6719. </p>
  6720. !! end
  6721. !! test
  6722. Piped link with 3 brackets
  6723. !! wikitext
  6724. [[[main page|the main page]]]
  6725. !! html
  6726. <p>[[[main page|the main page]]]
  6727. </p>
  6728. !! end
  6729. !! test
  6730. Piped link with extlink-like text
  6731. !! wikitext
  6732. [[Main Page|[bar]]]
  6733. [[Main Page|This is a [bar]]]
  6734. [[Main Page|[bar]]
  6735. !! html/php
  6736. <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
  6737. <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
  6738. <a href="/wiki/Main_Page" title="Main Page">[bar</a>
  6739. </p>
  6740. !! html/parsoid
  6741. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
  6742. <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
  6743. <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
  6744. !! end
  6745. !! test
  6746. Link with multiple pipes
  6747. !! wikitext
  6748. [[Main Page|The|Main|Page]]
  6749. !! html
  6750. <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
  6751. </p>
  6752. !! end
  6753. !! test
  6754. Anchor containing a #. (T65430)
  6755. !! config
  6756. wgFragmentMode=[ 'html5', 'legacy' ]
  6757. !! wikitext
  6758. [[Main Page#And#Link]]
  6759. !! html/php
  6760. <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
  6761. </p>
  6762. !! html/parsoid
  6763. <p><a rel="mw:WikiLink" href="./Main_Page#And#Link" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#And#Link"},"sa":{"href":"Main Page#And#Link"}}'>Main Page#And#Link</a></p>
  6764. !! end
  6765. !! test
  6766. Link to namespaces
  6767. !! wikitext
  6768. [[Talk:Parser testing]], [[Meta:Disclaimers]]
  6769. !! html
  6770. <p><a href="/index.php?title=Talk:Parser_testing&amp;action=edit&amp;redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
  6771. </p>
  6772. !! end
  6773. !! test
  6774. Link with space in namespace
  6775. !! wikitext
  6776. [[User talk:Foo bar]]
  6777. !! html
  6778. <p><a href="/index.php?title=User_talk:Foo_bar&amp;action=edit&amp;redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
  6779. </p>
  6780. !! end
  6781. !! article
  6782. MemoryAlpha:AlphaTest
  6783. !! text
  6784. This is an article in the MemoryAlpha namespace
  6785. (which shadows the memoryalpha interwiki link).
  6786. !! endarticle
  6787. !! test
  6788. Namespace takes precedence over interwiki link (T53680)
  6789. !! wikitext
  6790. [[MemoryAlpha:AlphaTest]]
  6791. !! html
  6792. <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
  6793. </p>
  6794. !! end
  6795. # The previous test doesn't work correctly in html2*, due to not recognizing the
  6796. # link as an internal one. This one checks for the correct behavior.
  6797. !! test
  6798. Link to namespace preferred over interwiki with correct rel attribute
  6799. !! options
  6800. parsoid=html2wt,html2html
  6801. !! html/parsoid
  6802. <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
  6803. !! wikitext
  6804. [[MemoryAlpha:AlphaTest]]
  6805. !! end
  6806. !! test
  6807. Piped link to namespace
  6808. !! wikitext
  6809. [[Meta:Disclaimers|The disclaimers]]
  6810. !! html
  6811. <p><a href="/index.php?title=Meta:Disclaimers&amp;action=edit&amp;redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
  6812. </p>
  6813. !! end
  6814. !! test
  6815. Link containing }
  6816. !! wikitext
  6817. [[Usually caused by a typo (oops}]]
  6818. !! html
  6819. <p>[[Usually caused by a typo (oops}]]
  6820. </p>
  6821. !! end
  6822. !! article
  6823. 7% Solution
  6824. !! text
  6825. Just a test of an article title containing a percent.
  6826. !! endarticle
  6827. !! test
  6828. Link containing % (not as a hex sequence)
  6829. !! wikitext
  6830. [[7% Solution]]
  6831. [[7% Solution|7%25 Solution]]
  6832. !! html/php
  6833. <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
  6834. <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
  6835. </p>
  6836. !! html/parsoid
  6837. <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
  6838. <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
  6839. !! end
  6840. # note that the parsoid HTML is identical to the previous test output,
  6841. # so the previous test ensures that the html2wt mode will generate the
  6842. # "not as a hex sequence" wikitext.
  6843. !! test
  6844. Link containing % as a single hex sequence interpreted to char
  6845. !! options
  6846. parsoid=wt2wt,wt2html,html2html
  6847. !! wikitext
  6848. [[7%25 Solution]]
  6849. [[7%25 Solution|7%25 Solution]]
  6850. !! html/php
  6851. <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
  6852. <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
  6853. </p>
  6854. !! html/parsoid
  6855. <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
  6856. <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
  6857. !!end
  6858. !! test
  6859. Link containing % as a double hex sequence interpreted to hex sequence
  6860. !! wikitext
  6861. [[7%2525 Solution]]
  6862. !! html
  6863. <p>[[7%2525 Solution]]
  6864. </p>
  6865. !!end
  6866. ## Example for such a section: == < ==
  6867. !! test
  6868. Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
  6869. !! config
  6870. wgFragmentMode=[ 'html5', 'legacy' ]
  6871. !! wikitext
  6872. [[%23%3c]][[%23%3e]]
  6873. !! html/php
  6874. <p><a href="#&lt;">#&lt;</a><a href="#&gt;">#&gt;</a>
  6875. </p>
  6876. !! html/parsoid
  6877. <p><a rel="mw:WikiLink" href="./Main_Page#&lt;" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#&lt;"},"sa":{"href":"%23%3c"}}'>#&lt;</a><a rel="mw:WikiLink" href="./Main_Page#>" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#>"},"sa":{"href":"%23%3e"}}'>#></a></p>
  6878. !! end
  6879. ## Example for such a section: == < ==
  6880. !! test
  6881. Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
  6882. !! config
  6883. wgFragmentMode=[ 'legacy' ]
  6884. !! wikitext
  6885. [[%23%3c]][[%23%3e]]
  6886. !! html/php
  6887. <p><a href="#.3C">#&lt;</a><a href="#.3E">#&gt;</a>
  6888. </p>
  6889. !! end
  6890. !! test
  6891. Link containing "<#" and ">#" as a hex sequences
  6892. !! wikitext
  6893. [[%3c%23]][[%3e%23]]
  6894. !! html
  6895. <p>[[%3c%23]][[%3e%23]]
  6896. </p>
  6897. !! end
  6898. !! test
  6899. Link containing an equals sign
  6900. !! wikitext
  6901. [[Special:BookSources/isbn=4-00-026157-6]]
  6902. !! html/php
  6903. <p><a href="/wiki/Special:BookSources/isbn%3D4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a>
  6904. </p>
  6905. !! html/parsoid
  6906. <p><a rel="mw:WikiLink" href="./Special:BookSources/isbn=4-00-026157-6" title="Special:BookSources/isbn=4-00-026157-6">Special:BookSources/isbn=4-00-026157-6</a></p>
  6907. !! end
  6908. !! article
  6909. Foo~bar
  6910. !! text
  6911. Just a test of an article title containing a tilde.
  6912. !! endarticle
  6913. # note that links containing signatures, like [[Foo~~~~]], are
  6914. # massaged by the pre-save transform (PST) and so the tildes are never
  6915. # seen by the parser.
  6916. !! test
  6917. Link containing a tilde
  6918. !! wikitext
  6919. [[Foo~bar]]
  6920. !! html/php
  6921. <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
  6922. </p>
  6923. !! html/parsoid
  6924. <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
  6925. !! end
  6926. !! test
  6927. Link containing double-single-quotes '' (T6598)
  6928. !! wikitext
  6929. [[Lista d''e paise d''o munno]]
  6930. !! html/php
  6931. <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&amp;action=edit&amp;redlink=1" class="new" title="Lista d&#39;&#39;e paise d&#39;&#39;o munno (page does not exist)">Lista d''e paise d''o munno</a>
  6932. </p>
  6933. !! html/parsoid
  6934. <p><a rel="mw:WikiLink" href="./Lista_d''e_paise_d''o_munno" title="Lista d''e paise d''o munno">Lista d''e paise d''o munno</a></p>
  6935. !! end
  6936. !! test
  6937. Link containing double quotes and spaces
  6938. !! wikitext
  6939. [[Cool "Gator"]]
  6940. !! html/php
  6941. <p><a href="/index.php?title=Cool_%22Gator%22&amp;action=edit&amp;redlink=1" class="new" title="Cool &quot;Gator&quot; (page does not exist)">Cool "Gator"</a>
  6942. </p>
  6943. !! html/parsoid
  6944. <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
  6945. !! end
  6946. !! test
  6947. File containing double quotes and spaces
  6948. !! wikitext
  6949. [[File:Cool "Gator".png]]
  6950. !! html/parsoid
  6951. <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Cool_%22Gator%22.png" data-parsoid='{"a":{"href":"./File:Cool_%22Gator%22.png"},"sa":{"href":"File:Cool \"Gator\".png"}}'><img resource='./File:Cool_"Gator".png' src="./Special:FilePath/Cool_%22Gator%22.png" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Cool_\"Gator\".png","height":"220","width":"220","src":"./Special:FilePath/Cool_%22Gator%22.png"},"sa":{"resource":"File:Cool \"Gator\".png","src":"./Special:FilePath/Cool_\"Gator\".png"}}'/></a></figure-inline></p>
  6952. !! end
  6953. !! test
  6954. Redirect containing double quotes and spaces
  6955. !! wikitext
  6956. #REDIRECT [[Cool "Gator"]]
  6957. !! html/parsoid
  6958. <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
  6959. !! end
  6960. !! test
  6961. Link containing double-single-quotes '' in text (T6598 sanity check)
  6962. !! wikitext
  6963. Some [[Link|pretty ''italics'' and stuff]]!
  6964. !! html/php
  6965. <p>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
  6966. </p>
  6967. !! html/parsoid
  6968. <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
  6969. !! end
  6970. !! test
  6971. Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
  6972. !! wikitext
  6973. ''Some [[Link|pretty ''italics'' and stuff]]!''
  6974. !! html
  6975. <p><i>Some <a href="/index.php?title=Link&amp;action=edit&amp;redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
  6976. </p>
  6977. !! end
  6978. !! test
  6979. Link with double quotes in title part (literal) and alternate part (interpreted)
  6980. !! wikitext
  6981. [[File:Denys_Savchenko_''Pentecoste''.jpg]]
  6982. [[''Pentecoste'']]
  6983. [[''Pentecoste''|Pentecoste]]
  6984. [[''Pentecoste''|''Pentecoste'']]
  6985. !! html/php
  6986. <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko &#39;&#39;Pentecoste&#39;&#39;.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
  6987. </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">''Pentecoste''</a>
  6988. </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)">Pentecoste</a>
  6989. </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&amp;action=edit&amp;redlink=1" class="new" title="&#39;&#39;Pentecoste&#39;&#39; (page does not exist)"><i>Pentecoste</i></a>
  6990. </p>
  6991. !! html/parsoid
  6992. <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Denys_Savchenko_''Pentecoste''.jpg"><img resource="./File:Denys_Savchenko_''Pentecoste''.jpg" src="./Special:FilePath/Denys_Savchenko_''Pentecoste''.jpg" height="220" width="220"/></a></figure-inline></p>
  6993. <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
  6994. <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
  6995. <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
  6996. !! end
  6997. !! test
  6998. Broken image links with HTML captions (T41700)
  6999. !! wikitext
  7000. [[File:Nonexistent|<script></script>]]
  7001. [[File:Nonexistent|100x100px|<script></script>]]
  7002. [[File:Nonexistent|&lt;]]
  7003. [[File:Nonexistent|a<i>b</i>c]]
  7004. !! html/php
  7005. <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
  7006. <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;script&gt;&lt;/script&gt;</a>
  7007. <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">&lt;</a>
  7008. <a href="/index.php?title=Special:Upload&amp;wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
  7009. </p>
  7010. !! html/parsoid
  7011. <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
  7012. <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"&lt;script>&lt;/script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&amp;lt;script>&amp;lt;/script>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="100" width="100" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"100","width":"100"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
  7013. <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;lt;\",\"srcContent\":\"&amp;lt;\",\"dsr\":[107,111,null,null]}&#39;>&amp;lt;&lt;/span>"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline>
  7014. <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a&lt;i>b&lt;/i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a&lt;i data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[134,142,3,4]}&#39;>b&lt;/i>c"}'><a href="./File:Nonexistent" data-parsoid='{"a":{"href":"./File:Nonexistent"},"sa":{}}'><img resource="./File:Nonexistent" src="./Special:FilePath/Nonexistent" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Nonexistent","height":"220","width":"220"},"sa":{"resource":"File:Nonexistent"}}'/></a></figure-inline></p>
  7015. !! end
  7016. !! test
  7017. Plain link to URL
  7018. !! wikitext
  7019. [[http://www.example.com]]
  7020. !! html/php
  7021. <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
  7022. </p>
  7023. !! html/parsoid
  7024. <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
  7025. !! end
  7026. !! test
  7027. Plain link to URL with link text
  7028. !! wikitext
  7029. [[http://www.example.com Link text]]
  7030. !! html
  7031. <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
  7032. </p>
  7033. !! end
  7034. !! test
  7035. Plain link to protocol-relative URL
  7036. !! wikitext
  7037. [[//www.example.com]]
  7038. !! html/php
  7039. <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
  7040. </p>
  7041. !! html/parsoid
  7042. <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
  7043. !! end
  7044. !! test
  7045. Plain link to protocol-relative URL with link text
  7046. !! wikitext
  7047. [[//www.example.com Link text]]
  7048. !! html
  7049. <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
  7050. </p>
  7051. !! end
  7052. !! test
  7053. Plain link to page with question mark in title
  7054. !! wikitext
  7055. [[A?b]]
  7056. [[A?b|Baz]]
  7057. !! html
  7058. <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
  7059. </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
  7060. </p>
  7061. !! end
  7062. # I'm fairly sure the expected result here is wrong.
  7063. # We want these to be URL links, not pseudo-pages with URLs for titles....
  7064. # However the current output is also pretty screwy.
  7065. #
  7066. # ----
  7067. # I'm changing it to match the current output--it arguably makes more
  7068. # sense in the light of the test above. Old expected result was:
  7069. #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&amp;action=edit" class="new">an example URL</a>
  7070. #</p>
  7071. # But I think this test is bordering on "garbage in, garbage out" anyway.
  7072. # -- wtm
  7073. !! test
  7074. Piped link to URL
  7075. !! wikitext
  7076. Piped link to URL: [[http://www.example.com|an example URL]]
  7077. !! html/php
  7078. <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
  7079. </p>
  7080. !! html/parsoid
  7081. <p>Piped link to URL: [<a rel="mw:ExtLink" class="external text" href="http://www.example.com%7Can" data-parsoid='{"a":{"href":"http://www.example.com%7Can"},"sa":{"href":"http://www.example.com|an"}}'>example URL</a>]</p>
  7082. !! end
  7083. !! test
  7084. Plain link in template argument
  7085. !! options
  7086. parsoid=wt2html
  7087. !! wikitext
  7088. {{echo|[http://www.example.com |123]}}
  7089. {{echo|[[http://www.example.com |123]]}}
  7090. {{echo|[[http://www.example.com |123]}}
  7091. {{echo|[http://www.example.com |123]]}}
  7092. !! html/php
  7093. <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
  7094. </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
  7095. </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
  7096. </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
  7097. </p>
  7098. !! html/parsoid
  7099. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
  7100. <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[http://www.example.com |123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external text" href="http://www.example.com">|123</a>]</p>
  7101. <p>{{echo|[<a rel="mw:ExtLink" class="external text" href="http://www.example.com" data-parsoid='{"targetOff":114,"contentOffsets":[114,118],"dsr":[90,119,24,1]}'>|123</a>}}</p>
  7102. <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[http://www.example.com "},"2":{"wt":"123]]"}},"i":0}}]}'>[<a rel="mw:ExtLink" class="external free" href="http://www.example.com">http://www.example.com</a> </p>
  7103. !! end
  7104. !! test
  7105. T2002: [[page|http://url/]] should link to page, not http://url/
  7106. !! wikitext
  7107. [[Main Page|http://url/]]
  7108. !! html/php
  7109. <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
  7110. </p>
  7111. !! html/parsoid
  7112. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
  7113. !! end
  7114. # Parsoid does not mark self-links, by design.
  7115. !! test
  7116. T2337: Escaped self-links should be bold
  7117. !! options
  7118. title=[[Bug462]]
  7119. !! wikitext
  7120. [[Bu&#103;462]] [[Bug462]]
  7121. !! html/php+tidy
  7122. <p><a class="mw-selflink selflink">Bu&#103;462</a> <a class="mw-selflink selflink">Bug462</a>
  7123. </p>
  7124. !! html/parsoid
  7125. <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
  7126. !! end
  7127. !! test
  7128. Self-link to section should not be bold
  7129. !! options
  7130. title=[[Main Page]]
  7131. !! wikitext
  7132. [[Main Page#section]]
  7133. !! html
  7134. <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
  7135. </p>
  7136. !! end
  7137. !! article
  7138. 00
  7139. !! text
  7140. This is 00.
  7141. !! endarticle
  7142. !!test
  7143. Self-link to numeric title
  7144. !!options
  7145. title=[[0]]
  7146. !! wikitext
  7147. [[0]]
  7148. !! html
  7149. <p><a class="mw-selflink selflink">0</a>
  7150. </p>
  7151. !!end
  7152. !!test
  7153. Link to numeric-equivalent title
  7154. !!options
  7155. title=[[0]]
  7156. !! wikitext
  7157. [[00]]
  7158. !! html
  7159. <p><a href="/wiki/00" title="00">00</a>
  7160. </p>
  7161. !!end
  7162. !! test
  7163. <nowiki> inside a link
  7164. !! wikitext
  7165. [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
  7166. !! html
  7167. <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
  7168. </p>
  7169. !! end
  7170. !! test
  7171. Non-breaking spaces in title
  7172. !! wikitext
  7173. [[&nbsp; Main &nbsp; Page &nbsp;]]
  7174. !! html
  7175. <p><a href="/wiki/Main_Page" title="Main Page">&#160; Main &#160; Page &#160;</a>
  7176. </p>
  7177. !!end
  7178. # Add new article for the test below so that it doesn't red-link
  7179. !! article
  7180. Foo bar baz
  7181. !! text
  7182. boo
  7183. !! endarticle
  7184. !! test
  7185. Multiple spaces in titles should normalize to a single underscore
  7186. !! options
  7187. parsoid=wt2html,wt2wt
  7188. !! wikitext
  7189. [[Foo bar baz|x]]
  7190. [[Foo bar baz|x]]
  7191. [[Foo bar baz|x]]
  7192. !! html/php
  7193. <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
  7194. <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
  7195. <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
  7196. </p>
  7197. !! html/parsoid
  7198. <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
  7199. <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
  7200. <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
  7201. </p>
  7202. !! end
  7203. !! test
  7204. Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
  7205. !! options
  7206. language=ca
  7207. !! wikitext
  7208. '''[[Main Page]]'''
  7209. !! html
  7210. <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
  7211. </p>
  7212. !! end
  7213. !! test
  7214. Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
  7215. !! options
  7216. language=ca
  7217. !! wikitext
  7218. ''[[Main Page]]''
  7219. !! html
  7220. <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
  7221. </p>
  7222. !! end
  7223. !! test
  7224. Internal link with en linktrail: no apostrophes (T29473)
  7225. !! options
  7226. language=en
  7227. !! wikitext
  7228. [[Something]]'nice
  7229. !! html
  7230. <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
  7231. </p>
  7232. !! end
  7233. !! test
  7234. Internal link with ca linktrail with apostrophes (T29473)
  7235. !! options
  7236. language=ca
  7237. !! wikitext
  7238. [[Something]]'nice
  7239. !! html
  7240. <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
  7241. </p>
  7242. !! end
  7243. !! test
  7244. Internal link with kaa linktrail with apostrophes (T29473)
  7245. !! options
  7246. language=kaa
  7247. !! wikitext
  7248. [[Something]]'nice
  7249. !! html
  7250. <p><a href="/index.php?title=Something&amp;action=edit&amp;redlink=1" class="new" title="Something (bet ele jaratılmag&#39;an)">Something'nice</a>
  7251. </p>
  7252. !! end
  7253. !! test
  7254. Link with multiple ":" in a subpage-supporting namespace (T65636)
  7255. !! wikitext
  7256. [[User:Foo/Test/63636:Bar|Test]]
  7257. !! html/php
  7258. <p><a href="/index.php?title=User:Foo/Test/63636:Bar&amp;action=edit&amp;redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
  7259. </p>
  7260. !! html/parsoid
  7261. <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
  7262. !! end
  7263. ## Mainly a sanity check for Parsoid
  7264. !! test
  7265. Handle title parsing for subpages
  7266. !! options
  7267. title=[[/123123]]
  7268. subpage
  7269. !! wikitext
  7270. 123
  7271. !! html/php
  7272. <p>123
  7273. </p>
  7274. !! html/parsoid
  7275. <p>123</p>
  7276. !! end
  7277. !! article
  7278. User:Test/123
  7279. !! text
  7280. test 123
  7281. !! endarticle
  7282. !! test
  7283. Link to a subpage from a namespace other than main
  7284. !! options
  7285. title=[[User:Test]]
  7286. subpage
  7287. !! wikitext
  7288. [[/123]]
  7289. !! html/php
  7290. <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
  7291. </p>
  7292. !! html/parsoid
  7293. <p><a rel="mw:WikiLink" href="./User:Test/123" title="User:Test/123" data-parsoid='{"stx":"simple","a":{"href":"./User:Test/123"},"sa":{"href":"/123"}}'>/123</a></p>
  7294. !! end
  7295. !! test
  7296. Ensure that transclusion titles are not url-decoded
  7297. !! options
  7298. subpage title=[[Test]]
  7299. parsoid=wt2html
  7300. !! wikitext
  7301. {{Bar%C3%A9}} {{/Bar%C3%A9}}
  7302. !! html/php
  7303. <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
  7304. </p>
  7305. !! html/parsoid
  7306. <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
  7307. !! end
  7308. !! test
  7309. Purely hash wikilink
  7310. !! options
  7311. title=[[User:Test/123]]
  7312. subpage
  7313. !! wikitext
  7314. [[#a|b]]
  7315. !! html/php
  7316. <p><a href="#a">b</a>
  7317. </p>
  7318. !! html/parsoid
  7319. <p><a rel="mw:WikiLink" href="./User:Test/123#a" data-parsoid='{"stx":"piped","a":{"href":"./User:Test/123#a"},"sa":{"href":"#a"}}'>b</a></p>
  7320. !! end
  7321. !! test
  7322. Serialization of purely hash wikilink
  7323. !! options
  7324. title=[[User:Test/123]]
  7325. subpage
  7326. parsoid=html2wt
  7327. !! html/parsoid
  7328. <p><a href="#a">[[</a></p>
  7329. !! wikitext
  7330. [[#a|<nowiki>[[</nowiki>]]
  7331. !! html/php
  7332. <p><a href="#a">[[</a>
  7333. </p>
  7334. !! end
  7335. !! test
  7336. 1. Interaction of linktrail and template encapsulation
  7337. !! wikitext
  7338. {{echo|[[Foo]]}}l
  7339. !! html/parsoid
  7340. <p><a rel="mw:WikiLink" href="./Foo" title="Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo]]"}},"i":0}},"l"]}'>Fool</a></p>
  7341. !! end
  7342. !! test
  7343. 2. Interaction of linktrail and template encapsulation
  7344. !! options
  7345. parsoid
  7346. !! wikitext
  7347. {{echo|Some [[Fool]]}}s
  7348. !! html
  7349. <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]"}},"i":0}},"s"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some </span><a rel="mw:WikiLink" href="./Fool" title="Fool" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a></p>
  7350. !! end
  7351. !! test
  7352. 3. Interaction of linktrail and template encapsulation
  7353. !! options
  7354. parsoid
  7355. !! wikitext
  7356. {{echo|Some [[Fool]]s are '''bold and foolish'''}}
  7357. !! html
  7358. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are &#39;&#39;&#39;bold and foolish&#39;&#39;&#39;"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>Some <a rel="mw:WikiLink" href="./Fool" title="Fool" data-parsoid='{"stx":"simple","a":{"href":"./Fool"},"sa":{"href":"Fool"},"tail":"s"}'>Fools</a> are <b>bold and foolish</b></p>
  7359. !! end
  7360. !! article
  7361. Söfnuður
  7362. !! text
  7363. Test.
  7364. !! endarticle
  7365. !! test
  7366. Internal link with is link prefix
  7367. !! options
  7368. language=is
  7369. !! wikitext
  7370. Aðrir mótmælenda[[söfnuður|söfnuðir]] og
  7371. !! html
  7372. <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
  7373. </p>
  7374. !! end
  7375. !! article
  7376. Mótmælendatrú
  7377. !! text
  7378. Test.
  7379. !! endarticle
  7380. !! test
  7381. Internal link with is link trail and link prefix
  7382. !! options
  7383. language=is
  7384. !! wikitext
  7385. [[mótmælendatrú|xxx]]ar
  7386. [[mótmælendatrú]]ar
  7387. mótmælenda[[söfnuður]]
  7388. mótmælenda[[söfnuður|söfnuðir]]
  7389. mótmælenda[[söfnuður|söfnuðir]]xxx
  7390. !! html
  7391. <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
  7392. <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
  7393. <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
  7394. <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
  7395. <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
  7396. </p>
  7397. !! end
  7398. !! test
  7399. Parsoid link trail escaping
  7400. !! options
  7401. parsoid=html2wt,html2html
  7402. !! html/parsoid
  7403. <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
  7404. !! wikitext
  7405. [[apple]]<nowiki/>s
  7406. !! end
  7407. !! test
  7408. Parsoid link prefix escaping
  7409. !! options
  7410. language=is
  7411. parsoid=html2wt,html2html
  7412. !! html/parsoid
  7413. <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
  7414. !! wikitext
  7415. Aðrir mótmælenda<nowiki/>[[söfnuður]]
  7416. !! end
  7417. !! test
  7418. Parsoid link bracket escaping
  7419. !! options
  7420. parsoid=html2wt,html2html
  7421. !! html/parsoid
  7422. <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
  7423. <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
  7424. <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
  7425. <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
  7426. <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
  7427. <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
  7428. !! wikitext
  7429. [[Test]]
  7430. [<nowiki/>[[Test]]]
  7431. [[[[Test]]]]
  7432. [[[<nowiki/>[[Test]]]]]
  7433. [[[[[[Test]]]]]]
  7434. [[[[[<nowiki/>[[Test]]]]]]]
  7435. !! end
  7436. !! test
  7437. Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
  7438. !! wikitext
  7439. [[Foo| bar]]
  7440. [[Foo| ''bar'']]
  7441. [http://wp.org foo]
  7442. [http://wp.org ''foo'']
  7443. !! html
  7444. <p><a href="/wiki/Foo" title="Foo"> bar</a>
  7445. </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
  7446. </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
  7447. </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
  7448. </p>
  7449. !! end
  7450. !! test
  7451. Parsoid: Scoped parsing should handle mixed transclusions and plain text
  7452. !! wikitext
  7453. [[Foo|{{echo|a}} b {{echo|c}}]]
  7454. !! html/parsoid
  7455. <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span> b <span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c"}},"i":0}}]}'>c</span></a></p>
  7456. !! end
  7457. !! test
  7458. Link with angle bracket after anchor
  7459. !! config
  7460. wgFragmentMode=[ 'html5', 'legacy' ]
  7461. !! wikitext
  7462. [[Foo#<bar>]]
  7463. !! html/php
  7464. <p><a href="/wiki/Foo#&lt;bar&gt;" title="Foo">Foo#&lt;bar&gt;</a>
  7465. </p>
  7466. !! html/parsoid
  7467. <p><a rel="mw:WikiLink" href="./Foo#&lt;bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#&lt;bar>"},"sa":{"href":"Foo#&lt;bar>"}}'>Foo#&lt;bar></a></p>
  7468. !! end
  7469. !! test
  7470. Link with angle bracket after anchor (legacy)
  7471. !! config
  7472. wgFragmentMode=[ 'legacy' ]
  7473. !! wikitext
  7474. [[Foo#<bar>]]
  7475. !! html/php
  7476. <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#&lt;bar&gt;</a>
  7477. </p>
  7478. !! end
  7479. ###
  7480. ### Interwiki links (see maintenance/interwiki.sql)
  7481. ###
  7482. !! test
  7483. Inline interwiki link
  7484. !! options
  7485. parsoid=wt2html,wt2wt,html2html
  7486. !! wikitext
  7487. [[MeatBall:SoftSecurity]]
  7488. !! html/php
  7489. <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
  7490. </p>
  7491. !! html/parsoid
  7492. <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
  7493. !! end
  7494. !! test
  7495. Inline interwiki link with empty title (T4372)
  7496. !! options
  7497. parsoid=wt2html,wt2wt,html2html
  7498. !! wikitext
  7499. [[MeatBall:]]
  7500. !! html/php
  7501. <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
  7502. </p>
  7503. !! html/parsoid
  7504. <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
  7505. !! end
  7506. ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
  7507. !! test
  7508. Interwiki link encoding conversion (T3636)
  7509. !! options
  7510. parsoid=wt2html,wt2wt
  7511. !! wikitext
  7512. *[[Wikipedia:ro:Olteni&#0355;a]]
  7513. *[[Wikipedia:ro:Olteni&#355;a]]
  7514. !! html
  7515. <ul><li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li>
  7516. <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteni&#355;a</a></li></ul>
  7517. !! html/php+tidy
  7518. <ul>
  7519. <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
  7520. <li><a href="http://en.wikipedia.org/wiki/ro:Olteni%C5%A3a" class="extiw" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
  7521. </ul>
  7522. !! html/parsoid
  7523. <ul>
  7524. <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
  7525. <li><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/ro:Olteniţa" title="wikipedia:ro:Olteniţa">Wikipedia:ro:Olteniţa</a></li>
  7526. </ul>
  7527. !! end
  7528. !! test
  7529. Interwiki link with fragment (T4130)
  7530. !! wikitext
  7531. [[MeatBall:SoftSecurity#foo]]
  7532. !! html
  7533. <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
  7534. </p>
  7535. !! end
  7536. !! test
  7537. Link scenarios with escaped fragments
  7538. !! config
  7539. wgFragmentMode=[ 'html5', 'legacy' ]
  7540. !! wikitext
  7541. [[#Is this great?]]
  7542. [[Foo#Is this great?]]
  7543. [[meatball:Foo#Is this great?]]
  7544. !! html/php
  7545. <p><a href="#Is_this_great?">#Is this great?</a>
  7546. <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
  7547. <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
  7548. </p>
  7549. !! html/parsoid
  7550. <p><a rel="mw:WikiLink" href="./Main_Page#Is_this_great?" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Is_this_great?"},"sa":{"href":"#Is this great?"}}'>#Is this great?</a>
  7551. <a rel="mw:WikiLink" href="./Foo#Is_this_great?" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#Is_this_great?"},"sa":{"href":"Foo#Is this great?"}}'>Foo#Is this great?</a>
  7552. <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?" title="meatball:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great?"},"sa":{"href":"meatball:Foo#Is this great?"},"isIW":true}'>meatball:Foo#Is this great?</a></p>
  7553. !! end
  7554. !! test
  7555. Link scenarios with escaped fragments (legacy)
  7556. !! config
  7557. wgFragmentMode=[ 'legacy' ]
  7558. !! wikitext
  7559. [[#Is this great?]]
  7560. [[Foo#Is this great?]]
  7561. [[meatball:Foo#Is this great?]]
  7562. !! html/php
  7563. <p><a href="#Is_this_great.3F">#Is this great?</a>
  7564. <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
  7565. <a href="http://www.usemod.com/cgi-bin/mb.pl?Foo#Is_this_great.3F" class="extiw" title="meatball:Foo">meatball:Foo#Is this great?</a>
  7566. </p>
  7567. !! end
  7568. # Ideally the wikipedia: prefix here should be proto-relative too
  7569. # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
  7570. # define the 'en' prefix, and originally the test used 'wikipedia',
  7571. # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
  7572. # article.
  7573. !! test
  7574. Different interwiki prefixes mapping to the same URL
  7575. !! wikitext
  7576. [[:en:Foo]]
  7577. [[:en:Foo|Foo]]
  7578. [[wikipedia:Foo]]
  7579. [[:wikipedia:Foo|Foo]]
  7580. [[wikipedia:en:Foo]]
  7581. [[:wikipedia:en:Foo]]
  7582. [[ wikiPEdia :Foo]]
  7583. !! html/parsoid
  7584. <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">en:Foo</a></p>
  7585. <p><a rel="mw:WikiLink/Interwiki" href="//en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"//en.wikipedia.org/wiki/Foo"},"sa":{"href":":en:Foo"},"isIW":true}' title="en:Foo">Foo</a></p>
  7586. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">wikipedia:Foo</a></p>
  7587. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":":wikipedia:Foo"},"isIW":true}' title="wikipedia:Foo">Foo</a></p>
  7588. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":"wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
  7589. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/en:Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/en:Foo"},"sa":{"href":":wikipedia:en:Foo"},"isIW":true}' title="wikipedia:en:Foo">wikipedia:en:Foo</a></p>
  7590. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"simple","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":" wikiPEdia :Foo"},"isIW":true}' title="wikipedia:Foo"> wikiPEdia :Foo</a></p>
  7591. !! end
  7592. !! test
  7593. Interwiki links that cannot be represented in wiki syntax
  7594. !! wikitext
  7595. [[meatball:ok]]
  7596. [[meatball:ok#foo|ok with fragment]]
  7597. [[meatball:ok_as_well?|ok ending with ? mark]]
  7598. [http://de.wikipedia.org/wiki/Foo?action=history has query]
  7599. [http://de.wikipedia.org/wiki/#foo is just fragment]
  7600. !! html/php
  7601. <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
  7602. <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
  7603. <a href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well%3F" class="extiw" title="meatball:ok as well?">ok ending with ? mark</a>
  7604. <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
  7605. <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
  7606. </p>
  7607. !! html/parsoid
  7608. <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
  7609. <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
  7610. <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok_as_well?" title="meatball:ok as well?">ok ending with ? mark</a>
  7611. <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
  7612. <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
  7613. !! end
  7614. !! test
  7615. Interwiki links: trail
  7616. !! wikitext
  7617. [[wikipedia:Foo|Ba]]r
  7618. !! html/php
  7619. <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
  7620. </p>
  7621. !! html/parsoid
  7622. <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" data-parsoid='{"stx":"piped","a":{"href":"http://en.wikipedia.org/wiki/Foo"},"sa":{"href":"wikipedia:Foo"},"isIW":true,"tail":"r"}' title="wikipedia:Foo">Bar</a></p>
  7623. !! end
  7624. !! test
  7625. Local interwiki link
  7626. !! options
  7627. parsoid=wt2html,wt2wt,html2html
  7628. !! wikitext
  7629. [[local:Template:Foo]]
  7630. !! html/php
  7631. <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
  7632. </p>
  7633. !! html/parsoid
  7634. <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
  7635. !! end
  7636. # Parsoid does not mark self-links, by design.
  7637. !! test
  7638. Local interwiki link: self-link to current page
  7639. !! options
  7640. title=[[Main Page]]
  7641. parsoid=wt2html,wt2wt,html2html
  7642. !! wikitext
  7643. [[local:Main Page]]
  7644. !! html/php
  7645. <p><a class="mw-selflink selflink">local:Main Page</a>
  7646. </p>
  7647. !! html/parsoid
  7648. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
  7649. !! end
  7650. !! test
  7651. Local interwiki link: prefix only (T66167)
  7652. !! options
  7653. parsoid=wt2html,wt2wt,html2html
  7654. !! wikitext
  7655. [[local:]]
  7656. !! html/php
  7657. <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
  7658. </p>
  7659. !! html/parsoid
  7660. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
  7661. !! end
  7662. !! test
  7663. Local interwiki link: with additional interwiki prefix (T63357)
  7664. !! options
  7665. parsoid=wt2html,wt2wt,html2html
  7666. !! wikitext
  7667. [[local:meatball:Hello]]
  7668. !! html/php
  7669. <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
  7670. </p>
  7671. !! html/parsoid
  7672. <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
  7673. !! end
  7674. !! test
  7675. Multiple local interwiki link prefixes
  7676. !! wikitext
  7677. [[local:local:local:local:mi:local:Foo]]
  7678. !! options
  7679. parsoid=wt2html,wt2wt,html2html
  7680. !! html/php
  7681. <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
  7682. </p>
  7683. !! html/parsoid
  7684. <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
  7685. !! end
  7686. ###
  7687. ### Interlanguage links
  7688. ### Language links (so that searching for '### language' matches..)
  7689. ###
  7690. !! test
  7691. Interlanguage link
  7692. !! wikitext
  7693. Blah blah blah
  7694. [[zh:Chinese]]
  7695. !! html/php
  7696. <p>Blah blah blah
  7697. </p>
  7698. !! html/parsoid
  7699. <p>Blah blah blah</p>
  7700. <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
  7701. !! end
  7702. ## parsoid html2wt will lose the space variations
  7703. !! test
  7704. Interlanguage link with spacing
  7705. !! options
  7706. parsoid=wt2html,wt2wt,html2html
  7707. !! wikitext
  7708. Blah blah blah
  7709. [[ zh : Chinese ]]
  7710. !! html/php
  7711. <p>Blah blah blah
  7712. </p>
  7713. !! html/parsoid
  7714. <p>Blah blah blah</p>
  7715. <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
  7716. !! end
  7717. !! test
  7718. Double interlanguage link
  7719. !! wikitext
  7720. Blah blah blah
  7721. [[es:Spanish]]
  7722. [[zh:Chinese]]
  7723. !! html/php
  7724. <p>Blah blah blah
  7725. </p>
  7726. !! html/parsoid
  7727. <p>Blah blah blah</p>
  7728. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
  7729. <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
  7730. !! end
  7731. ## parsoid html2wt will lose the space variations
  7732. !! test
  7733. Interlanguage link variations
  7734. !! options
  7735. parsoid=wt2html,wt2wt,html2html
  7736. !! wikitext
  7737. Blah blah blah
  7738. [[ es :Spanish]]
  7739. [[ ZH :Chinese]]
  7740. [[es:Foo_bar]]
  7741. !! html/php
  7742. <p>Blah blah blah
  7743. </p>
  7744. !! html/parsoid
  7745. <p>Blah blah blah</p>
  7746. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
  7747. <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
  7748. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
  7749. !! end
  7750. !! test
  7751. Escaping of interlanguage links (T129218, T156308)
  7752. !! wikitext
  7753. Blah blah blah
  7754. [[:es:Spanish]]
  7755. [[ : zh : Chinese ]]
  7756. !! html/php
  7757. <p>Blah blah blah
  7758. <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
  7759. <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
  7760. </p>
  7761. !! html/parsoid
  7762. <p>Blah blah blah
  7763. <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
  7764. <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
  7765. !! end
  7766. !! test
  7767. Multiple colons escaping interlanguage links
  7768. !! options
  7769. parsoid=wt2html
  7770. !! wikitext
  7771. [[:es:Spanish]]
  7772. [[::es:Spanish]]
  7773. [[:::es:Spanish]]
  7774. !! html/php
  7775. <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
  7776. [[::es:Spanish]]
  7777. [[:::es:Spanish]]
  7778. </p>
  7779. !! html/parsoid
  7780. <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
  7781. [[::es:Spanish]]
  7782. [[:::es:Spanish]]</p>
  7783. !! end
  7784. ## parsoid html2wt will normalize the space to _
  7785. !! test
  7786. Space and question mark encoding in interlanguage links (T95473)
  7787. !! options
  7788. parsoid=wt2html,wt2wt,html2html
  7789. !! wikitext
  7790. Blah blah blah
  7791. [[es:Foo bar?]]
  7792. !! html/php
  7793. <p>Blah blah blah
  7794. </p>
  7795. !! html/parsoid
  7796. <p>Blah blah blah</p>
  7797. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
  7798. !! end
  7799. !! test
  7800. Interlanguage link, with prefix links
  7801. !! options
  7802. language=ln
  7803. !! wikitext
  7804. Blah blah blah
  7805. [[zh:Chinese]]
  7806. !! html/php
  7807. <p>Blah blah blah
  7808. </p>
  7809. !! html/parsoid
  7810. <p>Blah blah blah</p>
  7811. <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
  7812. !! end
  7813. !! test
  7814. Double interlanguage link, with prefix links (T10897)
  7815. !! options
  7816. language=ln
  7817. !! wikitext
  7818. Blah blah blah
  7819. [[es:Spanish]]
  7820. [[zh:Chinese]]
  7821. !! html/php
  7822. <p>Blah blah blah
  7823. </p>
  7824. !! html/parsoid
  7825. <p>Blah blah blah</p>
  7826. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
  7827. <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
  7828. !! end
  7829. !! test
  7830. "Extra" interlanguage links (T34189 / gerrit 111390)
  7831. !! wikitext
  7832. Blah blah blah
  7833. [[mul:Article]]
  7834. !! html/php
  7835. <p>Blah blah blah
  7836. </p>
  7837. !! html/parsoid
  7838. <p>Blah blah blah</p>
  7839. <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
  7840. !! end
  7841. ## PHP parser tests script needs an update
  7842. ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
  7843. !! test
  7844. Language links render as inline links if $wgInterwikiMagic=false
  7845. !! options
  7846. wgInterwikiMagic=false
  7847. parsoid=wt2html,wt2wt,html2html
  7848. !! wikitext
  7849. Blah blah blah
  7850. [[zh:Chinese]]
  7851. !! html/parsoid
  7852. <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
  7853. !! end
  7854. ## PHP parser tests script needs an update
  7855. ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
  7856. !! test
  7857. Language links render as inline links in the Talk namespace
  7858. !! options
  7859. title=Talk:Foo
  7860. parsoid=wt2html,wt2wt,html2html
  7861. !! wikitext
  7862. Blah blah blah
  7863. [[zh:Chinese]]
  7864. !! html/parsoid
  7865. <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
  7866. !! end
  7867. !! test
  7868. Parsoid-specific test: Wikilinks with &nbsp; should RT properly
  7869. !! options
  7870. language=ln
  7871. !! wikitext
  7872. [[WW&nbsp;II]]
  7873. !! html
  7874. <p><a href="/index.php?title=WW_II&amp;action=edit&amp;redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW&#160;II</a>
  7875. </p>
  7876. !! end
  7877. !! test
  7878. Parsoid T55221: Wikilinks should be properly entity-escaped
  7879. !! options
  7880. parsoid={ "modes": ["html2wt"], "suppressErrors": true }
  7881. !! html/parsoid
  7882. <p>He&amp;nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
  7883. <p>He&amp;nbsp;llo <a href="./He&amp;nbsp;llo" rel="mw:WikiLink">He&amp;nbsp;llo</a></p>
  7884. !! wikitext
  7885. He&amp;nbsp;llo [[Foo|He&amp;nbsp;llo]]
  7886. He&amp;nbsp;llo He&amp;nbsp;llo
  7887. !! html/php
  7888. <p>He&amp;nbsp;llo <a href="/wiki/Foo" title="Foo">He&amp;nbsp;llo</a>
  7889. </p><p>He&amp;nbsp;llo He&amp;nbsp;llo
  7890. </p>
  7891. !! end
  7892. # html2wt will fail because of title normalization without data-parsoid
  7893. !! test
  7894. Parsoid: handle constructor well
  7895. !! options
  7896. parsoid=wt2html,wt2wt
  7897. !! wikitext
  7898. [[constructor]]
  7899. [[constructor:foo]]
  7900. !! html/php
  7901. <p><a href="/index.php?title=Constructor&amp;action=edit&amp;redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
  7902. </p><p><a href="/index.php?title=Constructor:foo&amp;action=edit&amp;redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
  7903. </p>
  7904. !! html/parsoid
  7905. <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
  7906. <p><a rel="mw:WikiLink" href="./Constructor:foo" title="Constructor:foo" data-parsoid='{"stx":"simple","a":{"href":"./Constructor:foo"},"sa":{"href":"constructor:foo"}}'>constructor:foo</a></p>
  7907. !! end
  7908. !! article
  7909. ko:
  7910. !! text
  7911. Test.
  7912. !! endarticle
  7913. # Note that `ko` isn't a known interlanguage prefix
  7914. !! test
  7915. Parsoid: recognize interlanguage links without a target page
  7916. !! options
  7917. ill
  7918. !! wikitext
  7919. [[es:]]
  7920. [[ko:]]
  7921. !! html/php
  7922. es:
  7923. !! html/parsoid
  7924. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
  7925. <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
  7926. !! end
  7927. # Note that `ko` isn't a known interwiki prefix
  7928. !! test
  7929. Parsoid: recognize interwiki links without a target page
  7930. !! options
  7931. parsoid=wt2html,wt2wt,html2html
  7932. !! wikitext
  7933. [[:es:]]
  7934. [[:ko:]]
  7935. !! html/php
  7936. <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
  7937. </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
  7938. </p>
  7939. !! html/parsoid
  7940. <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
  7941. <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
  7942. !! end
  7943. !! test
  7944. Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
  7945. !! wikitext
  7946. [[mi:Foo]]
  7947. !! html/php
  7948. <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
  7949. </p>
  7950. !! html/parsoid
  7951. <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
  7952. !! end
  7953. !! test
  7954. Interlanguage link with preceding local interwiki link (T70085)
  7955. !! options
  7956. parsoid=wt2html,wt2wt,html2html
  7957. !! wikitext
  7958. Blah blah blah
  7959. [[local:es:Spanish]]
  7960. !! html/php
  7961. <p>Blah blah blah
  7962. <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
  7963. </p>
  7964. !! html/parsoid
  7965. <p>Blah blah blah
  7966. <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
  7967. !! end
  7968. !! test
  7969. Looks like an interlanguage link, but is actually a local interwiki
  7970. !! options
  7971. parsoid=wt2html,wt2wt,html2html
  7972. !! wikitext
  7973. Blah blah blah
  7974. [[mi:Template:Foo]]
  7975. !! html/php
  7976. <p>Blah blah blah
  7977. <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
  7978. </p>
  7979. !! html/parsoid
  7980. <p>Blah blah blah
  7981. <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
  7982. !! end
  7983. ###
  7984. ### Redirects, Parsoid-only
  7985. ###
  7986. !! test
  7987. 1. Simple redirect to page
  7988. !! wikitext
  7989. #REDIRECT [[Main Page]]
  7990. !! html/parsoid
  7991. <link rel="mw:PageProp/redirect" href="./Main_Page"/>
  7992. !! end
  7993. !! test
  7994. 2. Other redirect variants
  7995. !! wikitext
  7996. #REDIRECT [[Main_Page]]
  7997. !! html/parsoid
  7998. <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
  7999. !! end
  8000. # Not a valid redirect in PHP (although perhaps it was, once upon a time)
  8001. # This tests the Parsoid bail-out code.
  8002. !! test
  8003. 3. Other redirect variants
  8004. !! options
  8005. parsoid=wt2html
  8006. !! wikitext
  8007. #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
  8008. !! html/parsoid
  8009. <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
  8010. !! end
  8011. !! test
  8012. 4. Redirect to a templated destination
  8013. !! wikitext
  8014. #REDIRECT [[{{echo|Foo}}bar]]
  8015. !! html/parsoid
  8016. <link about="#mwt2" typeof="mw:ExpandedAttrs" rel="mw:PageProp/redirect" href="./Foobar" data-parsoid='{"a":{"href":"./Foobar"},"sa":{"href":"{{echo|Foo}}bar"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}&#39;>Foo&lt;/span>bar"}]]}'/>
  8017. !! end
  8018. !! test
  8019. Empty redirect
  8020. !! options
  8021. parsoid=wt2html,wt2wt
  8022. !! wikitext
  8023. #REDIRECT [[]]
  8024. !! html/parsoid
  8025. <ol>
  8026. <li>REDIRECT [[]]</li></ol>
  8027. !! end
  8028. !! test
  8029. Optional colon in #REDIRECT
  8030. !! options
  8031. # the colon is archaic syntax. we support it for wt2html, but we
  8032. # don't care that it roundtrips back to the modern syntax.
  8033. parsoid=wt2html,html2html
  8034. !! wikitext
  8035. #REDIRECT:[[Main Page]]
  8036. !! html/parsoid
  8037. <link rel="mw:PageProp/redirect" href="./Main_Page"/>
  8038. !! end
  8039. !! test
  8040. Whitespace in #REDIRECT with optional colon
  8041. !! options
  8042. # the colon and gratuitous whitespace is archaic syntax. we support
  8043. # it for wt2html, but we don't care that it roundtrips back to the
  8044. # modern syntax (without extra whitespace)
  8045. parsoid=wt2html,html2html
  8046. !! wikitext
  8047. #REDIRECT
  8048. :
  8049. [[Main Page]]
  8050. !! html/parsoid
  8051. <link rel="mw:PageProp/redirect" href="./Main_Page"/>
  8052. !! end
  8053. !! test
  8054. Piped link in #REDIRECT
  8055. !! options
  8056. # content after piped link is ignored. we support this syntax,
  8057. # but don't care that the piped link is lost when we roundtrip this.
  8058. parsoid=wt2html
  8059. !! wikitext
  8060. #REDIRECT [[Main Page|bar]]
  8061. !! html/parsoid
  8062. <link rel="mw:PageProp/redirect" href="./Main_Page"/>
  8063. !! end
  8064. !! test
  8065. Redirect to category (T104502)
  8066. !! options
  8067. parsoid=wt2html,wt2wt
  8068. !! wikitext
  8069. #REDIRECT [[Category:Foo]]
  8070. !! html/parsoid
  8071. <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
  8072. !! end
  8073. !! test
  8074. Redirect to category with URL encoding (T104502)
  8075. !! options
  8076. parsoid=wt2html
  8077. !! wikitext
  8078. #REDIRECT [[Category%3AFoo]]
  8079. !! html/parsoid
  8080. <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
  8081. !! end
  8082. !! test
  8083. Redirect to category page
  8084. !! wikitext
  8085. #REDIRECT [[:Category:Foo]]
  8086. !! html/parsoid
  8087. <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
  8088. !! end
  8089. !! test
  8090. Redirect to image page (1)
  8091. !! wikitext
  8092. #REDIRECT [[File:Wiki.png]]
  8093. !! html/parsoid
  8094. <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
  8095. !! end
  8096. !! test
  8097. Redirect to image page (2)
  8098. !! wikitext
  8099. #REDIRECT [[Image:Wiki.png]]
  8100. !! html/parsoid
  8101. <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
  8102. !! end
  8103. # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
  8104. # Next test confirms this.
  8105. !! test
  8106. Redirect to language (1) (T104918)
  8107. !! options
  8108. parsoid=wt2html,wt2wt,html2html
  8109. !! wikitext
  8110. #REDIRECT [[en:File:Wiki.png]]
  8111. !! html/parsoid
  8112. <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
  8113. !! end
  8114. !! test
  8115. Redirect to language (2) (T104918)
  8116. !! wikitext
  8117. #REDIRECT [[:en:File:Wiki.png]]
  8118. !! html/parsoid
  8119. <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
  8120. !! end
  8121. !! test
  8122. Redirect to interwiki (T104918)
  8123. !! wikitext
  8124. #REDIRECT [[meatball:File:Wiki.png]]
  8125. !! html/parsoid
  8126. <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
  8127. !! end
  8128. !! test
  8129. Non-English #REDIRECT
  8130. !! options
  8131. language=is
  8132. !! wikitext
  8133. #TILVÍSUN [[Main Page]]
  8134. !! html/parsoid
  8135. <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
  8136. !! end
  8137. !! test
  8138. Redirect syntax under text isn't considered a redirect
  8139. !! wikitext
  8140. some text
  8141. #redirect [[Main Page]]
  8142. !! html/parsoid
  8143. <p>some text</p>
  8144. <ol data-parsoid='{}'><li data-parsoid='{}'>redirect <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'>Main Page</a></li></ol>
  8145. !! end
  8146. !! test
  8147. New redirect
  8148. !! options
  8149. parsoid=html2wt
  8150. !! html/parsoid
  8151. <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
  8152. !! wikitext
  8153. #REDIRECT [[Foo]]
  8154. Foo
  8155. !! end
  8156. !! test
  8157. Redirect followed by block on the same line
  8158. !! options
  8159. parsoid=wt2html
  8160. !! wikitext
  8161. #REDIRECT [[Main Page]]<!-- haha -->==hi==
  8162. !! html/parsoid
  8163. <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
  8164. !! end
  8165. !! test
  8166. Redirect followed by a newline
  8167. !! wikitext
  8168. #REDIRECT [[Main Page]]
  8169. A newline
  8170. !! html/parsoid
  8171. <link rel="mw:PageProp/redirect" href="./Main_Page"/>
  8172. <p>A newline</p>
  8173. !! end
  8174. !! test
  8175. Redirect followed by multiple newlines
  8176. !! wikitext
  8177. #REDIRECT [[Main Page]]
  8178. A newline
  8179. !! html/parsoid
  8180. <link rel="mw:PageProp/redirect" href="./Main_Page"/>
  8181. <p><br/>
  8182. A newline</p>
  8183. !! end
  8184. !! test
  8185. Drop duplicate redirects
  8186. !! options
  8187. parsoid=html2wt
  8188. !! html/parsoid
  8189. <link rel="mw:PageProp/redirect" href="./Foo"/>
  8190. <link rel="mw:PageProp/redirect" href="./Bar"/>
  8191. <link rel="mw:PageProp/redirect" href="./Baz"/>
  8192. !! wikitext
  8193. #REDIRECT [[Foo]]
  8194. !! end
  8195. ##
  8196. ## XHTML tidiness
  8197. ###
  8198. !! test
  8199. <br> to <br />
  8200. !! wikitext
  8201. 1<br>2<br />3
  8202. !! html
  8203. <p>1<br />2<br />3
  8204. </p>
  8205. !! end
  8206. !! test
  8207. Broken br tag sanitization
  8208. !! wikitext
  8209. </br>
  8210. !! html/php
  8211. <p>&lt;/br&gt;
  8212. </p>
  8213. !! end
  8214. # TODO: Fix html2html mode (T53055)!
  8215. !! test
  8216. Parsoid: Broken br tag recognition
  8217. !! options
  8218. parsoid=wt2html
  8219. !! wikitext
  8220. </br>
  8221. <br/ >
  8222. !! html+tidy
  8223. <p><br />
  8224. </p><p><br />
  8225. </p>
  8226. !! end
  8227. !! test
  8228. Incorrecly removing closing slashes from correctly formed XHTML
  8229. !! wikitext
  8230. <br style="clear:both;" />
  8231. !! html
  8232. <p><br style="clear:both;" />
  8233. </p>
  8234. !! end
  8235. !! test
  8236. Failing to transform badly formed HTML into correct XHTML
  8237. !! wikitext
  8238. <br style="clear: left;">
  8239. <br style="clear: right;">
  8240. <br style="clear: both;">
  8241. !! html
  8242. <p><br style="clear: left;" />
  8243. <br style="clear: right;" />
  8244. <br style="clear: both;" />
  8245. </p>
  8246. !!end
  8247. ## FIXME: Is Parsoid's acceptance of self-closing html-tags
  8248. ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
  8249. !! test
  8250. Handling html with a div self-closing tag
  8251. !! wikitext
  8252. <div title />
  8253. <div title/>
  8254. <div title/ >
  8255. <div title=bar />
  8256. <div title=bar/>
  8257. <div title=bar/ >
  8258. !! html/php
  8259. <p>&lt;div title /&gt;
  8260. &lt;div title/&gt;
  8261. </p>
  8262. <div>
  8263. <p>&lt;div title=bar /&gt;
  8264. &lt;div title=bar/&gt;
  8265. </p>
  8266. <div title="bar/"></div>
  8267. </div>
  8268. !! html/parsoid
  8269. <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
  8270. <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
  8271. <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
  8272. <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
  8273. <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
  8274. <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
  8275. !! end
  8276. !! test
  8277. Handling html with a br self-closing tag
  8278. !! wikitext
  8279. <br title />
  8280. <br title/>
  8281. <br title/ >
  8282. <br title=bar />
  8283. <br title=bar/>
  8284. <br title=bar/ >
  8285. !! html/php
  8286. <p><br title="" />
  8287. <br title="" />
  8288. <br />
  8289. <br title="bar" />
  8290. <br title="bar" />
  8291. <br title="bar/" />
  8292. </p>
  8293. !! html/parsoid
  8294. <p><br title="" />
  8295. <br title="" />
  8296. <br title="" />
  8297. <br title="bar" />
  8298. <br title="bar" />
  8299. <br title="bar/" />
  8300. </p>
  8301. !! end
  8302. !! test
  8303. Horizontal ruler (should it add that extra space?)
  8304. !! wikitext
  8305. <hr>
  8306. <hr >
  8307. foo <hr
  8308. > bar
  8309. !! html+tidy
  8310. <hr />
  8311. <hr /><p>
  8312. foo </p><hr /><p> bar
  8313. </p>
  8314. !! end
  8315. !! test
  8316. Horizontal ruler -- 4+ dashes render hr
  8317. !! wikitext
  8318. ----
  8319. !! html
  8320. <hr />
  8321. !! end
  8322. !! test
  8323. Horizontal ruler -- eats additional dashes on the same line
  8324. !! wikitext
  8325. ---------
  8326. !! html
  8327. <hr />
  8328. !! end
  8329. !! test
  8330. Horizontal ruler -- does not collapse dashes on consecutive lines
  8331. !! wikitext
  8332. ----
  8333. ----
  8334. !! html
  8335. <hr />
  8336. <hr />
  8337. !! end
  8338. !! test
  8339. Horizontal ruler -- <4 dashes render as plain text
  8340. !! wikitext
  8341. ---
  8342. !! html
  8343. <p>---
  8344. </p>
  8345. !! end
  8346. !! test
  8347. Horizontal ruler -- Supports content following dashes on same line
  8348. !! wikitext
  8349. ---- Foo
  8350. !! html
  8351. <hr /> Foo
  8352. !! html+tidy
  8353. <hr /><p> Foo
  8354. </p>
  8355. !! end
  8356. ###
  8357. ### Block-level elements
  8358. ###
  8359. !! test
  8360. Common list
  8361. !! wikitext
  8362. *Common list
  8363. *item 2
  8364. *item 3
  8365. !! html
  8366. <ul><li>Common list</li>
  8367. <li>item 2</li>
  8368. <li>item 3</li></ul>
  8369. !! end
  8370. !! test
  8371. Numbered list
  8372. !! wikitext
  8373. #Numbered list
  8374. #item 2
  8375. #item 3
  8376. !! html
  8377. <ol><li>Numbered list</li>
  8378. <li>item 2</li>
  8379. <li>item 3</li></ol>
  8380. !! end
  8381. # the switch from level 3 to ordered should not introduce a newline between
  8382. !! test
  8383. Mixed list
  8384. !! wikitext
  8385. *Mixed list
  8386. *#with numbers
  8387. **and bullets
  8388. *#and numbers
  8389. *bullets again
  8390. **bullet level 2
  8391. ***bullet level 3
  8392. ***#Number on level 4
  8393. **bullet level 2
  8394. **#Number on level 3
  8395. **#Number on level 3
  8396. *#number level 2
  8397. *Level 1
  8398. ***Level 3
  8399. #**Level 3, but ordered
  8400. !! html
  8401. <ul><li>Mixed list
  8402. <ol><li>with numbers</li></ol>
  8403. <ul><li>and bullets</li></ul>
  8404. <ol><li>and numbers</li></ol></li>
  8405. <li>bullets again
  8406. <ul><li>bullet level 2
  8407. <ul><li>bullet level 3
  8408. <ol><li>Number on level 4</li></ol></li></ul></li>
  8409. <li>bullet level 2
  8410. <ol><li>Number on level 3</li>
  8411. <li>Number on level 3</li></ol></li></ul>
  8412. <ol><li>number level 2</li></ol></li>
  8413. <li>Level 1
  8414. <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
  8415. <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
  8416. !! end
  8417. !! test
  8418. 1. Nested mixed wikitext and html list
  8419. !! wikitext
  8420. *hi
  8421. *<ul><li>ho</li></ul>
  8422. *hi
  8423. **ho
  8424. !! html/php
  8425. <ul><li>hi</li>
  8426. <li><ul><li>ho</li></ul></li>
  8427. <li>hi
  8428. <ul><li>ho</li></ul></li></ul>
  8429. !! html/parsoid
  8430. <ul><li>hi</li>
  8431. <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
  8432. <li>hi
  8433. <ul><li>ho</li></ul></li></ul>
  8434. !! end
  8435. !! test
  8436. 2. Nested mixed wikitext and html list (incompatible)
  8437. !! wikitext
  8438. ;hi
  8439. :{{echo|<li>ho</li>}}
  8440. !! html/php
  8441. <dl><dt>hi</dt>
  8442. <dd><li>ho</li></dd></dl>
  8443. !! html/parsoid
  8444. <dl><dt>hi</dt>
  8445. <dd><li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>ho&lt;/li>"}},"i":0}}]}'>ho</li></dd></dl>
  8446. !! end
  8447. !! test
  8448. Nested lists 1
  8449. !! wikitext
  8450. *foo
  8451. **bar
  8452. !! html
  8453. <ul><li>foo
  8454. <ul><li>bar</li></ul></li></ul>
  8455. !! end
  8456. !! test
  8457. Nested lists 2
  8458. !! wikitext
  8459. **foo
  8460. *bar
  8461. !! html
  8462. <ul><li><ul><li>foo</li></ul></li>
  8463. <li>bar</li></ul>
  8464. !! end
  8465. !! test
  8466. Nested lists 3 (first element empty)
  8467. !! wikitext
  8468. *
  8469. **bar
  8470. !! html
  8471. <ul><li>
  8472. <ul><li>bar</li></ul></li></ul>
  8473. !! end
  8474. !! test
  8475. Nested lists 4 (first element empty)
  8476. !! wikitext
  8477. **
  8478. *bar
  8479. !! html
  8480. <ul><li><ul><li></li></ul></li>
  8481. <li>bar</li></ul>
  8482. !! end
  8483. !! test
  8484. Nested lists 5 (both elements empty)
  8485. !! wikitext
  8486. **
  8487. *
  8488. !! html
  8489. <ul><li><ul><li></li></ul></li>
  8490. <li></li></ul>
  8491. !! end
  8492. !! test
  8493. Nested lists 6 (both elements empty)
  8494. !! wikitext
  8495. *
  8496. **
  8497. !! html
  8498. <ul><li>
  8499. <ul><li></li></ul></li></ul>
  8500. !! end
  8501. !! test
  8502. Nested lists 7 (skip initial nesting levels)
  8503. !! wikitext
  8504. ***foo
  8505. !! html
  8506. <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
  8507. !! end
  8508. !! test
  8509. Nested lists 8 (multiple nesting transitions)
  8510. !! wikitext
  8511. *foo
  8512. ***bar
  8513. **baz
  8514. *boo
  8515. !! html
  8516. <ul><li>foo
  8517. <ul><li><ul><li>bar</li></ul></li>
  8518. <li>baz</li></ul></li>
  8519. <li>boo</li></ul>
  8520. !! end
  8521. !! test
  8522. Nested lists 9 (extension interaction)
  8523. !! options
  8524. parsoid
  8525. !! wikitext
  8526. *<references />
  8527. !! html/parsoid
  8528. <ul><li data-parsoid='{}'><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-parsoid='{}' data-mw='{"name":"references","attrs":{}}'></ol></li></ul>
  8529. !! end
  8530. !! test
  8531. 1. Lists with start-of-line-transparent tokens before bullets: Comments
  8532. !! wikitext
  8533. *foo
  8534. *<!--cmt-->bar
  8535. <!--cmt-->*baz
  8536. !! html
  8537. <ul><li>foo</li>
  8538. <li>bar</li>
  8539. <li>baz</li></ul>
  8540. !! end
  8541. !! test
  8542. 2. Lists with start-of-line-transparent tokens before bullets: Template close
  8543. !! wikitext
  8544. *foo {{echo|bar
  8545. }}*baz
  8546. !! html
  8547. <ul><li>foo bar</li>
  8548. <li>baz</li></ul>
  8549. !! end
  8550. !! test
  8551. List items are not parsed correctly following a <pre> block (T2785)
  8552. !! wikitext
  8553. *<pre>foo</pre>
  8554. *<pre>bar</pre>
  8555. *zar
  8556. !! html/php
  8557. <ul><li><pre>foo</pre></li>
  8558. <li><pre>bar</pre></li>
  8559. <li>zar</li></ul>
  8560. !! html/parsoid
  8561. <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
  8562. <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
  8563. <li>zar</li></ul>
  8564. !! end
  8565. # FIXME: Might benefit from a html/parsoid since this has a template
  8566. !! test
  8567. List items from template
  8568. !! wikitext
  8569. {{inner list}}
  8570. *item 2
  8571. *item 0
  8572. {{inner list}}
  8573. *item 2
  8574. *item 0
  8575. *notSOL{{inner list}}
  8576. *item 2
  8577. !! html
  8578. <ul><li>item 1</li>
  8579. <li>item 2</li></ul>
  8580. <ul><li>item 0</li>
  8581. <li>item 1</li>
  8582. <li>item 2</li></ul>
  8583. <ul><li>item 0</li>
  8584. <li>notSOL</li>
  8585. <li>item 1</li>
  8586. <li>item 2</li></ul>
  8587. !! end
  8588. !! test
  8589. List interrupted by empty line or heading
  8590. !! wikitext
  8591. *foo
  8592. **bar
  8593. ==A heading==
  8594. *Another list item
  8595. !! html
  8596. <ul><li>foo</li></ul>
  8597. <ul><li><ul><li>bar</li></ul></li></ul>
  8598. <h2><span class="mw-headline" id="A_heading">A heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  8599. <ul><li>Another list item</li></ul>
  8600. !!end
  8601. !!test
  8602. Multiple list tags generated by templates
  8603. !! wikitext
  8604. {{echo|<li>}}a
  8605. {{echo|<li>}}b
  8606. {{echo|<li>}}c
  8607. !! html
  8608. <li>a
  8609. <li>b
  8610. <li>c</li>
  8611. </li>
  8612. </li>
  8613. !! html+tidy
  8614. <li>a
  8615. </li><li>b
  8616. </li><li>c
  8617. </li>
  8618. !! html/parsoid
  8619. <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[0,44,null,null],"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>"}},"i":2}},"c"]}'>a
  8620. </li><li about="#mwt1">b
  8621. </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
  8622. !!end
  8623. !!test
  8624. Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
  8625. !! wikitext
  8626. *a
  8627. <!--This line will NOT split the list-->
  8628. *b
  8629. <!--This line will NOT split the list either-->
  8630. *c
  8631. <!--foo--> <!----> <!--This line NOT split the list either-->
  8632. *d
  8633. !! html
  8634. <ul><li>a</li>
  8635. <li>b</li>
  8636. <li>c</li>
  8637. <li>d</li></ul>
  8638. !!end
  8639. !!test
  8640. Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
  8641. !! wikitext
  8642. *a
  8643. <!--This line will NOT split the list-->
  8644. *b
  8645. <!--This line will NOT split the list either-->
  8646. *c
  8647. <!--foo--> <!----> <!--This line NOT split the list
  8648. either-->
  8649. *d
  8650. !! html
  8651. <ul><li>a</li>
  8652. <li>b</li>
  8653. <li>c</li>
  8654. <li>d</li></ul>
  8655. !!end
  8656. # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
  8657. # That pass could possibly be removed.
  8658. !!test
  8659. Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
  8660. !!options
  8661. parsoid=wt2html,wt2wt
  8662. !! wikitext
  8663. *foo
  8664. *<li>li-hack
  8665. *{{echo|<li>templated li-hack}}
  8666. *<!--foo--><li> unsupported li-hack with preceding comments
  8667. <ul>
  8668. <li><li>not a li-hack
  8669. </li>
  8670. </ul>
  8671. !! html+tidy
  8672. <ul><li>foo</li>
  8673. <li class="mw-empty-elt"></li><li>li-hack</li>
  8674. <li class="mw-empty-elt"></li><li>templated li-hack</li>
  8675. <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
  8676. <ul>
  8677. <li class="mw-empty-elt"></li><li>not a li-hack
  8678. </li>
  8679. </ul>
  8680. !! html/parsoid
  8681. <ul><li> foo</li>
  8682. <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
  8683. <li about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["*",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
  8684. <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
  8685. <ul data-parsoid='{"stx":"html"}'>
  8686. <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
  8687. </li>
  8688. </ul>
  8689. !!end
  8690. !! test
  8691. Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
  8692. !! options
  8693. parsoid
  8694. !! wikitext
  8695. #foo
  8696. ##bar
  8697. *foo
  8698. **bar
  8699. :foo
  8700. ::bar
  8701. !! html
  8702. <ol>
  8703. <li>foo<ol>
  8704. <li>bar</li>
  8705. </ol></li>
  8706. </ol><ul>
  8707. <li>foo<ul>
  8708. <li>bar</li>
  8709. </ul></li>
  8710. </ul><dl>
  8711. <dd>foo<dl>
  8712. <dd>bar</dd>
  8713. </dl></dd>
  8714. </dl>
  8715. !! end
  8716. !! test
  8717. Parsoid: Test of whitespace serialization with Templated bullets
  8718. !! options
  8719. parsoid
  8720. !! wikitext
  8721. * {{bullet}}
  8722. !! html/parsoid
  8723. <ul>
  8724. <li class="mw-empty-elt"> </li><li about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bullet","href":"./Template:Bullet"},"params":{},"i":0}}]}'> Bar</li>
  8725. </ul>
  8726. !! end
  8727. # ------------------------------------------------------------------------
  8728. # The next set of tests are about Parsoid's ability to handle badly nested
  8729. # tags (parse, minimize scope of fixup, and roundtrip back)
  8730. # ------------------------------------------------------------------------
  8731. # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
  8732. # Parsoid's list handling is more aware of block structure.
  8733. !! test
  8734. Unbalanced closing block tags break a list
  8735. !! wikitext
  8736. <div>
  8737. *a</div><div>
  8738. *b</div>
  8739. !! html+tidy
  8740. <div>
  8741. <ul><li>a</li></ul></div><div>
  8742. <li>b</li></div>
  8743. !! html/parsoid
  8744. <div><ul>
  8745. <li>a</li>
  8746. </ul></div>
  8747. <div><ul>
  8748. <li>b</li>
  8749. </ul></div>
  8750. !! end
  8751. !! test
  8752. Unbalanced closing non-block tags don't break a list
  8753. !! wikitext
  8754. <span>
  8755. *a</span><span>
  8756. *b</span>
  8757. !! html/php+tidy
  8758. <p><span>
  8759. </span></p>
  8760. <ul><li>a<span></span></li>
  8761. <li>b</li></ul>
  8762. !! html/parsoid
  8763. <span>
  8764. <ul>
  8765. <li>a<span></span></li>
  8766. <li>b</li>
  8767. </ul>
  8768. </span>
  8769. !! end
  8770. # Parsoid does some post-dom-building cleanup
  8771. # which is why its output differs from Remex.
  8772. !! test
  8773. Unclosed formatting tags that straddle lists are closed and reopened
  8774. !! options
  8775. parsoid=wt2html,wt2wt,html2html
  8776. !! wikitext
  8777. #<s> a
  8778. #b </s>
  8779. !! html/php+tidy
  8780. <ol><li><s> a</s></li><s>
  8781. </s><li><s>b </s></li></ol>
  8782. !! html/parsoid
  8783. <ol><li><s> a</s></li>
  8784. <li><s>b </s></li></ol>
  8785. !! end
  8786. # Output is ugly because of all the misnested tag fixups.
  8787. # Remex is wrapping p-tags around empty elements.
  8788. # Parsoid has special-case handling of this pattern of
  8789. # wrapping lists in formatting tags.
  8790. # FIXME: Should we remove this code from Parsoid? Or add
  8791. # special support in Remex? If the latter, maybe just wait
  8792. # for Parsoid to become the default parser.
  8793. # See T70395.
  8794. !!test
  8795. 1. List embedded in a formatting tag
  8796. !! wikitext
  8797. <small>
  8798. *foo
  8799. </small>
  8800. !! html/php+tidy
  8801. <p><small>
  8802. </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
  8803. </p>
  8804. !! html/parsoid
  8805. <small>
  8806. <ul>
  8807. <li>foo</li>
  8808. </ul>
  8809. </small>
  8810. !!end
  8811. # Output is ugly because of all the misnested tag fixups
  8812. # Remex is wrapping p-tags around empty elements.
  8813. # Parsoid has code that strips useless p-tags.
  8814. !!test
  8815. 2. List embedded in a formatting tag in a misnested way
  8816. !! wikitext
  8817. <small>
  8818. *a
  8819. *b</small>
  8820. !! html/php+tidy
  8821. <p><small>
  8822. </small></p><small></small><ul><small><li>a</li>
  8823. </small><li><small>b</small></li></ul>
  8824. !! html/parsoid
  8825. <small></small>
  8826. <ul><small>
  8827. <li>a</li>
  8828. </small>
  8829. <li><small>b</small></li>
  8830. </ul>
  8831. !!end
  8832. !! test
  8833. Table with missing opening <tr> tag
  8834. !! options
  8835. parsoid=wt2html,wt2wt
  8836. !! wikitext
  8837. <table>
  8838. <td>foo</td>
  8839. </tr>
  8840. </table>
  8841. !! html+tidy
  8842. <table>
  8843. <tbody><tr><td>foo</td>
  8844. </tr>
  8845. </tbody></table>
  8846. !! end
  8847. ###
  8848. ### Magic Words
  8849. ###
  8850. # Note that the current date is hard-coded as
  8851. # 1970-01-01T00:02:03Z (a Thursday)
  8852. # when running parser tests. The timezone is also fixed to GMT, so
  8853. # local date will be identical to current date.
  8854. !! test
  8855. Magic Word: {{CURRENTDAY}}
  8856. !! wikitext
  8857. {{CURRENTDAY}}
  8858. !! html
  8859. <p>1
  8860. </p>
  8861. !! end
  8862. !! test
  8863. Magic Word: {{CURRENTDAY2}}
  8864. !! wikitext
  8865. {{CURRENTDAY2}}
  8866. !! html
  8867. <p>01
  8868. </p>
  8869. !! end
  8870. !! test
  8871. Magic Word: {{CURRENTDAYNAME}}
  8872. !! wikitext
  8873. {{CURRENTDAYNAME}}
  8874. !! html
  8875. <p>Thursday
  8876. </p>
  8877. !! end
  8878. !! test
  8879. Magic Word: {{CURRENTDOW}}
  8880. !! wikitext
  8881. {{CURRENTDOW}}
  8882. !! html
  8883. <p>4
  8884. </p>
  8885. !! end
  8886. !! test
  8887. Magic Word: {{CURRENTMONTH}}
  8888. !! wikitext
  8889. {{CURRENTMONTH}}
  8890. !! html
  8891. <p>01
  8892. </p>
  8893. !! end
  8894. !! test
  8895. Magic Word: {{CURRENTMONTH1}}
  8896. !! wikitext
  8897. {{CURRENTMONTH1}}
  8898. !! html
  8899. <p>1
  8900. </p>
  8901. !! end
  8902. !! test
  8903. Magic Word: {{CURRENTMONTHABBREV}}
  8904. !! wikitext
  8905. {{CURRENTMONTHABBREV}}
  8906. !! html
  8907. <p>Jan
  8908. </p>
  8909. !! end
  8910. !! test
  8911. Magic Word: {{CURRENTMONTHNAME}}
  8912. !! wikitext
  8913. {{CURRENTMONTHNAME}}
  8914. !! html
  8915. <p>January
  8916. </p>
  8917. !! end
  8918. !! test
  8919. Magic Word: {{CURRENTMONTHNAMEGEN}}
  8920. !! wikitext
  8921. {{CURRENTMONTHNAMEGEN}}
  8922. !! html
  8923. <p>January
  8924. </p>
  8925. !! end
  8926. !! test
  8927. Magic Word: {{CURRENTTIME}}
  8928. !! wikitext
  8929. {{CURRENTTIME}}
  8930. !! html
  8931. <p>00:02
  8932. </p>
  8933. !! end
  8934. !! test
  8935. Magic Word: {{CURRENTHOUR}}
  8936. !! wikitext
  8937. {{CURRENTHOUR}}
  8938. !! html
  8939. <p>00
  8940. </p>
  8941. !! end
  8942. !! test
  8943. Magic Word: {{CURRENTWEEK}} (T6594)
  8944. !! wikitext
  8945. {{CURRENTWEEK}}
  8946. !! html
  8947. <p>1
  8948. </p>
  8949. !! end
  8950. !! test
  8951. Magic Word: {{CURRENTYEAR}}
  8952. !! wikitext
  8953. {{CURRENTYEAR}}
  8954. !! html
  8955. <p>1970
  8956. </p>
  8957. !! end
  8958. !! test
  8959. Magic Word: {{CURRENTTIMESTAMP}}
  8960. !! wikitext
  8961. {{CURRENTTIMESTAMP}}
  8962. !! html
  8963. <p>19700101000203
  8964. </p>
  8965. !! end
  8966. !! test
  8967. Magic Words LOCAL (UTC)
  8968. !! wikitext
  8969. *{{LOCALMONTH}}
  8970. *{{LOCALMONTH1}}
  8971. *{{LOCALMONTHNAME}}
  8972. *{{LOCALMONTHNAMEGEN}}
  8973. *{{LOCALMONTHABBREV}}
  8974. *{{LOCALDAY}}
  8975. *{{LOCALDAY2}}
  8976. *{{LOCALDAYNAME}}
  8977. *{{LOCALYEAR}}
  8978. *{{LOCALTIME}}
  8979. *{{LOCALHOUR}}
  8980. *{{LOCALWEEK}}
  8981. *{{LOCALDOW}}
  8982. *{{LOCALTIMESTAMP}}
  8983. !! html
  8984. <ul><li>01</li>
  8985. <li>1</li>
  8986. <li>January</li>
  8987. <li>January</li>
  8988. <li>Jan</li>
  8989. <li>1</li>
  8990. <li>01</li>
  8991. <li>Thursday</li>
  8992. <li>1970</li>
  8993. <li>00:02</li>
  8994. <li>00</li>
  8995. <li>1</li>
  8996. <li>4</li>
  8997. <li>19700101000203</li></ul>
  8998. !! end
  8999. !! test
  9000. Magic Word: {{FULLPAGENAME}}
  9001. !! options
  9002. title=[[User:Ævar Arnfjörð Bjarmason]]
  9003. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9004. !! wikitext
  9005. {{FULLPAGENAME}}
  9006. !! html/*
  9007. <p>User:Ævar Arnfjörð Bjarmason
  9008. </p>
  9009. !! end
  9010. !! test
  9011. Magic Word: {{FULLPAGENAMEE}}
  9012. !! options
  9013. title=[[User:Ævar Arnfjörð Bjarmason]]
  9014. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9015. !! wikitext
  9016. {{FULLPAGENAMEE}}
  9017. !! html/*
  9018. <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
  9019. </p>
  9020. !! end
  9021. !! test
  9022. Magic Word: {{TALKSPACE}}
  9023. !! options
  9024. title=[[User:Ævar Arnfjörð Bjarmason]]
  9025. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9026. !! wikitext
  9027. {{TALKSPACE}}
  9028. !! html/*
  9029. <p>User talk
  9030. </p>
  9031. !! end
  9032. !! test
  9033. Magic Word: {{TALKSPACE}}, same namespace
  9034. !! options
  9035. title=[[User talk:Ævar Arnfjörð Bjarmason]]
  9036. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9037. !! wikitext
  9038. {{TALKSPACE}}
  9039. !! html/*
  9040. <p>User talk
  9041. </p>
  9042. !! end
  9043. !! test
  9044. Magic Word: {{TALKSPACE}}, main namespace
  9045. !! options
  9046. title=[[Parser Test]]
  9047. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9048. !! wikitext
  9049. {{TALKSPACE}}
  9050. !! html/*
  9051. <p>Talk
  9052. </p>
  9053. !! end
  9054. !! test
  9055. Magic Word: {{TALKSPACEE}}
  9056. !! options
  9057. title=[[User:Ævar Arnfjörð Bjarmason]]
  9058. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9059. !! wikitext
  9060. {{TALKSPACEE}}
  9061. !! html/*
  9062. <p>User_talk
  9063. </p>
  9064. !! end
  9065. !! test
  9066. Magic Word: {{SUBJECTSPACE}}
  9067. !! options
  9068. title=[[User talk:Ævar Arnfjörð Bjarmason]]
  9069. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9070. !! wikitext
  9071. {{SUBJECTSPACE}}
  9072. !! html/*
  9073. <p>User
  9074. </p>
  9075. !! end
  9076. !! test
  9077. Magic Word: {{SUBJECTSPACE}}, same namespace
  9078. !! options
  9079. title=[[User:Ævar Arnfjörð Bjarmason]]
  9080. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9081. !! wikitext
  9082. {{SUBJECTSPACE}}
  9083. !! html/*
  9084. <p>User
  9085. </p>
  9086. !! end
  9087. !! test
  9088. Magic Word: {{SUBJECTSPACE}}, main namespace
  9089. !! options
  9090. title=[[Parser Test]]
  9091. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9092. !! wikitext
  9093. {{SUBJECTSPACE}}
  9094. !! html/*
  9095. !! end
  9096. !! test
  9097. Magic Word: {{SUBJECTSPACEE}}
  9098. !! options
  9099. title=[[User talk:Ævar Arnfjörð Bjarmason]]
  9100. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9101. !! wikitext
  9102. {{SUBJECTSPACEE}}
  9103. !! html/*
  9104. <p>User
  9105. </p>
  9106. !! end
  9107. !! test
  9108. Magic Word: {{NAMESPACE}}
  9109. !! options
  9110. title=[[User:Ævar Arnfjörð Bjarmason]]
  9111. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9112. !! wikitext
  9113. {{NAMESPACE}}
  9114. !! html/*
  9115. <p>User
  9116. </p>
  9117. !! end
  9118. !! test
  9119. Magic Word: {{NAMESPACEE}}
  9120. !! options
  9121. title=[[User:Ævar Arnfjörð Bjarmason]]
  9122. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9123. !! wikitext
  9124. {{NAMESPACEE}}
  9125. !! html/*
  9126. <p>User
  9127. </p>
  9128. !! end
  9129. !! test
  9130. Magic Word: {{NAMESPACENUMBER}}
  9131. !! options
  9132. title=[[User:Ævar Arnfjörð Bjarmason]]
  9133. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9134. !! wikitext
  9135. {{NAMESPACENUMBER}}
  9136. !! html/*
  9137. <p>2
  9138. </p>
  9139. !! end
  9140. !! test
  9141. Magic Word: {{SUBPAGENAME}}
  9142. !! options
  9143. title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
  9144. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9145. !! wikitext
  9146. {{SUBPAGENAME}}
  9147. !! html/*
  9148. <p>sub ö
  9149. </p>
  9150. !! end
  9151. !! test
  9152. Magic Word: {{SUBPAGENAMEE}}
  9153. !! options
  9154. title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
  9155. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9156. !! wikitext
  9157. {{SUBPAGENAMEE}}
  9158. !! html/*
  9159. <p>sub_%C3%B6
  9160. </p>
  9161. !! end
  9162. !! test
  9163. Magic Word: {{ROOTPAGENAME}}
  9164. !! options
  9165. title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
  9166. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9167. !! wikitext
  9168. {{ROOTPAGENAME}}
  9169. !! html/*
  9170. <p>Ævar Arnfjörð Bjarmason
  9171. </p>
  9172. !! end
  9173. !! test
  9174. Magic Word: {{ROOTPAGENAMEE}}
  9175. !! options
  9176. title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
  9177. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9178. !! wikitext
  9179. {{ROOTPAGENAMEE}}
  9180. !! html/*
  9181. <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
  9182. </p>
  9183. !! end
  9184. !! test
  9185. Magic Word: {{BASEPAGENAME}}
  9186. !! options
  9187. title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
  9188. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9189. !! wikitext
  9190. {{BASEPAGENAME}}
  9191. !! html/*
  9192. <p>Ævar Arnfjörð Bjarmason
  9193. </p>
  9194. !! end
  9195. !! test
  9196. Magic Word: {{BASEPAGENAMEE}}
  9197. !! options
  9198. title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
  9199. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9200. !! wikitext
  9201. {{BASEPAGENAMEE}}
  9202. !! html/*
  9203. <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
  9204. </p>
  9205. !! end
  9206. !! test
  9207. Magic Word: {{TALKPAGENAME}}
  9208. !! options
  9209. title=[[User:Ævar Arnfjörð Bjarmason]]
  9210. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9211. !! wikitext
  9212. {{TALKPAGENAME}}
  9213. !! html/*
  9214. <p>User talk:Ævar Arnfjörð Bjarmason
  9215. </p>
  9216. !! end
  9217. !! test
  9218. Magic Word: {{TALKPAGENAMEE}}
  9219. !! options
  9220. title=[[User:Ævar Arnfjörð Bjarmason]]
  9221. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9222. !! wikitext
  9223. {{TALKPAGENAMEE}}
  9224. !! html/*
  9225. <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
  9226. </p>
  9227. !! end
  9228. !! test
  9229. Magic Word: {{SUBJECTPAGENAME}}
  9230. !! options
  9231. title=[[User talk:Ævar Arnfjörð Bjarmason]]
  9232. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9233. !! wikitext
  9234. {{SUBJECTPAGENAME}}
  9235. !! html/*
  9236. <p>User:Ævar Arnfjörð Bjarmason
  9237. </p>
  9238. !! end
  9239. !! test
  9240. Magic Word: {{SUBJECTPAGENAMEE}}
  9241. !! options
  9242. title=[[User talk:Ævar Arnfjörð Bjarmason]]
  9243. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9244. !! wikitext
  9245. {{SUBJECTPAGENAMEE}}
  9246. !! html/*
  9247. <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
  9248. </p>
  9249. !! end
  9250. !! test
  9251. Magic Word: {{NUMBEROFFILES}}
  9252. !! options
  9253. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9254. !! wikitext
  9255. {{NUMBEROFFILES}}
  9256. !! html/*
  9257. <p>7
  9258. </p>
  9259. !! end
  9260. !! test
  9261. Magic Word: {{PAGENAME}}
  9262. !! options
  9263. title=[[User:Ævar Arnfjörð Bjarmason]]
  9264. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9265. !! wikitext
  9266. {{PAGENAME}}
  9267. !! html/*
  9268. <p>Ævar Arnfjörð Bjarmason
  9269. </p>
  9270. !! end
  9271. !! test
  9272. Magic Word: {{PAGENAME}} with metacharacters
  9273. !! options
  9274. title=[['foo & bar = baz']]
  9275. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9276. !! wikitext
  9277. ''{{PAGENAME}}''
  9278. !! html+tidy
  9279. <p><i>&#39;foo &#38; bar &#61; baz&#39;</i>
  9280. </p>
  9281. !! end
  9282. !! test
  9283. Magic Word: {{PAGENAME}} with metacharacters (T28781)
  9284. !! options
  9285. title=[[*RFC 1234 http://example.com/]]
  9286. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9287. !! wikitext
  9288. {{PAGENAME}}
  9289. !! html+tidy
  9290. <p>&#42;RFC&#32;1234 http&#58;//example.com/
  9291. </p>
  9292. !! end
  9293. !! test
  9294. Magic Word: {{PAGENAMEE}}
  9295. !! options
  9296. title=[[User:Ævar Arnfjörð Bjarmason]]
  9297. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9298. !! wikitext
  9299. {{PAGENAMEE}}
  9300. !! html/*
  9301. <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
  9302. </p>
  9303. !! end
  9304. !! test
  9305. Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
  9306. !! options
  9307. title=[[*RFC 1234 http://example.com/]]
  9308. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9309. !! wikitext
  9310. {{PAGENAMEE}}
  9311. !! html+tidy
  9312. <p>&#42;RFC_1234_http&#58;//example.com/
  9313. </p>
  9314. !! end
  9315. !! test
  9316. Magic Word: {{REVISIONID}}
  9317. !! options
  9318. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9319. showflags
  9320. !! wikitext
  9321. {{REVISIONID}}
  9322. !! html/*
  9323. <p>1337
  9324. </p>
  9325. flags=vary-revision-id
  9326. !! end
  9327. !! test
  9328. Magic Word: {{SCRIPTPATH}}
  9329. !! options
  9330. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9331. !! wikitext
  9332. {{SCRIPTPATH}}
  9333. !! html/*
  9334. !! end
  9335. !! test
  9336. Magic Word: {{STYLEPATH}}
  9337. !! options
  9338. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9339. !! wikitext
  9340. {{STYLEPATH}}
  9341. !! html/*
  9342. <p>/skins
  9343. </p>
  9344. !! end
  9345. !! test
  9346. Magic Word: {{SERVER}}
  9347. !! options
  9348. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9349. !! wikitext
  9350. {{SERVER}}
  9351. !! html/*
  9352. <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
  9353. </p>
  9354. !! end
  9355. !! test
  9356. Magic Word: {{SERVERNAME}}
  9357. !! options
  9358. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9359. !! wikitext
  9360. {{SERVERNAME}}
  9361. !! html/*
  9362. <p>example.org
  9363. </p>
  9364. !! end
  9365. !! test
  9366. Magic Word: {{SITENAME}}
  9367. !! options
  9368. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9369. !! wikitext
  9370. {{SITENAME}}
  9371. !! html/*
  9372. <p>MediaWiki
  9373. </p>
  9374. !! end
  9375. !! test
  9376. Magic Word: {{PAGELANGUAGE}}
  9377. !! options
  9378. language=fr
  9379. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9380. !! wikitext
  9381. {{PAGELANGUAGE}}
  9382. !! html/*
  9383. <p>fr
  9384. </p>
  9385. !! end
  9386. !! test
  9387. Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
  9388. !! options
  9389. parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
  9390. !! wikitext
  9391. {{PAGELANGUAGE}}
  9392. !! html/*
  9393. <p>en
  9394. </p>
  9395. !! end
  9396. !! test
  9397. Case-sensitive magic words, when cased differently, should just be template transclusions
  9398. !! wikitext
  9399. {{CurrentMonth}}
  9400. {{currentday}}
  9401. {{cURreNTweEK}}
  9402. {{currentHour}}
  9403. !! html
  9404. <p><a href="/index.php?title=Template:CurrentMonth&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
  9405. <a href="/index.php?title=Template:Currentday&amp;action=edit&amp;redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
  9406. <a href="/index.php?title=Template:CURreNTweEK&amp;action=edit&amp;redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
  9407. <a href="/index.php?title=Template:CurrentHour&amp;action=edit&amp;redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
  9408. </p>
  9409. !! end
  9410. !! test
  9411. Case-insensitive magic words should still work with weird casing.
  9412. !! wikitext
  9413. {{sErVeRNaMe}}
  9414. {{LCFirst:AOEU}}
  9415. {{ucFIRST:aoeu}}
  9416. {{SERver}}
  9417. !! html
  9418. <p>example.org
  9419. aOEU
  9420. Aoeu
  9421. <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
  9422. </p>
  9423. !! end
  9424. # From plwiki:PLOS_ONE
  9425. !! test
  9426. Parsoid: Page property magic word with magic word contents
  9427. !! wikitext
  9428. {{DISPLAYTITLE:''{{PAGENAME}}''}}
  9429. !! html/parsoid
  9430. <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:&#39;&#39;{{PAGENAME}}&#39;&#39;}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:&lt;i data-parsoid=&#39;{\"dsr\":[15,31,2,2]}&#39;>&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}&#39;>Main Page&lt;/span>&lt;/i>"}]]}'/>
  9431. !! end
  9432. # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
  9433. # But, this is a limitation of our representation and is documented in
  9434. # TemplateHandler.js in processSpecialMagicWord
  9435. !! test
  9436. Parsoid: Template-generated DISPLAYTITLE
  9437. !! wikitext
  9438. {{{{echo|DISPLAYTITLE}}:Foo}}
  9439. !! options
  9440. showtitle
  9441. !! config
  9442. wgAllowDisplayTitle=true
  9443. wgRestrictDisplayTitle=false
  9444. !! html/php
  9445. Foo
  9446. !! html/parsoid
  9447. <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}&#39;>DISPLAYTITLE&lt;/span>:Foo"}]]}'/>
  9448. !! end
  9449. !! test
  9450. Namespace 1 {{ns:1}}
  9451. !! wikitext
  9452. {{ns:1}}
  9453. !! html
  9454. <p>Talk
  9455. </p>
  9456. !! end
  9457. !! test
  9458. Namespace 1 {{ns:01}}
  9459. !! wikitext
  9460. {{ns:01}}
  9461. !! html
  9462. <p>Talk
  9463. </p>
  9464. !! end
  9465. !! test
  9466. Namespace 0 {{ns:0}} (T6783)
  9467. !! wikitext
  9468. {{ns:0}}
  9469. !! html
  9470. !! end
  9471. !! test
  9472. Namespace 0 {{ns:00}} (T6783)
  9473. !! wikitext
  9474. {{ns:00}}
  9475. !! html
  9476. !! end
  9477. !! test
  9478. Namespace -1 {{ns:-1}}
  9479. !! wikitext
  9480. {{ns:-1}}
  9481. !! html
  9482. <p>Special
  9483. </p>
  9484. !! end
  9485. !! test
  9486. Namespace User {{ns:User}}
  9487. !! wikitext
  9488. {{ns:User}}
  9489. !! html
  9490. <p>User
  9491. </p>
  9492. !! end
  9493. !! test
  9494. Namespace User talk {{ns:User_talk}}
  9495. !! wikitext
  9496. {{ns:User_talk}}
  9497. !! html
  9498. <p>User talk
  9499. </p>
  9500. !! end
  9501. !! test
  9502. Namespace User talk {{ns:uSeR tAlK}}
  9503. !! wikitext
  9504. {{ns:uSeR tAlK}}
  9505. !! html
  9506. <p>User talk
  9507. </p>
  9508. !! end
  9509. !! test
  9510. Namespace File {{ns:File}}
  9511. !! wikitext
  9512. {{ns:File}}
  9513. !! html
  9514. <p>File
  9515. </p>
  9516. !! end
  9517. !! test
  9518. Namespace File {{ns:Image}}
  9519. !! wikitext
  9520. {{ns:Image}}
  9521. !! html
  9522. <p>File
  9523. </p>
  9524. !! end
  9525. !! test
  9526. Namespace (lang=de) Benutzer {{ns:User}}
  9527. !! options
  9528. language=de
  9529. !! wikitext
  9530. {{ns:User}}
  9531. !! html
  9532. <p>Benutzer
  9533. </p>
  9534. !! end
  9535. !! test
  9536. Namespace (lang=de) Benutzer Diskussion {{ns:3}}
  9537. !! options
  9538. language=de
  9539. !! wikitext
  9540. {{ns:3}}
  9541. !! html
  9542. <p>Benutzer Diskussion
  9543. </p>
  9544. !! end
  9545. !! test
  9546. Urlencode
  9547. !! wikitext
  9548. {{urlencode:hi world?!}}
  9549. {{urlencode:hi world?!|WIKI}}
  9550. {{urlencode:hi world?!|PATH}}
  9551. {{urlencode:hi world?!|QUERY}}
  9552. !! html/php
  9553. <p>hi+world%3F%21
  9554. hi_world%3F!
  9555. hi%20world%3F%21
  9556. hi+world%3F%21
  9557. </p>
  9558. !! end
  9559. !! test
  9560. Magic Word: prioritize type info over data-parsoid
  9561. !! options
  9562. parsoid=html2wt
  9563. !! html/parsoid
  9564. <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
  9565. !! wikitext
  9566. __FORCETOC__
  9567. !! end
  9568. !! test
  9569. Magic Word: serialize on separate line (parsoid)
  9570. !! options
  9571. parsoid=wt2wt,html2wt
  9572. !! wikitext
  9573. foo
  9574. __NOTOC__
  9575. bar
  9576. !! html/parsoid
  9577. foo<meta property="mw:PageProp/notoc"/>bar
  9578. !! end
  9579. !! test
  9580. Magic Word: rt non-english wikis
  9581. !! options
  9582. parsoid=wt2wt
  9583. language=de
  9584. !! wikitext
  9585. __NOEDITSECTION__
  9586. !! html/parsoid
  9587. <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
  9588. !! end
  9589. !!test
  9590. __proto__ is treated as normal wikitext (T105997)
  9591. !!wikitext
  9592. __proto__
  9593. !!html
  9594. <p>__proto__
  9595. </p>
  9596. !!end
  9597. ###
  9598. ### Magic links
  9599. ###
  9600. !! test
  9601. Magic links: internal link to RFC (T2479)
  9602. !! wikitext
  9603. [[RFC 123]]
  9604. !! html/php
  9605. <p><a href="/index.php?title=RFC_123&amp;action=edit&amp;redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
  9606. </p>
  9607. !! html/parsoid
  9608. <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
  9609. !! end
  9610. !! test
  9611. Magic links: RFC (T2479)
  9612. !! wikitext
  9613. RFC 822
  9614. !! html/php
  9615. <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
  9616. </p>
  9617. !! html/parsoid
  9618. <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
  9619. !! end
  9620. !! test
  9621. Magic links: RFC (T67278)
  9622. !! wikitext
  9623. This is RFC 822 but thisRFC 822 is not RFC 822linked.
  9624. !! html/php
  9625. <p>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a> but thisRFC 822 is not RFC 822linked.
  9626. </p>
  9627. !! html/parsoid
  9628. <p>This is <a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a> but thisRFC 822 is not RFC 822linked.</p>
  9629. !! end
  9630. !! test
  9631. Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
  9632. !! wikitext
  9633. RFC &nbsp;&#160;&#0160;&#xA0;&#Xa0; 822
  9634. RFC
  9635. 822
  9636. !! html/php
  9637. <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
  9638. RFC
  9639. 822
  9640. </p>
  9641. !! html/parsoid
  9642. <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 822</a>
  9643. RFC
  9644. 822</p>
  9645. !! end
  9646. !! test
  9647. Magic links: ISBN (T3937)
  9648. !! wikitext
  9649. ISBN 0-306-40615-2
  9650. !! html/php
  9651. <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
  9652. </p>
  9653. !! html/parsoid
  9654. <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
  9655. !! end
  9656. !! test
  9657. Magic links: ISBN (T67278)
  9658. !! wikitext
  9659. This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
  9660. !! html/php
  9661. <p>This is <a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
  9662. </p>
  9663. !! html/parsoid
  9664. <p>This is <a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN 978-0-316-09811-3</a> but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.</p>
  9665. !! end
  9666. !! test
  9667. Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
  9668. !! wikitext
  9669. ISBN &nbsp;&#160;&#0160;&#xA0;&#Xa0; 978&nbsp;0&#160;316&#0160;09811&#xA0;3
  9670. ISBN
  9671. 9780316098113
  9672. ISBN 978
  9673. 0316098113
  9674. !! html/php
  9675. <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
  9676. ISBN
  9677. 9780316098113
  9678. ISBN 978
  9679. 0316098113
  9680. </p>
  9681. !! html/parsoid
  9682. <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span>3</a>
  9683. ISBN
  9684. 9780316098113
  9685. ISBN 978
  9686. 0316098113</p>
  9687. !! end
  9688. !! test
  9689. Magic links: PMID incorrectly converts space to underscore
  9690. !! wikitext
  9691. PMID 1234
  9692. !! html/php
  9693. <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
  9694. </p>
  9695. !! html/parsoid
  9696. <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
  9697. !! end
  9698. !! test
  9699. Magic links: PMID (T67278)
  9700. !! wikitext
  9701. This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
  9702. !! html/php
  9703. <p>This is <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.
  9704. </p>
  9705. !! html/parsoid
  9706. <p>This is <a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a> but thisPMID 1234 is not PMID 1234linked.</p>
  9707. !! end
  9708. !! test
  9709. Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
  9710. !! wikitext
  9711. PMID &nbsp;&#160;&#0160;&#xA0;&#Xa0; 1234
  9712. PMID
  9713. 1234
  9714. !! html/php
  9715. <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
  9716. PMID
  9717. 1234
  9718. </p>
  9719. !! html/parsoid
  9720. <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID <span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#Xa0;","srcContent":" "}'> </span> 1234</a>
  9721. PMID
  9722. 1234</p>
  9723. !! end
  9724. # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
  9725. # since these are ExtLinkText, not MagicLinkText
  9726. !! test
  9727. Magic links: use appropriate serialization for "almost" magic links.
  9728. !! wikitext
  9729. X[[Special:BookSources/0978739256|foo]]
  9730. X[https://tools.ietf.org/html/rfc1234 foo]
  9731. !! html/php
  9732. <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
  9733. </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
  9734. </p>
  9735. !! html/parsoid
  9736. <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
  9737. <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
  9738. !! end
  9739. !! test
  9740. Magic links: All disabled (T47942)
  9741. !! options
  9742. wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
  9743. !! wikitext
  9744. ISBN 0-306-40615-2
  9745. PMID 1234
  9746. RFC 4321
  9747. !! html/php
  9748. <p>ISBN 0-306-40615-2
  9749. PMID 1234
  9750. RFC 4321
  9751. </p>
  9752. !! end
  9753. ###
  9754. ### Templates
  9755. ####
  9756. !! test
  9757. Nonexistent template
  9758. !! wikitext
  9759. {{thistemplatedoesnotexist}}
  9760. !! html
  9761. <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&amp;action=edit&amp;redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
  9762. </p>
  9763. !! end
  9764. !! test
  9765. Template with invalid target containing tags
  9766. !! wikitext
  9767. {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
  9768. !! html
  9769. <p>{{a<b>b</b>|foo|a=b|a = b}}
  9770. </p>
  9771. !! end
  9772. !! test
  9773. Template with invalid target containing unclosed tag
  9774. !! wikitext
  9775. {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
  9776. !! html
  9777. <p>{{a<b>|foo|a=b|a = b}}</b>
  9778. </p>
  9779. !! end
  9780. !! test
  9781. Template with invalid target containing wikilink
  9782. !! wikitext
  9783. {{[[Main Page]]}}
  9784. !! html/php
  9785. <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
  9786. </p>
  9787. !! html/parsoid
  9788. <p><span typeof="mw:Transclusion" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"[[Main Page]]"},"params":{},"i":0}}]}'>{{</span><a rel="mw:WikiLink" href="./Main_Page" about="#mwt1">Main Page</a><span about="#mwt1">}}</span></p>
  9789. !! end
  9790. !! test
  9791. Template with just whitespace in it, T70421
  9792. !! wikitext
  9793. {{echo|{{ }}}}
  9794. !! html/parsoid
  9795. <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{ }}"}},"i":0}}]}'>{{ }}</p>
  9796. !! end
  9797. !! article
  9798. Template:test
  9799. !! text
  9800. This is a test template
  9801. !! endarticle
  9802. !! test
  9803. Simple template
  9804. !! wikitext
  9805. {{test}}
  9806. !! html
  9807. <p>This is a test template
  9808. </p>
  9809. !! end
  9810. !! test
  9811. Template with explicit namespace
  9812. !! wikitext
  9813. {{Template:test}}
  9814. !! html
  9815. <p>This is a test template
  9816. </p>
  9817. !! end
  9818. !! article
  9819. Template:paramtest
  9820. !! text
  9821. This is a test template with parameter {{{param}}}
  9822. !! endarticle
  9823. !! test
  9824. Template parameter
  9825. !! wikitext
  9826. {{paramtest|param=foo}}
  9827. !! html
  9828. <p>This is a test template with parameter foo
  9829. </p>
  9830. !! end
  9831. !! article
  9832. Template:paramtestnum
  9833. !! text
  9834. [[{{{1}}}|{{{2}}}]]
  9835. !! endarticle
  9836. !! test
  9837. Template unnamed parameter
  9838. !! wikitext
  9839. {{paramtestnum|Main Page|the main page}}
  9840. !! html
  9841. <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
  9842. </p>
  9843. !! end
  9844. !! article
  9845. Template:templatesimple
  9846. !! text
  9847. (test)
  9848. !! endarticle
  9849. !! article
  9850. Template:templateredirect
  9851. !! text
  9852. #redirect [[Template:templatesimple]]
  9853. !! endarticle
  9854. !! article
  9855. Template:templateasargtestnum
  9856. !! text
  9857. {{{{{1}}}}}
  9858. !! endarticle
  9859. !! article
  9860. Template:templateasargtest
  9861. !! text
  9862. {{template{{{templ}}}}}
  9863. !! endarticle
  9864. !! article
  9865. Template:templateasargtest2
  9866. !! text
  9867. {{{{{templ}}}}}
  9868. !! endarticle
  9869. !! test
  9870. Template with template name as unnamed argument
  9871. !! wikitext
  9872. {{templateasargtestnum|templatesimple}}
  9873. !! html
  9874. <p>(test)
  9875. </p>
  9876. !! end
  9877. !! test
  9878. Template with template name as argument
  9879. !! wikitext
  9880. {{templateasargtest|templ=simple}}
  9881. !! html
  9882. <p>(test)
  9883. </p>
  9884. !! end
  9885. !! test
  9886. Template with template name as argument (2)
  9887. !! wikitext
  9888. {{templateasargtest2|templ=templatesimple}}
  9889. !! html
  9890. <p>(test)
  9891. </p>
  9892. !! end
  9893. !! article
  9894. Template:templateasargtestdefault
  9895. !! text
  9896. {{{{{templ|templatesimple}}}}}
  9897. !! endarticle
  9898. !! article
  9899. Template:templa
  9900. !! text
  9901. '''templ'''
  9902. !! endarticle
  9903. !! test
  9904. Template with default value
  9905. !! wikitext
  9906. {{templateasargtestdefault}}
  9907. !! html
  9908. <p>(test)
  9909. </p>
  9910. !! end
  9911. !! test
  9912. Template with default value (value set)
  9913. !! wikitext
  9914. {{templateasargtestdefault|templ=templa}}
  9915. !! html
  9916. <p><b>templ</b>
  9917. </p>
  9918. !! end
  9919. !! test
  9920. Template redirect
  9921. !! wikitext
  9922. {{templateredirect}}
  9923. !! html/php
  9924. <p>(test)
  9925. </p>
  9926. !! html/parsoid
  9927. <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
  9928. !! end
  9929. !! test
  9930. Template with argument in separate line
  9931. !! wikitext
  9932. {{ templateasargtest |
  9933. templ = simple }}
  9934. !! html
  9935. <p>(test)
  9936. </p>
  9937. !! end
  9938. !! test
  9939. Template with complex template as argument
  9940. !! wikitext
  9941. {{paramtest|
  9942. param ={{ templateasargtest |
  9943. templ = simple }}}}
  9944. !! html
  9945. <p>This is a test template with parameter (test)
  9946. </p>
  9947. !! end
  9948. !! test
  9949. Templates with templated name
  9950. !! wikitext
  9951. {{{{echo|echo}}|foo}}
  9952. {{{{echo|inner list}} }}
  9953. !! html
  9954. <p>foo
  9955. </p>
  9956. <ul><li>item 1</li></ul>
  9957. !! html/parsoid
  9958. <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|echo}}","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
  9959. <ul about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"{{echo|inner list}} ","href":"./Template:Inner_list"},"params":{},"i":0}}]}'><li>item 1</li></ul>
  9960. !! end
  9961. ## Regression test; the output here isn't really that interesting.
  9962. !! test
  9963. Templates with templated name and top level template args
  9964. !! wikitext
  9965. {{1{{2{{{3}}}|4=5}}}}
  9966. !! html/parsoid
  9967. <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"1{{2{{{3}}}|4=5}}"},"params":{},"i":0}}]}'>{{1{{2{{{3}}}|4=5}}}}</p>
  9968. !! end
  9969. # Parsoid markup is deliberate "broken". This is an edge case.
  9970. # See long comment in TemplateHandler.js:convertAttribsToString.
  9971. !! test
  9972. Templates with invalid templated targets
  9973. !! wikitext
  9974. {{echo
  9975. {{echo|foo}}
  9976. }}
  9977. !! html/php
  9978. <p>{{echo
  9979. foo
  9980. }}
  9981. </p>
  9982. !! html/parsoid
  9983. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
  9984. foo }}</p>
  9985. !! end
  9986. !! test
  9987. Template with thumb image (with link in description)
  9988. !! wikitext
  9989. {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
  9990. !! html/php
  9991. This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
  9992. !! html+tidy
  9993. <p>This is a test template with parameter </p><div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&amp;wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&amp;action=edit&amp;redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
  9994. !! html/parsoid
  9995. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"paramtest","href":"./Template:Paramtest"},"params":{"param":{"wt":"[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]"}},"i":0}}]}'>This is a test template with parameter </p><figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" about="#mwt1" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Noimage.png" ><img resource="./File:Noimage.png" src="./Special:FilePath/Noimage.png" height="220" width="220"/></a><figcaption><a rel="mw:WikiLink" href="./No_link" title="No link">link</a> <a rel="mw:WikiLink" href="./No_link" title="No link">caption</a></figcaption></figure>
  9996. !! end
  9997. !! article
  9998. Template:complextemplate
  9999. !! text
  10000. {{{1}}} {{paramtest|
  10001. param ={{{param}}}}}
  10002. !! endarticle
  10003. !! test
  10004. Template with complex arguments
  10005. !! wikitext
  10006. {{complextemplate|
  10007. param ={{ templateasargtest |
  10008. templ = simple }}|[[Template:complextemplate|link]]}}
  10009. !! html
  10010. <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
  10011. </p>
  10012. !! end
  10013. !! test
  10014. T2553: link with two variables in a piped link
  10015. !! wikitext
  10016. {|
  10017. |[[{{{1}}}|{{{2}}}]]
  10018. |}
  10019. !! html/php
  10020. <table>
  10021. <tr>
  10022. <td>[[{{{1}}}|{{{2}}}]]
  10023. </td></tr></table>
  10024. !! html/parsoid
  10025. <table>
  10026. <tbody><tr><td>[[<span about="#mwt5" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{},"i":0}}]}'>{{{1}}}</span>|<span about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"2"},"params":{},"i":0}}]}'>{{{2}}}</span>]]</td></tr>
  10027. </tbody></table>
  10028. !! end
  10029. # See: T2553
  10030. !! test
  10031. Abort table cell attribute parsing on wikilink
  10032. !! wikitext
  10033. {|
  10034. |testing [[one|two]] |three||four
  10035. |testing one two |three||four
  10036. |testing="[[one|two]]" |three||four
  10037. |}
  10038. !! html/php
  10039. <table>
  10040. <tr>
  10041. <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> |three</td>
  10042. <td>four
  10043. </td>
  10044. <td>three</td>
  10045. <td>four
  10046. </td>
  10047. <td>testing="<a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a>" |three</td>
  10048. <td>four
  10049. </td></tr></table>
  10050. !! html/parsoid
  10051. <table>
  10052. <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>testing <a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a> |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
  10053. <td data-parsoid='{"a":{"testing":null,"one":null,"two":null},"sa":{"testing":"","one":"","two":""},"autoInsertedEnd":true}'>three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td>
  10054. <td>testing="<a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"piped","a":{"href":"./One"},"sa":{"href":"one"}}'>two</a>" |three</td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'>four</td></tr>
  10055. </tbody></table>
  10056. !! end
  10057. !! test
  10058. Don't abort table cell attribute parsing if wikilink is found in template arg
  10059. !! wikitext
  10060. {|
  10061. |Test {{#tag:ref|One two "[[three]]" four}}
  10062. |}
  10063. !! html/parsoid
  10064. <table>
  10065. <tbody><tr><td>Test <ref about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"#tag:ref","function":"tag"},"params":{"1":{"wt":"One two \"[[three]]\" four"}},"i":0}}]}'>One two "<a rel="mw:WikiLink" href="./Three" title="Three">three</a>" four</ref></td></tr>
  10066. </tbody></table>
  10067. !! end
  10068. !! test
  10069. Magic variable as template parameter
  10070. !! wikitext
  10071. {{paramtest|param={{SITENAME}}}}
  10072. !! html
  10073. <p>This is a test template with parameter MediaWiki
  10074. </p>
  10075. !! end
  10076. !! article
  10077. Template:linktest
  10078. !! text
  10079. [[{{{param}}}|link]]
  10080. !! endarticle
  10081. !! test
  10082. Template parameter as link source
  10083. !! wikitext
  10084. {{linktest|param=Main Page}}
  10085. !! html
  10086. <p><a href="/wiki/Main_Page" title="Main Page">link</a>
  10087. </p>
  10088. !! end
  10089. !!article
  10090. Template:paramtest2
  10091. !! text
  10092. including another template, {{paramtest|param={{{arg}}}}}
  10093. !! endarticle
  10094. !! test
  10095. Template passing argument to another template
  10096. !! wikitext
  10097. {{paramtest2|arg='hmm'}}
  10098. !! html
  10099. <p>including another template, This is a test template with parameter 'hmm'
  10100. </p>
  10101. !! end
  10102. !! article
  10103. Template:Linktest2
  10104. !! text
  10105. Main Page
  10106. !! endarticle
  10107. !! test
  10108. Template as link source
  10109. !! wikitext
  10110. [[{{linktest2}}]]
  10111. [[{{linktest2}}|Main Page]]
  10112. [[{{linktest2}}]]Page
  10113. !! html
  10114. <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  10115. </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  10116. </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
  10117. </p>
  10118. !! end
  10119. !! article
  10120. Template:loop1
  10121. !! text
  10122. {{loop2}}
  10123. !! endarticle
  10124. !! article
  10125. Template:loop2
  10126. !! text
  10127. {{loop1}}
  10128. !! endarticle
  10129. !! test
  10130. Template infinite loop
  10131. !! wikitext
  10132. {{loop1}}
  10133. !! html
  10134. <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
  10135. </p>
  10136. !! end
  10137. !! test
  10138. Template from main namespace
  10139. !! wikitext
  10140. {{:Main Page}}
  10141. !! html
  10142. <p>blah blah
  10143. </p>
  10144. !! end
  10145. !! article
  10146. Template:table
  10147. !! text
  10148. {|
  10149. | 1 || 2
  10150. |-
  10151. | 3 || 4
  10152. |}
  10153. !! endarticle
  10154. !! test
  10155. T2529: Template with table, not included at beginning of line
  10156. !! wikitext
  10157. foo {{table}}
  10158. !! html
  10159. <p>foo
  10160. </p>
  10161. <table>
  10162. <tr>
  10163. <td>1</td>
  10164. <td>2
  10165. </td></tr>
  10166. <tr>
  10167. <td>3</td>
  10168. <td>4
  10169. </td></tr></table>
  10170. !! end
  10171. !! test
  10172. T2523: Template shouldn't eat newline (or add an extra one before table)
  10173. !! wikitext
  10174. foo
  10175. {{table}}
  10176. !! html
  10177. <p>foo
  10178. </p>
  10179. <table>
  10180. <tr>
  10181. <td>1</td>
  10182. <td>2
  10183. </td></tr>
  10184. <tr>
  10185. <td>3</td>
  10186. <td>4
  10187. </td></tr></table>
  10188. !! end
  10189. !! test
  10190. T2041: Template parameters shown as broken links
  10191. !! wikitext
  10192. {{{parameter}}}
  10193. !! html
  10194. <p>{{{parameter}}}
  10195. </p>
  10196. !! end
  10197. !! test
  10198. Template with targets containing wikilinks
  10199. !! options
  10200. parsoid=wt2html
  10201. !! wikitext
  10202. {{[[foo]]}}
  10203. {{[[{{echo|foo}}]]}}
  10204. {{{{echo|[[foo}}]]}}
  10205. !! html/php
  10206. <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
  10207. </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
  10208. </p><p>{{[[foo}}]]
  10209. </p>
  10210. !! html/parsoid
  10211. <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
  10212. <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"&lt;span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>"}]]}'>foo</a>}}</p>
  10213. <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
  10214. !! end
  10215. !! article
  10216. Template:''
  10217. !! text
  10218. bar
  10219. !! endarticle
  10220. !! test
  10221. Templates: Double quotes as template target
  10222. !! wikitext
  10223. foo {{''}} baz
  10224. !! html/php
  10225. <p>foo bar baz
  10226. </p>
  10227. !! html/parsoid
  10228. <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"&#39;&#39;","href":"./Template:&#39;&#39;"},"params":{},"i":0}}]}'>bar</span> baz
  10229. </p>
  10230. !! end
  10231. ## This test is about making sure Parsoid's data-mw is well formed in the
  10232. ## face of multiple templates with intersecting and overlapping ranges. The
  10233. ## wikitext itself is wretched.
  10234. !! test
  10235. Templates with intersecting and overlapping ranges
  10236. !! wikitext
  10237. {|{{echo|
  10238. <p>ha</p>}}
  10239. {|{{echo|
  10240. <p>ho</p>}}
  10241. {{echo|{{!}}hi}}
  10242. |}
  10243. !! html/php+tidy
  10244. <p>ha</p><table>
  10245. </table><p>ho</p><table>
  10246. <tbody><tr>
  10247. <td>hi
  10248. </td></tr></tbody></table>
  10249. !! html/parsoid
  10250. <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]],"firstWikitextNode":"table"}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ha&lt;/p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n&lt;p>ho&lt;/p>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}}hi"}},"i":2}},"\n|}"]}'>ha</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
  10251. </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
  10252. <tbody><tr><td>hi</td></tr>
  10253. </tbody></table>
  10254. !! end
  10255. !! article
  10256. Template:MSGNW test
  10257. !! text
  10258. ''None'' of '''this''' should be
  10259. * interpreted
  10260. but rather passed unmodified
  10261. {{test}}
  10262. <gallery>
  10263. File:Foobar.jpg
  10264. </gallery>
  10265. <!-- comment -->
  10266. !! endarticle
  10267. # hmm, fix this or just deprecate msgnw and document its behavior?
  10268. !! test
  10269. msgnw keyword
  10270. !! wikitext
  10271. {{msgnw:MSGNW test}}
  10272. !! html/php
  10273. <p>&#39;&#39;None&#39;&#39; of &#39;&#39;&#39;this&#39;&#39;&#39; should be
  10274. &#42; interpreted
  10275. &#32;but rather passed unmodified
  10276. &#123;&#123;test&#125;&#125;
  10277. &#60;gallery&#62;
  10278. File:Foobar.jpg
  10279. &#60;/gallery&#62;
  10280. &#60;!-- comment --&#62;
  10281. </p>
  10282. !! end
  10283. !! test
  10284. int keyword
  10285. !! wikitext
  10286. {{int:youhavenewmessages|lots of money|not!}}
  10287. !! html
  10288. <p>You have lots of money (not!).
  10289. </p>
  10290. !! end
  10291. !! test
  10292. int keyword - non-existing message
  10293. !! wikitext
  10294. {{int:var}}
  10295. !! html
  10296. <p>⧼var⧽
  10297. </p>
  10298. !! end
  10299. !! article
  10300. Template:Includes
  10301. !! text
  10302. Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
  10303. !! endarticle
  10304. !! test
  10305. <includeonly> and <noinclude> being included
  10306. !! wikitext
  10307. {{Includes}}
  10308. !! html
  10309. <p>Foobar
  10310. </p>
  10311. !! end
  10312. !! article
  10313. Template:Includes2
  10314. !! text
  10315. <onlyinclude>Foo</onlyinclude>bar
  10316. !! endarticle
  10317. !! test
  10318. <onlyinclude> being included
  10319. !! wikitext
  10320. {{Includes2}}
  10321. !! html
  10322. <p>Foo
  10323. </p>
  10324. !! end
  10325. !! article
  10326. Template:Includes3
  10327. !! text
  10328. <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
  10329. !! endarticle
  10330. !! test
  10331. <onlyinclude> and <includeonly> being included
  10332. !! wikitext
  10333. {{Includes3}}
  10334. !! html
  10335. <p>Foo
  10336. </p>
  10337. !! end
  10338. !! test
  10339. <includeonly> and <noinclude> on a page
  10340. !! wikitext
  10341. Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
  10342. !! html
  10343. <p>Foozar
  10344. </p>
  10345. !! end
  10346. !! test
  10347. Un-closed <noinclude>
  10348. !! wikitext
  10349. <noinclude>
  10350. !! html
  10351. !! end
  10352. !! test
  10353. <onlyinclude> on a page
  10354. !! wikitext
  10355. <onlyinclude>Foo</onlyinclude>bar
  10356. !! html
  10357. <p>Foobar
  10358. </p>
  10359. !! end
  10360. !! test
  10361. Un-closed <onlyinclude>
  10362. !! wikitext
  10363. <onlyinclude>
  10364. !! html
  10365. !! end
  10366. !!test
  10367. Self-closed noinclude, includeonly, onlyinclude tags
  10368. !! wikitext
  10369. <noinclude />
  10370. <includeonly />
  10371. <onlyinclude />
  10372. !! html
  10373. <p><br />
  10374. </p>
  10375. !!end
  10376. !!test
  10377. Unbalanced includeonly and noinclude tags
  10378. !! wikitext
  10379. {|
  10380. |a</noinclude>
  10381. |b</noinclude></noinclude>
  10382. |c</noinclude></includeonly>
  10383. |d</includeonly></includeonly>
  10384. |}
  10385. !! html
  10386. <table>
  10387. <tr>
  10388. <td>a
  10389. </td>
  10390. <td>b
  10391. </td>
  10392. <td>c&lt;/includeonly&gt;
  10393. </td>
  10394. <td>d&lt;/includeonly&gt;&lt;/includeonly&gt;
  10395. </td></tr></table>
  10396. !!end
  10397. !! article
  10398. Template:Includeonly section
  10399. !! text
  10400. <includeonly>
  10401. ==Includeonly section==
  10402. </includeonly>
  10403. ==Section T-1==
  10404. !!endarticle
  10405. !! test
  10406. T8563: Edit link generation for section shown by <includeonly>
  10407. !! wikitext
  10408. {{includeonly section}}
  10409. !! html
  10410. <h2><span class="mw-headline" id="Includeonly_section">Includeonly section</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  10411. <h2><span class="mw-headline" id="Section_T-1">Section T-1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Includeonly_section&amp;action=edit&amp;section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  10412. !! end
  10413. # Uses same input as the contents of [[Template:Includeonly section]]
  10414. !! test
  10415. T8563: Section extraction for section shown by <includeonly>
  10416. !! options
  10417. section=T-2
  10418. !! wikitext
  10419. <includeonly>
  10420. ==Includeonly section==
  10421. </includeonly>
  10422. ==Section T-2==
  10423. !! html
  10424. ==Section T-2==
  10425. !! end
  10426. !! test
  10427. T8563: Edit link generation for section suppressed by <includeonly>
  10428. !! wikitext
  10429. <includeonly>
  10430. ==Includeonly section==
  10431. </includeonly>
  10432. ==Section 1==
  10433. !! html
  10434. <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  10435. !! end
  10436. !! test
  10437. T8563: Section extraction for section suppressed by <includeonly>
  10438. !! options
  10439. section=1
  10440. !! wikitext
  10441. <includeonly>
  10442. ==Includeonly section==
  10443. </includeonly>
  10444. ==Section 1==
  10445. !! html
  10446. ==Section 1==
  10447. !! end
  10448. !! test
  10449. Un-closed <includeonly>
  10450. !! wikitext
  10451. <includeonly>
  10452. !! html/php
  10453. !! html/parsoid
  10454. <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>"}'/>
  10455. !! end
  10456. ## We used to, but no longer wt2wt this test since the default serializer
  10457. ## will normalize the include directives to serialize on their own line.
  10458. ## Selser will take care of preserving formatting in scenarios where they
  10459. ## intermingled with other wikitext.
  10460. !! test
  10461. Includes and comments at SOL
  10462. !! options
  10463. parsoid=wt2html,html2html
  10464. !! wikitext
  10465. <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
  10466. <noinclude>
  10467. some
  10468. </noinclude>*stuff
  10469. *here
  10470. <includeonly>can have stuff</includeonly>===here===
  10471. !! html/php
  10472. <h2><span class="mw-headline" id="hu">hu</span></h2>
  10473. <p>some
  10474. </p>
  10475. <ul><li>stuff</li>
  10476. <li>here</li></ul>
  10477. <h3><span class="mw-headline" id="here">here</span></h3>
  10478. !! html/parsoid
  10479. <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><!-- comment --><h2 id="hu">hu</h2>
  10480. <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>
  10481. <p>some</p>
  10482. <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"&lt;/noinclude>"}'/><ul><li>stuff</li>
  10483. <li>here</li></ul>
  10484. <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>can have stuff&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
  10485. !! end
  10486. # TODO: test with DOM fragment reuse!
  10487. !! test
  10488. Parsoid: DOM fragment reuse
  10489. !! options
  10490. parsoid=wt2wt,wt2html
  10491. !! wikitext
  10492. a{{echo|b<table></table>c}}d
  10493. a{{echo|b
  10494. <table></table>
  10495. c}}d
  10496. {{echo|a
  10497. <table></table>
  10498. b}}
  10499. !! html
  10500. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b&lt;table>&lt;/table>c"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><table about="#mwt1" data-parsoid='{"stx":"html"}'></table><p about="#mwt1">cd</p>
  10501. <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n&lt;table>&lt;/table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
  10502. </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
  10503. </span><p about="#mwt2">cd</p>
  10504. <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n&lt;table>&lt;/table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
  10505. </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
  10506. </span><p about="#mwt3">b</p>
  10507. !! end
  10508. !! test
  10509. Parsoid: Merge double tds (T52603)
  10510. !! options
  10511. parsoid
  10512. !! wikitext
  10513. {|
  10514. |{{echo|{{!}} foo}}
  10515. |}
  10516. !! html
  10517. <table><tbody>
  10518. <tr><td about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":0}}]}'> foo</td></tr>
  10519. </tbody></table>
  10520. !! end
  10521. !! test
  10522. Parsoid: Merge double tds in nested transclusion content (T52603)
  10523. !! options
  10524. parsoid
  10525. !! wikitext
  10526. {{echo|<div>}}
  10527. {|
  10528. |{{echo|{{!}} foo}}
  10529. |}
  10530. {{echo|</div>}}
  10531. !! html
  10532. <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":0}},"\n{|\n|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} foo"}},"i":1}},"\n|}\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":2}}]}'>
  10533. <table><tbody>
  10534. <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
  10535. </tbody></table>
  10536. </div>
  10537. !! end
  10538. ###
  10539. ### <includeonly> and <noinclude> in attributes
  10540. ###
  10541. !!test
  10542. 0. includeonly around the entire attribute
  10543. !! wikitext
  10544. <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
  10545. !! html
  10546. <p><span id="v2">bar</span>
  10547. </p>
  10548. !!end
  10549. !!test
  10550. 1. includeonly in html attr key
  10551. !! wikitext
  10552. <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
  10553. !! html
  10554. <p><span id="foo">bar</span>
  10555. </p>
  10556. !!end
  10557. !!test
  10558. 2. includeonly in html attr value
  10559. !! wikitext
  10560. <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
  10561. <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
  10562. !! html
  10563. <p><span id="v1">bar</span>
  10564. <span id="v1">bar</span>
  10565. </p>
  10566. !!end
  10567. !!test
  10568. 3. includeonly in part of an attr value
  10569. !! wikitext
  10570. <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
  10571. !! html
  10572. <p><span style="color:red;">bar</span>
  10573. </p>
  10574. !!end
  10575. !!test
  10576. 4. includeonly in table attributes
  10577. !! wikitext
  10578. {|
  10579. |- <noinclude>
  10580. |-
  10581. |a
  10582. </noinclude>
  10583. |- <includeonly>
  10584. |-
  10585. |b
  10586. </includeonly>
  10587. |}
  10588. !! html
  10589. <table>
  10590. <tr>
  10591. <td>a
  10592. </td></tr>
  10593. </table>
  10594. !!end
  10595. ###
  10596. ### Preprocessor precedence tests
  10597. ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
  10598. ###
  10599. ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
  10600. !! test
  10601. Preprocessor precedence 1: link is rightmost opening
  10602. !! options
  10603. parsoid=wt2html
  10604. !! wikitext
  10605. {{[[Foo|bar}}]]
  10606. But close-brace is not a valid character in a link title:
  10607. {{[[Foo}}|bar]]
  10608. However, we can still tell this was handled as a link in the preprocessor:
  10609. {{echo|[[Foo}}|bar]]|bat}}
  10610. !! html/php
  10611. <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
  10612. </p><p>But close-brace is not a valid character in a link title:
  10613. {{[[Foo}}|bar]]
  10614. </p><p>However, we can still tell this was handled as a link in the preprocessor:
  10615. [[Foo}}|bar]]
  10616. </p>
  10617. !! html/parsoid
  10618. <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
  10619. <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
  10620. <p>However, we can still tell this was handled as a link in the preprocessor: <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Foo}}|bar]]"},"2":{"wt":"bat"}},"i":0}}]}'>[[Foo}}|bar]]</span></p>
  10621. !! end
  10622. !! test
  10623. Preprocessor precedence 2: template is rightmost opening
  10624. !! options
  10625. language=zh
  10626. !! wikitext
  10627. -{{echo|foo}-}}-
  10628. !! html/php
  10629. <p>-foo}--
  10630. </p>
  10631. !! html/parsoid
  10632. <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
  10633. !! end
  10634. !! test
  10635. Preprocessor precedence 3: language converter is rightmost opening
  10636. !! options
  10637. language=zh
  10638. parsoid=wt2html
  10639. !! wikitext
  10640. {{echo|hi}}
  10641. {{-{R|echo|hi}}}-
  10642. [[-{R|raw]]}-
  10643. !! html/php
  10644. <p>hi
  10645. </p><p>{{echo|hi}}
  10646. </p><p>[[raw]]
  10647. </p>
  10648. !! html/parsoid
  10649. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
  10650. <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
  10651. <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
  10652. !! end
  10653. !! test
  10654. Preprocessor precedence 4: left-most angle bracket
  10655. !! options
  10656. language=zh
  10657. !! wikitext
  10658. <!--{raw}-->
  10659. !! html/php
  10660. !! html/parsoid
  10661. <!--{raw}-->
  10662. !! end
  10663. !! article
  10664. Template:Precedence5
  10665. !! text
  10666. {{{{{1}}}}}
  10667. !! endarticle
  10668. !! test
  10669. Preprocessor precedence 5: tplarg takes precedence over template
  10670. !! wikitext
  10671. {{Precedence5|Bullet}}
  10672. !! html/php
  10673. <ul><li>Bar</li></ul>
  10674. !! html/parsoid
  10675. <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
  10676. !! end
  10677. !! test
  10678. Preprocessor precedence 6: broken link is rightmost opening
  10679. !! options
  10680. parsoid=wt2html
  10681. !! wikitext
  10682. {{echo|[[Foo}}
  10683. {{echo|[[Foo|bar|bat=baz}}
  10684. !! html/php
  10685. <p>{{echo|[[Foo}}
  10686. </p><p>{{echo|[[Foo|bar|bat=baz}}
  10687. </p>
  10688. !! html/parsoid
  10689. <p>{{echo|[[Foo}}</p>
  10690. <p>{{echo|[[Foo|bar|bat=baz}}</p>
  10691. !! end
  10692. # This next test exposes a difference between PHP and Parsoid:
  10693. # Given [[Foo|{{echo|Bar]]x}}y]]z:
  10694. # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
  10695. # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
  10696. # outer `[[Foo` extends until the `y]]`
  10697. # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
  10698. # intermediate result (after template expansion), and link processing
  10699. # happens on this intermediate result, which moves the wikilink
  10700. # boundary leftward to `[[Foo|Bar]]`
  10701. # 2b) Parsoid works in a single step, so it's going to keep the
  10702. # wikilink as extending to the `y]]`
  10703. # 3a) Then PHP does linktrail processing which slurps up the trailing
  10704. # `xy` inside the link.
  10705. # 3b) Parsoid will do linktrail processing to slurp up the trailing
  10706. # `z` inside the link.
  10707. # This is "correct" behavior. Parsoid's basic worldview is that the
  10708. # `]]` inside the template shouldn't be allowed to leak out to affect
  10709. # the surrounding wikilink. PHP may match Parsoid (in the future)
  10710. # if you use {{#balance}} (T114445).
  10711. !! test
  10712. Preprocessor precedence 7: broken template is rightmost opening
  10713. !! options
  10714. parsoid=wt2html
  10715. !! wikitext
  10716. [[Foo|{{echo|Bar]]
  10717. [[Foo|{{echo|Bar]]-x}}-y]]-z
  10718. Careful: linktrails can move the end of the wikilink:
  10719. [[Foo|{{echo|y']]a}}l]]l
  10720. !! html/php
  10721. <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
  10722. </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
  10723. </p><p>Careful: linktrails can move the end of the wikilink:
  10724. <a href="/wiki/Foo" title="Foo">y'al</a>]]l
  10725. </p>
  10726. !! html/parsoid
  10727. <p>[[Foo|{{echo|Bar]]</p>
  10728. <p><a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar]]-x"}},"i":0}}]}'>Bar]]-x</span>-y</a>-z</p>
  10729. <p>Careful: linktrails can move the end of the wikilink:
  10730. <a rel="mw:WikiLink" href="./Foo" title="Foo"><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"y&#39;]]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
  10731. !! end
  10732. !! test
  10733. Preprocessor precedence 8: broken language converter is rightmost opening
  10734. !! options
  10735. language=zh
  10736. !! wikitext
  10737. [[Foo-{R|raw]]
  10738. !! html
  10739. <p>[[Foo-{R|raw]]
  10740. </p>
  10741. !! end
  10742. !! article
  10743. Template:Preprocessor_precedence_9
  10744. !! text
  10745. ;4: {{{{1}}}}
  10746. ;5: {{{{{2}}}}}
  10747. ;6: {{{{{{3}}}}}}
  10748. ;7: {{{{{{{4}}}}}}}
  10749. !! endarticle
  10750. !! test
  10751. Preprocessor precedence 9: groups of braces
  10752. !! wikitext
  10753. {{Preprocessor precedence 9|Four|Bullet|1|2}}
  10754. !! html/php
  10755. <dl><dt>4</dt>
  10756. <dd>{Four}</dd>
  10757. <dt>5</dt>
  10758. <dd></dd></dl>
  10759. <ul><li>Bar</li></ul>
  10760. <dl><dt>6</dt>
  10761. <dd>Four</dd>
  10762. <dt>7</dt>
  10763. <dd>{Bullet}</dd></dl>
  10764. !! html/parsoid
  10765. <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 9","href":"./Template:Preprocessor_precedence_9"},"params":{"1":{"wt":"Four"},"2":{"wt":"Bullet"},"3":{"wt":"1"},"4":{"wt":"2"}},"i":0}}]}'>
  10766. <dt>4</dt>
  10767. <dd>{Four}</dd>
  10768. <dt>5</dt>
  10769. <dd></dd>
  10770. </dl><ul about="#mwt1">
  10771. <li>Bar</li>
  10772. </ul><span about="#mwt1"> </span><dl about="#mwt1">
  10773. <dt>6</dt>
  10774. <dd>Four</dd>
  10775. <dt>7</dt>
  10776. <dd>{Bullet}</dd>
  10777. </dl>
  10778. !! end
  10779. !! article
  10780. Template:Preprocessor_precedence_10
  10781. !! text
  10782. ;1: -{R|raw}-
  10783. ;2: -{{Bullet}}-
  10784. ;3: -{{{1}}}-
  10785. ;4: -{{{{2}}}}-
  10786. ;5: -{{{{{3}}}}}-
  10787. ;6: -{{{{{{4}}}}}}-
  10788. ;7: -{{{{{{{5}}}}}}}-
  10789. !! endarticle
  10790. !! test
  10791. Preprocessor precedence 10: groups of braces with leading dash
  10792. !! options
  10793. language=zh
  10794. !! wikitext
  10795. {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
  10796. !! html/php
  10797. <dl><dt>1</dt>
  10798. <dd>raw</dd>
  10799. <dt>2</dt>
  10800. <dd>-</dd></dl>
  10801. <ul><li>Bar-</li></ul>
  10802. <dl><dt>3</dt>
  10803. <dd>-Three-</dd>
  10804. <dt>4</dt>
  10805. <dd>raw2</dd>
  10806. <dt>5</dt>
  10807. <dd>-</dd></dl>
  10808. <ul><li>Bar-</li></ul>
  10809. <dl><dt>6</dt>
  10810. <dd>-Three-</dd>
  10811. <dt>7</dt>
  10812. <dd>raw2</dd></dl>
  10813. !! html/parsoid
  10814. <dl about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Preprocessor precedence 10","href":"./Template:Preprocessor_precedence_10"},"params":{"1":{"wt":"Three"},"2":{"wt":"raw2"},"3":{"wt":"Bullet"},"4":{"wt":"1"},"5":{"wt":"2"}},"i":0}}]}'>
  10815. <dt>1</dt>
  10816. <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
  10817. <dt>2</dt>
  10818. <dd>-</dd>
  10819. </dl><ul about="#mwt1">
  10820. <li>Bar-</li>
  10821. </ul><span about="#mwt1"> </span><dl about="#mwt1">
  10822. <dt>3</dt>
  10823. <dd>-Three-</dd>
  10824. <dt>4</dt>
  10825. <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
  10826. <dt>5</dt>
  10827. <dd>-</dd>
  10828. </dl><ul about="#mwt1">
  10829. <li>Bar-</li>
  10830. </ul><span about="#mwt1"> </span><dl about="#mwt1">
  10831. <dt>6</dt>
  10832. <dd>-Three-</dd>
  10833. <dt>7</dt>
  10834. <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
  10835. </dl>
  10836. !! end
  10837. !! test
  10838. Preprocessor precedence 11: found during visual diff testing
  10839. !! wikitext
  10840. {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
  10841. {{echo|-{{echo|-{{echo|x}}}}}}
  10842. {{echo|-{{echo|x}}}}
  10843. !! html/php
  10844. <p><span>-<span>-x</span></span>
  10845. </p><p>--x
  10846. </p><p>-x
  10847. </p>
  10848. !! html/parsoid
  10849. <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"#tag:span","function":"tag"},"params":{"1":{"wt":"-{{#tag:span|-{{echo|x}}}}"}},"i":0}}]}'>-<span>-x</span></span></p>
  10850. <p about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|-{{echo|x}}}}"}},"i":0}}]}'>--x</p>
  10851. <p about="#mwt7" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"-{{echo|x}}"}},"i":0}}]}'>-x</p>
  10852. !! end
  10853. !! test
  10854. Preprocessor precedence 12: broken language converter closed by brace.
  10855. !! options
  10856. parsoid=wt2html
  10857. !! wikitext
  10858. This form breaks the template, which is unfortunate:
  10859. *{{echo|foo-{bar}bat}}
  10860. But if the broken language converter markup is inside an extension
  10861. tag, nothing bad happens:
  10862. *<nowiki>foo-{bar}bat</nowiki>
  10863. *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
  10864. *<pre>foo-{bar}bat</pre>
  10865. *{{echo|<pre>foo-{bar}bat</pre>}}
  10866. <tag>foo-{bar}bat</tag>
  10867. {{echo|<tag>foo-{bar}bat</tag>}}
  10868. !! html/php+tidy
  10869. <p>This form breaks the template, which is unfortunate:
  10870. </p>
  10871. <ul><li>{{echo|foo-{bar}bat}}</li></ul>
  10872. <p>But if the broken language converter markup is inside an extension
  10873. tag, nothing bad happens:
  10874. </p>
  10875. <ul><li>foo-&#123;bar}bat</li>
  10876. <li>foo-&#123;bar}bat</li>
  10877. <li><pre>foo-{bar}bat</pre></li>
  10878. <li><pre>foo-{bar}bat</pre></li></ul>
  10879. <pre>'foo-{bar}bat'
  10880. array (
  10881. )
  10882. </pre>
  10883. <pre>'foo-{bar}bat'
  10884. array (
  10885. )
  10886. </pre>
  10887. !! html/parsoid
  10888. <p>This form breaks the template, which is unfortunate:</p>
  10889. <ul>
  10890. <li>{{echo|foo-{bar}bat}}</li>
  10891. </ul>
  10892. <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
  10893. <ul>
  10894. <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
  10895. <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki>foo-{bar}bat&lt;/nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
  10896. <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
  10897. <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;pre>foo-{bar}bat&lt;/pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
  10898. </ul>
  10899. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'></pre> <pre typeof="mw:Extension/tag mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tag>foo-{bar}bat&lt;/tag>"}},"i":0}}]}'></pre>
  10900. !! end
  10901. !! test
  10902. Preprocessor precedence 13: broken language converter in external link
  10903. !! options
  10904. parsoid=wt2html
  10905. !! wikitext
  10906. *[http://example.com/-{foo Example in URL]
  10907. *[http://example.com Example in -{link} description]
  10908. *{{echo|[http://example.com/-{foo Breaks template, however]}}
  10909. !! html/php+tidy
  10910. <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
  10911. <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
  10912. <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
  10913. !! html/parsoid
  10914. <ul>
  10915. <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
  10916. <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
  10917. <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
  10918. </ul>
  10919. !! end
  10920. !! test
  10921. Preprocessor precedence 14: broken language converter in comment
  10922. !! wikitext
  10923. *<!--{{foo}}-->...should be ok
  10924. *<!---{{foo}}-->...extra dashes
  10925. *{{echo|foo<!-- -{bar} -->bat}}...should be ok
  10926. !! html/php+tidy
  10927. <ul><li>...should be ok</li>
  10928. <li>...extra dashes</li>
  10929. <li>foobat...should be ok</li></ul>
  10930. !! html/parsoid
  10931. <ul>
  10932. <li><!--{{foo}}-->...should be ok</li>
  10933. <li><!--&#x2D;{{foo}}-->...extra dashes</li>
  10934. <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- &#x2D;{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
  10935. </ul>
  10936. !! end
  10937. !! test
  10938. Preprocessor precedence 15: broken brace markup in headings
  10939. !! config
  10940. wgFragmentMode=[ 'html5', 'legacy' ]
  10941. !! options
  10942. parsoid=wt2html
  10943. !! wikitext
  10944. __NOTOC__ __NOEDITSECTION__
  10945. ===1 foo[bar 1===
  10946. 1
  10947. ===2 foo[[bar 2===
  10948. 2
  10949. ===3 foo{bar 3===
  10950. 3
  10951. ===4 foo{{bar 4===
  10952. 4
  10953. ===5 foo{{{bar 5===
  10954. 5
  10955. ===6 foo-{bar 6===
  10956. 6
  10957. !! html/php+tidy
  10958. <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
  10959. <p>1
  10960. </p>
  10961. <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
  10962. <p>2
  10963. </p>
  10964. <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
  10965. <p>3
  10966. </p>
  10967. <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
  10968. <p>4
  10969. </p>
  10970. <h3><span id="5_foo.7B.7B.7Bbar_5"></span><span class="mw-headline" id="5_foo{{{bar_5">5 foo{{{bar 5</span></h3>
  10971. <p>5
  10972. </p>
  10973. <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
  10974. <p>6
  10975. </p>
  10976. !! html/parsoid
  10977. <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
  10978. <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
  10979. <p>1</p>
  10980. <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
  10981. <p>2</p>
  10982. <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
  10983. <p>3</p>
  10984. <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
  10985. <p>4</p>
  10986. <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
  10987. <p>5</p>
  10988. <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
  10989. <p>6</p>
  10990. !! end
  10991. !! test
  10992. Preprocessor precedence 16: matching closing braces to opening braces
  10993. !! options
  10994. language=zh
  10995. parsoid=wt2html
  10996. !! wikitext
  10997. -{{{echo|foo}}bar}-
  10998. !! html/php
  10999. <p>foobar
  11000. </p>
  11001. !! html/parsoid
  11002. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}&#39;>foo&lt;/span>bar"}}'></span></p>
  11003. !! end
  11004. !! test
  11005. Preprocessor precedence 17: template w/o target shouldn't prevent closing
  11006. !! options
  11007. parsoid=wt2html
  11008. !! wikitext
  11009. {{echo|hi {{}}}}
  11010. !! html/php
  11011. <p>hi {{}}
  11012. </p>
  11013. !! html/parsoid
  11014. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
  11015. !! end
  11016. !! test
  11017. Preprocessor precedence 18: another rightmost wins scenario
  11018. !! options
  11019. parsoid=wt2html
  11020. !! wikitext
  11021. {{ -{{{{1|tplarg}}} }} }-
  11022. !! html/php
  11023. <p>{{ -{tplarg }} }-
  11024. </p>
  11025. !! html/parsoid
  11026. <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
  11027. !! end
  11028. !! test
  11029. Preprocessor precedence 19: break syntax
  11030. !! options
  11031. parsoid=wt2html
  11032. !! wikitext
  11033. -{{
  11034. !! html/php
  11035. <p>-{{
  11036. </p>
  11037. !! html/parsoid
  11038. <p>-{{</p>
  11039. !! end
  11040. ###
  11041. ### Token Stream Patcher tests
  11042. ###
  11043. ### These tests won't always pass wt2wt and other modes because
  11044. ### on serialization, the table will be output on a new line.
  11045. ### For now, we are blacklisting them, and using this to test selser.
  11046. ###
  11047. !!test
  11048. 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
  11049. !!options
  11050. parsoid=wt2html,wt2wt
  11051. !!wikitext
  11052. {{echo|}}{| width = '100%'
  11053. |foo
  11054. |}
  11055. !!html/parsoid
  11056. <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
  11057. <tbody><tr><td>foo</td></tr>
  11058. </tbody></table>
  11059. !!end
  11060. ## We used to, but no longer wt2wt this test since the default serializer
  11061. ## will normalize the include directives to serialize on their own line.
  11062. ## Selser will take care of preserving formatting in scenarios where they
  11063. ## intermingled with other wikitext.
  11064. !!test
  11065. 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
  11066. !!options
  11067. parsoid=wt2html
  11068. !!wikitext
  11069. <includeonly>a</includeonly>{| {{{b}}}
  11070. |c
  11071. |}
  11072. !!html/parsoid
  11073. <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>a&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><table about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"a":{"{{{b}}}":null},"sa":{"{{{b}}}":""}}' data-mw='{"attribs":[[{"txt":"{{{b}}}","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[31,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}&#39;>{{{b}}}&lt;/span>"},{"html":""}]]}'>
  11074. <tbody><tr><td>c</td></tr>
  11075. </tbody></table>
  11076. !!end
  11077. !! test
  11078. Table wikitext syntax outside wiki-tables
  11079. !! wikitext
  11080. a
  11081. |+ not a caption
  11082. ! not a table heading
  11083. |- not a table row
  11084. | not a table cell
  11085. | class="foo bar" | baz
  11086. b
  11087. |}
  11088. |-
  11089. c
  11090. !! html
  11091. <p>a
  11092. |+ not a caption
  11093. ! not a table heading
  11094. |- not a table row
  11095. | not a table cell
  11096. | class="foo bar" | baz
  11097. b
  11098. |}
  11099. |-
  11100. c
  11101. </p>
  11102. !! end
  11103. ###
  11104. ### Testing parsing of templates where a template arg
  11105. ### has the same name as the template itself.
  11106. ###
  11107. !! article
  11108. Template:quote
  11109. !! text
  11110. {{{quote|{{{1}}}}}}
  11111. !! endarticle
  11112. !!test
  11113. Templates: Template Name/Arg clash: 1. Use of positional param
  11114. !! wikitext
  11115. {{quote|foo}}
  11116. !! html
  11117. <p>foo
  11118. </p>
  11119. !!end
  11120. !!test
  11121. Templates: Template Name/Arg clash: 2. Use of named param
  11122. !! wikitext
  11123. {{quote|quote=foo}}
  11124. !! html
  11125. <p>foo
  11126. </p>
  11127. !!end
  11128. !!test
  11129. Templates: Template Name/Arg clash: 3. Use of named param with empty input
  11130. !! wikitext
  11131. {{quote|quote}}
  11132. !! html
  11133. <p>quote
  11134. </p>
  11135. !!end
  11136. ###
  11137. ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
  11138. ###
  11139. !!test
  11140. Templates: 1. Simple use
  11141. !! wikitext
  11142. {{echo|Foo}}
  11143. !! html
  11144. <p>Foo
  11145. </p>
  11146. !!end
  11147. !!test
  11148. Templates: 2. Inside a block tag
  11149. !! wikitext
  11150. <div>{{echo|Foo}}</div>
  11151. <blockquote>{{echo|Foo}}</blockquote>
  11152. !! html
  11153. <div>Foo</div>
  11154. <blockquote>Foo</blockquote>
  11155. !! html+tidy
  11156. <div>Foo</div>
  11157. <blockquote><p>Foo</p></blockquote>
  11158. !!end
  11159. !!test
  11160. Templates: P-wrapping: 1a. Templates on consecutive lines
  11161. !! wikitext
  11162. {{echo|Foo}}
  11163. {{echo|bar}}
  11164. !! html
  11165. <p>Foo
  11166. bar
  11167. </p>
  11168. !!end
  11169. !!test
  11170. Templates: P-wrapping: 1b. Templates on consecutive lines
  11171. !! wikitext
  11172. Foo
  11173. {{echo|bar}}
  11174. {{echo|baz}}
  11175. !! html
  11176. <p>Foo
  11177. </p><p>bar
  11178. baz
  11179. </p>
  11180. !!end
  11181. !!test
  11182. Templates: P-wrapping: 1c. Templates on consecutive lines
  11183. !! wikitext
  11184. {{echo|Foo}}
  11185. {{echo|bar}} <div>baz</div>
  11186. !! html
  11187. <p>Foo
  11188. </p>
  11189. bar <div>baz</div>
  11190. !! html+tidy
  11191. <p>Foo
  11192. </p><p>
  11193. bar </p><div>baz</div>
  11194. !! end
  11195. !!test
  11196. Templates: P-wrapping: 1d. Template preceded by comment-only line
  11197. !!options
  11198. parsoid
  11199. !! wikitext
  11200. <!-- foo -->
  11201. {{echo|Bar}}
  11202. !! html
  11203. <!-- foo -->
  11204. <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
  11205. !!end
  11206. !!test
  11207. Templates: Inline Text: 1. Multiple template uses
  11208. !! wikitext
  11209. {{echo|Foo}}bar{{echo|baz}}
  11210. !! html
  11211. <p>Foobarbaz
  11212. </p>
  11213. !!end
  11214. !!test
  11215. Templates: Inline Text: 2. Back-to-back template uses
  11216. !! wikitext
  11217. {{echo|Foo}}{{echo|bar}}
  11218. !! html
  11219. <p>Foobar
  11220. </p>
  11221. !!end
  11222. !!test
  11223. Templates: Block Tags: 1. Multiple template uses
  11224. !! wikitext
  11225. {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
  11226. !! html
  11227. <div>Foo</div><div>bar</div><div>baz</div>
  11228. !!end
  11229. !!test
  11230. Templates: Block Tags: 2. Back-to-back template uses
  11231. !! wikitext
  11232. {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
  11233. !! html
  11234. <div>Foo</div><div>bar</div>
  11235. !!end
  11236. # This is an edge case relating to paragraph wrapping.
  11237. !!test
  11238. Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
  11239. !! wikitext
  11240. {{echo|a
  11241. b</p>}}
  11242. !! html/parsoid
  11243. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb&lt;/p>"}},"i":0}}]}'>a
  11244. b</p>
  11245. !!end
  11246. !!test
  11247. Templates: Links: 1. Simple example
  11248. !! wikitext
  11249. {{echo|[[Foo|bar]]}}
  11250. !! html
  11251. <p><a href="/wiki/Foo" title="Foo">bar</a>
  11252. </p>
  11253. !!end
  11254. !!test
  11255. Templates: Links: 2. Generation of link href
  11256. !! wikitext
  11257. [[{{echo|Foo}}|bar]]
  11258. !! html
  11259. <p><a href="/wiki/Foo" title="Foo">bar</a>
  11260. </p>
  11261. !!end
  11262. !!test
  11263. Templates: Links: 3. Generation of part of a link href
  11264. !! wikitext
  11265. [[Fo{{echo|o}}|bar]]
  11266. [[Foo{{echo|bar}}]]
  11267. [[Foo{{echo|bar}}baz]]
  11268. [[Foo{{echo|bar}}|bar]]
  11269. [[:Foo{{echo|bar}}]]
  11270. [[:Foo{{echo|bar}}|bar]]
  11271. !! html
  11272. <p><a href="/wiki/Foo" title="Foo">bar</a>
  11273. </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
  11274. </p><p><a href="/index.php?title=Foobarbaz&amp;action=edit&amp;redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
  11275. </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
  11276. </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
  11277. </p><p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
  11278. </p>
  11279. !!end
  11280. !!test
  11281. Templates: Links: 4. Multiple templates generating link href
  11282. !! wikitext
  11283. [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
  11284. !! html
  11285. <p><a href="/index.php?title=Foobar&amp;action=edit&amp;redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
  11286. </p>
  11287. !!end
  11288. !!test
  11289. Templates: Links: 5. Generation of link text
  11290. !! wikitext
  11291. [[Foo|{{echo|bar}}]]
  11292. !! html
  11293. <p><a href="/wiki/Foo" title="Foo">bar</a>
  11294. </p>
  11295. !!end
  11296. !!test
  11297. Templates: Links: 5. Nested templates (only outermost template should be marked)
  11298. !! wikitext
  11299. {{echo|[[{{echo|Foo}}|bar]]}}
  11300. !! html
  11301. <p><a href="/wiki/Foo" title="Foo">bar</a>
  11302. </p>
  11303. !!end
  11304. !!test
  11305. Templates: HTML Tag: 1. Generation of HTML attr. key
  11306. !! wikitext
  11307. <div {{echo|style}}="color:red;">foo</div>
  11308. !! html
  11309. <div style="color:red;">foo</div>
  11310. !!end
  11311. !!test
  11312. Templates: HTML Tag: 2. Generation of HTML attr. value
  11313. !! wikitext
  11314. <div style={{echo|'color:red;'}}>foo</div>
  11315. !! html
  11316. <div style="color:red;">foo</div>
  11317. !!end
  11318. !!test
  11319. Templates: HTML Tag: 3. Generation of HTML attr key and value
  11320. !! wikitext
  11321. <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
  11322. !! html
  11323. <div style="color:red;">foo</div>
  11324. !!end
  11325. !!test
  11326. Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
  11327. !! wikitext
  11328. <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
  11329. !! html
  11330. <div title="This is a long title with just one piece templated">foo</div>
  11331. !!end
  11332. !!test
  11333. Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
  11334. !! wikitext
  11335. <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
  11336. !! html
  11337. <div title="This is a long title with just one piece templated">foo</div>
  11338. !!end
  11339. !!test
  11340. Templates: HTML Tag: 6. Generation of end piece of HTML attr value
  11341. !! wikitext
  11342. <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
  11343. !! html
  11344. <div title="This is a long title with just one piece templated">foo</div>
  11345. !!end
  11346. # SSS FIXME: While it is great we added support for all this,
  11347. # do we want to make this part of the spec? Maybe we want to
  11348. # deprecate this kind of usage in the future?
  11349. !!test
  11350. Templates: HTML Tag: 7. Generation of partial attribute key string
  11351. !! wikitext
  11352. <div st{{echo|yle}}="color:red;">foo</div>
  11353. !! html
  11354. <div style="color:red;">foo</div>
  11355. !!end
  11356. !! test
  11357. Templates: HTML Tag: 8. Template-generated attribute (k=v)
  11358. !! wikitext
  11359. <div {{echo|1=id="v1"}}>bar</div>
  11360. !! html
  11361. <div id="v1">bar</div>
  11362. !!end
  11363. !! test
  11364. Templates: HTML Tag: 9. Multiple template-generated attributes
  11365. !! wikitext
  11366. <div {{echo|1=id="v1" title="foo"}}>bar</div>
  11367. !! html
  11368. <div id="v1" title="foo">bar</div>
  11369. !!end
  11370. !! test
  11371. Templates: Support for templates generating attributes and content
  11372. !! wikitext
  11373. {| {{mixed_attr_content_template}}
  11374. |-
  11375. |bar
  11376. |}
  11377. !! html/php
  11378. <table style="color:red;" title="T48811">
  11379. <tr>
  11380. <td>foo
  11381. </td></tr>
  11382. <tr>
  11383. <td>bar
  11384. </td></tr></table>
  11385. !! html/parsoid
  11386. <table style="color:red;" title="T48811" about="#mwt1" typeof="mw:Transclusion mw:ExpandedAttrs" data-mw='{"parts":["{| ",{"template":{"target":{"wt":"mixed_attr_content_template","href":"./Template:Mixed_attr_content_template"},"params":{},"i":0}},"\n|-\n|bar\n|}"]}'>
  11387. <tbody><tr>
  11388. <td>foo</td></tr>
  11389. <tr>
  11390. <td>bar</td></tr>
  11391. </tbody></table>
  11392. !!end
  11393. !! test
  11394. 1. Entities and nowikis inside templated attributes should be handled correctly
  11395. !! wikitext
  11396. <div {{echo|style{{=}}"background:&#35;f9f9f9;"}}>foo</div>
  11397. !! html/php
  11398. <div style="background:#f9f9f9;">foo</div>
  11399. !! html/parsoid
  11400. <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}&#39;>style&lt;/span>&lt;span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">\"background:&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&#39;{\"src\":\"&amp;amp;#35;\",\"srcContent\":\"#\"}&#39;>#&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"&lt;/span>"},{"html":""}]]}'>foo</div>
  11401. !! end
  11402. !! test
  11403. 2. Entities and nowikis inside templated attributes should be handled correctly
  11404. !! wikitext
  11405. {|
  11406. |{{table_attribs_3}}
  11407. |}
  11408. !! html/php
  11409. <table>
  11410. <tr>
  11411. <td style="background:#f9f9f9;">Foo
  11412. </td></tr></table>
  11413. !! html/parsoid
  11414. <table>
  11415. <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td style="background:#f9f9f9;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":0}}]}'>Foo</td></tr>
  11416. </tbody></table>
  11417. !! end
  11418. !! test
  11419. 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
  11420. !! wikitext
  11421. {{tbl-start}}
  11422. |{{table_attribs_3}}
  11423. {{tbl-end}}
  11424. !! html/php
  11425. <table>
  11426. <tr>
  11427. <td style="background:#f9f9f9;">Foo
  11428. </td></tr></table>
  11429. !! html/parsoid
  11430. <table about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[],[],[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"tbl-start","href":"./Template:Tbl-start"},"params":{},"i":0}},"\n|",{"template":{"target":{"wt":"table_attribs_3","href":"./Template:Table_attribs_3"},"params":{},"i":1}},"\n",{"template":{"target":{"wt":"tbl-end","href":"./Template:Tbl-end"},"params":{},"i":2}}]}'>
  11431. <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
  11432. </tbody></table>
  11433. !! end
  11434. # T107622
  11435. !! test
  11436. 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
  11437. !! wikitext
  11438. {|
  11439. |{{table_attribs_6}} hi
  11440. |}
  11441. !! html/php
  11442. <table>
  11443. <tr>
  11444. <td style="background: red;">hi
  11445. </td></tr></table>
  11446. !! html/parsoid
  11447. <table>
  11448. <tbody><tr><td style="background: red;" typeof="mw:Transclusion" about="#mwt1" data-parsoid='{"autoInsertedEnd":true,"pi":[[]]}' data-mw='{"parts":["|",{"template":{"target":{"wt":"table_attribs_6","href":"./Template:Table_attribs_6"},"params":{},"i":0}}," hi"]}'> hi</td></tr>
  11449. </tbody></table>
  11450. !! end
  11451. !!test
  11452. Templates: HTML Tables: 1. Generating start of a HTML table
  11453. !! wikitext
  11454. {{echo|<table><tr><td>foo</td>}}</tr></table>
  11455. !! html
  11456. <table><tr><td>foo</td></tr></table>
  11457. !!end
  11458. !!test
  11459. Templates: HTML Tables: 2a. Generating middle of a HTML table
  11460. !! wikitext
  11461. <table><tr>{{echo|<td>foo</td>}}</tr></table>
  11462. !! html
  11463. <table><tr><td>foo</td></tr></table>
  11464. !!end
  11465. !!test
  11466. Templates: HTML Tables: 2b. Generating middle of a HTML table
  11467. !! wikitext
  11468. <table>{{echo|<tr><td>foo</td></tr>}}</table>
  11469. !! html
  11470. <table><tr><td>foo</td></tr></table>
  11471. !!end
  11472. !!test
  11473. Templates: HTML Tables: 3. Generating end of a HTML table
  11474. !! wikitext
  11475. <table><tr>{{echo|<td>foo</td></tr></table>}}
  11476. !! html
  11477. <table><tr><td>foo</td></tr></table>
  11478. !!end
  11479. !!test
  11480. Templates: HTML Tables: 4a. Generating a single tag of a HTML table
  11481. !! wikitext
  11482. {{echo|<table>}}<tr><td>foo</td></tr></table>
  11483. !! html
  11484. <table><tr><td>foo</td></tr></table>
  11485. !!end
  11486. !!test
  11487. Templates: HTML Tables: 4b. Generating a single tag of a HTML table
  11488. !! wikitext
  11489. <table>{{echo|<tr>}}<td>foo</td></tr></table>
  11490. !! html
  11491. <table><tr><td>foo</td></tr></table>
  11492. !!end
  11493. !!test
  11494. Templates: HTML Tables: 4c. Generating a single tag of a HTML table
  11495. !! wikitext
  11496. <table><tr>{{echo|<td>}}foo</td></tr></table>
  11497. !! html
  11498. <table><tr><td>foo</td></tr></table>
  11499. !!end
  11500. !!test
  11501. Templates: HTML Tables: 4d. Generating a single tag of a HTML table
  11502. !! wikitext
  11503. <table><tr><td>foo{{echo|</td>}}</tr></table>
  11504. !! html
  11505. <table><tr><td>foo</td></tr></table>
  11506. !!end
  11507. !!test
  11508. Templates: HTML Tables: 4e. Generating a single tag of a HTML table
  11509. !! wikitext
  11510. <table><tr><td>foo</td>{{echo|</tr>}}</table>
  11511. !! html
  11512. <table><tr><td>foo</td></tr></table>
  11513. !!end
  11514. !!test
  11515. Templates: HTML Tables: 4f. Generating a single tag of a HTML table
  11516. !! wikitext
  11517. <table><tr><td>foo</td></tr>{{echo|</table>}}
  11518. !! html
  11519. <table><tr><td>foo</td></tr></table>
  11520. !!end
  11521. !!test
  11522. Templates: HTML Tables: 5. Proper fostering of categories from inside
  11523. !!options
  11524. parsoid=wt2html,wt2wt
  11525. !! wikitext
  11526. <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
  11527. <!--Two categories (T52330)-->
  11528. <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
  11529. !! html
  11530. <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
  11531. <!--Two categories (T52330)-->
  11532. <link rel="mw:PageProp/Category" href="./Category:Bar1"><link rel="mw:PageProp/Category" href="./Category:Bar2"><table><tbody><tr><td>foo</td></tr></tbody></table>
  11533. !!end
  11534. !!test
  11535. Templates: Wiki Tables: 1a. Fostering of entire template content
  11536. !! wikitext
  11537. {|
  11538. {{echo|a}}
  11539. |}
  11540. !! html
  11541. <table>
  11542. a
  11543. <tr><td></td></tr></table>
  11544. !! html/php+tidy
  11545. a
  11546. <table><tbody><tr><td></td></tr></tbody></table>
  11547. !! html/parsoid
  11548. <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}},"\n|}"]}'>a</p><table about="#mwt2">
  11549. </table>
  11550. !! end
  11551. !!test
  11552. Templates: Wiki Tables: 1b. Fostering of entire template content
  11553. !! wikitext
  11554. {|
  11555. {{echo|<div>}}
  11556. foo
  11557. {{echo|</div>}}
  11558. |}
  11559. !! html
  11560. <table>
  11561. <div>
  11562. <p>foo
  11563. </p>
  11564. </div>
  11565. <tr><td></td></tr></table>
  11566. !! html/php+tidy
  11567. <div>
  11568. <p>foo
  11569. </p>
  11570. </div><table>
  11571. <tbody><tr><td></td></tr></tbody></table>
  11572. !! html/parsoid
  11573. <div about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"stx":"html","fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}],[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":0}},"\nfoo\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":1}},"\n|}"]}'>
  11574. <p>foo</p>
  11575. </div><table about="#mwt3">
  11576. </table>
  11577. !! end
  11578. !!test
  11579. Templates: Wiki Tables: 2. Fostering of partial template content
  11580. !! wikitext
  11581. {|
  11582. {{echo|a
  11583. <div>b</div>}}
  11584. |}
  11585. !! html
  11586. <table>
  11587. a
  11588. <div>b</div>
  11589. <tr><td></td></tr></table>
  11590. !! html/php+tidy
  11591. a
  11592. <div>b</div><table>
  11593. <tbody><tr><td></td></tr></tbody></table>
  11594. !! html/parsoid
  11595. <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"fostered":true,"autoInsertedEnd":true,"firstWikitextNode":"TABLE","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n&lt;div>b&lt;/div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
  11596. </table>
  11597. !! end
  11598. !!test
  11599. Templates: Wiki Tables: 3. td-content via multiple templates
  11600. !! wikitext
  11601. {|
  11602. {{echo|{{pipe}}a}}{{echo|b}}
  11603. |}
  11604. !! html
  11605. <table>
  11606. <tr>
  11607. <td>ab
  11608. </td></tr></table>
  11609. !!end
  11610. !!test
  11611. Templates: Wiki Tables: 4. Templated tags, no content
  11612. !! wikitext
  11613. {{tbl-start}}
  11614. {{tbl-end}}
  11615. !! html
  11616. <table>
  11617. <tr><td></td></tr></table>
  11618. !!end
  11619. !!test
  11620. Templates: Wiki Tables: 5. Templated tags, regular td-tags
  11621. !! wikitext
  11622. {{tbl-start}}
  11623. |foo
  11624. {{tbl-end}}
  11625. !! html
  11626. <table>
  11627. <tr>
  11628. <td>foo
  11629. </td></tr></table>
  11630. !!end
  11631. !!test
  11632. Templates: Wiki Tables: 6. Templated tags, templated td-tags
  11633. !! wikitext
  11634. {{tbl-start}}
  11635. {{!}}foo
  11636. {{tbl-end}}
  11637. !! html
  11638. <table>
  11639. <tr>
  11640. <td>foo
  11641. </td></tr></table>
  11642. !!end
  11643. ## This test case is very specific to Parsoid's internals
  11644. ## and is hence only tested for Parsoid's code. Parsoid uses
  11645. ## a <meta> marker tag for <ref> tags and they are expanded
  11646. ## much later. We are verifying that this <meta> tag usage
  11647. ## doesn't prevent foster parenting.
  11648. !!test
  11649. Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
  11650. !!wikitext
  11651. {{PartialTable}}<ref>foo</ref>
  11652. |}
  11653. <references />
  11654. !!html/parsoid
  11655. <sup about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"PartialTable","href":"./Template:PartialTable"},"params":{},"i":0}},"&lt;ref>foo&lt;/ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup><table about="#mwt2">
  11656. <tbody>
  11657. </tbody></table>
  11658. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
  11659. !!end
  11660. !! test
  11661. Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
  11662. !! wikitext
  11663. {{echo|
  11664. {{{!}}
  11665. {{!}}-}}
  11666. <onlyinclude>
  11667. |foo
  11668. </onlyinclude>
  11669. {{!}}}
  11670. !! html/parsoid
  11671. <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n&lt;onlyinclude>\n|foo\n&lt;/onlyinclude>\n{{!}}}"]}'>
  11672. </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
  11673. <tbody><tr>
  11674. <td>foo
  11675. <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
  11676. </tbody></table>
  11677. !! end
  11678. !!test
  11679. Templates: Lists: Multi-line list-items via templates
  11680. !! wikitext
  11681. *{{echo|a {{nonexistent|
  11682. unused}}}}
  11683. *{{echo|b {{nonexistent|
  11684. unused}}}}
  11685. !! html
  11686. <ul><li>a <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
  11687. <li>b <a href="/index.php?title=Template:Nonexistent&amp;action=edit&amp;redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
  11688. !!end
  11689. !!test
  11690. Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
  11691. !! wikitext
  11692. {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
  11693. !! html
  11694. <p><i>ab</i>c<i>d</i>e
  11695. </p>
  11696. !!end
  11697. !!test
  11698. Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
  11699. (PHP parser generates misnested html)
  11700. !! wikitext
  11701. {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
  11702. !! html/parsoid
  11703. <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}},{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_span&quot;,&quot;href&quot;:&quot;./Template:Echo_with_span&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
  11704. !!end
  11705. !!test
  11706. Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
  11707. (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
  11708. !! options
  11709. parsoid=wt2html,wt2wt
  11710. !! wikitext
  11711. {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
  11712. !! html
  11713. <div about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''a&quot;}},&quot;i&quot;:0}}]}"><i>a</i></div>
  11714. <div about="#mwt2" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;b''c''d&quot;}},&quot;i&quot;:0}}]}"><i>b</i>c<i>d</i></div>
  11715. <div about="#mwt3" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo_with_div&quot;,&quot;href&quot;:&quot;./Template:Echo_with_div&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;''e&quot;}},&quot;i&quot;:0}}]}">e</div>
  11716. !!end
  11717. !!test
  11718. Templates: Ugly nesting: 4. Divs opened/closed across templates
  11719. !! wikitext
  11720. a<div>b{{echo|c</div>d}}e
  11721. !! html
  11722. a<div>bc</div>de
  11723. !! html+tidy
  11724. <p>a</p><div>bc</div><p>de
  11725. </p>
  11726. !! end
  11727. !! test
  11728. Templates: Ugly templates: 3. newline-only template parameter
  11729. !! wikitext
  11730. foo {{echo|
  11731. }}
  11732. !! html
  11733. <p>foo
  11734. </p>
  11735. !! end
  11736. # This looks like a bug: a single newline triggers p/br for some reason.
  11737. !! test
  11738. Templates: Ugly templates: 4. newline-only template parameter inconsistency
  11739. !! wikitext
  11740. {{echo|
  11741. }}
  11742. !! html
  11743. <p><br />
  11744. </p>
  11745. !! end
  11746. # T66017 -- ugly wikitext with fostered content generates two template ranges that
  11747. # have a true overlap (T1-start - T2-start - T1-end - T2-end).
  11748. !! test
  11749. Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
  11750. !! wikitext
  11751. {{echo|<table>}}
  11752. {{echo|<div>foo}}
  11753. {{echo|</table>}}
  11754. !! html/parsoid
  11755. <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
  11756. </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
  11757. </table>
  11758. !! end
  11759. # T66017 -- ugly wikitext with fostered content generates two template ranges
  11760. # that are "identical" and generate nesting cycles in the algorithm
  11761. !! test
  11762. Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
  11763. !! wikitext
  11764. {{echo|<table><tr><td><table>}}
  11765. {{echo|<div>}}
  11766. {{echo|</div>}}
  11767. !! html/parsoid
  11768. <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>&lt;tr>&lt;td>&lt;table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;/div>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>
  11769. </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
  11770. </table></td></tr></tbody></table>
  11771. !! end
  11772. !! test
  11773. Templates: Parameters substituted at the top-level
  11774. !! wikitext
  11775. {{{foo|''who'' {{echo|me}}? '''never!'''}}}
  11776. {{{foo|bar|baz}}}
  11777. !! html/php
  11778. <p><i>who</i> me? <b>never!</b>
  11779. </p><p>bar
  11780. </p>
  11781. !! html/parsoid
  11782. <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"&#39;&#39;who&#39;&#39; {{echo|me}}? &#39;&#39;&#39;never!&#39;&#39;&#39;"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
  11783. <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
  11784. !! end
  11785. !! test
  11786. Templates: Param with empty arg in the final position
  11787. !! wikitext
  11788. {{{hi|}}}
  11789. !! html/parsoid
  11790. <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
  11791. !! end
  11792. !!test
  11793. Parser Functions: 1. Simple example
  11794. !! wikitext
  11795. {{uc:foo}}
  11796. !! html
  11797. <p>FOO
  11798. </p>
  11799. !!end
  11800. !!test
  11801. Parser Functions: 2. Nested use (only outermost should be marked up)
  11802. !! wikitext
  11803. {{uc:{{lc:FOO}}}}
  11804. !! html
  11805. <p>FOO
  11806. </p>
  11807. !!end
  11808. ###
  11809. ### Pre-save transform tests
  11810. ###
  11811. !! test
  11812. pre-save transform: subst:
  11813. !! options
  11814. pst
  11815. !! wikitext
  11816. {{subst:test}}
  11817. !! html/php
  11818. This is a test template
  11819. !! end
  11820. !! test
  11821. pre-save transform: normal template
  11822. !! options
  11823. pst
  11824. !! wikitext
  11825. {{test}}
  11826. !! html/php
  11827. {{test}}
  11828. !! end
  11829. !! test
  11830. pre-save transform: nonexistent template
  11831. !! options
  11832. pst
  11833. !! wikitext
  11834. {{thistemplatedoesnotexist}}
  11835. !! html/php
  11836. {{thistemplatedoesnotexist}}
  11837. !! end
  11838. !! test
  11839. pre-save transform: subst magic variables
  11840. !! options
  11841. pst
  11842. !! wikitext
  11843. {{subst:SITENAME}}
  11844. !! html/php
  11845. MediaWiki
  11846. !! end
  11847. # This is T2089, which I fixed. -- wtm
  11848. !! test
  11849. pre-save transform: subst: templates with parameters
  11850. !! options
  11851. pst
  11852. !! wikitext
  11853. {{subst:paramtest|param="something else"}}
  11854. !! html/php
  11855. This is a test template with parameter "something else"
  11856. !! end
  11857. !! article
  11858. Template:nowikitest
  11859. !! text
  11860. <nowiki>'''not wiki'''</nowiki>
  11861. !! endarticle
  11862. !! test
  11863. pre-save transform: nowiki in subst (T3188)
  11864. !! options
  11865. pst
  11866. !! wikitext
  11867. {{subst:nowikitest}}
  11868. !! html/php
  11869. <nowiki>'''not wiki'''</nowiki>
  11870. !! end
  11871. !! article
  11872. Template:commenttest
  11873. !! text
  11874. This template has <!-- a comment --> in it.
  11875. !! endarticle
  11876. !! test
  11877. pre-save transform: comment in subst (T3936)
  11878. !! options
  11879. pst
  11880. !! wikitext
  11881. {{subst:commenttest}}
  11882. !! html/php
  11883. This template has <!-- a comment --> in it.
  11884. !! end
  11885. !! test
  11886. pre-save transform: unclosed tag
  11887. !! options
  11888. pst
  11889. !! wikitext
  11890. <nowiki>'''not wiki'''
  11891. !! html/php
  11892. <nowiki>'''not wiki'''
  11893. !! end
  11894. !! test
  11895. pre-save transform: mixed tag case
  11896. !! options
  11897. pst
  11898. !! wikitext
  11899. <NOwiki>'''not wiki'''</noWIKI>
  11900. !! html/php
  11901. <NOwiki>'''not wiki'''</noWIKI>
  11902. !! end
  11903. !! test
  11904. pre-save transform: unclosed comment in <nowiki>
  11905. !! options
  11906. pst
  11907. !! wikitext
  11908. wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
  11909. !! html/php
  11910. wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
  11911. !!end
  11912. # Leading @ in this template definition works around a limitation
  11913. # in parsoid's parserTests which otherwise strips the <span> from the
  11914. # result (confusing it for a template wrapper)
  11915. !! article
  11916. Template:dangerous
  11917. !!text
  11918. @<span onmouseover="alert('crap')">Oh no</span>
  11919. !!endarticle
  11920. !!test
  11921. (confirming safety of fix for subst T3936)
  11922. !! wikitext
  11923. {{Template:dangerous}}
  11924. !! html
  11925. <p>@<span>Oh no</span>
  11926. </p>
  11927. !! end
  11928. !! test
  11929. pre-save transform: comment containing gallery (T7024)
  11930. !! options
  11931. pst
  11932. !! wikitext
  11933. <!-- <gallery>data</gallery> -->
  11934. !! html/php
  11935. <!-- <gallery>data</gallery> -->
  11936. !!end
  11937. !! test
  11938. pre-save transform: comment containing extension
  11939. !! options
  11940. pst
  11941. !! wikitext
  11942. <!-- <tag>data</tag> -->
  11943. !! html/php
  11944. <!-- <tag>data</tag> -->
  11945. !!end
  11946. !! test
  11947. pre-save transform: comment containing nowiki
  11948. !! options
  11949. pst
  11950. !! wikitext
  11951. <!-- <nowiki>data</nowiki> -->
  11952. !! html/php
  11953. <!-- <nowiki>data</nowiki> -->
  11954. !!end
  11955. !! test
  11956. pre-save transform: <noinclude> in subst (T5298)
  11957. !! options
  11958. pst
  11959. !! wikitext
  11960. {{subst:Includes}}
  11961. !! html/php
  11962. Foobar
  11963. !! end
  11964. !! test
  11965. pre-save transform: <onlyinclude> in subst (T5298)
  11966. !! options
  11967. pst
  11968. !! wikitext
  11969. {{subst:Includes2}}
  11970. !! html/php
  11971. Foo
  11972. !! end
  11973. !! article
  11974. Template:SubstTest
  11975. !!text
  11976. {{<includeonly>subst:</includeonly>Includes}}
  11977. !! endarticle
  11978. !! article
  11979. Template:SafeSubstTest
  11980. !! text
  11981. {{<includeonly>safesubst:</includeonly>Includes}}
  11982. !! endarticle
  11983. !! test
  11984. T24297: safesubst: works during PST
  11985. !! options
  11986. pst
  11987. !! wikitext
  11988. {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
  11989. !! html/php
  11990. FoobarFoobar
  11991. !! end
  11992. !! test
  11993. T24297: safesubst: works during normal parse
  11994. !! wikitext
  11995. {{SafeSubstTest}}
  11996. !! html
  11997. <p>Foobar
  11998. </p>
  11999. !! end
  12000. !! test
  12001. subst: does not work during normal parse
  12002. !! wikitext
  12003. {{SubstTest}}
  12004. !! html
  12005. <p>{{subst:Includes}}
  12006. </p>
  12007. !! end
  12008. !! test
  12009. pre-save transform: context links ("pipe trick")
  12010. !! options
  12011. pst
  12012. !! wikitext
  12013. [[Article (context)|]]
  12014. [[Bar:Article|]]
  12015. [[:Bar:Article|]]
  12016. [[Bar:Article (context)|]]
  12017. [[:Bar:Article (context)|]]
  12018. [[|Article]]
  12019. [[|Article (context)]]
  12020. [[Bar:X (Y) Z|]]
  12021. [[:Bar:X (Y) Z|]]
  12022. !! html/php
  12023. [[Article (context)|Article]]
  12024. [[Bar:Article|Article]]
  12025. [[:Bar:Article|Article]]
  12026. [[Bar:Article (context)|Article]]
  12027. [[:Bar:Article (context)|Article]]
  12028. [[Article]]
  12029. [[Article (context)]]
  12030. [[Bar:X (Y) Z|X (Y) Z]]
  12031. [[:Bar:X (Y) Z|X (Y) Z]]
  12032. !! end
  12033. !! test
  12034. pre-save transform: context links ("pipe trick") with interwiki prefix
  12035. !! options
  12036. pst
  12037. !! wikitext
  12038. [[interwiki:Article|]]
  12039. [[:interwiki:Article|]]
  12040. [[interwiki:Bar:Article|]]
  12041. [[:interwiki:Bar:Article|]]
  12042. !! html/php
  12043. [[interwiki:Article|Article]]
  12044. [[:interwiki:Article|Article]]
  12045. [[interwiki:Bar:Article|Bar:Article]]
  12046. [[:interwiki:Bar:Article|Bar:Article]]
  12047. !! end
  12048. !! test
  12049. pre-save transform: context links ("pipe trick") with parens in title
  12050. !! options
  12051. pst title=[[Somearticle (context)]]
  12052. !! wikitext
  12053. [[|Article]]
  12054. !! html/php
  12055. [[Article (context)|Article]]
  12056. !! end
  12057. !! test
  12058. pre-save transform: context links ("pipe trick") with comma in title
  12059. !! options
  12060. pst title=[[Someplace, Somewhere]]
  12061. !! wikitext
  12062. [[|Otherplace]]
  12063. [[Otherplace, Elsewhere|]]
  12064. [[Otherplace, Elsewhere, Anywhere|]]
  12065. !! html/php
  12066. [[Otherplace, Somewhere|Otherplace]]
  12067. [[Otherplace, Elsewhere|Otherplace]]
  12068. [[Otherplace, Elsewhere, Anywhere|Otherplace]]
  12069. !! end
  12070. !! test
  12071. pre-save transform: context links ("pipe trick") with parens and comma
  12072. !! options
  12073. pst title=[[Someplace (IGNORED), Somewhere]]
  12074. !! wikitext
  12075. [[|Otherplace]]
  12076. [[Otherplace (place), Elsewhere|]]
  12077. !! html/php
  12078. [[Otherplace, Somewhere|Otherplace]]
  12079. [[Otherplace (place), Elsewhere|Otherplace]]
  12080. !! end
  12081. !! test
  12082. pre-save transform: context links ("pipe trick") with comma and parens
  12083. !! options
  12084. pst title=[[Who, me? (context)]]
  12085. !! wikitext
  12086. [[|Yes, you.]]
  12087. [[Me, Myself, and I (1937 song)|]]
  12088. !! html/php
  12089. [[Yes, you. (context)|Yes, you.]]
  12090. [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
  12091. !! end
  12092. !! test
  12093. pre-save transform: context links ("pipe trick") with namespace
  12094. !! options
  12095. pst title=[[Ns:Somearticle]]
  12096. !! wikitext
  12097. [[|Article]]
  12098. !! html/php
  12099. [[Ns:Article|Article]]
  12100. !! end
  12101. !! test
  12102. pre-save transform: context links ("pipe trick") with namespace and parens
  12103. !! options
  12104. pst title=[[Ns:Somearticle (context)]]
  12105. !! wikitext
  12106. [[|Article]]
  12107. !! html/php
  12108. [[Ns:Article (context)|Article]]
  12109. !! end
  12110. !! test
  12111. pre-save transform: context links ("pipe trick") with namespace and comma
  12112. !! options
  12113. pst title=[[Ns:Somearticle, Context, Whatever]]
  12114. !! wikitext
  12115. [[|Article]]
  12116. !! html/php
  12117. [[Ns:Article, Context, Whatever|Article]]
  12118. !! end
  12119. !! test
  12120. pre-save transform: context links ("pipe trick") with namespace, comma and parens
  12121. !! options
  12122. pst title=[[Ns:Somearticle, Context (context)]]
  12123. !! wikitext
  12124. [[|Article]]
  12125. !! html/php
  12126. [[Ns:Article (context)|Article]]
  12127. !! end
  12128. !! test
  12129. pre-save transform: context links ("pipe trick") with namespace, parens and comma
  12130. !! options
  12131. pst title=[[Ns:Somearticle (IGNORED), Context]]
  12132. !! wikitext
  12133. [[|Article]]
  12134. !! html/php
  12135. [[Ns:Article, Context|Article]]
  12136. !! end
  12137. !! test
  12138. pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
  12139. !! options
  12140. pst
  12141. !! wikitext
  12142. [[Article(context)|]]
  12143. [[Bar:Article(context)|]]
  12144. [[:Bar:Article(context)|]]
  12145. [[|Article(context)]]
  12146. [[Bar:X(Y)Z|]]
  12147. [[:Bar:X(Y)Z|]]
  12148. !! html/php
  12149. [[Article(context)|Article]]
  12150. [[Bar:Article(context)|Article]]
  12151. [[:Bar:Article(context)|Article]]
  12152. [[Article(context)]]
  12153. [[Bar:X(Y)Z|X(Y)Z]]
  12154. [[:Bar:X(Y)Z|X(Y)Z]]
  12155. !! end
  12156. !! test
  12157. pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
  12158. !! options
  12159. pst
  12160. !! wikitext
  12161. [[Article (context)|]]
  12162. [[Bar:Article (context)|]]
  12163. [[:Bar:Article (context)|]]
  12164. [[|Article (context)]]
  12165. [[Bar:X (Y) Z|]]
  12166. [[:Bar:X (Y) Z|]]
  12167. !! html/php
  12168. [[Article (context)|Article]]
  12169. [[Bar:Article (context)|Article]]
  12170. [[:Bar:Article (context)|Article]]
  12171. [[Article (context)]]
  12172. [[Bar:X (Y) Z|X (Y) Z]]
  12173. [[:Bar:X (Y) Z|X (Y) Z]]
  12174. !! end
  12175. !! test
  12176. pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
  12177. !! options
  12178. pst
  12179. !! wikitext
  12180. [[Article(context)|]]
  12181. [[Bar:Article(context)|]]
  12182. [[:Bar:Article(context)|]]
  12183. [[|Article(context)]]
  12184. [[Bar:X(Y)Z|]]
  12185. [[:Bar:X(Y)Z|]]
  12186. !! html/php
  12187. [[Article(context)|Article]]
  12188. [[Bar:Article(context)|Article]]
  12189. [[:Bar:Article(context)|Article]]
  12190. [[Article(context)]]
  12191. [[Bar:X(Y)Z|X(Y)Z]]
  12192. [[:Bar:X(Y)Z|X(Y)Z]]
  12193. !! end
  12194. !! test
  12195. pre-save transform: context links ("pipe trick") with commas (T23660)
  12196. !! options
  12197. pst
  12198. !! wikitext
  12199. [[Article (context), context|]]
  12200. [[Article (context),context|]]
  12201. [[Bar:Article (context), context|]]
  12202. [[Bar:Article (context),context|]]
  12203. [[:Bar:Article (context), context|]]
  12204. [[:Bar:Article (context),context|]]
  12205. !! html/php
  12206. [[Article (context), context|Article]]
  12207. [[Article (context),context|Article]]
  12208. [[Bar:Article (context), context|Article]]
  12209. [[Bar:Article (context),context|Article]]
  12210. [[:Bar:Article (context), context|Article]]
  12211. [[:Bar:Article (context),context|Article]]
  12212. !! end
  12213. !! test
  12214. Parsoid: backwards pipe trick
  12215. !! wikitext
  12216. [[|'''bar''']]
  12217. !! html/php
  12218. <p>[[|<b>bar</b>]]
  12219. </p>
  12220. !! html/parsoid
  12221. <p>[[|<b>bar</b>]]</p>
  12222. !! end
  12223. !! test
  12224. pre-save transform: trim trailing empty lines
  12225. !! options
  12226. pst
  12227. !! wikitext
  12228. Empty lines are trimmed
  12229. !! html/php
  12230. Empty lines are trimmed
  12231. !! end
  12232. !! test
  12233. pre-save transform: Signature expansion
  12234. !! options
  12235. pst
  12236. !! wikitext
  12237. * ~~~
  12238. * ~~~~
  12239. * ~~~~~
  12240. * <noinclude>~~~</noinclude>
  12241. * <includeonly>~~~</includeonly>
  12242. * <onlyinclude>~~~</onlyinclude>
  12243. !! html/php
  12244. * [[Special:Contributions/127.0.0.1|127.0.0.1]]
  12245. * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
  12246. * 00:02, 1 January 1970 (UTC)
  12247. * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
  12248. * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
  12249. * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
  12250. !! end
  12251. !! test
  12252. ParserOutput flags from signature expansion (T84843)
  12253. !! options
  12254. pst
  12255. showflags
  12256. !! wikitext
  12257. ~~~~
  12258. !! html/php
  12259. [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
  12260. flags=user-signature
  12261. !! end
  12262. !! test
  12263. pre-save transform: Signature expansion in nowiki tags (T2093)
  12264. !! options
  12265. pst disabled
  12266. !! wikitext
  12267. Shall not expand:
  12268. <nowiki>~~~~</nowiki>
  12269. <includeonly><nowiki>~~~~</nowiki></includeonly>
  12270. <noinclude><nowiki>~~~~</nowiki></noinclude>
  12271. <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
  12272. {{subst:Foo}} shall be converted to FOO
  12273. As well as inside noinclude/onlyinclude
  12274. <noinclude>{{subst:Foo}}</noinclude>
  12275. <onlyinclude>{{subst:Foo}}</onlyinclude>
  12276. But not inside includeonly
  12277. <includeonly>{{subst:Foo}}</includeonly>
  12278. !! html/php
  12279. Shall not expand:
  12280. <nowiki>~~~~</nowiki>
  12281. <includeonly><nowiki>~~~~</nowiki></includeonly>
  12282. <noinclude><nowiki>~~~~</nowiki></noinclude>
  12283. <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
  12284. FOO shall be converted to FOO
  12285. As well as inside noinclude/onlyinclude
  12286. <noinclude>FOO</noinclude>
  12287. <onlyinclude>FOO</onlyinclude>
  12288. But not inside includeonly
  12289. <includeonly>{{subst:Foo}}</includeonly>
  12290. !! end
  12291. !! test
  12292. Parsoid: Recognize nowiki with trailing space in tags
  12293. !! options
  12294. parsoid=wt2html
  12295. !! wikitext
  12296. <nowiki ><div>[[foo]]</nowiki >
  12297. a<nowiki / >b
  12298. c<nowiki />d
  12299. e<nowiki/ >f
  12300. !! html
  12301. <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
  12302. <p>ab</p>
  12303. <p>cd</p>
  12304. <p>ef</p>
  12305. !! end
  12306. !! test
  12307. Parsoid: Recognize nowiki with odd capitalization
  12308. !! options
  12309. parsoid=wt2html
  12310. !! wikitext
  12311. <noWikI ><div>[[foo]]</Nowiki >
  12312. !! html
  12313. <p><span typeof="mw:Nowiki">&lt;div&gt;[[foo]]</span></p>
  12314. !! end
  12315. !! test
  12316. Parsoid: Escape nowiki with trailing space in tags
  12317. !! options
  12318. parsoid=html2wt
  12319. !! html/parsoid
  12320. <p>&lt;nowiki &gt; foo &lt/nowiki ></p>
  12321. <p>a&lt;nowiki /&gt;b</p>
  12322. <p>c&lt;nowiki/ &gt;d</p>
  12323. !! wikitext
  12324. &lt;nowiki &gt; foo &lt;/nowiki &gt;
  12325. a&lt;nowiki /&gt;b
  12326. c&lt;nowiki/ &gt;d
  12327. !! end
  12328. !! test
  12329. Parsoid: Escape weird noWikI capitalizations
  12330. !! options
  12331. parsoid=html2wt
  12332. !! html/parsoid
  12333. <p>&lt;noWikI &gt; foo &lt/NoWikI ></p>
  12334. !! wikitext
  12335. &lt;noWikI &gt; foo &lt;/NoWikI &gt;
  12336. !! end
  12337. ###
  12338. ### Message transform tests
  12339. ###
  12340. !! test
  12341. message transform: magic variables
  12342. !! options
  12343. msg
  12344. !! wikitext
  12345. {{SITENAME}}
  12346. !! html
  12347. MediaWiki
  12348. !! end
  12349. !! test
  12350. message transform: should not transform wiki markup
  12351. !! options
  12352. msg
  12353. !! wikitext
  12354. ''test''
  12355. !! html
  12356. ''test''
  12357. !! end
  12358. !! test
  12359. message transform: <noinclude> in transcluded template (T6926)
  12360. !! options
  12361. msg
  12362. !! wikitext
  12363. {{Includes}}
  12364. !! html
  12365. Foobar
  12366. !! end
  12367. !! test
  12368. message transform: <onlyinclude> in transcluded template (T6926)
  12369. !! options
  12370. msg
  12371. !! wikitext
  12372. {{Includes2}}
  12373. !! html
  12374. Foo
  12375. !! end
  12376. !! test
  12377. {{#special:}} page name, known
  12378. !! options
  12379. msg
  12380. !! wikitext
  12381. {{#special:Recentchanges}}
  12382. !! html
  12383. Special:RecentChanges
  12384. !! end
  12385. !! test
  12386. {{#special:}} page name with subpage, known
  12387. !! options
  12388. msg
  12389. !! wikitext
  12390. {{#special:Recentchanges/param}}
  12391. !! html
  12392. Special:RecentChanges/param
  12393. !! end
  12394. !! test
  12395. {{#special:}} page name, unknown
  12396. !! options
  12397. msg
  12398. !! wikitext
  12399. {{#special:foobar nonexistent}}
  12400. !! html
  12401. Special:Foobar nonexistent
  12402. !! end
  12403. !! test
  12404. {{#speciale:}} page name, known
  12405. !! options
  12406. msg
  12407. !! wikitext
  12408. {{#speciale:Recentchanges}}
  12409. !! html
  12410. Special:RecentChanges
  12411. !! end
  12412. !! test
  12413. {{#speciale:}} page name with subpage, known
  12414. !! options
  12415. msg
  12416. !! wikitext
  12417. {{#speciale:Recentchanges/param}}
  12418. !! html
  12419. Special:RecentChanges/param
  12420. !! end
  12421. !! test
  12422. {{#speciale:}} page name, unknown
  12423. !! options
  12424. msg
  12425. !! wikitext
  12426. {{#speciale:foobar nonexistent}}
  12427. !! html
  12428. Special:Foobar_nonexistent
  12429. !! end
  12430. ###
  12431. ### Images
  12432. ###
  12433. ### For Parsoid-specific tests, see
  12434. #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
  12435. !! test
  12436. Simple image
  12437. !! options
  12438. parsoid=wt2html,wt2wt,html2html
  12439. !! wikitext
  12440. [[Image:foobar.jpg]]
  12441. !! html/php
  12442. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12443. </p>
  12444. !! html/parsoid
  12445. <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12446. !! end
  12447. !! test
  12448. Serialize simple image with span wrapper
  12449. !! options
  12450. parsoid=html2wt
  12451. !! html/parsoid
  12452. <p><span class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></span></p>
  12453. !! wikitext
  12454. [[File:Foobar.jpg]]
  12455. !! end
  12456. !! test
  12457. Simple image (using File: namespace, now canonical)
  12458. !! wikitext
  12459. [[File:Foobar.jpg]]
  12460. !! html/php
  12461. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12462. </p>
  12463. !! html/parsoid
  12464. <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12465. !! end
  12466. !! test
  12467. Right-aligned image
  12468. !! wikitext
  12469. [[File:Foobar.jpg|right]]
  12470. !! html/php
  12471. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12472. !! html/parsoid
  12473. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
  12474. !! end
  12475. !! test
  12476. Image with caption
  12477. !! wikitext
  12478. [[File:Foobar.jpg|right|Caption text]]
  12479. !! html/php
  12480. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12481. !! html/parsoid
  12482. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
  12483. !! end
  12484. !! test
  12485. Image with caption, T55312 #1
  12486. !! wikitext
  12487. [[File:Foobar.jpg|right|Caption page stuff]]
  12488. !! html/php
  12489. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page stuff"><img alt="Caption page stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12490. !! html/parsoid
  12491. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page stuff</figcaption></figure>
  12492. !! end
  12493. !! test
  12494. Image with caption, T55312 #2
  12495. !! wikitext
  12496. [[File:Foobar.jpg|right|Caption page=]]
  12497. !! html/php
  12498. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page="><img alt="Caption page=" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12499. !! html/parsoid
  12500. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=</figcaption></figure>
  12501. !! end
  12502. !! test
  12503. Image with caption, T55312 #3
  12504. !! wikitext
  12505. [[File:Foobar.jpg|right|Caption page=stuff]]
  12506. !! html/php
  12507. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption page=stuff"><img alt="Caption page=stuff" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12508. !! html/parsoid
  12509. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption page=stuff</figcaption></figure>
  12510. !! end
  12511. !! test
  12512. Image caption with pipe entity
  12513. !! wikitext
  12514. [[File:Foobar.jpg|thumb|one &#x7C; two]]
  12515. [[File:Foobar.jpg|thumb|one ''two'' &#x7C; three]]
  12516. !! html/php
  12517. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one &#x7c; two</div></div></div>
  12518. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>one <i>two</i> &#x7c; three</div></div></div>
  12519. !! html/parsoid
  12520. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <span typeof="mw:Entity">|</span> two</figcaption></figure>
  12521. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>one <i>two</i> <span typeof="mw:Entity">|</span> three</figcaption></figure>
  12522. !! end
  12523. !! test
  12524. Allow empty links in image captions (T62753)
  12525. !! options
  12526. thumbsize=220
  12527. !! wikitext
  12528. [[File:Foobar.jpg|thumb|Caption [[Link1]]
  12529. [[]]
  12530. [[Link2]]
  12531. ]]
  12532. !! html/php
  12533. <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Caption <a href="/index.php?title=Link1&amp;action=edit&amp;redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&amp;action=edit&amp;redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
  12534. !! html/parsoid
  12535. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption [[Link1]]\n[[]]\n[[Link2]]\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption <a rel="mw:WikiLink" href="./Link1" title="Link1" data-parsoid='{"stx":"simple","a":{"href":"./Link1"},"sa":{"href":"Link1"}}'>Link1</a>
  12536. [[]]
  12537. <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
  12538. </figcaption></figure>
  12539. !! end
  12540. !! test
  12541. Titles in unlinked images (T23454)
  12542. !! wikitext
  12543. [[File:Foobar.jpg|link=|stuff]]
  12544. !! html/php
  12545. <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
  12546. </p>
  12547. !! html/parsoid
  12548. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"stuff"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></figure-inline></p>
  12549. !! end
  12550. !! test
  12551. Link with empty target
  12552. !! wikitext
  12553. [[]]
  12554. !! html
  12555. <p>[[]]
  12556. </p>
  12557. !! end
  12558. !! test
  12559. Image with link trail
  12560. !! wikitext
  12561. Linktrails should not work for images: [[File:Foobar.jpg]]s
  12562. !! html/php
  12563. <p>Linktrails should not work for images: <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>s
  12564. </p>
  12565. !! html/parsoid
  12566. <p>Linktrails should not work for images: <figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline>s</p>
  12567. !! end
  12568. !! test
  12569. Image with empty attribute
  12570. !! options
  12571. parsoid=wt2html,wt2wt,html2html
  12572. !! wikitext
  12573. [[File:Foobar.jpg|right||Caption text]]
  12574. !! html/php
  12575. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12576. !! html/parsoid
  12577. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
  12578. !! end
  12579. !! test
  12580. 1. Block image with individual attributes from templates
  12581. !! wikitext
  12582. [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
  12583. !! html/php
  12584. <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
  12585. !! html/parsoid
  12586. <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
  12587. !! end
  12588. !! test
  12589. 2. Block Image with individual attributes from templates
  12590. !! wikitext
  12591. [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
  12592. !! html/php
  12593. <div class="thumb tright"><div class="thumbinner" style="width:139px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" width="137" height="16" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/206px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/274px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption</div></div></div>
  12594. !! html/parsoid
  12595. <figure typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt3" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"{{echo|thumb}}"},{"ck":"width","ak":"{{echo|137px}}"},{"ck":"caption","ak":"This is a caption"}]}' data-mw='{"attribs":[["thumbnail",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}&#39;>thumb&lt;/span>"}],["width",{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}&#39;>137px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/137px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="16" width="137" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"16","width":"137"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>This is a caption</figcaption></figure>
  12596. !! end
  12597. !! test
  12598. 3. Inline image with individual attributes from templates
  12599. !! wikitext
  12600. [[File:Foobar.jpg|{{echo|50px}}]]
  12601. !! html/php
  12602. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
  12603. </p>
  12604. !! html/parsoid
  12605. <p><figure-inline typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}&#39;>50px&lt;/span>"}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  12606. !! end
  12607. ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
  12608. ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
  12609. !! test
  12610. Image with multiple attributes from the same template
  12611. !! wikitext
  12612. [[File:Foobar.jpg|{{image_attribs}}]]
  12613. !! html/php
  12614. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption text"><img alt="Caption text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12615. !! html/parsoid
  12616. <figure class="mw-default-size mw-halign-right" typeof="mw:Image mw:Placeholder"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption text</figcaption></figure>
  12617. !! end
  12618. !! test
  12619. Image with link tails
  12620. !! options
  12621. thumbsize=220
  12622. !! wikitext
  12623. 123[[File:Foobar.jpg]]456
  12624. 123[[File:Foobar.jpg|right]]456
  12625. 123[[File:Foobar.jpg|thumb]]456
  12626. !! html/php
  12627. <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
  12628. </p>
  12629. 123<div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>456
  12630. 123<div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>456
  12631. !! html/php+tidy
  12632. <p>123<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>456
  12633. </p><p>
  12634. 123</p><div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div><p>456
  12635. 123</p><div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div><p>456
  12636. </p>
  12637. !! html/parsoid
  12638. <p>123<figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline>456</p>
  12639. <p>123</p><figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure><p>456</p>
  12640. <p>123</p><figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure><p>456</p>
  12641. !! end
  12642. !! test
  12643. Image with multiple captions -- only last one is accepted
  12644. !! wikitext
  12645. [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
  12646. !! html/php
  12647. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption3 - accepted"><img alt="Caption3 - accepted" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  12648. !! html/parsoid
  12649. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Caption3 - accepted</figcaption></figure>
  12650. !! end
  12651. !! test
  12652. Image with multiple widths -- use last
  12653. !! wikitext
  12654. [[File:Foobar.jpg|200px|300px|caption]]
  12655. !! html/php
  12656. <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" width="300" height="34" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/450px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/600px-Foobar.jpg 2x" /></a>
  12657. </p>
  12658. !! html/parsoid
  12659. <p><figure-inline typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure-inline></p>
  12660. !! end
  12661. !! test
  12662. Image with multiple alignments -- use first (T50664)
  12663. !! options
  12664. thumbsize=220
  12665. !! wikitext
  12666. [[File:Foobar.jpg|thumb|left|right|center|caption]]
  12667. [[File:Foobar.jpg|middle|text-top|caption]]
  12668. !! html/php
  12669. <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  12670. <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" style="vertical-align: middle" /></a>
  12671. </p>
  12672. !! html/parsoid
  12673. <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  12674. <p><figure-inline class="mw-default-size mw-valign-middle" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12675. !! end
  12676. !! test
  12677. Image with width attribute at different positions
  12678. !! wikitext
  12679. [[File:Foobar.jpg|200px|right|Caption]]
  12680. [[File:Foobar.jpg|right|200px|Caption]]
  12681. [[File:Foobar.jpg|right|Caption|200px]]
  12682. !! html/php
  12683. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
  12684. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
  12685. <div class="floatright"><a href="/wiki/File:Foobar.jpg" class="image" title="Caption"><img alt="Caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a></div>
  12686. !! html/parsoid
  12687. <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
  12688. <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
  12689. <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>Caption</figcaption></figure>
  12690. !! end
  12691. # a sad bit of backward-compatibility
  12692. !! test
  12693. Image with size specified with pxpx (T15500, T53628)
  12694. !! options
  12695. parsoid=wt2html,wt2wt,html2html
  12696. !! wikitext
  12697. [[File:Foobar.jpg|20pxpx]]
  12698. [[File:Foobar.jpg|200x20pxpx]]
  12699. !! html/php
  12700. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
  12701. <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" width="177" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/265px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/353px-Foobar.jpg 2x" /></a>
  12702. </p>
  12703. !! html/parsoid
  12704. <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline> <figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/177px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="177"/></a></figure-inline></p>
  12705. !! end
  12706. !! test
  12707. Image with link parameter, wiki target
  12708. !! wikitext
  12709. [[File:Foobar.jpg|link=Main Page]]
  12710. !! html/php
  12711. <p><a href="/wiki/Main_Page" title="Main Page"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12712. </p>
  12713. !! html/parsoid
  12714. <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12715. !! end
  12716. # parsoid T51293 (part 1)
  12717. !! test
  12718. Image with link parameter, URL target
  12719. !! wikitext
  12720. [[File:Foobar.jpg|link=http://example.com/]]
  12721. !! html/php
  12722. <p><a href="http://example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12723. </p>
  12724. !! html/parsoid
  12725. <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12726. !! end
  12727. # parsoid T51293 (part 2)
  12728. !! test
  12729. Image with link parameter, protocol-less URL target
  12730. !! wikitext
  12731. [[File:Foobar.jpg|link=//example.com/]]
  12732. !! html/php
  12733. <p><a href="//example.com/" rel="nofollow"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12734. </p>
  12735. !! html/parsoid
  12736. <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="//example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12737. !! end
  12738. !! test
  12739. Escaping non-block captions (T107435)
  12740. !! options
  12741. parsoid={
  12742. "modes": ["wt2wt"],
  12743. "changes": [
  12744. ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
  12745. ]
  12746. }
  12747. !! wikitext
  12748. [[Image:Foobar.jpg|caption]]
  12749. !! wikitext/edited
  12750. [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
  12751. !! end
  12752. # wgExternalLinkTarget not supported by Parsoid
  12753. !! test
  12754. Image with link parameter, wgExternalLinkTarget
  12755. !! wikitext
  12756. [[Image:foobar.jpg|link=http://example.com/]]
  12757. !! config
  12758. wgExternalLinkTarget='foobar'
  12759. !! html/php
  12760. <p><a href="http://example.com/" target="foobar" rel="nofollow noreferrer noopener"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12761. </p>
  12762. !! end
  12763. !! test
  12764. Image with link parameter, wgNoFollowLinks set to false
  12765. !! wikitext
  12766. [[Image:foobar.jpg|link=http://example.com/]]
  12767. !! config
  12768. wgNoFollowLinks=false
  12769. !! html/php
  12770. <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12771. </p>
  12772. !! end
  12773. !! test
  12774. Image with link parameter, wgNoFollowDomainExceptions
  12775. !! wikitext
  12776. [[Image:foobar.jpg|link=http://example.com/]]
  12777. !! config
  12778. wgNoFollowDomainExceptions='example.com'
  12779. !! html/php
  12780. <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12781. </p>
  12782. !! end
  12783. # wgExternalLinkTarget not supported by Parsoid
  12784. !! test
  12785. Image with link parameter, wgExternalLinkTarget, unnamed parameter
  12786. !! wikitext
  12787. [[Image:foobar.jpg|link=http://example.com/|Title]]
  12788. !! config
  12789. wgExternalLinkTarget='foobar'
  12790. !! html/php
  12791. <p><a href="http://example.com/" title="Title" target="foobar" rel="nofollow noreferrer noopener"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12792. </p>
  12793. !! end
  12794. !! test
  12795. Image with empty link parameter
  12796. !! wikitext
  12797. [[File:Foobar.jpg|link=]]
  12798. !! html/php
  12799. <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
  12800. </p>
  12801. !! html/parsoid
  12802. <p><figure-inline class="mw-default-size" typeof="mw:Image"><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></figure-inline></p>
  12803. !! end
  12804. !! test
  12805. Image with link parameter (wiki target) and unnamed parameter
  12806. !! wikitext
  12807. [[File:Foobar.jpg|link=Main_Page|Title]]
  12808. !! html/php
  12809. <p><a href="/wiki/Main_Page" title="Title"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12810. </p>
  12811. !! html/parsoid
  12812. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12813. !! end
  12814. !! test
  12815. Image with link parameter (URL target) and unnamed parameter
  12816. !! wikitext
  12817. [[File:Foobar.jpg|link=http://example.com/|Title]]
  12818. !! html/php
  12819. <p><a href="http://example.com/" title="Title" rel="nofollow"><img alt="Title" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12820. </p>
  12821. !! html/parsoid
  12822. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"Title"}'><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  12823. !! end
  12824. !! test
  12825. Thumbnail image with link parameter
  12826. !! options
  12827. thumbsize=220
  12828. parsoid=wt2html,wt2wt,html2html
  12829. !! wikitext
  12830. [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
  12831. !! html/php
  12832. <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="http://example.com/"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
  12833. !! html/parsoid
  12834. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="http://example.com/"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Title</figcaption></figure>
  12835. !! end
  12836. !! test
  12837. Manually-specified thumbnail image
  12838. !! options
  12839. thumbsize=220
  12840. !! wikitext
  12841. [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
  12842. !! html/php
  12843. <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Foobar.jpg"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
  12844. !! html/parsoid
  12845. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
  12846. !! end
  12847. !! test
  12848. Manually-specified thumbnail image with explicit link to wiki page
  12849. !! options
  12850. thumbsize=220
  12851. parsoid=wt2html,wt2wt,html2html
  12852. !! wikitext
  12853. [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
  12854. !! html/php
  12855. <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
  12856. !! html/parsoid
  12857. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
  12858. !! end
  12859. !! test
  12860. Manually-specified thumbnail image with explicit link to url
  12861. !! options
  12862. thumbsize=220
  12863. parsoid=wt2html,wt2wt,html2html
  12864. !! wikitext
  12865. [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
  12866. !! html/php
  12867. <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="http://example.com"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
  12868. !! html/parsoid
  12869. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="http://example.com"><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
  12870. !! end
  12871. !! test
  12872. Manually-specified thumbnail image with explicit no link
  12873. !! options
  12874. thumbsize=220
  12875. parsoid=wt2html,wt2wt,html2html
  12876. !! wikitext
  12877. [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
  12878. !! html/php
  12879. <div class="thumb tright"><div class="thumbinner" style="width:137px;"><img alt="" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
  12880. !! html/parsoid
  12881. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></span><figcaption>Title</figcaption></figure>
  12882. !! end
  12883. !! test
  12884. Manually-specified thumbnail image with explicit link and alt text
  12885. !! options
  12886. thumbsize=220
  12887. parsoid=wt2html,wt2wt,html2html
  12888. !! wikitext
  12889. [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
  12890. !! html/php
  12891. <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/Main_Page" title="Main Page"><img alt="alttext" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Title</div></div></div>
  12892. !! html/parsoid
  12893. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-mw='{"thumb":"Thumb.png"}'><a href="./Main_Page"><img alt="alttext" resource="./File:Foobar.jpg" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a><figcaption>Title</figcaption></figure>
  12894. !! end
  12895. !! test
  12896. Image with frame and link
  12897. !! options
  12898. parsoid=wt2html,wt2wt,html2html
  12899. !! wikitext
  12900. [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
  12901. !! html/php
  12902. <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
  12903. !! html/parsoid
  12904. <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
  12905. !! end
  12906. !! test
  12907. Image with frame and link and explicit alt
  12908. !! options
  12909. parsoid=wt2html,wt2wt,html2html
  12910. !! wikitext
  12911. [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
  12912. !! html/php
  12913. <div class="thumb tleft"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Altitude" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">This is a test image <a href="/wiki/Main_Page" title="Main Page">Main Page</a></div></div></div>
  12914. !! html/parsoid
  12915. <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img alt="Altitude" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>This is a test image <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></figcaption></figure>
  12916. !! end
  12917. !! test
  12918. Image with wiki markup in implicit alt
  12919. !! wikitext
  12920. [[Image:Foobar.jpg|testing '''bold''' in alt]]
  12921. [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
  12922. !! html/php
  12923. <p><a href="/wiki/File:Foobar.jpg" class="image" title="testing bold in alt"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12924. </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="testing bold in alt" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  12925. </p>
  12926. !! html/parsoid
  12927. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}' data-mw='{"caption":"testing &lt;b data-parsoid=&#39;{\"dsr\":[27,37,3,3]}&#39;>bold&lt;/b> in alt"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
  12928. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="testing bold in alt" resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"testing bold in alt","resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=testing &#39;&#39;&#39;bold&#39;&#39;&#39; in alt","resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
  12929. !! end
  12930. !! test
  12931. Alt image option should handle most kinds of wikitext without barfing
  12932. !! wikitext
  12933. [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
  12934. !! html/php
  12935. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a link and a bold template." src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is the image caption</div></div></div>
  12936. !! html/parsoid
  12937. <figure class="mw-default-size" typeof="mw:Image/Thumb mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"This is the image caption"},{"ck":"alt","ak":"alt=This is a [[link]] and a {{echo|&apos;&apos;bold template&apos;&apos;}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&apos;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}&apos;>link&lt;/a> and a &lt;i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&apos;{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;apos;&amp;apos;bold template&amp;apos;&amp;apos;\"}},\"i\":0}}]}&#39;>bold template&lt;/i>."}]]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img alt="This is a link and a bold template." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"This is a link and a bold template.","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=This is a [[link]] and a {{echo|&#39;&#39;bold template&#39;&#39;}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
  12938. !! end
  12939. !! test
  12940. Image with table with attributes in caption
  12941. !! options
  12942. parsoid=wt2html,html2html
  12943. !! wikitext
  12944. [[File:Foobar.jpg|thumb|
  12945. {| class="123" |
  12946. |- class="456" |
  12947. | ha
  12948. |}
  12949. ]]
  12950. !! html/parsoid
  12951. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{| class=\"123\" |\n|- class=\"456\" |\n| ha\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
  12952. <table class="123">
  12953. <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
  12954. <td> ha</td></tr>
  12955. </tbody></table>
  12956. </figcaption></figure>
  12957. !! end
  12958. !! test
  12959. Image with table with rows from templates in caption
  12960. !! wikitext
  12961. [[File:Foobar.jpg|thumb|
  12962. {|
  12963. {{echo|{{!}} hi}}
  12964. |}
  12965. ]]
  12966. !! html/parsoid
  12967. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"\n{|\n{{echo|{{!}} hi}}\n|}\n"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>
  12968. <table>
  12969. <tbody about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"{{!}} hi"}},"i":0}},"\n"]}'><tr><td> hi</td></tr>
  12970. </tbody></table>
  12971. </figcaption></figure>
  12972. !! end
  12973. !! test
  12974. Image with nested tables in caption
  12975. !! wikitext
  12976. [[File:Foobar.jpg|thumb|Foo<br />
  12977. {|
  12978. |
  12979. {|
  12980. |z
  12981. |}
  12982. |}
  12983. ]]
  12984. !! html/parsoid
  12985. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Foo&lt;br/>\n{|\n|\n{|\n|z\n|}\n|}\n"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption data-parsoid='{"dsr":[null,50,null,null]}'>Foo<br data-parsoid='{"stx":"html","selfClose":true}'/>
  12986. <table>
  12987. <tbody><tr><td>
  12988. <table>
  12989. <tbody><tr><td>z</td></tr>
  12990. </tbody></table></td></tr>
  12991. </tbody></table>
  12992. </figcaption></figure>
  12993. !! end
  12994. ###################
  12995. # Conflicting image format options.
  12996. # First option specified should 'win'.
  12997. # All three cases in each test should be identical.
  12998. !! test
  12999. Image with 'frameless' first.
  13000. !! options
  13001. parsoid=wt2html,wt2wt,html2html
  13002. !! wikitext
  13003. [[File:Foobar.jpg|frameless|caption]]
  13004. [[File:Foobar.jpg|frameless|frame|caption]]
  13005. [[File:Foobar.jpg|frameless|thumb|caption]]
  13006. !! html/php
  13007. <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
  13008. </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
  13009. </p><p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a>
  13010. </p>
  13011. !! html/parsoid
  13012. <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
  13013. <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
  13014. <p><figure-inline class="mw-default-size" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
  13015. !! end
  13016. !! test
  13017. Image with 'frame' first.
  13018. !! options
  13019. parsoid=wt2html,wt2wt,html2html
  13020. !! wikitext
  13021. [[File:Foobar.jpg|frame|caption]]
  13022. [[File:Foobar.jpg|frame|frameless|caption]]
  13023. [[File:Foobar.jpg|frame|thumb|caption]]
  13024. !! html/php
  13025. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
  13026. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
  13027. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption">caption</div></div></div>
  13028. !! html/parsoid
  13029. <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
  13030. <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
  13031. <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
  13032. !! end
  13033. !! test
  13034. Image with 'thumb' first.
  13035. !! options
  13036. parsoid=wt2html,wt2wt,html2html
  13037. !! wikitext
  13038. [[File:Foobar.jpg|thumb|caption]]
  13039. [[File:Foobar.jpg|thumb|frameless|caption]]
  13040. [[File:Foobar.jpg|thumb|frame|caption]]
  13041. !! html/php
  13042. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13043. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13044. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13045. !! html/parsoid
  13046. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  13047. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  13048. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  13049. !! end
  13050. ###################
  13051. # Image sizing.
  13052. # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
  13053. # and https://phabricator.wikimedia.org/T64258
  13054. # Foobar has actual size of 1941x220
  13055. # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
  13056. # a scalable format.
  13057. # 2. Framed images always ignore size options; always render at default size.
  13058. # 3. "Unspecified format" and border are the only types which can be
  13059. # enlarged.
  13060. !! test
  13061. Image: unspecified format and border enlarge
  13062. !! options
  13063. parsoid=wt2html,wt2wt,html2html
  13064. !! wikitext
  13065. [[File:Foobar.jpg|2000px]]
  13066. [[File:Foobar.jpg|border|2000px]]
  13067. !! html/php
  13068. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" /></a>
  13069. </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="2000" height="227" class="thumbborder" /></a>
  13070. </p>
  13071. !! html/parsoid
  13072. <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
  13073. <p><figure-inline class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="227" width="2000"/></a></figure-inline></p>
  13074. !! end
  13075. !! test
  13076. Image: "unspecified format" and border reduce
  13077. !! options
  13078. parsoid=wt2html,wt2wt,html2html
  13079. !! wikitext
  13080. [[File:Foobar.jpg|1000px]]
  13081. [[File:Foobar.jpg|border|1000px]]
  13082. !! html/php
  13083. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
  13084. </p><p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" width="1000" height="113" class="thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/1500px-Foobar.jpg 1.5x, http://example.com/images/3/3a/Foobar.jpg 2x" /></a>
  13085. </p>
  13086. !! html/parsoid
  13087. <p><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></figure-inline></p>
  13088. <p><figure-inline class="mw-image-border" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/1000px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="113" width="1000"/></a></figure-inline></p>
  13089. !! end
  13090. !! test
  13091. Image: thumbs reduce
  13092. !! options
  13093. parsoid=wt2html,wt2wt,html2html
  13094. !! wikitext
  13095. [[File:Foobar.jpg|thumb|50px]]
  13096. !! html/php
  13097. <div class="thumb tright"><div class="thumbinner" style="width:52px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
  13098. !! html/parsoid
  13099. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure>
  13100. !! end
  13101. !! test
  13102. Image: bitmap thumbs can't be enlarged past original size, but vector can.
  13103. !! options
  13104. parsoid=wt2html,wt2wt,html2html
  13105. !! wikitext
  13106. [[File:Foobar.jpg|thumb|2000px]]
  13107. [[File:Foobar.svg|thumb|2000px]]
  13108. !! html/php
  13109. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div></div></div></div>
  13110. <div class="thumb tright"><div class="thumbinner" style="width:2002px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div></div></div></div>
  13111. !! html/parsoid
  13112. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
  13113. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure>
  13114. !! end
  13115. !! test
  13116. Image: frameless can reduce in size
  13117. !! options
  13118. parsoid=wt2html,wt2wt,html2html
  13119. !! wikitext
  13120. [[File:Foobar.jpg|frameless|50px]]
  13121. !! html/php
  13122. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" width="50" height="6" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/75px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/100px-Foobar.jpg 2x" /></a>
  13123. </p>
  13124. !! html/parsoid
  13125. <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
  13126. !! end
  13127. !! test
  13128. Image: bitmap frameless can't be enlarged past original size, but vector can
  13129. !! options
  13130. parsoid=wt2html,wt2wt,html2html
  13131. !! wikitext
  13132. [[File:Foobar.jpg|frameless|2000px]]
  13133. [[File:Foobar.svg|frameless|2000px]]
  13134. !! html/php
  13135. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13136. </p><p><a href="/wiki/File:Foobar.svg" class="image"><img alt="Foobar.svg" src="http://example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" width="2000" height="1500" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/3000px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/4000px-Foobar.svg.png 2x" /></a>
  13137. </p>
  13138. !! html/parsoid
  13139. <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  13140. <p><figure-inline typeof="mw:Image/Frameless"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/2000px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="1500" width="2000"/></a></figure-inline></p>
  13141. !! end
  13142. !! test
  13143. Image: framed images are always unscaled.
  13144. !! options
  13145. parsoid=wt2html,wt2wt,html2html
  13146. !! wikitext
  13147. [[File:Foobar.jpg|frame]]
  13148. [[File:Foobar.jpg|frame|50px]]
  13149. [[File:Foobar.jpg|frame|50x50px]]
  13150. [[File:Foobar.jpg|frame|2000px]]
  13151. !! html/php
  13152. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
  13153. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
  13154. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
  13155. <div class="thumb tright"><div class="thumbinner" style="width:1943px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="thumbimage" /></a> <div class="thumbcaption"></div></div></div>
  13156. !! html/parsoid
  13157. <figure class="mw-default-size" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
  13158. <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
  13159. <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
  13160. <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure>
  13161. !! end
  13162. ###################
  13163. !! test
  13164. Link to image page- image page normally doesn't exists, hence edit link
  13165. Add test with existing image page
  13166. #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
  13167. !! wikitext
  13168. [[:Image:test]]
  13169. !! html
  13170. <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
  13171. </p>
  13172. !! end
  13173. !! test
  13174. T20784 Link to non-existent image page with caption should use caption as link text
  13175. !! wikitext
  13176. [[:Image:test|caption]]
  13177. !! html
  13178. <p><a href="/index.php?title=File:Test&amp;action=edit&amp;redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
  13179. </p>
  13180. !! end
  13181. !! test
  13182. Frameless image caption with a free URL
  13183. !! wikitext
  13184. [[File:Foobar.jpg|http://example.com]]
  13185. !! html/php
  13186. <p><a href="/wiki/File:Foobar.jpg" class="image" title="http://example.com"><img alt="http://example.com" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13187. </p>
  13188. !! html/parsoid
  13189. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"&lt;a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid=&#39;{\"stx\":\"url\",\"dsr\":[18,36,0,0]}&#39;>http://example.com&lt;/a>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13190. !! end
  13191. !! test
  13192. Thumbnail image caption with a free URL
  13193. !! options
  13194. thumbsize=220
  13195. !! wikitext
  13196. [[File:Foobar.jpg|thumb|http://example.com]]
  13197. !! html/php
  13198. <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
  13199. !! html/parsoid
  13200. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
  13201. !! end
  13202. !! test
  13203. Thumbnail image caption with a free URL and explicit alt
  13204. !! options
  13205. thumbsize=220
  13206. parsoid=wt2html,wt2wt,html2html
  13207. !! wikitext
  13208. [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
  13209. !! html/php
  13210. <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Alteration" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
  13211. !! html/parsoid
  13212. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img alt="Alteration" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
  13213. !! end
  13214. !! test
  13215. SVG thumbnails with no language set
  13216. !! options
  13217. !! wikitext
  13218. [[File:Foobar.svg|thumb|caption]]
  13219. !! html/php
  13220. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13221. !! html/parsoid
  13222. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
  13223. !! end
  13224. !! test
  13225. SVG thumbnails with language de
  13226. !! options
  13227. parsoid=wt2html,wt2wt,html2html
  13228. !! wikitext
  13229. [[File:Foobar.svg|thumb|caption|lang=de]]
  13230. !! html/php
  13231. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&amp;lang=de" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/langde-180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/langde-270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/langde-360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13232. !! html/parsoid
  13233. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>caption</figcaption></figure>
  13234. !! end
  13235. !! test
  13236. SVG thumbnails with invalid language code
  13237. !! options
  13238. parsoid=wt2html,wt2wt,html2html
  13239. !! wikitext
  13240. [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
  13241. !! html/php
  13242. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.svg" class="image"><img alt="" src="http://example.com/images/thumb/f/ff/Foobar.svg/180px-Foobar.svg.png" width="180" height="135" class="thumbimage" srcset="http://example.com/images/thumb/f/ff/Foobar.svg/270px-Foobar.svg.png 1.5x, http://example.com/images/thumb/f/ff/Foobar.svg/360px-Foobar.svg.png 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.svg" class="internal" title="Enlarge"></a></div>lang=invalid:language:code</div></div></div>
  13243. !! html/parsoid
  13244. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/thumb/f/ff/Foobar.svg/220px-Foobar.svg.png" data-file-width="240" data-file-height="180" data-file-type="drawing" height="165" width="220"/></a><figcaption>lang=invalid:language:code</figcaption></figure>
  13245. !! end
  13246. !! test
  13247. T3887: A ISBN with a thumbnail
  13248. !! wikitext
  13249. [[File:Foobar.jpg|thumb|ISBN 1235467890]]
  13250. !! html/php
  13251. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/1235467890" class="internal mw-magiclink-isbn">ISBN 1235467890</a></div></div></div>
  13252. !! html/parsoid
  13253. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/1235467890" rel="mw:WikiLink">ISBN 1235467890</a></figcaption></figure>
  13254. !! end
  13255. !! test
  13256. T3887: A RFC with a thumbnail
  13257. !! wikitext
  13258. [[File:Foobar.jpg|thumb|This is RFC 12354]]
  13259. !! html/php
  13260. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc12354">RFC 12354</a></div></div></div>
  13261. !! html/parsoid
  13262. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is <a href="https://tools.ietf.org/html/rfc12354" rel="mw:ExtLink" class="external text">RFC 12354</a></figcaption></figure>
  13263. !! end
  13264. !! test
  13265. T3887: A mailto link with a thumbnail
  13266. !! wikitext
  13267. [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
  13268. !! html/php
  13269. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>Please <a rel="nofollow" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></div></div></div>
  13270. !! html/parsoid
  13271. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>Please <a rel="mw:ExtLink" class="external free" href="mailto:nobody@example.com">mailto:nobody@example.com</a></figcaption></figure>
  13272. !! end
  13273. # Pending resolution to T2368
  13274. !! test
  13275. T2648: Frameless image caption with a link
  13276. !! wikitext
  13277. [[File:Foobar.jpg|text with a [[link]] in it]]
  13278. !! html/php
  13279. <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13280. </p>
  13281. !! html/parsoid
  13282. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13283. !! end
  13284. !! test
  13285. T2648: Frameless image caption with a link (suffix)
  13286. !! wikitext
  13287. [[File:Foobar.jpg|text with a [[link]]foo in it]]
  13288. !! html/php
  13289. <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a linkfoo in it"><img alt="text with a linkfoo in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13290. </p>
  13291. !! html/parsoid
  13292. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[link]]foo in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}&#39;>linkfoo&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13293. !! end
  13294. !! test
  13295. T2648: Frameless image caption with an interwiki link
  13296. !! wikitext
  13297. [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
  13298. !! html/php
  13299. <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a MeatBall:Link in it"><img alt="text with a MeatBall:Link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13300. </p>
  13301. !! html/parsoid
  13302. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}&#39;>MeatBall:Link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13303. !! end
  13304. !! test
  13305. T2648: Frameless image caption with a piped interwiki link
  13306. !! wikitext
  13307. [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
  13308. !! html/php
  13309. <p><a href="/wiki/File:Foobar.jpg" class="image" title="text with a link in it"><img alt="text with a link in it" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13310. </p>
  13311. !! html/parsoid
  13312. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"text with a [[MeatBall:Link|link]] in it"}]}' data-mw='{"caption":"text with a &lt;a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid=&#39;{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}&#39;>link&lt;/a> in it"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13313. !! end
  13314. !! test
  13315. T107474: Frameless image caption with <nowiki>
  13316. !! wikitext
  13317. [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
  13318. !! html/parsoid
  13319. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;nowiki>text with a [[MeatBall:Link|link]] in it&lt;/nowiki>"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[18,75,8,9]}&#39;>text with a [[MeatBall:Link|link]] in it&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13320. !! end
  13321. !! test
  13322. Escape HTML special chars in image alt text
  13323. !! wikitext
  13324. [[File:Foobar.jpg|& < > "]]
  13325. !! html/php
  13326. <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13327. </p>
  13328. !! html/parsoid
  13329. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13330. !! end
  13331. !! test
  13332. Escape HTML special chars in image alt text with LanguageConverter
  13333. !! options
  13334. language=zh
  13335. !! wikitext
  13336. [[File:Foobar.jpg|& < > "]]
  13337. !! html/php
  13338. <p><a href="/wiki/File:Foobar.jpg" class="image" title="&amp; &lt; &gt; &quot;"><img alt="&amp; &lt; &gt; &quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13339. </p>
  13340. !! html/parsoid
  13341. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp; &lt; > \""}]}' data-mw='{"caption":"&amp;amp; &amp;lt; > \""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13342. !! end
  13343. !! test
  13344. Entities in file name and attributes
  13345. !! wikitext
  13346. [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
  13347. !! html/php
  13348. <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
  13349. </p>
  13350. !! html/parsoid
  13351. <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"manualthumb=7%25 solution.gif"},{"ck":"link","ak":"link=7%25 solution"},{"ck":"caption","ak":"[[7%25 solution]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}&#39;>7% solution&lt;/a>"}'><a href="./7%25_solution" data-parsoid='{"a":{"href":"./7%25_solution"},"sa":{"href":"link=7%25 solution"}}'><img resource="./File:7%25_solution.gif" src="./Special:FilePath/7%25_solution.gif" height="220" width="220" data-parsoid='{"a":{"resource":"./File:7%25_solution.gif","height":"220","width":"220"},"sa":{"resource":"File:7%25 solution.gif"}}'/></a></figure-inline></p>
  13352. !! end
  13353. !! test
  13354. T2499: Alt text should have &#1234;, not &amp;1234;
  13355. !! wikitext
  13356. [[File:Foobar.jpg|&#9792;]]
  13357. !! html/php
  13358. <p><a href="/wiki/File:Foobar.jpg" class="image" title="♀"><img alt="♀" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13359. </p>
  13360. !! html/parsoid
  13361. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&amp;#9792;"}]}' data-mw='{"caption":"&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}&#39;>♀&lt;/span>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13362. !! end
  13363. !! test
  13364. Broken image caption with link
  13365. !! options
  13366. parsoid=wt2html,wt2wt,html2html
  13367. !! wikitext
  13368. [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
  13369. !! html/php
  13370. <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a href="/wiki/Main_Page" title="Main Page">this</a> is just an ordinary link.
  13371. </p>
  13372. !! html/parsoid
  13373. <p>[[Image:Foobar.jpg|thumb|This is a broken caption. But <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">this</a> is just an ordinary link.</p>
  13374. !! end
  13375. !! test
  13376. Image caption containing another image
  13377. !! wikitext
  13378. [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
  13379. !! html/php
  13380. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is a caption with another <a href="/wiki/File:Thumb.png" class="image" title="image"><img alt="image" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" /></a> inside it!</div></div></div>
  13381. !! html/parsoid
  13382. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>This is a caption with another <figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"image"}'><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></figure-inline> inside it!</figcaption></figure>
  13383. !! end
  13384. !! test
  13385. Image: caption containing a newline
  13386. !! wikitext
  13387. [[File:Foobar.jpg|This
  13388. *is some text]]
  13389. !! html/php
  13390. <p><a href="/wiki/File:Foobar.jpg" class="image" title="This *is some text"><img alt="This *is some text" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  13391. </p>
  13392. !! html/parsoid
  13393. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"This\n*is some text"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  13394. !!end
  13395. !!test
  13396. Image: caption containing leading space
  13397. (The leading space should not trigger nowiki escaping in wt2wt mode)
  13398. !! wikitext
  13399. [[File:Foobar.jpg|thumb| bar]]
  13400. !! html/php
  13401. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>bar</div></div></div>
  13402. !! html/parsoid
  13403. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> bar</figcaption></figure>
  13404. !!end
  13405. # html/php output not have newlines after table, td, th, etc. because
  13406. # Linker::makeThumbLink2() replaces the newlines with spaces since
  13407. # the table is inside a caption.
  13408. # FIXME: Verify if that circa 2004 fix is still required.
  13409. !! test
  13410. Image: caption containing a table
  13411. !! options
  13412. parsoid=wt2html,wt2wt,html2html
  13413. !! wikitext
  13414. [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
  13415. {|
  13416. !Foo!!Bar
  13417. |-
  13418. |Foo1||Bar1
  13419. |}
  13420. and some more text.]]
  13421. !! html/php
  13422. <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This is an example image thumbnail caption with a table <table> <tr> <th>Foo</th> <th>Bar </th></tr> <tr> <td>Foo1</td> <td>Bar1 </td></tr></table> and some more text.</div></div></div>
  13423. !! html/parsoid
  13424. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This is an example image thumbnail caption with a table
  13425. <table>
  13426. <tbody>
  13427. <tr><th>Foo</th><th>Bar</th></tr>
  13428. <tr>
  13429. <td>Foo1</td>
  13430. <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
  13431. !! end
  13432. !! test
  13433. T5090: External links other than http: in image captions
  13434. !! wikitext
  13435. [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
  13436. !! html/php
  13437. <div class="thumb tright"><div class="thumbinner" style="width:202px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" width="200" height="23" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/400px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>This caption has <a rel="nofollow" class="external text" href="irc://example.net">irc</a> and <a rel="nofollow" class="external text" href="https://example.com">Secure</a> ext links in it.</div></div></div>
  13438. !! html/parsoid
  13439. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has <a rel="mw:ExtLink" class="external text" href="irc://example.net">irc</a> and <a rel="mw:ExtLink" class="external text" href="https://example.com">Secure</a> ext links in it.</figcaption></figure>
  13440. !! end
  13441. !! test
  13442. Custom class
  13443. !! options
  13444. parsoid=wt2html,wt2wt,html2html
  13445. !! wikitext
  13446. [[Image:foobar.jpg|a|class=b]]
  13447. !! html/php
  13448. <p><a href="/wiki/File:Foobar.jpg" class="image" title="a"><img alt="a" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" class="b" /></a>
  13449. </p>
  13450. !! html/parsoid
  13451. <p><figure-inline class="mw-default-size b" typeof="mw:Image" data-mw='{"caption":"a"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  13452. !! end
  13453. !! test
  13454. Localized image handling (1).
  13455. !! options
  13456. parsoid=wt2html,wt2wt,html2html
  13457. language=es
  13458. !! wikitext
  13459. [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
  13460. !! html/php
  13461. <div class="floatleft"><a href="/wiki/Foo" title="caption"><img alt="caption" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  13462. !! html/parsoid
  13463. <figure class="mw-default-size mw-halign-left" typeof="mw:Image"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
  13464. !! end
  13465. !! test
  13466. Localized image handling (2).
  13467. !! options
  13468. thumbsize=220
  13469. parsoid=wt2html,wt2wt,html2html
  13470. language=es
  13471. !! wikitext
  13472. [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
  13473. !! html/php
  13474. <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/Foo" title="Foo"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/Archivo:Foobar.jpg" class="internal" title="Aumentar"></a></div>caption</div></div></div>
  13475. !! html/parsoid
  13476. <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./Foo"><img resource="./Archivo:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  13477. !! end
  13478. !! test
  13479. Localized image handling (3).
  13480. !! options
  13481. language=fa
  13482. parsoid=html2wt
  13483. !! html/parsoid
  13484. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure>
  13485. !! wikitext
  13486. [[File:Foobar.jpg|بندانگشتی]]
  13487. !! end
  13488. !! test
  13489. "border", "frameless" and "class" attributes on an image.
  13490. !! options
  13491. thumbsize=220
  13492. parsoid=wt2html,wt2wt,html2html
  13493. !! wikitext
  13494. [[File:Foobar.jpg|frameless|border|class=extra|caption]]
  13495. !! html/php
  13496. <p><a href="/wiki/File:Foobar.jpg" class="image" title="caption"><img alt="caption" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="extra thumbborder" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a>
  13497. </p>
  13498. !! html/parsoid
  13499. <p><figure-inline class="mw-default-size mw-image-border extra" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a></figure-inline></p>
  13500. !! end
  13501. # Note that 'right' is the default alignment, despite the misspelled 'righ' below
  13502. !! test
  13503. Invalid image attributes (T64500)
  13504. !! options
  13505. thumbsize=220
  13506. parsoid=wt2html,wt2wt,html2html
  13507. !! wikitext
  13508. [[File:Foobar.jpg|thumb|float|left|caption]]
  13509. [[File:Foobar.jpg|thumb|righ|caption]]
  13510. [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
  13511. !! html/php
  13512. <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13513. <div class="thumb tright"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13514. <div class="thumb tleft"><div class="thumbinner" style="width:222px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" width="220" height="25" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/330px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/440px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>caption</div></div></div>
  13515. !! html/parsoid
  13516. <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  13517. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  13518. <figure class="mw-default-size mw-halign-left" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  13519. !! end
  13520. !! article
  13521. File:Barfoo.jpg
  13522. !! text
  13523. #REDIRECT [[File:Barfoo.jpg]]
  13524. !! endarticle
  13525. # FIXME: Parsoid should run this test -- but we'd need to teach the
  13526. # mockAPI about the redirected Barfoo.jpg image.
  13527. !! test
  13528. Redirected image
  13529. !! wikitext
  13530. [[Image:Barfoo.jpg]]
  13531. !! html/php
  13532. <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
  13533. </p>
  13534. !! end
  13535. !! test
  13536. Missing image with uploads disabled
  13537. !! options
  13538. wgEnableUploads=0
  13539. !! wikitext
  13540. [[File:Foobaz.jpg]]
  13541. !! html/php
  13542. <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
  13543. </p>
  13544. !! html/parsoid
  13545. <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Foobaz.jpg"><img resource="./File:Foobaz.jpg" src="./Special:FilePath/Foobaz.jpg" height="220" width="220"/></a></figure-inline></p>
  13546. !! end
  13547. # Parsoid-specific testing for images
  13548. # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
  13549. # Currently imperfect due to a flaw in the Parsoid testrunner
  13550. # Work in progress
  13551. # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
  13552. # image tests.
  13553. !! test
  13554. Parsoid-specific image handling - simple image with size and middle alignment
  13555. !! wikitext
  13556. [[File:Foobar.jpg|middle|50px]]
  13557. !! html/parsoid
  13558. <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
  13559. !! end
  13560. !! test
  13561. Parsoid-specific image handling - simple image with size, middle alignment,
  13562. non-standard namespace alias
  13563. !! options
  13564. parsoid=wt2wt,wt2html,html2html
  13565. !! wikitext
  13566. [[Image:Foobar.jpg|middle|50px]]
  13567. !! html/parsoid
  13568. <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
  13569. !! end
  13570. !! test
  13571. Parsoid-specific image handling - simple image with size and middle alignment
  13572. (existing content)
  13573. !! wikitext
  13574. [[File:Foobar.jpg|50px|middle]]
  13575. !! html/parsoid
  13576. <p><figure-inline class="mw-valign-middle" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"middle","ak":"middle"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13577. !! end
  13578. !! test
  13579. Parsoid-specific image handling - simple image with size and middle alignment
  13580. and non-standard namespace name
  13581. !! options
  13582. parsoid=wt2html,wt2wt,html2html
  13583. !! wikitext
  13584. [[Image:Foobar.jpg|50px|middle]]
  13585. !! html/parsoid
  13586. <p><figure-inline class="mw-valign-middle" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a></figure-inline></p>
  13587. !! end
  13588. !! test
  13589. Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
  13590. !! wikitext
  13591. [[File:Foobar.jpg|500x10px|baseline|caption]]
  13592. !! html/parsoid
  13593. <p><figure-inline class="mw-valign-baseline" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"500x10px"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption"}],"size":"500x10"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/89px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="10" width="89" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"10","width":"89"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13594. !! end
  13595. !! test
  13596. Parsoid-specific image handling - simple image with border and size spec
  13597. !! wikitext
  13598. [[File:Foobar.jpg|50px|border|caption]]
  13599. !! html/parsoid
  13600. <p><figure-inline class="mw-image-border" typeof="mw:Image" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"width","ak":"50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13601. !! end
  13602. !! test
  13603. Parsoid-specific image handling - thumbnail with halign, valign, and caption
  13604. !! wikitext
  13605. [[File:Foobar.jpg|left|baseline|thumb|caption content]]
  13606. !! html/parsoid
  13607. <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption content</figcaption></figure>
  13608. !! end
  13609. !! test
  13610. Parsoid-specific image handling - thumbnail with halign, valign, and caption
  13611. (existing content)
  13612. !! wikitext
  13613. [[File:Foobar.jpg|thumb|left|baseline|caption content]]
  13614. !! html/parsoid
  13615. <figure class="mw-default-size mw-halign-left mw-valign-baseline" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"left","ak":"left"},{"ck":"baseline","ak":"baseline"},{"ck":"caption","ak":"caption content"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption content</figcaption></figure>
  13616. !! end
  13617. !! test
  13618. Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
  13619. !! wikitext
  13620. [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
  13621. !! html/parsoid
  13622. <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50"/></a><figcaption>caption</figcaption></figure>
  13623. !! end
  13624. !! test
  13625. Parsoid-specific image handling - thumbnail with specific size, halign,
  13626. valign, and caption (existing content)
  13627. !! wikitext
  13628. [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
  13629. !! html/parsoid
  13630. <figure class="mw-halign-right mw-valign-middle" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"50x50px"},{"ck":"right","ak":"right"},{"ck":"middle","ak":"middle"},{"ck":"caption","ak":"caption"}],"size":"50x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="6" width="50" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"6","width":"50"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>caption</figcaption></figure>
  13631. !! end
  13632. !! test
  13633. Parsoid-specific image handling - framed image with specific size and caption
  13634. (size is ignored)
  13635. !! options
  13636. parsoid=wt2html,wt2wt,html2html
  13637. !! wikitext
  13638. [[File:Foobar.jpg|frame|500x50px|caption]]
  13639. !! html/parsoid
  13640. <figure typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
  13641. !! end
  13642. !! test
  13643. Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
  13644. (size is ignored)
  13645. !! options
  13646. parsoid=wt2html,wt2wt,html2html
  13647. !! wikitext
  13648. [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
  13649. !! html/parsoid
  13650. <figure class="mw-halign-left mw-valign-baseline" typeof="mw:Image/Frame"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>caption</figcaption></figure>
  13651. !! end
  13652. !! test
  13653. Parsoid-specific image handling - frameless image with specific size, border, and caption
  13654. !! wikitext
  13655. [[File:Foobar.jpg|frameless|442x50px|border|caption]]
  13656. !! html/parsoid
  13657. <p><figure-inline class="mw-image-border" typeof="mw:Image/Frameless" data-mw='{"caption":"caption"}' data-parsoid='{"optList":[{"ck":"frameless","ak":"frameless"},{"ck":"width","ak":"442x50px"},{"ck":"border","ak":"border"},{"ck":"caption","ak":"caption"}],"size":"442x50"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/442px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="50" width="442" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"50","width":"442"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13658. !! end
  13659. !! test
  13660. Parsoid-specific image handling - simple image with a formatted caption
  13661. !! wikitext
  13662. [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
  13663. !! html/parsoid
  13664. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;table>&lt;tr>&lt;td>a&lt;/td>&lt;td>b&lt;/td>&lt;/tr>&lt;tr>&lt;td>c&lt;/td>&lt;/tr>&lt;/table>"}]}' data-mw='{"caption":"&lt;table data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[18,81,7,8]}&#39;>&lt;tbody data-parsoid=&#39;{\"dsr\":[25,73,0,0]}&#39;>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[25,54,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[29,39,4,5]}&#39;>a&lt;/td>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[39,49,4,5]}&#39;>b&lt;/td>&lt;/tr>&lt;tr data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[54,73,4,5]}&#39;>&lt;td data-parsoid=&#39;{\"stx\":\"html\",\"dsr\":[58,68,4,5]}&#39;>c&lt;/td>&lt;/tr>&lt;/tbody>&lt;/table>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13665. !! end
  13666. !! test
  13667. Parsoid-specific image handling - caption with a template in it
  13668. !! wikitext
  13669. [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
  13670. !! html/parsoid
  13671. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"></a><figcaption>This caption has a <span about="#mwt1" typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;transclusion&quot;}},&quot;i&quot;:0}}]}">transclusion</span> in it.</figcaption></figure>
  13672. !! end
  13673. !! test
  13674. Parsoid-specific image handling - caption with unbalanced tags in it
  13675. !! options
  13676. parsoid=wt2html,wt2wt,html2html
  13677. !! wikitext
  13678. foo
  13679. [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
  13680. bar
  13681. !! html/parsoid
  13682. <p>foo</p>
  13683. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption>This caption has a <center>unbalanced tag in it.</center></figcaption></figure>
  13684. <p>bar</p>
  13685. !! end
  13686. !! test
  13687. Parsoid-specific image handling - empty caption (1)
  13688. !! options
  13689. parsoid=wt2html,wt2wt
  13690. !! wikitext
  13691. [[File:Foobar.jpg|thumb|]]
  13692. !! html/parsoid
  13693. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption></figcaption></figure>
  13694. !! end
  13695. # empty captions don't get serialized unless we're in the "round trip" case
  13696. !! test
  13697. Parsoid-specific image handling - empty caption (2)
  13698. !! options
  13699. parsoid=html2wt
  13700. !! html/parsoid
  13701. <figure class="mw-default-size" typeof="mw:Image/Thumb">
  13702. <a href="./File:Foobar.jpg">
  13703. <img resource="./File:Foobar.jpg"
  13704. src="//example.com/images/3/3a/Foobar.jpg"
  13705. data-file-width="1941" data-file-height="220" data-file-type="bitmap"
  13706. height="25" width="220"/>
  13707. </a>
  13708. <figcaption></figcaption>
  13709. </figure>
  13710. !! wikitext
  13711. [[File:Foobar.jpg|thumb]]
  13712. !! end
  13713. !! test
  13714. Parsoid-specific image handling - whitespace caption
  13715. !! wikitext
  13716. [[File:Foobar.jpg|thumb| ]]
  13717. !! html/parsoid
  13718. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption> </figcaption></figure>
  13719. !! end
  13720. !! test
  13721. Parsoid-specific image handling - lang option
  13722. !! wikitext
  13723. foo
  13724. [[File:Foobar.svg|lang=de|caption]]
  13725. bar
  13726. !! html/parsoid
  13727. <p>foo
  13728. <figure-inline class="mw-default-size" typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.svg"><img resource="./File:Foobar.svg" src="//example.com/images/f/ff/Foobar.svg" lang="de" data-file-width="240" data-file-height="180" data-file-type="drawing" height="180" width="240"/></a></figure-inline>
  13729. bar</p>
  13730. !! end
  13731. ## Edge case bugs in Parsoid from T93580
  13732. !! test
  13733. T93580: 1. Templated <ref> inside block images
  13734. !! wikitext
  13735. [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
  13736. <references />
  13737. !! html/parsoid
  13738. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|&lt;ref>foo&lt;/ref>}}"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"File:Foobar.jpg"}}'/></a><figcaption>Caption with templated ref: <sup about="#mwt5" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Transclusion mw:Extension/ref" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;ref>foo&lt;/ref>"}},"i":0}}]}'><a href="./Main_Page#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></sup></figcaption></figure>
  13739. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">foo</span></li></ol>
  13740. !! end
  13741. !! test
  13742. T93580: 2. <ref> inside inline images
  13743. !! wikitext
  13744. [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
  13745. <references />
  13746. !! html/parsoid
  13747. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: &lt;ref>foo&lt;/ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,78,5,6]}&#39; data-mw=&#39;{\"name\":\"ref\",\"body\":{\"id\":\"mw-reference-text-cite_note-1\"},\"attrs\":{}}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13748. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
  13749. !! end
  13750. !! test
  13751. T93580: 3. Templated <ref> inside inline images
  13752. !! wikitext
  13753. [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
  13754. <references />
  13755. !! html/parsoid
  13756. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|&lt;ref>{{echo|foo}}&lt;/ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: &lt;sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid=&#39;{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&amp;lt;ref>{{echo|foo}}&amp;lt;/ref>\"}},\"i\":0}}]}&#39;>&lt;a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\">&lt;span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]&lt;/span>&lt;/a>&lt;/sup>"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  13757. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt6" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">foo</span></li></ol>
  13758. !! end
  13759. ###
  13760. ### Subpages
  13761. ###
  13762. !! article
  13763. Subpage test/subpage
  13764. !! text
  13765. foo
  13766. !! endarticle
  13767. !! test
  13768. Subpage link
  13769. !! options
  13770. subpage title=[[Subpage test]]
  13771. !! wikitext
  13772. [[/subpage]]
  13773. !! html
  13774. <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
  13775. </p>
  13776. !! end
  13777. !! test
  13778. Subpage noslash link
  13779. !! options
  13780. subpage title=[[Subpage test]]
  13781. !! wikitext
  13782. [[/subpage/]]
  13783. !! html
  13784. <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
  13785. </p>
  13786. !! end
  13787. !! article
  13788. Subpage test/1/2/subpage
  13789. !! text
  13790. blah
  13791. !! endarticle
  13792. !! test
  13793. Relative subpage noslash link
  13794. !! options
  13795. parsoid=wt2wt,wt2html,html2html
  13796. subpage title=[[Subpage test/1/2/3/4]]
  13797. !! wikitext
  13798. [[../../subpage/]]
  13799. [[../../subpage]]
  13800. !! html/php
  13801. <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
  13802. </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
  13803. </p>
  13804. !! html/parsoid
  13805. <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
  13806. <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
  13807. !! end
  13808. !! test
  13809. Parsoid: dot-slash prefixed wikilinks
  13810. !! wikitext
  13811. [[./foo]]
  13812. [[././bar]]
  13813. [[././baz/]]
  13814. !! html/php
  13815. <p>[[./foo]]
  13816. </p><p>[[././bar]]
  13817. </p><p>[[././baz/]]
  13818. </p>
  13819. !! html/parsoid
  13820. <p>[[./foo]]
  13821. </p><p>[[././bar]]
  13822. </p><p>[[././baz/]]
  13823. </p>
  13824. !! end
  13825. !! test
  13826. Render invalid page names as plain text (T53090)
  13827. !! wikitext
  13828. [[./../foo|bar]]
  13829. [[foo�|bar]]
  13830. [[foo/.|bar]]
  13831. [[foo/..|bar]]
  13832. [[foo~~~bar]]
  13833. [[foo>bar]]
  13834. [[foo[bar]]
  13835. [[.]]
  13836. [[..]]
  13837. [[foo././bar]]
  13838. [[foo[http://example.com]xyz]]
  13839. [[{{echo|./../foo}}|bar]]
  13840. [[{{echo|foo/.}}|bar]]
  13841. [[{{echo|foo/..}}|bar]]
  13842. [[{{echo|foo~~~~bar}}]]
  13843. [[{{echo|foo>bar}}]]
  13844. [[{{echo|foo././bar}}]]
  13845. [[{{echo|foo{bar}}]]
  13846. [[{{echo|foo}bar}}]]
  13847. [[{{echo|foo[bar}}]]
  13848. [[{{echo|foo]bar}}]]
  13849. [[{{echo|foo<bar}}]]
  13850. !!html/php
  13851. <p>[[./../foo|bar]]
  13852. [[foo�|bar]]
  13853. [[foo/.|bar]]
  13854. [[foo/..|bar]]
  13855. [[foo~~~bar]]
  13856. [[foo&gt;bar]]
  13857. [[foo[bar]]
  13858. [[.]]
  13859. [[..]]
  13860. [[foo././bar]]
  13861. [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
  13862. </p><p>[[./../foo|bar]]
  13863. [[foo/.|bar]]
  13864. [[foo/..|bar]]
  13865. [[foo~~~~bar]]
  13866. [[foo&gt;bar]]
  13867. [[foo././bar]]
  13868. [[foo{bar]]
  13869. [[foo}bar]]
  13870. [[foo[bar]]
  13871. [[foo]bar]]
  13872. [[foo&lt;bar]]
  13873. </p>
  13874. !!html/parsoid
  13875. <p>[[./../foo|bar]]
  13876. [[foo�|bar]]
  13877. [[foo/.|bar]]
  13878. [[foo/..|bar]]
  13879. [[foo~~~bar]]
  13880. [[foo>bar]]
  13881. [[foo[bar]]
  13882. [[.]]
  13883. [[..]]
  13884. [[foo././bar]]
  13885. [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
  13886. <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
  13887. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
  13888. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
  13889. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
  13890. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
  13891. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
  13892. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
  13893. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
  13894. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
  13895. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
  13896. [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo&lt;bar"}},"i":0}}]}'>foo&lt;bar</span>]]</p>
  13897. !!end
  13898. !! test
  13899. Disabled subpages
  13900. !! wikitext
  13901. [[/subpage]]
  13902. !! html
  13903. <p><a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
  13904. </p>
  13905. !! end
  13906. !! test
  13907. T2561: {{/Subpage}}
  13908. !! options
  13909. subpage title=[[Page]]
  13910. !! wikitext
  13911. {{/Subpage}}
  13912. !! html
  13913. <p><a href="/index.php?title=Page/Subpage&amp;action=edit&amp;redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
  13914. </p>
  13915. !! end
  13916. ###
  13917. ### Categories
  13918. ###
  13919. !! article
  13920. Category:MediaWiki User's Guide
  13921. !! text
  13922. blah
  13923. !! endarticle
  13924. !! test
  13925. Link to category
  13926. !! wikitext
  13927. [[:Category:MediaWiki User's Guide]]
  13928. !! html
  13929. <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User&#39;s Guide">Category:MediaWiki User's Guide</a>
  13930. </p>
  13931. !! end
  13932. !! test
  13933. Simple category
  13934. !! options
  13935. cat
  13936. !! wikitext
  13937. [[Category:MediaWiki User's Guide]]
  13938. !! html/php
  13939. cat=MediaWiki_User's_Guide sort=
  13940. !! html/parsoid
  13941. <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
  13942. !! end
  13943. !! test
  13944. PAGESINCATEGORY invalid title fatal (r33546 fix)
  13945. !! wikitext
  13946. {{PAGESINCATEGORY:<bogus>}}
  13947. !! html
  13948. <p>0
  13949. </p>
  13950. !! end
  13951. !! test
  13952. Category with different sort key
  13953. !! options
  13954. cat
  13955. !! wikitext
  13956. [[Category:MediaWiki User's Guide|Foo]]
  13957. !! html/php
  13958. cat=MediaWiki_User's_Guide sort=Foo
  13959. !! html/parsoid
  13960. <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
  13961. !! end
  13962. !! test
  13963. Category with identical sort key
  13964. !! options
  13965. cat
  13966. !! wikitext
  13967. [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
  13968. !! html/php
  13969. cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
  13970. !! html/parsoid
  13971. <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User&#39;s_Guide"},"sa":{"href":"Category:MediaWiki User&#39;s Guide"}}'/>
  13972. !! end
  13973. !! test
  13974. Category with empty sort key
  13975. !! options
  13976. cat
  13977. pst
  13978. !! wikitext
  13979. [[Category:MediaWiki User's Guide|]]
  13980. !! html/php
  13981. [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
  13982. !! end
  13983. !! test
  13984. Category with empty sort key and parentheses
  13985. !! options
  13986. cat
  13987. pst
  13988. !! wikitext
  13989. [[Category:Foo (bar)|]]
  13990. !! html/php
  13991. [[Category:Foo (bar)|Foo]]
  13992. !! end
  13993. !! test
  13994. Category with link tail
  13995. !! options
  13996. cat
  13997. pst
  13998. !! wikitext
  13999. 123[[Category:Foo]]456
  14000. !! html/php
  14001. 123[[Category:Foo]]456
  14002. !! end
  14003. !! test
  14004. Category with template
  14005. !! options
  14006. cat
  14007. pst
  14008. !! wikitext
  14009. [[Category:{{echo|Foo}}]]
  14010. !! html/php
  14011. [[Category:{{echo|Foo}}]]
  14012. !! end
  14013. !! test
  14014. Category with template in sort key
  14015. !! options
  14016. cat
  14017. pst
  14018. !! wikitext
  14019. [[Category:Foo|{{echo|Bar}}]]
  14020. !! html/php
  14021. [[Category:Foo|{{echo|Bar}}]]
  14022. !! end
  14023. !! test
  14024. Category with template in sort key and title
  14025. !! options
  14026. cat
  14027. pst
  14028. !! wikitext
  14029. [[Category:{{echo|Foo}}|{{echo|Bar}}]]
  14030. !! html/php
  14031. [[Category:{{echo|Foo}}|{{echo|Bar}}]]
  14032. !! end
  14033. ## We used to, but no longer wt2wt this test since the default serializer
  14034. ## will normalize all categories to serialize on their own line.
  14035. ## This wikitext usage is going to be fairly uncommon in production and
  14036. ## selser will take care of preserving formatting in those scenarios.
  14037. !! test
  14038. Category / paragraph interactions
  14039. !! options
  14040. parsoid=wt2html
  14041. !! wikitext
  14042. Foo [[Category:Baz]] Bar
  14043. Foo [[Category:Baz]]
  14044. Bar
  14045. Foo
  14046. [[Category:Baz]]
  14047. Bar
  14048. Foo
  14049. [[Category:Baz]] Bar
  14050. Foo
  14051. [[Category:Baz]]
  14052. [[Category:Baz]]
  14053. [[Category:Baz]]
  14054. Bar
  14055. [[Category:Baz]]
  14056. [[Category:Baz]]
  14057. [[Category:Baz]]
  14058. [[Category:Baz]]
  14059. {{echo|[[Category:Baz]]}}
  14060. [[Category:Baz]]
  14061. !! html/php
  14062. <p>Foo Bar
  14063. </p><p>Foo
  14064. Bar
  14065. </p><p>Foo
  14066. Bar
  14067. </p><p>Foo Bar
  14068. </p><p>Foo
  14069. Bar
  14070. </p>
  14071. !! html/parsoid
  14072. <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
  14073. <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
  14074. <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
  14075. <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
  14076. <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
  14077. <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz"/> <link rel="mw:PageProp/Category" href="./Category:Baz" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Baz]]"}},"i":0}}]}'/>
  14078. <link rel="mw:PageProp/Category" href="./Category:Baz"/>
  14079. !! end
  14080. ## We used to, but no longer wt2wt this test since the default serializer
  14081. ## will normalize all categories to serialize on their own line.
  14082. ## This wikitext usage is going to be fairly uncommon in production and
  14083. ## selser will take care of preserving formatting in those scenarios.
  14084. ##
  14085. ## The whitespace on the empty line is part of the test. Please do not delete
  14086. !! test
  14087. 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
  14088. !! options
  14089. parsoid=wt2html
  14090. !! wikitext
  14091. This
  14092. [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
  14093. {{echo|[[Category:Foo]] and so should this!}}
  14094. !! html/php
  14095. <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
  14096. </p>
  14097. !! html/parsoid
  14098. <p>This
  14099. <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
  14100. <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and so should this!"}},"i":0}}]}'/><span about="#mwt1"> and so should this!</span></p>
  14101. !! end
  14102. ## Parsoid will not try to wt2wt this while preserving newlines because
  14103. ## it suppresses excess newlines within list items -- and we don't want to
  14104. ## introduce a special case just for categories, which is, in reality somewhat
  14105. ## odd behavior -- categories are unlikely to be used in list items like this
  14106. ## in top-level pages and are only likely to show up in template-generated
  14107. ## list items where this RT-ing is a non-issue.
  14108. ##
  14109. ## The whitespace on the empty line is part of the test. Please do not delete
  14110. !! test
  14111. 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
  14112. !! options
  14113. parsoid=wt2html
  14114. !! wikitext
  14115. * This
  14116. [[Category:Foo]] and this should be part of the same list item
  14117. * So should this
  14118. {{echo|[[Category:Foo]] and this should be part of the same list item}}
  14119. !! html
  14120. <ul><li>This and this should be part of the same list item</li>
  14121. <li>So should this and this should be part of the same list item</li></ul>
  14122. !! html/parsoid
  14123. <ul>
  14124. <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
  14125. <li>So should this <link rel="mw:PageProp/Category" href="./Category:Foo" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]] and this should be part of the same list item"}},"i":0}}]}'/><span> and this should be part of the same list item</span></li>
  14126. </ul>
  14127. !! end
  14128. ## Newlines and categories that follow the last item of a list
  14129. ## are treated differently because this (list followed by categories)
  14130. ## is an extremely common pattern on wikis.
  14131. !! test
  14132. 3. Categories and newlines: newline suppression for last list item should RT properly
  14133. !! wikitext
  14134. * a
  14135. * b
  14136. [[Category:Foo]]
  14137. [[Category:Bar]]
  14138. [[Category:Baz]]
  14139. !! html/parsoid
  14140. <ul><li> a</li>
  14141. <li> b</li></ul>
  14142. <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
  14143. <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
  14144. <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
  14145. !! end
  14146. !! test
  14147. 4. Categories and newlines: newline suppression for last list item should RT properly
  14148. !! wikitext
  14149. * a
  14150. **** b
  14151. [[Category:Foo]]
  14152. !! html/parsoid
  14153. <ul><li> a
  14154. <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
  14155. <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
  14156. !! end
  14157. ## only wt2html for this to make sure the algo only applies to the rightmost path
  14158. !! test
  14159. 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
  14160. !! options
  14161. parsoid=wt2html
  14162. !! wikitext
  14163. * a
  14164. ** b
  14165. [[Category:Foo]]
  14166. * c
  14167. ** d
  14168. [[Category:Foo]]
  14169. !! html/parsoid
  14170. <ul><li> a
  14171. <ul><li> b
  14172. <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
  14173. <li> c
  14174. <ul><li> d</li></ul></li></ul>
  14175. <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
  14176. !! end
  14177. ## We used to, but no longer wt2wt this test since the default serializer
  14178. ## will normalize all categories to serialize on their own line.
  14179. ## This wikitext usage is going to be fairly uncommon in production and
  14180. ## selser will take care of preserving formatting in those scenarios.
  14181. !! test
  14182. 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
  14183. !! options
  14184. parsoid=wt2html
  14185. !! wikitext
  14186. * a [[Category:Foo]]
  14187. !! html/parsoid
  14188. <ul><li>a <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
  14189. !! end
  14190. # This test also demonstrates because of newline+category tunneling
  14191. # through the list hander, template wrapping doesn't expand to the
  14192. # containing list when the list item swallows the category.
  14193. !! test
  14194. 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
  14195. !! wikitext
  14196. * {{echo|a
  14197. [[Category:Foo]]}}
  14198. !! html/parsoid
  14199. <ul><li> <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n[[Category:Foo]]"}},"i":0}}]}'>a
  14200. </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul>
  14201. !! end
  14202. !! test
  14203. 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
  14204. !! wikitext
  14205. * a
  14206. {{echo|[[Category:Foo]]
  14207. [[Category:Bar]]}}
  14208. [[Category:Baz]]
  14209. !! html/parsoid
  14210. <ul><li> a</li></ul>
  14211. <link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[Category:Foo]]\n[[Category:Bar]]"}},"i":0}}]}'/><span about="#mwt1">
  14212. </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
  14213. <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
  14214. !! end
  14215. !! test
  14216. 9. Categories and newlines: should behave properly with linkprefix (T87753)
  14217. !! options
  14218. language=ar
  14219. !! wikitext
  14220. foo bar
  14221. foo bar
  14222. [[تصنيف:Foo]]
  14223. [[تصنيف:Bar]]
  14224. !! html/php
  14225. <p>foo bar
  14226. foo bar
  14227. </p>
  14228. !! html/parsoid
  14229. <p>foo bar
  14230. foo bar</p>
  14231. <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
  14232. <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
  14233. !! end
  14234. !! test
  14235. 10. No regressions on internal links following category (T174639)
  14236. !! options
  14237. parsoid=wt2html,html2html
  14238. !! wikitext
  14239. [[Category:Foo]]<div>a
  14240. [[Foo]]</div>
  14241. !! html/php
  14242. <div>a
  14243. <a href="/wiki/Foo" title="Foo">Foo</a></div>
  14244. !! html/parsoid
  14245. <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
  14246. <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
  14247. !! end
  14248. # Note that Parsoid differs slightly from PHP due to T175421
  14249. !! test
  14250. 11. Special case where only newlines separate links (T175416)
  14251. !! options
  14252. parsoid=wt2html,html2html
  14253. !! wikitext
  14254. [[Category:Foo]]
  14255. [[Foo]][[es:Alimento]]
  14256. [[Foo]]
  14257. !! html/php
  14258. <p><br />
  14259. <a href="/wiki/Foo" title="Foo">Foo</a>
  14260. </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
  14261. </p>
  14262. !! html/parsoid
  14263. <link rel="mw:PageProp/Category" href="./Category:Foo"/>
  14264. <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
  14265. <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
  14266. !! end
  14267. !! test
  14268. Category links with multiple namespaces
  14269. !! wikitext
  14270. [[Category:Project:Foo]]
  14271. !! html/parsoid
  14272. <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
  14273. !! end
  14274. !! test
  14275. Parsoid: Serialize link to category page with colon escape
  14276. !! options
  14277. parsoid
  14278. !! wikitext
  14279. [[:Category:Foo]]
  14280. [[:Category:Foo|Bar]]
  14281. !! html
  14282. <p>
  14283. <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
  14284. <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
  14285. </p>
  14286. !! end
  14287. # We used to, but no longer wt2wt this test since the default serializer
  14288. # will normalize all categories to serialize on their own line.
  14289. # This wikitext usage is going to be fairly uncommon in production and
  14290. # selser will take care of preventing whitespace insertion if this
  14291. # occurs in an article.
  14292. #
  14293. # html2html disabled for the same reason (whitespace insertion between
  14294. # x and y).
  14295. #
  14296. # html2wt disabled because it localizes the "Category" namespace.
  14297. !! test
  14298. Link prefix/suffixes aren't applied to category links
  14299. !! options
  14300. parsoid=wt2html
  14301. language=is
  14302. !! wikitext
  14303. x[[Category:Foo]]y
  14304. !! html/php
  14305. <p>xy
  14306. </p>
  14307. !! html/parsoid
  14308. <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
  14309. !! end
  14310. !! test
  14311. Link prefix/suffixes aren't applied to language links
  14312. !! options
  14313. parsoid=wt2html
  14314. language=is
  14315. !! wikitext
  14316. x[[es:Foo]]y
  14317. !! html/php
  14318. <p>xy
  14319. </p>
  14320. !! html/parsoid
  14321. <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
  14322. !! end
  14323. !! test
  14324. Parsoid: Serialize link to file page with colon escape
  14325. !! options
  14326. parsoid
  14327. !! wikitext
  14328. [[:File:Foo.png]]
  14329. [[:File:Foo.png|Bar]]
  14330. !! html
  14331. <p>
  14332. <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
  14333. <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
  14334. </p>
  14335. !! end
  14336. !! test
  14337. Parsoid: Serialize a genuine category link without colon escape
  14338. !! options
  14339. parsoid
  14340. !! wikitext
  14341. [[Category:Foo]]
  14342. [[Category:Foo|Bar]]
  14343. !! html
  14344. <link rel="mw:PageProp/Category" href="./Category:Foo">
  14345. <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
  14346. !! end
  14347. !! test
  14348. Normalize hrefs properly before testing for invalid link targets (T72894)
  14349. !! options
  14350. parsoid=html2wt
  14351. !! html/parsoid
  14352. <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
  14353. !! wikitext
  14354. [[Category:Toxine bactérienne]]
  14355. !! end
  14356. !! test
  14357. Parsoid: Defaultsort
  14358. !! wikitext
  14359. {{DEFAULTSORT:Foo}}
  14360. !! html/parsoid
  14361. <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
  14362. !! end
  14363. # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
  14364. # But, this is a limitation of our representation and is documented in
  14365. # TemplateHandler.js in processSpecialMagicWord
  14366. !! test
  14367. Parsoid: Defaultsort (template-generated)
  14368. !! wikitext
  14369. {{{{echo|DEFAULTSORT}}:Foo}}
  14370. !! html/parsoid
  14371. <meta property="mw:PageProp/categorydefaultsort" content="Foo" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{{{echo|DEFAULTSORT}}:Foo}}","dsr":[0,26,null,null]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}&#39;>DEFAULTSORT&lt;/span>:Foo"}]]}'/>
  14372. !! end
  14373. ###
  14374. ### Inter-language links
  14375. ###
  14376. !! test
  14377. Interlanguage links
  14378. !! options
  14379. ill
  14380. !! wikitext
  14381. [[es:Alimento]]
  14382. [[fr:Nourriture]]
  14383. [[zh:食品]]
  14384. !! html/php
  14385. es:Alimento fr:Nourriture zh:食品
  14386. !! html/parsoid
  14387. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
  14388. <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
  14389. <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
  14390. !! end
  14391. !! test
  14392. Duplicate interlanguage links (T26502)
  14393. !! options
  14394. ill
  14395. !! wikitext
  14396. [[es:1]]
  14397. [[es:2]]
  14398. [[fr:1]]
  14399. [[fr:2]]
  14400. !! html/php
  14401. es:1 fr:1
  14402. !! html/parsoid
  14403. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
  14404. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
  14405. <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
  14406. <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
  14407. !! end
  14408. ###
  14409. ### Sections
  14410. ###
  14411. !! test
  14412. Basic section headings
  14413. !! wikitext
  14414. ==Headline 1==
  14415. Some text
  14416. ==Headline 2==
  14417. More
  14418. ===Smaller headline===
  14419. Blah blah
  14420. !! html
  14421. <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14422. <p>Some text
  14423. </p>
  14424. <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14425. <p>More
  14426. </p>
  14427. <h3><span class="mw-headline" id="Smaller_headline">Smaller headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14428. <p>Blah blah
  14429. </p>
  14430. !! end
  14431. !! test
  14432. Section headings with TOC
  14433. !! wikitext
  14434. ==Headline 1==
  14435. ===Subheadline 1===
  14436. =====Skipping a level=====
  14437. ======Skipping a level======
  14438. ==Headline 2==
  14439. Some text
  14440. ===Another headline===
  14441. !! html
  14442. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14443. <ul>
  14444. <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
  14445. <ul>
  14446. <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
  14447. <ul>
  14448. <li class="toclevel-3 tocsection-3"><a href="#Skipping_a_level"><span class="tocnumber">1.1.1</span> <span class="toctext">Skipping a level</span></a>
  14449. <ul>
  14450. <li class="toclevel-4 tocsection-4"><a href="#Skipping_a_level_2"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Skipping a level</span></a></li>
  14451. </ul>
  14452. </li>
  14453. </ul>
  14454. </li>
  14455. </ul>
  14456. </li>
  14457. <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
  14458. <ul>
  14459. <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
  14460. </ul>
  14461. </li>
  14462. </ul>
  14463. </div>
  14464. <h2><span class="mw-headline" id="Headline_1">Headline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14465. <h3><span class="mw-headline" id="Subheadline_1">Subheadline 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14466. <h5><span class="mw-headline" id="Skipping_a_level">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
  14467. <h6><span class="mw-headline" id="Skipping_a_level_2">Skipping a level</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  14468. <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14469. <p>Some text
  14470. </p>
  14471. <h3><span class="mw-headline" id="Another_headline">Another headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14472. !! end
  14473. !! test
  14474. TOC anchors don't collide
  14475. !! wikitext
  14476. __FORCETOC__
  14477. ==Headline 2==
  14478. ==Headline==
  14479. ==Headline 2==
  14480. ==Headline==
  14481. !! html/php
  14482. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14483. <ul>
  14484. <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
  14485. <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
  14486. <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
  14487. <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
  14488. </ul>
  14489. </div>
  14490. <h2><span class="mw-headline" id="Headline_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14491. <h2><span class="mw-headline" id="Headline">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14492. <h2><span class="mw-headline" id="Headline_2_2">Headline 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14493. <h2><span class="mw-headline" id="Headline_3">Headline</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14494. !! end
  14495. # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
  14496. # Parsoid html2wt direction adds <nowiki> for level 7 and up.
  14497. !! test
  14498. Handling of sections up to level 6 and beyond
  14499. !! options
  14500. parsoid=wt2html
  14501. !! wikitext
  14502. =Level 1 Heading=
  14503. ==Level 2 Heading==
  14504. ===Level 3 Heading===
  14505. ====Level 4 Heading====
  14506. =====Level 5 Heading=====
  14507. ======Level 6 Heading======
  14508. =======Level 7 Heading=======
  14509. ========Level 8 Heading========
  14510. =========Level 9 Heading=========
  14511. ==========Level 10 Heading==========
  14512. !! html/php
  14513. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14514. <ul>
  14515. <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
  14516. <ul>
  14517. <li class="toclevel-2 tocsection-2"><a href="#Level_2_Heading"><span class="tocnumber">1.1</span> <span class="toctext">Level 2 Heading</span></a>
  14518. <ul>
  14519. <li class="toclevel-3 tocsection-3"><a href="#Level_3_Heading"><span class="tocnumber">1.1.1</span> <span class="toctext">Level 3 Heading</span></a>
  14520. <ul>
  14521. <li class="toclevel-4 tocsection-4"><a href="#Level_4_Heading"><span class="tocnumber">1.1.1.1</span> <span class="toctext">Level 4 Heading</span></a>
  14522. <ul>
  14523. <li class="toclevel-5 tocsection-5"><a href="#Level_5_Heading"><span class="tocnumber">1.1.1.1.1</span> <span class="toctext">Level 5 Heading</span></a>
  14524. <ul>
  14525. <li class="toclevel-6 tocsection-6"><a href="#Level_6_Heading"><span class="tocnumber">1.1.1.1.1.1</span> <span class="toctext">Level 6 Heading</span></a></li>
  14526. <li class="toclevel-6 tocsection-7"><a href="#.3DLevel_7_Heading.3D"><span class="tocnumber">1.1.1.1.1.2</span> <span class="toctext">=Level 7 Heading=</span></a></li>
  14527. <li class="toclevel-6 tocsection-8"><a href="#.3D.3DLevel_8_Heading.3D.3D"><span class="tocnumber">1.1.1.1.1.3</span> <span class="toctext">==Level 8 Heading==</span></a></li>
  14528. <li class="toclevel-6 tocsection-9"><a href="#.3D.3D.3DLevel_9_Heading.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.4</span> <span class="toctext">===Level 9 Heading===</span></a></li>
  14529. <li class="toclevel-6 tocsection-10"><a href="#.3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D"><span class="tocnumber">1.1.1.1.1.5</span> <span class="toctext">====Level 10 Heading====</span></a></li>
  14530. </ul>
  14531. </li>
  14532. </ul>
  14533. </li>
  14534. </ul>
  14535. </li>
  14536. </ul>
  14537. </li>
  14538. </ul>
  14539. </li>
  14540. </ul>
  14541. </div>
  14542. <h1><span class="mw-headline" id="Level_1_Heading">Level 1 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  14543. <h2><span class="mw-headline" id="Level_2_Heading">Level 2 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14544. <h3><span class="mw-headline" id="Level_3_Heading">Level 3 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14545. <h4><span class="mw-headline" id="Level_4_Heading">Level 4 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
  14546. <h5><span class="mw-headline" id="Level_5_Heading">Level 5 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
  14547. <h6><span class="mw-headline" id="Level_6_Heading">Level 6 Heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  14548. <h6><span class="mw-headline" id=".3DLevel_7_Heading.3D">=Level 7 Heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=7" title="Edit section: =Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  14549. <h6><span class="mw-headline" id=".3D.3DLevel_8_Heading.3D.3D">==Level 8 Heading==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=8" title="Edit section: ==Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  14550. <h6><span class="mw-headline" id=".3D.3D.3DLevel_9_Heading.3D.3D.3D">===Level 9 Heading===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=9" title="Edit section: ===Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  14551. <h6><span class="mw-headline" id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D">====Level 10 Heading====</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=10" title="Edit section: ====Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  14552. !! html/parsoid
  14553. <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
  14554. <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
  14555. <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
  14556. <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
  14557. <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
  14558. <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
  14559. <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
  14560. <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
  14561. <h6 id="===Level_9_Heading===" data-parsoid='{}'><span id=".3D.3D.3DLevel_9_Heading.3D.3D.3D" typeof="mw:FallbackId"></span>===Level 9 Heading===</h6>
  14562. <h6 id="====Level_10_Heading====" data-parsoid='{}'><span id=".3D.3D.3D.3DLevel_10_Heading.3D.3D.3D.3D" typeof="mw:FallbackId"></span>====Level 10 Heading====</h6>
  14563. !! end
  14564. !! test
  14565. TOC regression (T11764)
  14566. !! wikitext
  14567. ==title 1==
  14568. ===title 1.1===
  14569. ====title 1.1.1====
  14570. ===title 1.2===
  14571. ==title 2==
  14572. ===title 2.1===
  14573. !! html
  14574. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14575. <ul>
  14576. <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  14577. <ul>
  14578. <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a>
  14579. <ul>
  14580. <li class="toclevel-3 tocsection-3"><a href="#title_1.1.1"><span class="tocnumber">1.1.1</span> <span class="toctext">title 1.1.1</span></a></li>
  14581. </ul>
  14582. </li>
  14583. <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
  14584. </ul>
  14585. </li>
  14586. <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
  14587. <ul>
  14588. <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
  14589. </ul>
  14590. </li>
  14591. </ul>
  14592. </div>
  14593. <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14594. <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14595. <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
  14596. <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14597. <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14598. <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14599. !! end
  14600. !! test
  14601. TOC for heading containing <span id="..."></span> (T96153)
  14602. !! wikitext
  14603. __FORCETOC__
  14604. ==<span id="old-anchor"></span>New title==
  14605. !! html/php
  14606. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14607. <ul>
  14608. <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
  14609. </ul>
  14610. </div>
  14611. <h2><span class="mw-headline" id="New_title"><span id="old-anchor"></span>New title</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14612. !! end
  14613. !! test
  14614. TOC with wgMaxTocLevel=3 (T8204)
  14615. !! options
  14616. wgMaxTocLevel=3
  14617. !! wikitext
  14618. ==title 1==
  14619. ===title 1.1===
  14620. ====title 1.1.1====
  14621. ===title 1.2===
  14622. ==title 2==
  14623. ===title 2.1===
  14624. !! html
  14625. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14626. <ul>
  14627. <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  14628. <ul>
  14629. <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
  14630. <li class="toclevel-2 tocsection-4"><a href="#title_1.2"><span class="tocnumber">1.2</span> <span class="toctext">title 1.2</span></a></li>
  14631. </ul>
  14632. </li>
  14633. <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
  14634. <ul>
  14635. <li class="toclevel-2 tocsection-6"><a href="#title_2.1"><span class="tocnumber">2.1</span> <span class="toctext">title 2.1</span></a></li>
  14636. </ul>
  14637. </li>
  14638. </ul>
  14639. </div>
  14640. <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14641. <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14642. <h4><span class="mw-headline" id="title_1.1.1">title 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
  14643. <h3><span class="mw-headline" id="title_1.2">title 1.2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14644. <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14645. <h3><span class="mw-headline" id="title_2.1">title 2.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14646. !! end
  14647. !! test
  14648. TOC with wgMaxTocLevel=3 and two level four headings (T8204)
  14649. !! options
  14650. wgMaxTocLevel=3
  14651. !! wikitext
  14652. ==Section 1==
  14653. ===Section 1.1===
  14654. ====Section 1.1.1====
  14655. ====Section 1.1.1.1====
  14656. ==Section 2==
  14657. !! html
  14658. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14659. <ul>
  14660. <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
  14661. <ul>
  14662. <li class="toclevel-2 tocsection-2"><a href="#Section_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Section 1.1</span></a></li>
  14663. </ul>
  14664. </li>
  14665. <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
  14666. </ul>
  14667. </div>
  14668. <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14669. <h3><span class="mw-headline" id="Section_1.1">Section 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14670. <h4><span class="mw-headline" id="Section_1.1.1">Section 1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
  14671. <h4><span class="mw-headline" id="Section_1.1.1.1">Section 1.1.1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
  14672. <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14673. !! end
  14674. !! test
  14675. Resolving duplicate section names
  14676. !! wikitext
  14677. ==Foo bar==
  14678. ==Foo bar==
  14679. !! html
  14680. <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14681. <h2><span class="mw-headline" id="Foo_bar_2">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14682. !! end
  14683. !! test
  14684. Resolving duplicate section names with differing case (T12721)
  14685. !! wikitext
  14686. ==Foo bar==
  14687. ==Foo Bar==
  14688. !! html
  14689. <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14690. <h2><span class="mw-headline" id="Foo_Bar_2">Foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14691. !! end
  14692. !! article
  14693. Template:sections
  14694. !! text
  14695. ===Section 1===
  14696. ==Section 2==
  14697. !! endarticle
  14698. !! test
  14699. Template with sections, __NOTOC__
  14700. !! wikitext
  14701. __NOTOC__
  14702. ==Section 0==
  14703. {{sections}}
  14704. ==Section 4==
  14705. !! html
  14706. <h2><span class="mw-headline" id="Section_0">Section 0</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14707. <h3><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14708. <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Template:Sections&amp;action=edit&amp;section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14709. <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14710. !! end
  14711. !! test
  14712. __NOEDITSECTION__ keyword
  14713. !! wikitext
  14714. __NOEDITSECTION__
  14715. ==Section 1==
  14716. ==Section 2==
  14717. !! html
  14718. <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
  14719. <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
  14720. !! end
  14721. !! test
  14722. Link inside a section heading
  14723. !! wikitext
  14724. ==Section with a [[Main Page|link]] in it==
  14725. !! html
  14726. <h2><span class="mw-headline" id="Section_with_a_link_in_it">Section with a <a href="/wiki/Main_Page" title="Main Page">link</a> in it</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14727. !! end
  14728. !! test
  14729. TOC regression (T14077)
  14730. !! wikitext
  14731. __TOC__
  14732. ==title 1==
  14733. ===title 1.1===
  14734. ==title 2==
  14735. !! html
  14736. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14737. <ul>
  14738. <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
  14739. <ul>
  14740. <li class="toclevel-2 tocsection-2"><a href="#title_1.1"><span class="tocnumber">1.1</span> <span class="toctext">title 1.1</span></a></li>
  14741. </ul>
  14742. </li>
  14743. <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
  14744. </ul>
  14745. </div>
  14746. <h2><span class="mw-headline" id="title_1">title 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14747. <h3><span class="mw-headline" id="title_1.1">title 1.1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  14748. <h2><span class="mw-headline" id="title_2">title 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14749. !! end
  14750. !! test
  14751. T3219 URL next to image (good)
  14752. !! wikitext
  14753. http://example.com [[File:Foobar.jpg]]
  14754. !! html/php
  14755. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  14756. </p>
  14757. !! html/parsoid
  14758. <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> <figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  14759. !!end
  14760. # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
  14761. !! test
  14762. Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
  14763. !! options
  14764. parsoid=wt2html,html2html
  14765. !! wikitext
  14766. ===
  14767. The line above must have a trailing space!
  14768. === <!--
  14769. --> <!-- -->
  14770. But just in case it doesn't...
  14771. !! html/php
  14772. <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  14773. <p>The line above must have a trailing space!
  14774. </p>
  14775. <h1><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  14776. <p>But just in case it doesn't...
  14777. </p>
  14778. !! html/parsoid
  14779. <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
  14780. <p>The line above must have a trailing space!</p>
  14781. <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
  14782. --> <!-- -->
  14783. <p>But just in case it doesn't...</p>
  14784. !! end
  14785. !! test
  14786. Header with special characters (T27462)
  14787. !! wikitext
  14788. The tooltips shall not show entities to the user (ie. be double escaped)
  14789. ==text > text==
  14790. section 1
  14791. ==text < text==
  14792. section 2
  14793. ==text & text==
  14794. section 3
  14795. ==text ' text==
  14796. section 4
  14797. ==text " text==
  14798. section 5
  14799. !! html/php
  14800. <p>The tooltips shall not show entities to the user (ie. be double escaped)
  14801. </p>
  14802. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14803. <ul>
  14804. <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text &gt; text</span></a></li>
  14805. <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text &lt; text</span></a></li>
  14806. <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text &amp; text</span></a></li>
  14807. <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
  14808. <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
  14809. </ul>
  14810. </div>
  14811. <h2><span class="mw-headline" id="text_.3E_text">text &gt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: text &gt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14812. <p>section 1
  14813. </p>
  14814. <h2><span class="mw-headline" id="text_.3C_text">text &lt; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: text &lt; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14815. <p>section 2
  14816. </p>
  14817. <h2><span class="mw-headline" id="text_.26_text">text &amp; text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: text &amp; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14818. <p>section 3
  14819. </p>
  14820. <h2><span class="mw-headline" id="text_.27_text">text ' text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: text &#039; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14821. <p>section 4
  14822. </p>
  14823. <h2><span class="mw-headline" id="text_.22_text">text " text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: text &quot; text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14824. <p>section 5
  14825. </p>
  14826. !! html/parsoid
  14827. <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
  14828. <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
  14829. <p>section 1</p>
  14830. <h2 id="text_&lt;_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text &lt; text</h2>
  14831. <p>section 2</p>
  14832. <h2 id="text_&amp;_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text &amp; text</h2>
  14833. <p>section 3</p>
  14834. <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
  14835. <p>section 4</p>
  14836. <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
  14837. <p>section 5</p>
  14838. !! end
  14839. !! test
  14840. Header with space, plus and underscore as entity
  14841. !! wikitext
  14842. Id should not contain + for spaces
  14843. ==Space between Text==
  14844. section 1
  14845. ==Space-Entity&#32;between&#32;Text==
  14846. section 2
  14847. ==Plus+between+Text==
  14848. section 3
  14849. ==Plus-Entity&#43;between&#43;Text==
  14850. section 4
  14851. ==Underscore_between_Text==
  14852. section 5
  14853. ==Underscore-Entity&#95;between&#95;Text==
  14854. section 6
  14855. [[#Space between Text]]
  14856. [[#Space-Entity&#32;between&#32;Text]]
  14857. [[#Plus+between+Text]]
  14858. [[#Plus-Entity&#43;between&#43;Text]]
  14859. [[#Underscore_between_Text]]
  14860. [[#Underscore-Entity&#95;between&#95;Text]]
  14861. !! html/php
  14862. <p>Id should not contain + for spaces
  14863. </p>
  14864. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14865. <ul>
  14866. <li class="toclevel-1 tocsection-1"><a href="#Space_between_Text"><span class="tocnumber">1</span> <span class="toctext">Space between Text</span></a></li>
  14867. <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity&#32;between&#32;Text</span></a></li>
  14868. <li class="toclevel-1 tocsection-3"><a href="#Plus.2Bbetween.2BText"><span class="tocnumber">3</span> <span class="toctext">Plus+between+Text</span></a></li>
  14869. <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity&#43;between&#43;Text</span></a></li>
  14870. <li class="toclevel-1 tocsection-5"><a href="#Underscore_between_Text"><span class="tocnumber">5</span> <span class="toctext">Underscore_between_Text</span></a></li>
  14871. <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity&#95;between&#95;Text</span></a></li>
  14872. </ul>
  14873. </div>
  14874. <h2><span class="mw-headline" id="Space_between_Text">Space between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14875. <p>section 1
  14876. </p>
  14877. <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity&#32;between&#32;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14878. <p>section 2
  14879. </p>
  14880. <h2><span class="mw-headline" id="Plus.2Bbetween.2BText">Plus+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14881. <p>section 3
  14882. </p>
  14883. <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity&#43;between&#43;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14884. <p>section 4
  14885. </p>
  14886. <h2><span class="mw-headline" id="Underscore_between_Text">Underscore_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14887. <p>section 5
  14888. </p>
  14889. <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity&#95;between&#95;Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  14890. <p>section 6
  14891. </p><p><a href="#Space_between_Text">#Space between Text</a>
  14892. <a href="#Space-Entity_between_Text">#Space-Entity&#32;between&#32;Text</a>
  14893. <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
  14894. <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity&#43;between&#43;Text</a>
  14895. <a href="#Underscore_between_Text">#Underscore_between_Text</a>
  14896. <a href="#Underscore-Entity_between_Text">#Underscore-Entity&#95;between&#95;Text</a>
  14897. </p>
  14898. !! html/parsoid
  14899. <p>Id should not contain + for spaces</p>
  14900. <h2 id="Space_between_Text">Space between Text</h2>
  14901. <p>section 1</p>
  14902. <h2 id="Space-Entity_between_Text">Space-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#32;","srcContent":" "}'> </span>Text</h2>
  14903. <p>section 2</p>
  14904. <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
  14905. <p>section 3</p>
  14906. <h2 id="Plus-Entity+between+Text"><span id="Plus-Entity.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#43;","srcContent":"+"}'>+</span>Text</h2>
  14907. <p>section 4</p>
  14908. <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
  14909. <p>section 5</p>
  14910. <h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&amp;#95;","srcContent":"_"}'>_</span>Text</h2>
  14911. <p>section 6</p>
  14912. <p><a rel="mw:WikiLink" href="./Main_Page#Space_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space_between_Text"},"sa":{"href":"#Space between Text"}}'>#Space between Text</a>
  14913. <a rel="mw:WikiLink" href="./Main_Page#Space-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Space-Entity_between_Text"},"sa":{"href":"#Space-Entity&amp;#32;between&amp;#32;Text"}}'>#Space-Entity between Text</a>
  14914. <a rel="mw:WikiLink" href="./Main_Page#Plus+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus+between+Text"},"sa":{"href":"#Plus+between+Text"}}'>#Plus+between+Text</a>
  14915. <a rel="mw:WikiLink" href="./Main_Page#Plus-Entity+between+Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Plus-Entity+between+Text"},"sa":{"href":"#Plus-Entity&amp;#43;between&amp;#43;Text"}}'>#Plus-Entity+between+Text</a>
  14916. <a rel="mw:WikiLink" href="./Main_Page#Underscore_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore_between_Text"},"sa":{"href":"#Underscore_between_Text"}}'>#Underscore_between_Text</a>
  14917. <a rel="mw:WikiLink" href="./Main_Page#Underscore-Entity_between_Text" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Underscore-Entity_between_Text"},"sa":{"href":"#Underscore-Entity&amp;#95;between&amp;#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
  14918. !! end
  14919. # Parsoid html2wt disabled because it adds padding spaces around =
  14920. !! test
  14921. Headers with excess '=' characters
  14922. (Are similar tests necessary beyond the 1st level?)
  14923. !! options
  14924. parsoid=wt2html,wt2wt,html2html
  14925. !! wikitext
  14926. =foo==
  14927. ==foo=
  14928. =''italic'' heading==
  14929. ==''italic'' heading=
  14930. !! html/php
  14931. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14932. <ul>
  14933. <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
  14934. <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
  14935. <li class="toclevel-1 tocsection-3"><a href="#italic_heading.3D"><span class="tocnumber">3</span> <span class="toctext"><i>italic</i> heading=</span></a></li>
  14936. <li class="toclevel-1 tocsection-4"><a href="#.3Ditalic_heading"><span class="tocnumber">4</span> <span class="toctext">=<i>italic</i> heading</span></a></li>
  14937. </ul>
  14938. </div>
  14939. <h1><span class="mw-headline" id="foo.3D">foo=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  14940. <h1><span class="mw-headline" id=".3Dfoo">=foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  14941. <h1><span class="mw-headline" id="italic_heading.3D"><i>italic</i> heading=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  14942. <h1><span class="mw-headline" id=".3Ditalic_heading">=<i>italic</i> heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  14943. !! html/parsoid
  14944. <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
  14945. <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
  14946. <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
  14947. <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
  14948. !! end
  14949. !! test
  14950. HTML headers vs TOC (T25393)
  14951. (__NOEDITSECTION__ for clearer output, doesn't matter here)
  14952. !! wikitext
  14953. <h1>Header 1</h1>
  14954. ==Header 1.1==
  14955. ==Header 1.2==
  14956. <h1>Header 2
  14957. </h1>
  14958. ==Header 2.1==
  14959. ==Header 2.2==
  14960. __NOEDITSECTION__
  14961. !! html/php
  14962. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  14963. <ul>
  14964. <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
  14965. <ul>
  14966. <li class="toclevel-2 tocsection-1"><a href="#Header_1.1"><span class="tocnumber">1.1</span> <span class="toctext">Header 1.1</span></a></li>
  14967. <li class="toclevel-2 tocsection-2"><a href="#Header_1.2"><span class="tocnumber">1.2</span> <span class="toctext">Header 1.2</span></a></li>
  14968. </ul>
  14969. </li>
  14970. <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
  14971. <ul>
  14972. <li class="toclevel-2 tocsection-3"><a href="#Header_2.1"><span class="tocnumber">2.1</span> <span class="toctext">Header 2.1</span></a></li>
  14973. <li class="toclevel-2 tocsection-4"><a href="#Header_2.2"><span class="tocnumber">2.2</span> <span class="toctext">Header 2.2</span></a></li>
  14974. </ul>
  14975. </li>
  14976. </ul>
  14977. </div>
  14978. <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
  14979. <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
  14980. <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
  14981. <h1><span class="mw-headline" id="Header_2">Header 2
  14982. </span></h1>
  14983. <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
  14984. <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
  14985. !! html/parsoid
  14986. <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
  14987. <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
  14988. <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
  14989. <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
  14990. </h1>
  14991. <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
  14992. <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
  14993. <meta property="mw:PageProp/noeditsection"/>
  14994. !! end
  14995. !! test
  14996. Single-line or multiline-comments can follow headings
  14997. !! options
  14998. parsoid=wt2html,wt2wt
  14999. !! wikitext
  15000. ==foo==<!---->
  15001. ==bar==<!--c1-->
  15002. ==baz==<!--
  15003. c2
  15004. c3-->
  15005. !! html/php
  15006. <h2><span class="mw-headline" id="foo">foo</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: foo">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  15007. <h2><span class="mw-headline" id="bar">bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  15008. <h2><span class="mw-headline" id="baz">baz</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: baz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  15009. !! html/parsoid
  15010. <h2 id="foo">foo</h2><!---->
  15011. <h2 id="bar">bar</h2><!--c1-->
  15012. <h2 id="baz">baz</h2><!--
  15013. c2
  15014. c3-->
  15015. !! end
  15016. !! test
  15017. T3219 URL next to image (broken)
  15018. !! wikitext
  15019. http://example.com[[File:Foobar.jpg]]
  15020. !! html/php
  15021. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  15022. </p>
  15023. !! html/parsoid
  15024. <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a></figure-inline></p>
  15025. !!end
  15026. !! test
  15027. T3186 news: in the middle of text
  15028. !! wikitext
  15029. http://en.wikinews.org/wiki/Wikinews:Workplace
  15030. !! html
  15031. <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
  15032. </p>
  15033. !!end
  15034. !! test
  15035. Namespaced link must have a title
  15036. !! wikitext
  15037. [[Project:]]
  15038. !! html
  15039. <p>[[Project:]]
  15040. </p>
  15041. !!end
  15042. !! test
  15043. Namespaced link must have a title (bad fragment version)
  15044. !! wikitext
  15045. [[Project:#fragment]]
  15046. !! html
  15047. <p>[[Project:#fragment]]
  15048. </p>
  15049. !!end
  15050. ###
  15051. ### HTML tags and HTML attributes
  15052. ###
  15053. !! test
  15054. div with no attributes
  15055. !! wikitext
  15056. <div>HTML rocks</div>
  15057. !! html
  15058. <div>HTML rocks</div>
  15059. !! end
  15060. !! test
  15061. div with double-quoted attribute
  15062. !! wikitext
  15063. <div id="rock">HTML rocks</div>
  15064. !! html
  15065. <div id="rock">HTML rocks</div>
  15066. !! end
  15067. !! test
  15068. div with single-quoted attribute
  15069. !! wikitext
  15070. <div id='rock'>HTML rocks</div>
  15071. !! html
  15072. <div id="rock">HTML rocks</div>
  15073. !! end
  15074. !! test
  15075. div with unquoted attribute
  15076. !! wikitext
  15077. <div id=rock>HTML rocks</div>
  15078. !! html
  15079. <div id="rock">HTML rocks</div>
  15080. !! end
  15081. !! test
  15082. div with illegal double attributes
  15083. !! wikitext
  15084. <div id="a" id="b">HTML rocks</div>
  15085. !! html
  15086. <div id="b">HTML rocks</div>
  15087. !!end
  15088. !! test
  15089. div with empty attribute value, space before equals
  15090. !! options
  15091. parsoid=wt2html,html2html
  15092. !! wikitext
  15093. <div class =>HTML rocks</div>
  15094. !! html/php
  15095. <div class="">HTML rocks</div>
  15096. !! html/parsoid
  15097. <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
  15098. !! end
  15099. !! test
  15100. div with multiple empty attribute values
  15101. !! config
  15102. wgFragmentMode=[ 'html5', 'legacy' ]
  15103. !! options
  15104. parsoid=wt2html,html2html
  15105. !! wikitext
  15106. <div id= title=>HTML rocks</div>
  15107. !! html/php
  15108. <div id="title=">HTML rocks</div>
  15109. !! html/parsoid
  15110. <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
  15111. !! end
  15112. # FIXME Parsoid doesn't actually match PHP here.
  15113. # Probably we should use the synthetic <foo /> or <indicator>
  15114. # extensions for this test, which are enabled when running parser tests.
  15115. !! test
  15116. Extension tag in attribute value
  15117. !! wikitext
  15118. <span title="<translate>123</translate>">ok</span>
  15119. !! html/php+disabled
  15120. <p>&lt;span title="&lt;translate&gt;123&lt;/translate&gt;"&gt;ok&lt;/span&gt;
  15121. </p>
  15122. !! html/parsoid
  15123. <p><span title="123" about="#mwt4" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"123"},"sa":{"title":"&lt;translate>123&lt;/translate>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;translate typeof=\"mw:Extension/translate\" about=\"#mwt3\" data-parsoid=&apos;{\"dsr\":[13,39,2,2]}&apos; data-mw=&apos;{\"name\":\"translate\",\"attrs\":{},\"body\":{\"extsrc\":\"123\"}}&apos;>123&lt;/translate>"}]]}'>ok</span></p>
  15124. !! end
  15125. !! test
  15126. table with multiple empty attribute values
  15127. !! options
  15128. parsoid=wt2html,html2html
  15129. !! wikitext
  15130. {| title= id=
  15131. |hi
  15132. |}
  15133. !! html/php
  15134. <table title="id=">
  15135. <tr>
  15136. <td>hi
  15137. </td></tr></table>
  15138. !! html/parsoid
  15139. <table title="id=">
  15140. <tbody><tr><td>hi</td></tr>
  15141. </tbody></table>
  15142. !! end
  15143. !! test
  15144. div with braces in attribute value
  15145. !! wikitext
  15146. <div title="{}">Foo</div>
  15147. !! html/php
  15148. <div title="&#123;&#125;">Foo</div>
  15149. !! html/parsoid
  15150. <div title="{}">Foo</div>
  15151. !! end
  15152. !! test
  15153. div with empty attribute value, no space before equals
  15154. !! options
  15155. parsoid=wt2html,html2html
  15156. !! wikitext
  15157. <div class=>HTML rocks</div>
  15158. !! html/php
  15159. <div class="">HTML rocks</div>
  15160. !! html/parsoid
  15161. <div class="">HTML rocks</div>
  15162. !! end
  15163. !! test
  15164. HTML multiple attributes correction
  15165. !! wikitext
  15166. <p class="error" class="awesome">Awesome!</p>
  15167. !! html
  15168. <p class="awesome">Awesome!</p>
  15169. !!end
  15170. !! test
  15171. Table multiple attributes correction
  15172. !! wikitext
  15173. {|
  15174. !+ class="error" class="awesome"|status
  15175. |}
  15176. !! html
  15177. <table>
  15178. <tr>
  15179. <th class="awesome">status
  15180. </th></tr></table>
  15181. !!end
  15182. !! test
  15183. DIV IN UPPERCASE
  15184. !! wikitext
  15185. <DIV ID="x">HTML ROCKS</DIV>
  15186. !! html
  15187. <div id="x">HTML ROCKS</div>
  15188. !!end
  15189. !! test
  15190. Non-ASCII pseudo-tags are rendered as text
  15191. !! wikitext
  15192. <khyô>
  15193. !! html
  15194. <p>&lt;khyô&gt;
  15195. </p>
  15196. !! end
  15197. !! test
  15198. Pseudo-tag with URL 'name' renders as url link
  15199. !! wikitext
  15200. <http://example.com/>
  15201. !! html
  15202. <p>&lt;<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>&gt;
  15203. </p>
  15204. !! end
  15205. !! test
  15206. text with amp in the middle of nowhere
  15207. !! wikitext
  15208. Remember AT&T?
  15209. !! html
  15210. <p>Remember AT&amp;T?
  15211. </p>
  15212. !! end
  15213. !! test
  15214. text with character entity: eacute
  15215. !! wikitext
  15216. I always thought &eacute; was a cute letter.
  15217. !! html+tidy
  15218. <p>I always thought &#233; was a cute letter.
  15219. </p>
  15220. !! end
  15221. !! test
  15222. text with entity-escaped character entity-like string: eacute
  15223. !! wikitext
  15224. I always thought &amp;eacute; was a cute letter.
  15225. !! html
  15226. <p>I always thought &amp;eacute; was a cute letter.
  15227. </p>
  15228. !! end
  15229. !! test
  15230. text with undefined character entity: xacute
  15231. !! wikitext
  15232. I always thought &xacute; was a cute letter.
  15233. !! html
  15234. <p>I always thought &amp;xacute; was a cute letter.
  15235. </p>
  15236. !! end
  15237. !! test
  15238. HTML5 tags
  15239. !! wikitext
  15240. <data value="5">five</data>
  15241. <time datetime="2000-01-01T00:00Z">The new millenium started</time>
  15242. <mark>This highlighted text</mark>
  15243. !! html
  15244. <p><data value="5">five</data>
  15245. <time datetime="2000-01-01T00:00Z">The new millenium started</time>
  15246. <mark>This highlighted text</mark>
  15247. </p>
  15248. !! end
  15249. !! test
  15250. HTML tag with leading space is parsed as text
  15251. !! wikitext
  15252. < div>foo< /div>
  15253. !! html
  15254. <p>&lt; div&gt;foo&lt; /div&gt;
  15255. </p>
  15256. !! end
  15257. ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
  15258. ## the HTML5 parsing spec.
  15259. !! test
  15260. Element with broken attribute syntax
  15261. !! options
  15262. parsoid=wt2html
  15263. !! wikitext
  15264. <div style=" style="123">hi</div>
  15265. <div =>ho</div>
  15266. !! html/php
  15267. <div style="123">hi</div>
  15268. <div>ho</div>
  15269. !! html/parsoid
  15270. <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
  15271. <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
  15272. !! end
  15273. ###
  15274. ### Nesting tests (see T43545, T52604, T53081)
  15275. ###
  15276. # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
  15277. # Note that html2wt is considerably more difficult if we use <b> in
  15278. # the test case, instead of <small>
  15279. !! test
  15280. Ensure that HTML adoption agency algorithm is properly implemented.
  15281. !! wikitext
  15282. <small>X<small>Y</small>Z</small>
  15283. !! html
  15284. <p><small>X<small>Y</small>Z</small>
  15285. </p>
  15286. !! end
  15287. # This was T43545 in the PHP parser.
  15288. !! test
  15289. Nesting of <kbd>
  15290. !! wikitext
  15291. <kbd>X<kbd>Y</kbd>Z</kbd>
  15292. !! html+tidy
  15293. <p><kbd>X<kbd>Y</kbd>Z</kbd>
  15294. </p>
  15295. !! end
  15296. # The following cases were T53081 in the PHP parser.
  15297. # Note that there are some other nestable tags (b, i, etc) which are
  15298. # not covered; see T53081 for discussion.
  15299. !! test
  15300. Nesting of <em>
  15301. !! wikitext
  15302. <em>X<em>Y</em>Z</em>
  15303. !! html+tidy
  15304. <p><em>X<em>Y</em>Z</em>
  15305. </p>
  15306. !! end
  15307. !! test
  15308. Nesting of <strong>
  15309. !! wikitext
  15310. <strong>X<strong>Y</strong>Z</strong>
  15311. !! html+tidy
  15312. <p><strong>X<strong>Y</strong>Z</strong>
  15313. </p>
  15314. !! end
  15315. !! test
  15316. Nesting of <q>
  15317. !! wikitext
  15318. <q>X<q>Y</q>Z</q>
  15319. !! html+tidy
  15320. <p><q>X<q>Y</q>Z</q>
  15321. </p>
  15322. !! end
  15323. !! test
  15324. Nesting of <ruby>
  15325. !! wikitext
  15326. <ruby>X<ruby>Y</ruby>Z</ruby>
  15327. !! html
  15328. <p><ruby>X<ruby>Y</ruby>Z</ruby>
  15329. </p>
  15330. !! end
  15331. !! test
  15332. Nesting of <bdo>
  15333. !! wikitext
  15334. <bdo>X<bdo>Y</bdo>Z</bdo>
  15335. !! html
  15336. <p><bdo>X<bdo>Y</bdo>Z</bdo>
  15337. </p>
  15338. !! end
  15339. ###
  15340. ### Media links
  15341. ###
  15342. !! test
  15343. Media link
  15344. !! wikitext
  15345. [[Media:Foobar.jpg]]
  15346. [[Media:Video.ogv]]
  15347. [[:Media:Video.ogv]]
  15348. !! html/php
  15349. <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
  15350. <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
  15351. <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
  15352. </p>
  15353. !! html/parsoid
  15354. <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
  15355. <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
  15356. <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv" data-parsoid='{"a":{"namespace":"Media"},"sa":{"namespace":":Media"}}'>Media:Video.ogv</a></p>
  15357. !! end
  15358. !! test
  15359. Media link with text
  15360. !! wikitext
  15361. [[Media:Foobar.jpg|A neat file to look at]]
  15362. !! html/php
  15363. <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
  15364. </p>
  15365. !! html/parsoid
  15366. <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
  15367. !! end
  15368. # FIXME: this is still bad HTML tag nesting
  15369. # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
  15370. # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
  15371. !! test
  15372. Media link with nasty text
  15373. !! wikitext
  15374. [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
  15375. !! html/php
  15376. <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link&lt;div style="display:none"&gt;" onmouseover="alert(document.cookie)" onfoo="&lt;/div&gt;</a>
  15377. !! html/php+tidy
  15378. <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link</a></p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg"><div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
  15379. !! html/parsoid
  15380. <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true}'>Safe Link</a></p><div style="display:none" data-parsoid='{"stx":"html"}'><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg" data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'>" onmouseover="alert(document.cookie)" onfoo="</a></div>
  15381. !! end
  15382. !! test
  15383. Media link to nonexistent file (T3702)
  15384. !! wikitext
  15385. [[Media:No such.jpg]]
  15386. [[Media:No_such file.jpg]]
  15387. !! html/php
  15388. <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
  15389. <a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
  15390. </p>
  15391. !! html/parsoid
  15392. <p><a rel="mw:MediaLink" href="./Special:FilePath/No_such.jpg" title="No such.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such.jpg"},"sa":{"fileName":"No such.jpg"}}'>Media:No such.jpg</a>
  15393. <a rel="mw:MediaLink" href="./Special:FilePath/No_such_file.jpg" title="No such file.jpg" typeof="mw:Error" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}' data-parsoid='{"a":{"fileName":"No_such_file.jpg"},"sa":{"fileName":"No_such file.jpg"}}'>Media:No_such file.jpg</a></p>
  15394. !! end
  15395. !! test
  15396. Image link to nonexistent file (T3850 - good)
  15397. !! wikitext
  15398. [[File:No_such.jpg]]
  15399. !! html/php
  15400. <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
  15401. </p>
  15402. !! html/parsoid
  15403. <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:No_such.jpg"><img resource="./File:No_such.jpg" src="./Special:FilePath/No_such.jpg" height="220" width="220"/></a></figure-inline></p>
  15404. !! end
  15405. !! test
  15406. :Image link to nonexistent file (T3850 - bad)
  15407. !! wikitext
  15408. [[:Image:No such.jpg]]
  15409. !! html/php
  15410. <p><a href="/index.php?title=File:No_such.jpg&amp;action=edit&amp;redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
  15411. </p>
  15412. !! html/parsoid
  15413. <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
  15414. !! end
  15415. !! test
  15416. Character reference normalization in link text (T3938)
  15417. !! wikitext
  15418. [[Main Page|this&that]]
  15419. !! html
  15420. <p><a href="/wiki/Main_Page" title="Main Page">this&amp;that</a>
  15421. </p>
  15422. !!end
  15423. !! article
  15424. אַ
  15425. !! text
  15426. Test for unicode normalization
  15427. The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
  15428. !! endarticle
  15429. !! test
  15430. (T21451) Links should refer to the normalized form.
  15431. !! wikitext
  15432. [[&#xFB2E;]]
  15433. [[&#x5d0;&#x5b7;]]
  15434. [[&#x5d0;ַ]]
  15435. [[א&#x5b7;]]
  15436. [[אַ]]
  15437. !! html
  15438. <p><a href="/wiki/%D7%90%D6%B7" title="אַ">&#xfb2e;</a>
  15439. <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;&#x5b7;</a>
  15440. <a href="/wiki/%D7%90%D6%B7" title="אַ">&#x5d0;ַ</a>
  15441. <a href="/wiki/%D7%90%D6%B7" title="אַ">א&#x5b7;</a>
  15442. <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
  15443. </p>
  15444. !! end
  15445. !! test
  15446. Empty attribute crash test (T4067)
  15447. !! wikitext
  15448. <font color="">foo</font>
  15449. !! html
  15450. <p><font color="">foo</font>
  15451. </p>
  15452. !! end
  15453. !! test
  15454. Empty attribute crash test single-quotes (T4067)
  15455. !! wikitext
  15456. <font color=''>foo</font>
  15457. !! html
  15458. <p><font color="">foo</font>
  15459. </p>
  15460. !! end
  15461. !! test
  15462. Attribute test: equals, then nothing
  15463. !! options
  15464. parsoid=wt2html,html2html
  15465. !! wikitext
  15466. <font color=>foo</font>
  15467. !! html/php
  15468. <p><font color="">foo</font>
  15469. </p>
  15470. !! html/parsoid
  15471. <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
  15472. !! end
  15473. !! test
  15474. Attribute test: unquoted value
  15475. !! options
  15476. parsoid=wt2html,html2html
  15477. !! wikitext
  15478. <font color=x>foo</font>
  15479. !! html/php
  15480. <p><font color="x">foo</font>
  15481. </p>
  15482. !! html/parsoid
  15483. <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
  15484. !! end
  15485. !! test
  15486. Attribute test: unquoted but illegal value (hash)
  15487. !! wikitext
  15488. <font color=#x>foo</font>
  15489. !! html
  15490. <p><font color="#x">foo</font>
  15491. </p>
  15492. !! end
  15493. # Parsoid does not serialize to empty attribute syntax,
  15494. # so wt2wt and html2wt cases are skipped
  15495. !! test
  15496. Attribute test: no value (T54330)
  15497. !! options
  15498. parsoid=wt2html,html2html
  15499. !! wikitext
  15500. <font color>foo</font>
  15501. !! html/php
  15502. <p><font color="">foo</font>
  15503. </p>
  15504. !! html/parsoid
  15505. <p><font color="">foo</font></p>
  15506. !! end
  15507. !! test
  15508. T4095: link with three closing brackets
  15509. !! wikitext
  15510. [[Main Page]]]
  15511. !! html/php
  15512. <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
  15513. </p>
  15514. !! html/parsoid
  15515. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
  15516. !! end
  15517. !! test
  15518. T4095: link with pipe and three closing brackets
  15519. !! wikitext
  15520. [[Main Page|link]]]
  15521. !! html/php
  15522. <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
  15523. </p>
  15524. !! html/parsoid
  15525. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
  15526. !! end
  15527. !! test
  15528. T4095: link with pipe and three closing brackets, version 2
  15529. !! wikitext
  15530. [[Main Page|[http://example.com/]]]
  15531. !! html/php
  15532. <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
  15533. </p>
  15534. !! html/parsoid
  15535. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
  15536. !! end
  15537. ###
  15538. ### Safety
  15539. ###
  15540. !! article
  15541. Template:Dangerous attribute
  15542. !! text
  15543. " onmouseover="alert(document.cookie)
  15544. !! endarticle
  15545. !! article
  15546. Template:Dangerous style attribute
  15547. !! text
  15548. border-size: expression(alert(document.cookie))
  15549. !! endarticle
  15550. !! article
  15551. Template:Div style
  15552. !! text
  15553. <div style="float: right; {{{1}}}">Magic div</div>
  15554. !! endarticle
  15555. !! test
  15556. T4304: HTML attribute safety (safe template; regression T4309)
  15557. !! wikitext
  15558. <div title="{{test}}"></div>
  15559. !! html/php
  15560. <div title="This is a test template"></div>
  15561. !! html/parsoid
  15562. <div title="This is a test template" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"This is a test template"},"sa":{"title":"{{test}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,20,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}&#39;>This is a test template&lt;/span>"}]]}'></div>
  15563. !! end
  15564. # Parsoid has enough context to handle this case
  15565. !! test
  15566. T4304: HTML attribute safety (dangerous template; 2309)
  15567. !! wikitext
  15568. <div title="{{dangerous attribute}}"></div>
  15569. !! html/php
  15570. <div title=""></div>
  15571. !! html/parsoid
  15572. <div title='" onmouseover="alert(document.cookie)' about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"\" onmouseover=\"alert(document.cookie)"},"sa":{"title":"{{dangerous attribute}}"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,35,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}&#39;>\" onmouseover=\"alert(document.cookie)&lt;/span>"}]]}'></div>
  15573. !! end
  15574. !! test
  15575. T4304: HTML attribute safety (dangerous style template; 2309)
  15576. !! wikitext
  15577. <div style="{{dangerous style attribute}}"></div>
  15578. !! html/php
  15579. <div style="/* insecure input */"></div>
  15580. !! html/parsoid
  15581. <div style="/* insecure input */" about="#mwt2" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"{{dangerous style attribute}}"}}' data-mw='{"attribs":[[{"txt":"style"},{"html":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[12,41,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}&#39;>border-size: expression(alert(document.cookie))&lt;/span>"}]]}'></div>
  15582. !! end
  15583. !! test
  15584. T4304: HTML attribute safety (safe parameter; 2309)
  15585. !! wikitext
  15586. {{div style|width: 200px}}
  15587. !! html/php
  15588. <div style="float: right; width: 200px">Magic div</div>
  15589. !! html/parsoid
  15590. <div style="float: right; width: 200px" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"float: right; width: 200px"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: 200px"}},"i":0}}]}'>Magic div</div>
  15591. !! end
  15592. !! test
  15593. T4304: HTML attribute safety (unsafe parameter; 2309)
  15594. !! wikitext
  15595. {{div style|width: expression(alert(document.cookie))}}
  15596. !! html/php
  15597. <div style="/* insecure input */">Magic div</div>
  15598. !! html/parsoid
  15599. <div style="/* insecure input */" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"float: right; {{{1}}}"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"div style","href":"./Template:Div_style"},"params":{"1":{"wt":"width: expression(alert(document.cookie))"}},"i":0}}]}'>Magic div</div>
  15600. !! end
  15601. ## Parsoid output here differs; needs investigation.
  15602. !! test
  15603. T4304: HTML attribute safety (unsafe breakout parameter; 2309)
  15604. !! wikitext
  15605. {{div style|"><script>alert(document.cookie)</script>}}
  15606. !! html
  15607. <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
  15608. !! end
  15609. ## Parsoid output here differs; needs investigation.
  15610. !! test
  15611. T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
  15612. !! wikitext
  15613. {{div style|" ><script>alert(document.cookie)</script>}}
  15614. !! html
  15615. <div style="float: right;">&lt;script&gt;alert(document.cookie)&lt;/script&gt;"&gt;Magic div</div>
  15616. !! end
  15617. !! test
  15618. T4304: HTML attribute safety (link)
  15619. !! wikitext
  15620. <div title="[[Main Page]]"></div>
  15621. !! html/php
  15622. <div title="&#91;&#91;Main Page&#93;&#93;"></div>
  15623. !! html/parsoid
  15624. <div title="[[Main Page]]"></div>
  15625. !! end
  15626. !! test
  15627. T4304: HTML attribute safety (italics)
  15628. !! wikitext
  15629. <div title="''foobar''"></div>
  15630. !! html
  15631. <div title="&#39;&#39;foobar&#39;&#39;"></div>
  15632. !! end
  15633. !! test
  15634. T4304: HTML attribute safety (bold)
  15635. !! wikitext
  15636. <div title="'''foobar'''"></div>
  15637. !! html
  15638. <div title="&#39;&#39;&#39;foobar&#39;&#39;&#39;"></div>
  15639. !! end
  15640. !! test
  15641. T4304: HTML attribute safety (ISBN)
  15642. !! wikitext
  15643. <div title="ISBN 1234567890"></div>
  15644. !! html
  15645. <div title="&#73;SBN 1234567890"></div>
  15646. !! end
  15647. !! test
  15648. T4304: HTML attribute safety (RFC)
  15649. !! wikitext
  15650. <div title="RFC 1234"></div>
  15651. !! html
  15652. <div title="&#82;FC 1234"></div>
  15653. !! end
  15654. !! test
  15655. T4304: HTML attribute safety (PMID)
  15656. !! wikitext
  15657. <div title="PMID 1234567890"></div>
  15658. !! html
  15659. <div title="&#80;MID 1234567890"></div>
  15660. !! end
  15661. !! test
  15662. T4304: HTML attribute safety (web link)
  15663. !! wikitext
  15664. <div title="http://example.com/"></div>
  15665. !! html
  15666. <div title="http&#58;//example.com/"></div>
  15667. !! end
  15668. !! test
  15669. T4304: HTML attribute safety (named web link)
  15670. !! wikitext
  15671. <div title="[http://example.com/ link]"></div>
  15672. !! html/php
  15673. <div title="&#91;http&#58;//example.com/ link&#93;"></div>
  15674. !! html/parsoid
  15675. <div title="[http://example.com/ link]"></div>
  15676. !! end
  15677. !! test
  15678. T5244: HTML attribute safety (extension; safe)
  15679. !! wikitext
  15680. <div style="<nowiki>background:blue</nowiki>"></div>
  15681. !! html/php
  15682. <div style="background:blue"></div>
  15683. !! html/parsoid
  15684. <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"&lt;nowiki>background:blue&lt;/nowiki>"}}'></div>
  15685. !! end
  15686. !! test
  15687. T5244: HTML attribute safety (extension; unsafe)
  15688. !! wikitext
  15689. <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
  15690. !! html/php
  15691. <div style="/* insecure input */"></div>
  15692. !! html/parsoid
  15693. <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"&lt;nowiki>border-left:expression(alert(document.cookie))&lt;/nowiki>"}}'></div>
  15694. !! end
  15695. # More MSIE fun discovered by Tom Gilder
  15696. !! test
  15697. MSIE CSS safety test: spurious slash
  15698. !! wikitext
  15699. <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
  15700. !! html/php
  15701. <div style="/* insecure input */">evil</div>
  15702. !! html/parsoid
  15703. <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
  15704. !! end
  15705. !! test
  15706. MSIE CSS safety test: hex code
  15707. !! wikitext
  15708. <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
  15709. !! html/php
  15710. <div style="/* insecure input */">evil</div>
  15711. !! html/parsoid
  15712. <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
  15713. !! end
  15714. !! test
  15715. MSIE CSS safety test: comment in url
  15716. !! wikitext
  15717. <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
  15718. !! html/php
  15719. <div style="background-image:u rl(javascript:alert(&#39;boo&#39;))">evil</div>
  15720. !! html/parsoid
  15721. <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert(&#39;boo&#39;))"},"sa":{"style":"background-image:u/**/rl(javascript:alert(&#39;boo&#39;))"}}'>evil</div>
  15722. !! end
  15723. !! test
  15724. MSIE CSS safety test: comment in expression
  15725. !! wikitext
  15726. <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
  15727. !! html/php
  15728. <div style="background-image:expres sion(alert(&#39;boo4&#39;))">evil4</div>
  15729. !! html/parsoid
  15730. <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert(&#39;boo4&#39;))"},"sa":{"style":"background-image:expres/**/sion(alert(&#39;boo4&#39;))"}}'>evil4</div>
  15731. !! end
  15732. !! test
  15733. CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
  15734. !! wikitext
  15735. <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
  15736. !! html/php
  15737. <p style="/* invalid control char */">A</p>
  15738. !! html/parsoid
  15739. <p style="/* invalid control char */" data-parsoid='{"stx":"html","a":{"style":"/* invalid control char */"},"sa":{"style":"font-size: 100px; background-image:url\\b(https://www.google.com/images/srpr/logo6w.png)"}}'>A</p>
  15740. !! end
  15741. !! test
  15742. MSIE 6 CSS safety test: Fullwidth (T57332)
  15743. !! wikitext
  15744. <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
  15745. <div style="top:EXPRESSION(alert())">B</div>
  15746. !! html/php
  15747. <p style="/* insecure input */">A</p>
  15748. <div style="/* insecure input */">B</div>
  15749. !! html/parsoid
  15750. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
  15751. <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
  15752. !! end
  15753. !! test
  15754. MSIE 6 CSS safety test: IPA extensions (T57332)
  15755. !! wikitext
  15756. <div style="background-image:uʀʟ(javascript:alert())">A</div>
  15757. <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
  15758. !! html/php
  15759. <div style="/* insecure input */">A</div>
  15760. <p style="/* insecure input */">B</p>
  15761. !! html/parsoid
  15762. <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
  15763. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
  15764. !! end
  15765. !! test
  15766. MSIE 6 CSS safety test: sup/sub script (T57332)
  15767. !! wikitext
  15768. <div style="background-image:url⁽javascript:alert())">A</div>
  15769. <div style="background-image:url₍javascript:alert())">B</div>
  15770. <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
  15771. !! html/php
  15772. <div style="/* insecure input */">A</div>
  15773. <div style="/* insecure input */">B</div>
  15774. <p style="/* insecure input */">C</p>
  15775. !! html/parsoid
  15776. <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
  15777. <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
  15778. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
  15779. !! end
  15780. !! test
  15781. Opera -o-link CSS
  15782. !! options
  15783. parsoid=wt2html,html2html
  15784. !! wikitext
  15785. <div
  15786. title="&#100;&#97;&#116;&#97;&#58;&#116;&#101;&#120;&#116;&#47;&#104;&#116;&#109;&#108;&#44;&#60;&#105;&#109;&#103;&#32;&#115;&#114;&#99;&#61;&#49;&#32;&#111;&#110;&#101;&#114;&#114;&#111;&#114;&#61;&#97;&#108;&#101;&#114;&#116;&#40;&#49;&#41;&#62;"
  15787. style="-o-link:attr(title);-o-link-source:current">X</div>
  15788. !! html/php
  15789. <div title="data:text/html,&lt;img src=1 onerror=alert(1)&gt;" style="/* insecure input */">X</div>
  15790. !! html/parsoid
  15791. <div title="data:text/html,&lt;img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,&lt;img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"title":"&amp;#100;&amp;#97;&amp;#116;&amp;#97;&amp;#58;&amp;#116;&amp;#101;&amp;#120;&amp;#116;&amp;#47;&amp;#104;&amp;#116;&amp;#109;&amp;#108;&amp;#44;&amp;#60;&amp;#105;&amp;#109;&amp;#103;&amp;#32;&amp;#115;&amp;#114;&amp;#99;&amp;#61;&amp;#49;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#114;&amp;#114;&amp;#111;&amp;#114;&amp;#61;&amp;#97;&amp;#108;&amp;#101;&amp;#114;&amp;#116;&amp;#40;&amp;#49;&amp;#41;&amp;#62;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
  15792. !! end
  15793. !! test
  15794. MSIE 6 CSS safety test: Repetition markers (T57332)
  15795. !! wikitext
  15796. <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
  15797. <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
  15798. <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
  15799. <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
  15800. <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
  15801. <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
  15802. <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
  15803. !! html/php
  15804. <p style="/* insecure input */">A</p>
  15805. <p style="/* insecure input */">B</p>
  15806. <p style="/* insecure input */">C</p>
  15807. <p style="/* insecure input */">D</p>
  15808. <p style="/* insecure input */">E</p>
  15809. <p style="/* insecure input */">F</p>
  15810. <p style="/* insecure input */">G</p>
  15811. !! html/parsoid
  15812. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>A</p>
  15813. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>B</p>
  15814. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>C</p>
  15815. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>D</p>
  15816. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>E</p>
  15817. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>F</p>
  15818. <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title=&#39;XSSed&#39;),&#39;red&#39;)"}}'>G</p>
  15819. !! end
  15820. !! test
  15821. Table attribute legitimate extension
  15822. !! wikitext
  15823. {|
  15824. !+ style="<nowiki>color:blue</nowiki>"|status
  15825. |}
  15826. !! html
  15827. <table>
  15828. <tr>
  15829. <th style="color:blue">status
  15830. </th></tr></table>
  15831. !!end
  15832. !! test
  15833. Table attribute safety
  15834. !! wikitext
  15835. {|
  15836. !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
  15837. |}
  15838. !! html
  15839. <table>
  15840. <tr>
  15841. <th style="/* insecure input */">status
  15842. </th></tr></table>
  15843. !! end
  15844. !! test
  15845. CSS line continuation 1
  15846. !! wikitext
  15847. <div style="background-image: u\&#10;rl(test.jpg);"></div>
  15848. !! html
  15849. <div style="/* insecure input */"></div>
  15850. !! end
  15851. !! test
  15852. CSS line continuation 2
  15853. !! wikitext
  15854. <div style="background-image: u\&#13;rl(test.jpg); "></div>
  15855. !! html
  15856. <div style="/* invalid control char */"></div>
  15857. !! end
  15858. !! article
  15859. Template:Identity
  15860. !! text
  15861. {{{1}}}
  15862. !! endarticle
  15863. !! test
  15864. Expansion of multi-line templates in attribute values (T8255)
  15865. !! wikitext
  15866. <div style="background: {{identity|#00FF00}}">-</div>
  15867. !! html
  15868. <div style="background: #00FF00">-</div>
  15869. !! end
  15870. !! test
  15871. Expansion of multi-line templates in attribute values (T8255 sanity check)
  15872. !! wikitext
  15873. <div style="background:
  15874. #00FF00">-</div>
  15875. !! html/php
  15876. <div style="background: #00FF00">-</div>
  15877. !! html/parsoid
  15878. <div style="background:
  15879. #00FF00">-</div>
  15880. !! end
  15881. !! test
  15882. Expansion of multi-line templates in attribute values (T8255 sanity check 2)
  15883. !! wikitext
  15884. <div style="background: &#10;#00FF00">-</div>
  15885. !! html
  15886. <div style="background: &#10;#00FF00">-</div>
  15887. !! end
  15888. !! test
  15889. Tags which are hidden from tidiers cannot pass through the Sanitizer
  15890. !! wikitext
  15891. <mw:toc><script>alert();</script></mw:toc>
  15892. !! html+tidy
  15893. <p>&lt;mw:toc&gt;&lt;script&gt;alert();&lt;/script&gt;&lt;/mw:toc&gt;
  15894. </p>
  15895. !! end
  15896. ###
  15897. ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
  15898. ###
  15899. !! test
  15900. Parser hook: empty input
  15901. !! wikitext
  15902. <tag></tag>
  15903. !! html/php
  15904. <pre>
  15905. ''
  15906. array (
  15907. )
  15908. </pre>
  15909. !! html/parsoid
  15910. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
  15911. !! end
  15912. ## Don't expect parsoid to rt this form.
  15913. !! test
  15914. Parser hook: empty input using terminated empty elements
  15915. !! options
  15916. parsoid=wt2html,html2html
  15917. !! wikitext
  15918. <tag/>
  15919. !! html/php
  15920. <pre>
  15921. NULL
  15922. array (
  15923. )
  15924. </pre>
  15925. !! html/parsoid
  15926. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
  15927. !! end
  15928. !! test
  15929. Parser hook: empty input using terminated empty elements (space before)
  15930. !! wikitext
  15931. <tag />
  15932. !! html/php
  15933. <pre>
  15934. NULL
  15935. array (
  15936. )
  15937. </pre>
  15938. !! html/parsoid
  15939. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
  15940. !! end
  15941. !! test
  15942. Parser hook: basic input
  15943. !! wikitext
  15944. <tag>input</tag>
  15945. !! html/php
  15946. <pre>
  15947. 'input'
  15948. array (
  15949. )
  15950. </pre>
  15951. !! html/parsoid
  15952. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
  15953. !! end
  15954. ## Don't expect parsoid to rt this form.
  15955. !! test
  15956. Parser hook: case insensitive
  15957. !! options
  15958. parsoid=wt2html,html2html
  15959. !! wikitext
  15960. <TAG>input</TAG>
  15961. !! html/php
  15962. <pre>
  15963. 'input'
  15964. array (
  15965. )
  15966. </pre>
  15967. !! html/parsoid
  15968. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
  15969. !! end
  15970. ## Don't expect parsoid to rt this form.
  15971. !! test
  15972. Parser hook: case insensitive, redux
  15973. !! options
  15974. parsoid=wt2html,html2html
  15975. !! wikitext
  15976. <TaG>input</TAg>
  15977. !! html/php
  15978. <pre>
  15979. 'input'
  15980. array (
  15981. )
  15982. </pre>
  15983. !! html/parsoid
  15984. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
  15985. !! end
  15986. !! test
  15987. Parser hook: nested tags
  15988. !! wikitext
  15989. <tag><tag></tag></tag>
  15990. !! html/php
  15991. <pre>
  15992. '<tag>'
  15993. array (
  15994. )
  15995. </pre>&lt;/tag&gt;
  15996. !! html/parsoid
  15997. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"&lt;tag>"}}' data-parsoid='{}' about="#mwt2"></pre>&lt;/tag>
  15998. !! end
  15999. !! test
  16000. Parser hook: basic arguments
  16001. !! wikitext
  16002. <tag width="200" height="100" depth="50" square=""></tag>
  16003. !! html/php
  16004. <pre>
  16005. ''
  16006. array (
  16007. 'width' => '200',
  16008. 'height' => '100',
  16009. 'depth' => '50',
  16010. 'square' => '',
  16011. )
  16012. </pre>
  16013. !! html/parsoid
  16014. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
  16015. !! end
  16016. ## Don't expect parsoid to rt this form.
  16017. !! test
  16018. Parser hook: basic arguments, variations
  16019. !! options
  16020. parsoid=wt2html,html2html
  16021. !! wikitext
  16022. <tag width=200 height = "100" depth = '50' square></tag>
  16023. !! html/php
  16024. <pre>
  16025. ''
  16026. array (
  16027. 'width' => '200',
  16028. 'height' => '100',
  16029. 'depth' => '50',
  16030. 'square' => '',
  16031. )
  16032. </pre>
  16033. !! html/parsoid
  16034. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
  16035. !! end
  16036. !! test
  16037. Parser hook: argument containing a forward slash (T7344)
  16038. !! wikitext
  16039. <tag filename="/tmp/bla"></tag>
  16040. !! html/php
  16041. <pre>
  16042. ''
  16043. array (
  16044. 'filename' => '/tmp/bla',
  16045. )
  16046. </pre>
  16047. !! html/parsoid
  16048. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
  16049. !! end
  16050. ## Don't expect parsoid to rt this form.
  16051. !! test
  16052. Parser hook: empty input using terminated empty elements (T4374)
  16053. !! options
  16054. parsoid=wt2html,html2html
  16055. !! wikitext
  16056. <tag foo=bar/>text
  16057. !! html/php
  16058. <pre>
  16059. NULL
  16060. array (
  16061. 'foo' => 'bar',
  16062. )
  16063. </pre>text
  16064. !! html/parsoid
  16065. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
  16066. !! end
  16067. ## </tag> should be output literally since there is no matching tag that begins it
  16068. ## Don't expect parsoid to rt this form.
  16069. !! test
  16070. Parser hook: basic arguments using terminated empty elements (T4374)
  16071. !! options
  16072. parsoid=wt2html
  16073. !! wikitext
  16074. <tag width=200 height = "100" depth = '50' square/>
  16075. other stuff
  16076. </tag>
  16077. !! html/php
  16078. <pre>
  16079. NULL
  16080. array (
  16081. 'width' => '200',
  16082. 'height' => '100',
  16083. 'depth' => '50',
  16084. 'square' => '',
  16085. )
  16086. </pre>
  16087. <p>other stuff
  16088. &lt;/tag&gt;
  16089. </p>
  16090. !! html/parsoid
  16091. <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":null}' about="#mwt2"></pre><p>other stuff
  16092. &lt;/tag></p>
  16093. !! end
  16094. ## Don't expect parsoid to rt this form.
  16095. !! test
  16096. Parser hook: Don't allow unclosed extension tags
  16097. !! options
  16098. parsoid=wt2html
  16099. !! wikitext
  16100. test <tag>123
  16101. this is a '''test'''
  16102. !! html/php
  16103. <p>test &lt;tag&gt;123
  16104. </p><p>this is a <b>test</b>
  16105. </p>
  16106. !! html/parsoid
  16107. <p>test &lt;tag>123</p>
  16108. <p>this is a <b>test</b></p>
  16109. !! end
  16110. !! test
  16111. Parser hook: horizontal rule inside extension tag that outputs <pre>
  16112. !! wikitext
  16113. <tag>
  16114. Hello
  16115. <hr/>
  16116. Goodbye
  16117. </tag>
  16118. !! html/php
  16119. <pre>
  16120. '
  16121. Hello
  16122. <hr/>
  16123. Goodbye
  16124. '
  16125. array (
  16126. )
  16127. </pre>
  16128. !! end
  16129. ###
  16130. ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
  16131. ###
  16132. !! test
  16133. Parser hook: static parser hook not inside a comment
  16134. !! wikitext
  16135. <statictag>hello, world</statictag>
  16136. <statictag action="flush" />
  16137. !! html/php
  16138. <p><br />
  16139. hello, world
  16140. </p>
  16141. !! html/parsoid
  16142. <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
  16143. <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
  16144. !! end
  16145. !! test
  16146. Parser hook: static parser hook inside a comment
  16147. !! wikitext
  16148. <!-- <statictag>hello, world</statictag> -->
  16149. <statictag action="flush" />
  16150. !! html/php
  16151. <p><br />
  16152. </p>
  16153. !! html/parsoid
  16154. <!-- <statictag&#x3E;hello, world</statictag&#x3E; -->
  16155. <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
  16156. !! end
  16157. # Nested template calls; this case was broken by Parser.php rev 1.506,
  16158. # since reverted.
  16159. !! article
  16160. Template:One-parameter
  16161. !! text
  16162. (My parameter is: {{{1}}})
  16163. !! endarticle
  16164. !! article
  16165. Template:Map-one-parameter
  16166. !! text
  16167. {{{{{1}}}|{{{2}}}}}
  16168. !! endarticle
  16169. !! test
  16170. Nested template calls
  16171. !! wikitext
  16172. {{Map-one-parameter|One-parameter|param}}
  16173. !! html
  16174. <p>(My parameter is: param)
  16175. </p>
  16176. !! end
  16177. ###
  16178. ### Sanitizer
  16179. ###
  16180. # Remex wraps empty tag runs with p-tags.
  16181. # Parsoid strips them out during p-wrapping.
  16182. !! test
  16183. Sanitizer: Closing of open tags
  16184. !! wikitext
  16185. <s></s><table></table>
  16186. !! html/php+tidy
  16187. <p><s></s></p><table></table>
  16188. !! html/parsoid
  16189. <s></s><table></table>
  16190. !! end
  16191. !! test
  16192. Sanitizer: Closing of open but not closed tags
  16193. !! wikitext
  16194. <s>foo
  16195. !! html
  16196. <p><s>foo</s>
  16197. </p>
  16198. !! end
  16199. !! test
  16200. Sanitizer: Closing of closed but not open tags
  16201. !! options
  16202. parsoid=wt2html
  16203. !! wikitext
  16204. </s>
  16205. !! html/php+tidy
  16206. <p class="mw-empty-elt">
  16207. </p>
  16208. !! html/parsoid
  16209. !! end
  16210. !! test
  16211. Sanitizer: Closing of closed but not open table tags
  16212. !! options
  16213. parsoid=wt2html
  16214. !! wikitext
  16215. Table not started</td></tr></table>
  16216. !! html+tidy
  16217. <p>Table not started
  16218. </p>
  16219. !! end
  16220. !! test
  16221. Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
  16222. !! config
  16223. wgFragmentMode=[ 'html5', 'legacy' ]
  16224. !! wikitext
  16225. <span id="æ: v">byte</span>[[#æ: v|backlink]]
  16226. !! html/php
  16227. <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
  16228. </p>
  16229. !! html/parsoid
  16230. <p><span id="æ:_v" data-parsoid='{"stx":"html","a":{"id":"æ:_v"},"sa":{"id":"æ: v"}}'>byte</span><a rel="mw:WikiLink" href="./Main_Page#æ:_v" data-parsoid='{"stx":"piped","a":{"href":"./Main_Page#æ:_v"},"sa":{"href":"#æ: v"}}'>backlink</a></p>
  16231. !! end
  16232. !! test
  16233. Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
  16234. !! config
  16235. wgFragmentMode=[ 'legacy' ]
  16236. !! wikitext
  16237. <span id="æ: v">byte</span>[[#æ: v|backlink]]
  16238. !! html/php
  16239. <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
  16240. </p>
  16241. !! end
  16242. # In HTML5, the restrictions are that id must contain at least one character,
  16243. # and must not contain any space characters.
  16244. !! test
  16245. Sanitizer: Validating the contents of the id attribute (T6515)
  16246. !! options
  16247. disabled
  16248. !! wikitext
  16249. <br id="" /><br id="a space" />
  16250. !! html
  16251. Something ...
  16252. !! end
  16253. # In HTML5, id must be unique amongst all the ids in the element's home subtree.
  16254. !! test
  16255. Sanitizer: Validating id attribute uniqueness (T6515, T8301)
  16256. !! options
  16257. disabled
  16258. !! wikitext
  16259. <br id="foo" /><br id="foo" />
  16260. !! html
  16261. Something need to be done. foo-2 ?
  16262. !! end
  16263. !! test
  16264. Sanitizer: Validating that <meta> and <link> work, but only for Microdata
  16265. !! wikitext
  16266. <div itemscope>
  16267. <meta itemprop="hello" content="world">
  16268. <meta http-equiv="refresh" content="5">
  16269. <meta itemprop="hello" http-equiv="refresh" content="5">
  16270. <link itemprop="hello" href="{{SERVER}}">
  16271. <link rel="stylesheet" href="{{SERVER}}">
  16272. <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
  16273. </div>
  16274. !! html
  16275. <div itemscope="">
  16276. <p> <meta itemprop="hello" content="world" />
  16277. &lt;meta http-equiv="refresh" content="5"&gt;
  16278. <meta itemprop="hello" content="5" />
  16279. <link itemprop="hello" href="http&#58;//example.org" />
  16280. &lt;link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>"&gt;
  16281. <link itemprop="hello" href="http&#58;//example.org" />
  16282. </p>
  16283. </div>
  16284. !! end
  16285. !! test
  16286. Sanitizer: Strip comments from CSS attributes
  16287. !! options
  16288. parsoid=wt2html,wt2wt
  16289. !! wikitext
  16290. <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
  16291. !! html/php
  16292. <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
  16293. </p>
  16294. !! html/parsoid
  16295. <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
  16296. !! end
  16297. !! test
  16298. Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
  16299. !! wikitext
  16300. [[meatball:Soft"Security]]
  16301. !! html/php
  16302. <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft&quot;Security">meatball:Soft"Security</a>
  16303. </p>
  16304. !! html/parsoid
  16305. <p><a rel="mw:WikiLink/Interwiki" href='http://www.usemod.com/cgi-bin/mb.pl?Soft"Security' title='meatball:Soft"Security'>meatball:Soft"Security</a></p>
  16306. !! end
  16307. !! test
  16308. Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
  16309. !! wikitext
  16310. [[meatball:Foo<Bar]]
  16311. [[meatball:Foo>Bar]]
  16312. [[meatball:Foo&lt;bar]]
  16313. [[meatball:Foo&gt;bar]]
  16314. !! html/php
  16315. <p>[[meatball:Foo&lt;Bar]]
  16316. [[meatball:Foo&gt;Bar]]
  16317. [[meatball:Foo&lt;bar]]
  16318. [[meatball:Foo&gt;bar]]
  16319. </p>
  16320. !! html/parsoid
  16321. <p>[[meatball:Foo&lt;Bar]]
  16322. [[meatball:Foo>Bar]]
  16323. [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;lt;","srcContent":"&lt;"}'>&lt;</span>bar]]
  16324. [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;gt;","srcContent":">"}'>></span>bar]]</p>
  16325. !! end
  16326. !! test
  16327. Language converter: output gets cut off unexpectedly (T7757)
  16328. !! options
  16329. language=zh
  16330. !! wikitext
  16331. this bit is safe: }-
  16332. but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
  16333. then we get cut off here: }-
  16334. all additional text is vanished
  16335. !! html/php
  16336. <p>this bit is safe: }-
  16337. </p><p>but if we add a conversion instance: xxx
  16338. </p><p>then we get cut off here: }-
  16339. </p><p>all additional text is vanished
  16340. </p>
  16341. !! html/parsoid
  16342. <p>this bit is safe: }-</p>
  16343. <p>but if we add a conversion instance: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"xxx"},{"l":"zh-tw","t":"yyy"}]}'></span></p>
  16344. <p>then we get cut off here: }-</p>
  16345. <p>all additional text is vanished</p>
  16346. !! end
  16347. !! test
  16348. Language converter glossary rules inside attributes (T119158)
  16349. !! options
  16350. language=sr variant=sr-el
  16351. !! wikitext
  16352. -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
  16353. [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
  16354. !! html/php
  16355. <p>
  16356. </p><p><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="&quot; onload=&quot;alert(1)&quot; data-foo=&quot;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  16357. </p>
  16358. !! html/parsoid
  16359. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
  16360. <p><figure-inline class="mw-default-size" typeof="mw:Image"><a href="./Датотека:Foobar.jpg"><img alt="foAjrjvi" resource="./Датотека:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"alt":"foAjrjvi","resource":"./Датотека:Foobar.jpg","height":"220","width":"1941"},"sa":{"alt":"alt=-{}-foAjrjvi-{}-","resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  16361. !! end
  16362. !! test
  16363. Self closed html pairs (T7487)
  16364. !! wikitext
  16365. <center><font id="bug" />Centered text</center>
  16366. <div><font id="bug2" />In div text</div>
  16367. !! html+tidy
  16368. <center><font id="bug"></font>Centered text</center>
  16369. <div><font id="bug2"></font>In div text</div>
  16370. !! end
  16371. !! test
  16372. Punctuation: nbsp before exclamation
  16373. !! wikitext
  16374. C'est grave !
  16375. !! html
  16376. <p>C'est grave&#160;!
  16377. </p>
  16378. !! end
  16379. !! test
  16380. Punctuation: CSS !important (T13874)
  16381. !! wikitext
  16382. <div style="width:50% !important">important</div>
  16383. !! html
  16384. <div style="width:50% !important">important</div>
  16385. !!end
  16386. !! test
  16387. Punctuation: CSS ! important (T13874; with space after)
  16388. !! wikitext
  16389. <div style="width:50% ! important">important</div>
  16390. !! html
  16391. <div style="width:50% ! important">important</div>
  16392. !!end
  16393. !! test
  16394. HTML bullet list, closed tags (T7497)
  16395. !! wikitext
  16396. <ul>
  16397. <li>One</li>
  16398. <li>Two</li>
  16399. </ul>
  16400. !! html/php
  16401. <ul>
  16402. <li>One</li>
  16403. <li>Two</li>
  16404. </ul>
  16405. !! html/parsoid
  16406. <ul data-parsoid='{"stx":"html"}'>
  16407. <li data-parsoid='{"stx":"html"}'>One</li>
  16408. <li data-parsoid='{"stx":"html"}'>Two</li>
  16409. </ul>
  16410. !! end
  16411. !! test
  16412. HTML bullet list, unclosed tags (T7497)
  16413. !! wikitext
  16414. <ul>
  16415. <li>One
  16416. <li>Two
  16417. </ul>
  16418. !! html/php+tidy
  16419. <ul>
  16420. <li>One
  16421. </li><li>Two
  16422. </li></ul>
  16423. !! html/parsoid
  16424. <ul data-parsoid='{"stx":"html"}'>
  16425. <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
  16426. <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
  16427. </ul>
  16428. !! end
  16429. !! test
  16430. HTML ordered list, closed tags (T7497)
  16431. !! wikitext
  16432. <ol>
  16433. <li>One</li>
  16434. <li>Two</li>
  16435. </ol>
  16436. !! html/php
  16437. <ol>
  16438. <li>One</li>
  16439. <li>Two</li>
  16440. </ol>
  16441. !! html/parsoid
  16442. <ol data-parsoid='{"stx":"html"}'>
  16443. <li data-parsoid='{"stx":"html"}'>One</li>
  16444. <li data-parsoid='{"stx":"html"}'>Two</li>
  16445. </ol>
  16446. !! end
  16447. !! test
  16448. HTML ordered list, unclosed tags (T7497)
  16449. !! options
  16450. !! wikitext
  16451. <ol>
  16452. <li>One
  16453. <li>Two
  16454. </ol>
  16455. !! html/php+tidy
  16456. <ol>
  16457. <li>One
  16458. </li><li>Two
  16459. </li></ol>
  16460. !! html/parsoid
  16461. <ol data-parsoid='{"stx":"html"}'>
  16462. <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
  16463. <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
  16464. </ol>
  16465. !! end
  16466. !! test
  16467. HTML nested bullet list, closed tags (T7497)
  16468. !! wikitext
  16469. <ul>
  16470. <li>One</li>
  16471. <li>Two:
  16472. <ul>
  16473. <li>Sub-one</li>
  16474. <li>Sub-two</li>
  16475. </ul>
  16476. </li>
  16477. </ul>
  16478. !! html/php
  16479. <ul>
  16480. <li>One</li>
  16481. <li>Two:
  16482. <ul>
  16483. <li>Sub-one</li>
  16484. <li>Sub-two</li>
  16485. </ul>
  16486. </li>
  16487. </ul>
  16488. !! html/parsoid
  16489. <ul data-parsoid='{"stx":"html"}'>
  16490. <li data-parsoid='{"stx":"html"}'>One</li>
  16491. <li data-parsoid='{"stx":"html"}'>Two:
  16492. <ul data-parsoid='{"stx":"html"}'>
  16493. <li data-parsoid='{"stx":"html"}'>Sub-one</li>
  16494. <li data-parsoid='{"stx":"html"}'>Sub-two</li>
  16495. </ul>
  16496. </li>
  16497. </ul>
  16498. !! end
  16499. !! test
  16500. HTML nested bullet list, open tags (T7497)
  16501. !! wikitext
  16502. <ul>
  16503. <li>One
  16504. <li>Two:
  16505. <ul>
  16506. <li>Sub-one
  16507. <li>Sub-two
  16508. </ul>
  16509. </ul>
  16510. !! html+tidy
  16511. <ul>
  16512. <li>One
  16513. </li><li>Two:
  16514. <ul>
  16515. <li>Sub-one
  16516. </li><li>Sub-two
  16517. </li></ul>
  16518. </li></ul>
  16519. !! end
  16520. !! test
  16521. HTML nested ordered list, closed tags (T7497)
  16522. !! wikitext
  16523. <ol>
  16524. <li>One</li>
  16525. <li>Two:
  16526. <ol>
  16527. <li>Sub-one</li>
  16528. <li>Sub-two</li>
  16529. </ol>
  16530. </li>
  16531. </ol>
  16532. !! html
  16533. <ol>
  16534. <li>One</li>
  16535. <li>Two:
  16536. <ol>
  16537. <li>Sub-one</li>
  16538. <li>Sub-two</li>
  16539. </ol>
  16540. </li>
  16541. </ol>
  16542. !! end
  16543. !! test
  16544. HTML nested ordered list, open tags (T7497)
  16545. !! wikitext
  16546. <ol>
  16547. <li>One
  16548. <li>Two:
  16549. <ol>
  16550. <li>Sub-one
  16551. <li>Sub-two
  16552. </ol>
  16553. </ol>
  16554. !! html/php
  16555. <ol>
  16556. <li>One
  16557. <li>Two:
  16558. <ol>
  16559. <li>Sub-one
  16560. <li>Sub-two
  16561. </ol>
  16562. </ol>
  16563. !! html/parsoid
  16564. <ol>
  16565. <li>One
  16566. </li>
  16567. <li>Two:
  16568. <ol>
  16569. <li>Sub-one
  16570. </li>
  16571. <li>Sub-two
  16572. </li>
  16573. </ol>
  16574. </li>
  16575. </ol>
  16576. !! end
  16577. !! test
  16578. HTML ordered list item with parameters oddity
  16579. !! wikitext
  16580. <ol><li id="fragment">One</li>
  16581. </ol>
  16582. !! html
  16583. <ol><li id="fragment">One</li>
  16584. </ol>
  16585. !! end
  16586. # parsoid doesn't explicitly mark autonumbered links, see T55505
  16587. !!test
  16588. T7918: autonumbering
  16589. !! wikitext
  16590. [http://first/] [http://second] [ftp://ftp]
  16591. ftp://inlineftp
  16592. [mailto:enclosed@mail.tld With target]
  16593. [mailto:enclosed@mail.tld]
  16594. mailto:inline@mail.tld
  16595. !! html/php
  16596. <p><a rel="nofollow" class="external autonumber" href="http://first/">[1]</a> <a rel="nofollow" class="external autonumber" href="http://second">[2]</a> <a rel="nofollow" class="external autonumber" href="ftp://ftp">[3]</a>
  16597. </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
  16598. </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
  16599. </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
  16600. </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
  16601. </p>
  16602. !! html/parsoid
  16603. <p><a rel="mw:ExtLink" class="external autonumber" href="http://first/"></a> <a rel="mw:ExtLink" class="external autonumber" href="http://second"></a> <a rel="mw:ExtLink" class="external autonumber" href="ftp://ftp"></a></p>
  16604. <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
  16605. <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
  16606. <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
  16607. <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
  16608. !! end
  16609. #
  16610. # Security and HTML correctness
  16611. # From Nick Jenkins' fuzz testing
  16612. #
  16613. !! test
  16614. Fuzz testing: Parser13
  16615. !! wikitext
  16616. {|
  16617. | http://a|
  16618. !! html
  16619. <table>
  16620. <tr>
  16621. <td>
  16622. </td>
  16623. </tr>
  16624. </table>
  16625. !! end
  16626. # Note that Parsoid output differs from the PHP parser here: the PHP
  16627. # parser breaks the URL for the magic word, while in Parsoid the URL
  16628. # production takes precedence.
  16629. !! test
  16630. Fuzz testing: Parser14
  16631. !! wikitext
  16632. ==onmouseover===
  16633. http://__TOC__
  16634. !! html/php
  16635. <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  16636. http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  16637. <ul>
  16638. <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
  16639. </ul>
  16640. </div>
  16641. !! html/php+tidy
  16642. <h2><span class="mw-headline" id="onmouseover.3D">onmouseover=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2><p>
  16643. http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  16644. <ul>
  16645. <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
  16646. </ul>
  16647. </div>
  16648. !! html/parsoid
  16649. <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
  16650. <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
  16651. !! end
  16652. !! test
  16653. Fuzz testing: Parser14-table
  16654. !! options
  16655. parsoid=wt2html,html2html
  16656. !! wikitext
  16657. ==a==
  16658. {| STYLE=__TOC__
  16659. !! html
  16660. <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  16661. <table style="&#95;_TOC&#95;_">
  16662. <tr><td></td></tr>
  16663. </table>
  16664. !! html+tidy
  16665. <h2><span class="mw-headline" id="a">a</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  16666. <table style="__TOC__">
  16667. <tr>
  16668. <td></td>
  16669. </tr>
  16670. </table>
  16671. !! html/parsoid
  16672. <h2 id="a">a</h2>
  16673. <table style="__TOC__"></table>
  16674. !! end
  16675. # Known to produce bogus xml (extra </td>)
  16676. # Don't add the html/php section since it generates broken HTML
  16677. !! test
  16678. Fuzz testing: Parser16
  16679. !! wikitext
  16680. {|
  16681. !https://||||||
  16682. !! html+tidy
  16683. <table>
  16684. <tbody><tr>
  16685. <th>https://</th>
  16686. <th></th>
  16687. <th></th>
  16688. <th>
  16689. </th></tr>
  16690. </tbody></table>
  16691. !! end
  16692. !! test
  16693. Fuzz testing: Parser21
  16694. !! wikitext
  16695. {|
  16696. !irc://{{ftp://a" onmouseover="alert('hello world');"
  16697. |
  16698. !! html
  16699. <table>
  16700. <tr>
  16701. <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
  16702. </th>
  16703. <td>
  16704. </td>
  16705. </tr>
  16706. </table>
  16707. !! end
  16708. !! test
  16709. Fuzz testing: Parser22
  16710. !! wikitext
  16711. http://===r:::https://b
  16712. {|
  16713. !! html
  16714. <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
  16715. </p>
  16716. <table>
  16717. <tr><td></td></tr>
  16718. </table>
  16719. !! end
  16720. # Known to produce bad XML for now
  16721. !! test
  16722. Fuzz testing: Parser24
  16723. !! options
  16724. parsoid=wt2html
  16725. !! wikitext
  16726. {|
  16727. {{{|
  16728. <u CLASS=
  16729. | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
  16730. <br style="onmouseover='alert(document.cookie);' " />
  16731. MOVE YOUR MOUSE CURSOR OVER THIS TEXT
  16732. |
  16733. !! html/php
  16734. <table>
  16735. {{{|
  16736. <u class="&#124;">}}}} &gt;
  16737. <br style="onmouseover=&#39;alert(document.cookie);&#39;" />
  16738. MOVE YOUR MOUSE CURSOR OVER THIS TEXT
  16739. <tr>
  16740. <td></u>
  16741. </td>
  16742. </tr>
  16743. </table>
  16744. !! html/parsoid
  16745. <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>{{{|
  16746. <u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"&lt;noinclude>"}'/>}}}} >
  16747. <br style="onmouseover='alert(document.cookie);' " data-parsoid='{"stx":"html","selfClose":true}'/></u></p><p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><u class="|" data-parsoid='{"stx":"html","a":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":null},"sa":{"{{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--":""},"autoInsertedEnd":true,"autoInsertedStart":true}'>MOVE YOUR MOUSE CURSOR OVER THIS TEXT</u></p><table data-parsoid='{"autoInsertedEnd":true}'>
  16748. <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
  16749. !! end
  16750. # Note: the current result listed for this is not what the original one was,
  16751. # but the original bug was JavaScript injection, which is fixed in any case.
  16752. # It's not clear that the original result listed was any more correct than the
  16753. # current one. Original result:
  16754. # <p>{{{|
  16755. # </p>
  16756. # <li class="&#124;&#124;">
  16757. # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
  16758. !!test
  16759. Fuzz testing: Parser25 (T8055)
  16760. !! wikitext
  16761. {{{
  16762. |
  16763. <LI CLASS=||
  16764. >
  16765. }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
  16766. !! html/php
  16767. <p>&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
  16768. </p>
  16769. !! html/parsoid
  16770. <span about="#mwt1" typeof="mw:Param" data-parsoid='{"pi":[[{"k":"1"},{"k":"2"},{"k":"3"}]]}' data-mw='{"parts":[{"templatearg":{"target":{"wt":"\n"},"params":{"1":{"wt":" \n&lt;LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert(&#39;hello world&#39;);\" align=\"left\"&#39;&#39;&#39;MOVE MOUSE CURSOR OVER HERE"]}'>
  16771. </span><p about="#mwt1">&lt;LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
  16772. !! end
  16773. !!test
  16774. Fuzz testing: URL adjacent extension (with space, clean)
  16775. !! wikitext
  16776. http://example.com <nowiki>junk</nowiki>
  16777. !! html/php
  16778. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
  16779. </p>
  16780. !! html/parsoid
  16781. <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a> <span typeof="mw:Nowiki">junk</span></p>
  16782. !! end
  16783. !!test
  16784. Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
  16785. !! wikitext
  16786. http://example.com<nowiki>junk</nowiki>
  16787. !! html/php
  16788. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
  16789. </p>
  16790. !! html/parsoid
  16791. <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a><span typeof="mw:Nowiki">junk</span></p>
  16792. !! end
  16793. !! test
  16794. Fuzz testing: URL adjacent extension (no space, dirty; pre)
  16795. !! wikitext
  16796. http://example.com<pre>junk</pre>
  16797. !! html/php
  16798. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
  16799. !! html/php+tidy
  16800. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
  16801. !! html/parsoid
  16802. <p><a rel="mw:ExtLink" class="external free" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a></p><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"junk"}}'>junk</pre>
  16803. !! end
  16804. !! test
  16805. Fuzz testing: image with bogus manual thumbnail
  16806. !! wikitext
  16807. [[Image:foobar.jpg|thumbnail= ]]
  16808. !! html/php
  16809. <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
  16810. !! html/parsoid
  16811. <figure class="mw-default-size" typeof="mw:Error mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"manualthumb","ak":"thumbnail= "}]}' data-mw='{"errors":[{"key":"apierror-invalidtitle","message":"Invalid thumbnail title.","params":{"name":""}}],"thumb":""}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{"href":"Image:foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="./Special:FilePath/Foobar.jpg" height="220" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"220"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
  16812. !! end
  16813. # Parsoid will emit the newline literally in wt2wt; see next test case.
  16814. !! test
  16815. Fuzz testing: encoded newline in generated HTML replacements (T8577)
  16816. !! options
  16817. parsoid=wt2html
  16818. !! wikitext
  16819. <pre dir="&#10;"></pre>
  16820. !! html/php
  16821. <pre dir="&#10;"></pre>
  16822. !! html/parsoid
  16823. <pre typeof="mw:Extension/pre" about="#mwt2" dir="
  16824. " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
  16825. !! end
  16826. !! test
  16827. Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
  16828. !! options
  16829. parsoid=html2wt
  16830. !! html/parsoid
  16831. <pre typeof="mw:Extension/pre" about="#mwt2" dir="
  16832. " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
  16833. !! wikitext
  16834. <pre dir="
  16835. "></pre>
  16836. !! html/php
  16837. <pre dir=""></pre>
  16838. !! end
  16839. !! test
  16840. Templates in extension attributes are not expanded
  16841. !! wikitext
  16842. <pre dir="{{echo|ltr}}"></pre>
  16843. !! html/php
  16844. <pre dir="{{echo|ltr}}"></pre>
  16845. !! html/parsoid
  16846. <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
  16847. !! end
  16848. !! test
  16849. Parsing optional HTML elements (T8171)
  16850. !! options
  16851. !! wikitext
  16852. <table>
  16853. <tr>
  16854. <td> Some tabular data</td>
  16855. <td> More tabular data ...
  16856. <td> And yet som tabular data</td>
  16857. </tr>
  16858. </table>
  16859. !! html
  16860. <table>
  16861. <tr>
  16862. <td> Some tabular data</td>
  16863. <td> More tabular data ...
  16864. </td><td> And yet som tabular data</td>
  16865. </tr>
  16866. </table>
  16867. !! end
  16868. !! test
  16869. Correct handling of <td>, <tr> (T8171)
  16870. !! options
  16871. !! wikitext
  16872. <table>
  16873. <tr>
  16874. <td> Some tabular data</td>
  16875. <td> More tabular data ...</td>
  16876. <td> And yet som tabular data</td>
  16877. </tr>
  16878. </table>
  16879. !! html
  16880. <table>
  16881. <tr>
  16882. <td> Some tabular data</td>
  16883. <td> More tabular data ...</td>
  16884. <td> And yet som tabular data</td>
  16885. </tr>
  16886. </table>
  16887. !! end
  16888. !! test
  16889. Parsing crashing regression (fr:JavaScript)
  16890. !! wikitext
  16891. </body></x>
  16892. !! html
  16893. <p>&lt;/body&gt;&lt;/x&gt;
  16894. </p>
  16895. !! end
  16896. !! test
  16897. Inline wiki vs wiki block nesting
  16898. !! wikitext
  16899. '''Bold paragraph
  16900. New wiki paragraph
  16901. !! html
  16902. <p><b>Bold paragraph</b>
  16903. </p><p>New wiki paragraph
  16904. </p>
  16905. !! end
  16906. # FIXME: The current php output is documented
  16907. # and desired output is the parsoid target.
  16908. !! test
  16909. Inline HTML vs wiki block nesting
  16910. !! wikitext
  16911. <b>Bold paragraph
  16912. New wiki paragraph
  16913. !! html/php
  16914. <p><b>Bold paragraph
  16915. </p><p>New wiki paragraph</b>
  16916. </p>
  16917. !! html/parsoid
  16918. <p><b>Bold paragraph</b>
  16919. </p><p>New wiki paragraph
  16920. </p>
  16921. !! end
  16922. # Original result was this:
  16923. # <p><b>bold</b><b>bold<i>bolditalics</i></b>
  16924. # </p>
  16925. # While that might be marginally more intuitive, maybe, the six-apostrophe
  16926. # construct is clearly pathological and the result stated here (which is what
  16927. # the parser actually does) is about as reasonable as anything.
  16928. !!test
  16929. Mixing markup for italics and bold
  16930. !! options
  16931. !! wikitext
  16932. '''bold''''''bold''bolditalics'''''
  16933. !! html
  16934. <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
  16935. </p>
  16936. !! end
  16937. !! article
  16938. Xyzzyx
  16939. !! text
  16940. Article for special page transclusion test
  16941. !! endarticle
  16942. !! test
  16943. Special page transclusion
  16944. !! options
  16945. !! wikitext
  16946. {{Special:Prefixindex/Xyzzyx}}
  16947. !! html
  16948. <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
  16949. </ul>
  16950. !! end
  16951. !! test
  16952. Special page transclusion twice (T7021)
  16953. !! options
  16954. !! wikitext
  16955. {{Special:Prefixindex/Xyzzyx}}
  16956. {{Special:Prefixindex/Xyzzyx}}
  16957. !! html
  16958. <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
  16959. </ul>
  16960. <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
  16961. </ul>
  16962. !! end
  16963. !! test
  16964. Transclusion of default MediaWiki message
  16965. !! wikitext
  16966. {{MediaWiki:Mainpage}}
  16967. !! html
  16968. <p>Main Page
  16969. </p>
  16970. !! end
  16971. !! test
  16972. Transclusion of nonexistent MediaWiki message
  16973. !! wikitext
  16974. {{MediaWiki:Mainpagexxx}}
  16975. !! html
  16976. <p><a href="/index.php?title=MediaWiki:Mainpagexxx&amp;action=edit&amp;redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
  16977. </p>
  16978. !! end
  16979. !! test
  16980. Transclusion of MediaWiki message with underscore
  16981. !! wikitext
  16982. {{MediaWiki:history_short}}
  16983. !! html
  16984. <p>History
  16985. </p>
  16986. !! end
  16987. !! test
  16988. Transclusion of MediaWiki message with space
  16989. !! wikitext
  16990. {{MediaWiki:history short}}
  16991. !! html
  16992. <p>History
  16993. </p>
  16994. !! end
  16995. !! test
  16996. Invalid header with following text
  16997. !! wikitext
  16998. = x = y
  16999. !! html
  17000. <p>= x = y
  17001. </p>
  17002. !! end
  17003. !! test
  17004. Section extraction test (section 0)
  17005. !! options
  17006. section=0
  17007. !! wikitext
  17008. start
  17009. ==a==
  17010. ===aa===
  17011. ====aaa====
  17012. ==b==
  17013. ===ba===
  17014. ===bb===
  17015. ====bba====
  17016. ===bc===
  17017. ==c==
  17018. ===ca===
  17019. !! html/php
  17020. start
  17021. !! end
  17022. !! test
  17023. Section extraction test (section 1)
  17024. !! options
  17025. section=1
  17026. !! wikitext
  17027. start
  17028. ==a==
  17029. ===aa===
  17030. ====aaa====
  17031. ==b==
  17032. ===ba===
  17033. ===bb===
  17034. ====bba====
  17035. ===bc===
  17036. ==c==
  17037. ===ca===
  17038. !! html/php
  17039. ==a==
  17040. ===aa===
  17041. ====aaa====
  17042. !! end
  17043. !! test
  17044. Section extraction test (section 2)
  17045. !! options
  17046. section=2
  17047. !! wikitext
  17048. start
  17049. ==a==
  17050. ===aa===
  17051. ====aaa====
  17052. ==b==
  17053. ===ba===
  17054. ===bb===
  17055. ====bba====
  17056. ===bc===
  17057. ==c==
  17058. ===ca===
  17059. !! html/php
  17060. ===aa===
  17061. ====aaa====
  17062. !! end
  17063. !! test
  17064. Section extraction test (section 3)
  17065. !! options
  17066. section=3
  17067. !! wikitext
  17068. start
  17069. ==a==
  17070. ===aa===
  17071. ====aaa====
  17072. ==b==
  17073. ===ba===
  17074. ===bb===
  17075. ====bba====
  17076. ===bc===
  17077. ==c==
  17078. ===ca===
  17079. !! html/php
  17080. ====aaa====
  17081. !! end
  17082. !! test
  17083. Section extraction test (section 4)
  17084. !! options
  17085. section=4
  17086. !! wikitext
  17087. start
  17088. ==a==
  17089. ===aa===
  17090. ====aaa====
  17091. ==b==
  17092. ===ba===
  17093. ===bb===
  17094. ====bba====
  17095. ===bc===
  17096. ==c==
  17097. ===ca===
  17098. !! html/php
  17099. ==b==
  17100. ===ba===
  17101. ===bb===
  17102. ====bba====
  17103. ===bc===
  17104. !! end
  17105. !! test
  17106. Section extraction test (section 5)
  17107. !! options
  17108. section=5
  17109. !! wikitext
  17110. start
  17111. ==a==
  17112. ===aa===
  17113. ====aaa====
  17114. ==b==
  17115. ===ba===
  17116. ===bb===
  17117. ====bba====
  17118. ===bc===
  17119. ==c==
  17120. ===ca===
  17121. !! html/php
  17122. ===ba===
  17123. !! end
  17124. !! test
  17125. Section extraction test (section 6)
  17126. !! options
  17127. section=6
  17128. !! wikitext
  17129. start
  17130. ==a==
  17131. ===aa===
  17132. ====aaa====
  17133. ==b==
  17134. ===ba===
  17135. ===bb===
  17136. ====bba====
  17137. ===bc===
  17138. ==c==
  17139. ===ca===
  17140. !! html/php
  17141. ===bb===
  17142. ====bba====
  17143. !! end
  17144. !! test
  17145. Section extraction test (section 7)
  17146. !! options
  17147. section=7
  17148. !! wikitext
  17149. start
  17150. ==a==
  17151. ===aa===
  17152. ====aaa====
  17153. ==b==
  17154. ===ba===
  17155. ===bb===
  17156. ====bba====
  17157. ===bc===
  17158. ==c==
  17159. ===ca===
  17160. !! html/php
  17161. ====bba====
  17162. !! end
  17163. !! test
  17164. Section extraction test (section 8)
  17165. !! options
  17166. section=8
  17167. !! wikitext
  17168. start
  17169. ==a==
  17170. ===aa===
  17171. ====aaa====
  17172. ==b==
  17173. ===ba===
  17174. ===bb===
  17175. ====bba====
  17176. ===bc===
  17177. ==c==
  17178. ===ca===
  17179. !! html/php
  17180. ===bc===
  17181. !! end
  17182. !! test
  17183. Section extraction test (section 9)
  17184. !! options
  17185. section=9
  17186. !! wikitext
  17187. start
  17188. ==a==
  17189. ===aa===
  17190. ====aaa====
  17191. ==b==
  17192. ===ba===
  17193. ===bb===
  17194. ====bba====
  17195. ===bc===
  17196. ==c==
  17197. ===ca===
  17198. !! html/php
  17199. ==c==
  17200. ===ca===
  17201. !! end
  17202. !! test
  17203. Section extraction test (section 10)
  17204. !! options
  17205. section=10
  17206. !! wikitext
  17207. start
  17208. ==a==
  17209. ===aa===
  17210. ====aaa====
  17211. ==b==
  17212. ===ba===
  17213. ===bb===
  17214. ====bba====
  17215. ===bc===
  17216. ==c==
  17217. ===ca===
  17218. !! html/php
  17219. ===ca===
  17220. !! end
  17221. !! test
  17222. Section extraction test (nonexistent section 11)
  17223. !! options
  17224. section=11
  17225. !! wikitext
  17226. start
  17227. ==a==
  17228. ===aa===
  17229. ====aaa====
  17230. ==b==
  17231. ===ba===
  17232. ===bb===
  17233. ====bba====
  17234. ===bc===
  17235. ==c==
  17236. ===ca===
  17237. !! html/php
  17238. !! end
  17239. !! test
  17240. Section extraction test with bogus heading (section 1)
  17241. !! options
  17242. section=1
  17243. !! wikitext
  17244. ==a==
  17245. ==bogus== not a legal section
  17246. ==b==
  17247. !! html/php
  17248. ==a==
  17249. ==bogus== not a legal section
  17250. !! end
  17251. !! test
  17252. Section extraction test with bogus heading (section 2)
  17253. !! options
  17254. section=2
  17255. !! wikitext
  17256. ==a==
  17257. ==bogus== not a legal section
  17258. ==b==
  17259. !! html/php
  17260. ==b==
  17261. !! end
  17262. !! test
  17263. Section extraction test with comment after heading (section 1)
  17264. !! options
  17265. section=1
  17266. !! wikitext
  17267. ==a==
  17268. ==b== <!-- -->
  17269. ==c==
  17270. !! html/php
  17271. ==a==
  17272. !! end
  17273. !! test
  17274. Section extraction test with comment after heading (section 2)
  17275. !! options
  17276. section=2
  17277. !! wikitext
  17278. ==a==
  17279. ==b== <!-- -->
  17280. ==c==
  17281. !! html/php
  17282. ==b== <!-- -->
  17283. !! end
  17284. !! test
  17285. Section extraction test with bogus <nowiki> heading (section 1)
  17286. !! options
  17287. section=1
  17288. !! wikitext
  17289. ==a==
  17290. ==bogus== <nowiki>not a legal section</nowiki>
  17291. ==b==
  17292. !! html/php
  17293. ==a==
  17294. ==bogus== <nowiki>not a legal section</nowiki>
  17295. !! end
  17296. !! test
  17297. Section extraction test with bogus <nowiki> heading (section 2)
  17298. !! options
  17299. section=2
  17300. !! wikitext
  17301. ==a==
  17302. ==bogus== <nowiki>not a legal section</nowiki>
  17303. ==b==
  17304. !! html/php
  17305. ==b==
  17306. !! end
  17307. # Formerly testing for T4587, now resolved by the use of unmarked sections
  17308. # instead of respecting commented sections
  17309. !! test
  17310. Section extraction prefixed by comment (section 1)
  17311. !! options
  17312. section=1
  17313. !! wikitext
  17314. <!-- -->==sec1==
  17315. ==sec2==
  17316. !! html/php
  17317. ==sec2==
  17318. !!end
  17319. !! test
  17320. Section extraction prefixed by comment (section 2)
  17321. !! options
  17322. section=2
  17323. !! wikitext
  17324. <!-- -->==sec1==
  17325. ==sec2==
  17326. !! html/php
  17327. !!end
  17328. # Formerly testing for T4607, now resolved by the use of unmarked sections
  17329. # instead of respecting HTML-style headings
  17330. !! test
  17331. Section extraction, mixed wiki and html (section 1)
  17332. !! options
  17333. section=1
  17334. !! wikitext
  17335. <h2>unmarked</h2>
  17336. unmarked
  17337. ==1==
  17338. one
  17339. ==2==
  17340. two
  17341. !! html/php
  17342. ==1==
  17343. one
  17344. !! end
  17345. !! test
  17346. Section extraction, mixed wiki and html (section 2)
  17347. !! options
  17348. section=2
  17349. !! wikitext
  17350. <h2>unmarked</h2>
  17351. unmarked
  17352. ==1==
  17353. one
  17354. ==2==
  17355. two
  17356. !! html/php
  17357. ==2==
  17358. two
  17359. !! end
  17360. # Formerly testing for T5342
  17361. !! test
  17362. Section extraction, heading surrounded by <noinclude>
  17363. !! options
  17364. section=1
  17365. !! wikitext
  17366. <noinclude>==unmarked==</noinclude>
  17367. ==marked==
  17368. !! html/php
  17369. ==marked==
  17370. !!end
  17371. # Test behavior of T21910
  17372. !! test
  17373. Sectiion with all-equals
  17374. !! options
  17375. section=2
  17376. !! wikitext
  17377. ===
  17378. The line above must have a trailing space
  17379. === <!--
  17380. --> <!-- -->
  17381. But just in case it doesn't...
  17382. !! html/php
  17383. === <!--
  17384. --> <!-- -->
  17385. But just in case it doesn't...
  17386. !! end
  17387. !! test
  17388. Section replacement test (section 0)
  17389. !! options
  17390. replace=0,"xxx"
  17391. !! wikitext
  17392. start
  17393. ==a==
  17394. ===aa===
  17395. ====aaa====
  17396. ==b==
  17397. ===ba===
  17398. ===bb===
  17399. ====bba====
  17400. ===bc===
  17401. ==c==
  17402. ===ca===
  17403. !! html/php
  17404. xxx
  17405. ==a==
  17406. ===aa===
  17407. ====aaa====
  17408. ==b==
  17409. ===ba===
  17410. ===bb===
  17411. ====bba====
  17412. ===bc===
  17413. ==c==
  17414. ===ca===
  17415. !! end
  17416. !! test
  17417. Section replacement test (section 1)
  17418. !! options
  17419. replace=1,"xxx"
  17420. !! wikitext
  17421. start
  17422. ==a==
  17423. ===aa===
  17424. ====aaa====
  17425. ==b==
  17426. ===ba===
  17427. ===bb===
  17428. ====bba====
  17429. ===bc===
  17430. ==c==
  17431. ===ca===
  17432. !! html/php
  17433. start
  17434. xxx
  17435. ==b==
  17436. ===ba===
  17437. ===bb===
  17438. ====bba====
  17439. ===bc===
  17440. ==c==
  17441. ===ca===
  17442. !! end
  17443. !! test
  17444. Section replacement test (section 2)
  17445. !! options
  17446. replace=2,"xxx"
  17447. !! wikitext
  17448. start
  17449. ==a==
  17450. ===aa===
  17451. ====aaa====
  17452. ==b==
  17453. ===ba===
  17454. ===bb===
  17455. ====bba====
  17456. ===bc===
  17457. ==c==
  17458. ===ca===
  17459. !! html/php
  17460. start
  17461. ==a==
  17462. xxx
  17463. ==b==
  17464. ===ba===
  17465. ===bb===
  17466. ====bba====
  17467. ===bc===
  17468. ==c==
  17469. ===ca===
  17470. !! end
  17471. !! test
  17472. Section replacement test (section 3)
  17473. !! options
  17474. replace=3,"xxx"
  17475. !! wikitext
  17476. start
  17477. ==a==
  17478. ===aa===
  17479. ====aaa====
  17480. ==b==
  17481. ===ba===
  17482. ===bb===
  17483. ====bba====
  17484. ===bc===
  17485. ==c==
  17486. ===ca===
  17487. !! html/php
  17488. start
  17489. ==a==
  17490. ===aa===
  17491. xxx
  17492. ==b==
  17493. ===ba===
  17494. ===bb===
  17495. ====bba====
  17496. ===bc===
  17497. ==c==
  17498. ===ca===
  17499. !! end
  17500. !! test
  17501. Section replacement test (section 4)
  17502. !! options
  17503. replace=4,"xxx"
  17504. !! wikitext
  17505. start
  17506. ==a==
  17507. ===aa===
  17508. ====aaa====
  17509. ==b==
  17510. ===ba===
  17511. ===bb===
  17512. ====bba====
  17513. ===bc===
  17514. ==c==
  17515. ===ca===
  17516. !! html/php
  17517. start
  17518. ==a==
  17519. ===aa===
  17520. ====aaa====
  17521. xxx
  17522. ==c==
  17523. ===ca===
  17524. !! end
  17525. !! test
  17526. Section replacement test (section 5)
  17527. !! options
  17528. replace=5,"xxx"
  17529. !! wikitext
  17530. start
  17531. ==a==
  17532. ===aa===
  17533. ====aaa====
  17534. ==b==
  17535. ===ba===
  17536. ===bb===
  17537. ====bba====
  17538. ===bc===
  17539. ==c==
  17540. ===ca===
  17541. !! html/php
  17542. start
  17543. ==a==
  17544. ===aa===
  17545. ====aaa====
  17546. ==b==
  17547. xxx
  17548. ===bb===
  17549. ====bba====
  17550. ===bc===
  17551. ==c==
  17552. ===ca===
  17553. !! end
  17554. !! test
  17555. Section replacement test (section 6)
  17556. !! options
  17557. replace=6,"xxx"
  17558. !! wikitext
  17559. start
  17560. ==a==
  17561. ===aa===
  17562. ====aaa====
  17563. ==b==
  17564. ===ba===
  17565. ===bb===
  17566. ====bba====
  17567. ===bc===
  17568. ==c==
  17569. ===ca===
  17570. !! html/php
  17571. start
  17572. ==a==
  17573. ===aa===
  17574. ====aaa====
  17575. ==b==
  17576. ===ba===
  17577. xxx
  17578. ===bc===
  17579. ==c==
  17580. ===ca===
  17581. !! end
  17582. !! test
  17583. Section replacement test (section 7)
  17584. !! options
  17585. replace=7,"xxx"
  17586. !! wikitext
  17587. start
  17588. ==a==
  17589. ===aa===
  17590. ====aaa====
  17591. ==b==
  17592. ===ba===
  17593. ===bb===
  17594. ====bba====
  17595. ===bc===
  17596. ==c==
  17597. ===ca===
  17598. !! html/php
  17599. start
  17600. ==a==
  17601. ===aa===
  17602. ====aaa====
  17603. ==b==
  17604. ===ba===
  17605. ===bb===
  17606. xxx
  17607. ===bc===
  17608. ==c==
  17609. ===ca===
  17610. !! end
  17611. !! test
  17612. Section replacement test (section 8)
  17613. !! options
  17614. replace=8,"xxx"
  17615. !! wikitext
  17616. start
  17617. ==a==
  17618. ===aa===
  17619. ====aaa====
  17620. ==b==
  17621. ===ba===
  17622. ===bb===
  17623. ====bba====
  17624. ===bc===
  17625. ==c==
  17626. ===ca===
  17627. !! html/php
  17628. start
  17629. ==a==
  17630. ===aa===
  17631. ====aaa====
  17632. ==b==
  17633. ===ba===
  17634. ===bb===
  17635. ====bba====
  17636. xxx
  17637. ==c==
  17638. ===ca===
  17639. !!end
  17640. !! test
  17641. Section replacement test (section 9)
  17642. !! options
  17643. replace=9,"xxx"
  17644. !! wikitext
  17645. start
  17646. ==a==
  17647. ===aa===
  17648. ====aaa====
  17649. ==b==
  17650. ===ba===
  17651. ===bb===
  17652. ====bba====
  17653. ===bc===
  17654. ==c==
  17655. ===ca===
  17656. !! html/php
  17657. start
  17658. ==a==
  17659. ===aa===
  17660. ====aaa====
  17661. ==b==
  17662. ===ba===
  17663. ===bb===
  17664. ====bba====
  17665. ===bc===
  17666. xxx
  17667. !! end
  17668. !! test
  17669. Section replacement test (section 10)
  17670. !! options
  17671. replace=10,"xxx"
  17672. !! wikitext
  17673. start
  17674. ==a==
  17675. ===aa===
  17676. ====aaa====
  17677. ==b==
  17678. ===ba===
  17679. ===bb===
  17680. ====bba====
  17681. ===bc===
  17682. ==c==
  17683. ===ca===
  17684. !! html/php
  17685. start
  17686. ==a==
  17687. ===aa===
  17688. ====aaa====
  17689. ==b==
  17690. ===ba===
  17691. ===bb===
  17692. ====bba====
  17693. ===bc===
  17694. ==c==
  17695. xxx
  17696. !! end
  17697. !! test
  17698. Section replacement test with initial whitespace (T15728)
  17699. !! options
  17700. replace=2,"xxx"
  17701. !! wikitext
  17702. Preformatted initial line
  17703. ==a==
  17704. ===a===
  17705. !! html/php
  17706. Preformatted initial line
  17707. ==a==
  17708. xxx
  17709. !! end
  17710. !! test
  17711. Section extraction, heading followed by pre with 20 spaces (T8398)
  17712. !! options
  17713. section=1
  17714. !! wikitext
  17715. ==a==
  17716. a
  17717. !! html/php
  17718. ==a==
  17719. a
  17720. !! end
  17721. !! test
  17722. Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
  17723. !! options
  17724. section=1
  17725. !! wikitext
  17726. ==a==
  17727. a
  17728. !! html/php
  17729. ==a==
  17730. a
  17731. !! end
  17732. !! test
  17733. Section extraction, <pre> around bogus header (T12309)
  17734. !! options
  17735. section=2
  17736. !! wikitext
  17737. == Section One ==
  17738. <pre>
  17739. =======
  17740. </pre>
  17741. == Section Two ==
  17742. stuff
  17743. !! html/php
  17744. == Section Two ==
  17745. stuff
  17746. !! end
  17747. !! test
  17748. Section replacement, <pre> around bogus header (T12309)
  17749. !! options
  17750. replace=2,"xxx"
  17751. !! wikitext
  17752. == Section One ==
  17753. <pre>
  17754. =======
  17755. </pre>
  17756. == Section Two ==
  17757. stuff
  17758. !! html/php
  17759. == Section One ==
  17760. <pre>
  17761. =======
  17762. </pre>
  17763. xxx
  17764. !! end
  17765. !! test
  17766. Handling of &#x0A; in URLs
  17767. !! wikitext
  17768. *irc://&#x0A;a
  17769. !! html/php
  17770. <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
  17771. !! html/parsoid
  17772. <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&amp;#x0A;a"}}'>irc://%0Aa</a></li></ul>
  17773. !! end
  17774. !! test
  17775. Handling of %0A in URLs
  17776. !! wikitext
  17777. *irc://%0Aa
  17778. !! html/php
  17779. <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
  17780. !! html/parsoid
  17781. <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
  17782. !! end
  17783. # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
  17784. !! test
  17785. 5 quotes, code coverage +1 line
  17786. !! options
  17787. parsoid=wt2html
  17788. !! wikitext
  17789. '''''
  17790. !! html/php
  17791. !! html/parsoid
  17792. <b><i></i></b>
  17793. !! end
  17794. # same html as previous, but wikitext adjusted to match parsoid html2wt
  17795. # note that wt2html and html2html will put the <i> before the <b>
  17796. !! test
  17797. 5 quotes, code coverage +1 line w/ nowiki (1)
  17798. !! options
  17799. parsoid=wt2wt,html2wt
  17800. !! wikitext
  17801. '''''<nowiki/>'''''
  17802. !! html/php
  17803. <p><i></i>
  17804. </p>
  17805. !! html/parsoid
  17806. <p><b><i></i></b></p>
  17807. !! end
  17808. # same as previous, just swapping the <i> and <b>
  17809. !! test
  17810. 5 quotes, code coverage +1 line w/ nowiki (2)
  17811. !! wikitext
  17812. '''''<nowiki/>'''''
  17813. !! html/php
  17814. <p><i></i>
  17815. </p>
  17816. !! html/parsoid
  17817. <p><i><b></b></i></p>
  17818. !! end
  17819. !! test
  17820. Special:Search page linking.
  17821. !! wikitext
  17822. {{Special:search}}
  17823. !! html
  17824. <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
  17825. </p>
  17826. !! end
  17827. !! test
  17828. {{!}} is a magic word
  17829. !! wikitext
  17830. {{!}} is a magic word there and {{!}} is still a magic word here
  17831. | is not a magic word here but {{!}} is still a magic word here
  17832. !! html/php
  17833. <p>| is a magic word there and | is still a magic word here
  17834. | is not a magic word here but | is still a magic word here
  17835. </p>
  17836. !! html/parsoid
  17837. <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is a magic word there and <span about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here
  17838. | is not a magic word here but <span about="#mwt3" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"!","function":"!"},"params":{},"i":0}}]}'>|</span> is still a magic word here</p>
  17839. !! end
  17840. !! test
  17841. Say the magic word
  17842. !! options
  17843. title=[[Parser test]]
  17844. !! wikitext
  17845. *{{PAGENAME}}
  17846. *{{PAGENAMEE}}
  17847. *{{FULLPAGENAME}}
  17848. *{{FULLPAGENAMEE}}
  17849. *{{BASEPAGENAME}}
  17850. *{{BASEPAGENAMEE}}
  17851. *{{SUBPAGENAME}}
  17852. *{{SUBPAGENAMEE}}
  17853. *{{ROOTPAGENAME}}
  17854. *{{ROOTPAGENAMEE}}
  17855. *{{TALKPAGENAME}}
  17856. *{{TALKPAGENAMEE}}
  17857. *{{SUBJECTPAGENAME}}
  17858. *{{SUBJECTPAGENAMEE}}
  17859. *{{NAMESPACEE}}
  17860. *{{NAMESPACE}}
  17861. *{{NAMESPACENUMBER}}
  17862. *{{TALKSPACE}}
  17863. *{{TALKSPACEE}}
  17864. *{{SUBJECTSPACE}}
  17865. *{{SUBJECTSPACEE}}
  17866. *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
  17867. !! html
  17868. <ul><li>Parser test</li>
  17869. <li>Parser_test</li>
  17870. <li>Parser test</li>
  17871. <li>Parser_test</li>
  17872. <li>Parser test</li>
  17873. <li>Parser_test</li>
  17874. <li>Parser test</li>
  17875. <li>Parser_test</li>
  17876. <li>Parser test</li>
  17877. <li>Parser_test</li>
  17878. <li>Talk:Parser test</li>
  17879. <li>Talk:Parser_test</li>
  17880. <li>Parser test</li>
  17881. <li>Parser_test</li>
  17882. <li></li>
  17883. <li></li>
  17884. <li>0</li>
  17885. <li>Talk</li>
  17886. <li>Talk</li>
  17887. <li></li>
  17888. <li></li>
  17889. <li><a href="/index.php?title=Template:Dynamic&amp;action=edit&amp;redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a></li></ul>
  17890. !! end
  17891. ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
  17892. !! test
  17893. Gallery with valid attributes
  17894. !! wikitext
  17895. <gallery type="123" summary="345">
  17896. File:File:Foobar.jpg
  17897. </gallery>
  17898. !! html/php
  17899. <ul class="gallery mw-gallery-traditional" type="123">
  17900. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  17901. <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
  17902. <div class="gallerytext">
  17903. </div>
  17904. </div></li>
  17905. </ul>
  17906. !! html/parsoid
  17907. <ul class="gallery mw-gallery-traditional" type="123" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"type":"123","summary":"345"},"body":{"extsrc":"\nFile:File:Foobar.jpg\n"}}'>
  17908. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:File:Foobar.jpg"><img resource="./File:File:Foobar.jpg" src="./Special:FilePath/File:Foobar.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  17909. </ul>
  17910. !! end
  17911. ## Parsoid thinks the "centre" here is a property, not a caption.
  17912. !! test
  17913. Gallery
  17914. !! options
  17915. parsoid={
  17916. "modes": ["wt2html"],
  17917. "nativeGallery": true
  17918. }
  17919. !! wikitext
  17920. <gallery>
  17921. image1.png |
  17922. image2.gif|||||
  17923. image3|
  17924. image4 |300px| centre
  17925. image5.svg| http://///////
  17926. [[x|xx]]]]
  17927. * image6
  17928. </gallery>
  17929. !! html/php
  17930. <ul class="gallery mw-gallery-traditional">
  17931. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  17932. <div class="thumb" style="height: 150px;">Image1.png</div>
  17933. <div class="gallerytext">
  17934. </div>
  17935. </div></li>
  17936. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  17937. <div class="thumb" style="height: 150px;">Image2.gif</div>
  17938. <div class="gallerytext">
  17939. </div>
  17940. </div></li>
  17941. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  17942. <div class="thumb" style="height: 150px;">Image3</div>
  17943. <div class="gallerytext">
  17944. </div>
  17945. </div></li>
  17946. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  17947. <div class="thumb" style="height: 150px;">Image4</div>
  17948. <div class="gallerytext">
  17949. <pre>centre
  17950. </pre>
  17951. </div>
  17952. </div></li>
  17953. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  17954. <div class="thumb" style="height: 150px;">Image5.svg</div>
  17955. <div class="gallerytext">
  17956. <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
  17957. </p>
  17958. </div>
  17959. </div></li>
  17960. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  17961. <div class="thumb" style="height: 150px;">* image6</div>
  17962. <div class="gallerytext">
  17963. </div>
  17964. </div></li>
  17965. </ul>
  17966. !! html/parsoid
  17967. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  17968. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image1.png"><img resource="./File:Image1.png" src="./Special:FilePath/Image1.png" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  17969. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image2.gif"><img resource="./File:Image2.gif" src="./Special:FilePath/Image2.gif" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  17970. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image3"><img resource="./File:Image3" src="./Special:FilePath/Image3" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  17971. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image4"><img resource="./File:Image4" src="./Special:FilePath/Image4" height="300" width="300"/></a></figure-inline></div><div class="gallerytext"></div></li>
  17972. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Image5.svg"><img resource="./File:Image5.svg" src="./Special:FilePath/Image5.svg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"> <a rel="mw:ExtLink" class="external free" href="http://///////">http://///////</a></div></li>
  17973. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:*_image6"><img resource="./File:*_image6" src="./Special:FilePath/*_image6" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  17974. </ul>
  17975. !! end
  17976. !! test
  17977. Gallery (with options, html)
  17978. !! options
  17979. parsoid={
  17980. "modes": ["wt2html", "html2html"],
  17981. "nativeGallery": true
  17982. }
  17983. !! wikitext
  17984. <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
  17985. File:Nonexistent.jpg|caption
  17986. File:Nonexistent.jpg
  17987. image:foobar.jpg|some '''caption''' [[Main Page]]
  17988. image:foobar.jpg
  17989. image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
  17990. </gallery>
  17991. !! html/php
  17992. <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
  17993. <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
  17994. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  17995. <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
  17996. <div class="gallerytext">
  17997. <p>caption
  17998. </p>
  17999. </div>
  18000. </div></li>
  18001. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18002. <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
  18003. <div class="gallerytext">
  18004. </div>
  18005. </div></li>
  18006. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18007. <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
  18008. <div class="gallerytext">
  18009. <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  18010. </p>
  18011. </div>
  18012. </div></li>
  18013. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18014. <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
  18015. <div class="gallerytext">
  18016. </div>
  18017. </div></li>
  18018. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18019. <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
  18020. <div class="gallerytext">
  18021. <p>blabla.
  18022. </p>
  18023. </div>
  18024. </div></li>
  18025. </ul>
  18026. !! html/parsoid
  18027. <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2"},"body":{}}'>
  18028. <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
  18029. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
  18030. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18031. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
  18032. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18033. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
  18034. </ul>
  18035. !! end
  18036. !! test
  18037. Gallery (with options, extsrc)
  18038. !! options
  18039. parsoid={
  18040. "nativeGallery": false
  18041. }
  18042. !! wikitext
  18043. <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
  18044. File:Nonexistent.jpg|caption
  18045. File:Nonexistent.jpg
  18046. image:foobar.jpg|some '''caption''' [[Main Page]]
  18047. image:foobar.jpg
  18048. image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
  18049. </gallery>
  18050. !! html/php
  18051. <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
  18052. <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
  18053. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18054. <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
  18055. <div class="gallerytext">
  18056. <p>caption
  18057. </p>
  18058. </div>
  18059. </div></li>
  18060. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18061. <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
  18062. <div class="gallerytext">
  18063. </div>
  18064. </div></li>
  18065. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18066. <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
  18067. <div class="gallerytext">
  18068. <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  18069. </p>
  18070. </div>
  18071. </div></li>
  18072. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18073. <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
  18074. <div class="gallerytext">
  18075. </div>
  18076. </div></li>
  18077. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18078. <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="This is a foo-bar." src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
  18079. <div class="gallerytext">
  18080. <p>blabla.
  18081. </p>
  18082. </div>
  18083. </div></li>
  18084. </ul>
  18085. !! html/parsoid
  18086. <ul class="gallery mw-gallery-traditional" style="max-width: 226px; _width: 226px;" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"widths":"70px","heights":"40px","perrow":"2","caption":"Foo [[Main Page]]"},"body":{"extsrc":"\nFile:Nonexistent.jpg|caption\nFile:Nonexistent.jpg\nimage:foobar.jpg|some &#39;&#39;&#39;caption&#39;&#39;&#39; [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
  18087. <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
  18088. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
  18089. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="40" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18090. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
  18091. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18092. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="This is a foo-bar." resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext">blabla.</div></li>
  18093. </ul>
  18094. !! end
  18095. !! test
  18096. Gallery (without px units)
  18097. !! wikitext
  18098. <gallery widths="70" heights="40">
  18099. File:Foobar.jpg
  18100. </gallery>
  18101. !! html/php
  18102. <ul class="gallery mw-gallery-traditional">
  18103. <li class="gallerybox" style="width: 105px"><div style="width: 105px">
  18104. <div class="thumb" style="width: 100px;"><div style="margin:31px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" width="70" height="8" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/105px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/140px-Foobar.jpg 2x" /></a></div></div>
  18105. <div class="gallerytext">
  18106. </div>
  18107. </div></li>
  18108. </ul>
  18109. !! html/parsoid
  18110. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70","heights":"40"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
  18111. <li class="gallerybox" style="width: 105px;"><div class="thumb" style="width: 100px; height: 70px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/70px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="8" width="70"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18112. </ul>
  18113. !! end
  18114. !! test
  18115. Gallery (with invalid units)
  18116. !! wikitext
  18117. <gallery widths="70em" heights="40em">
  18118. File:Foobar.jpg
  18119. </gallery>
  18120. !! html/php
  18121. <ul class="gallery mw-gallery-traditional">
  18122. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18123. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18124. <div class="gallerytext">
  18125. </div>
  18126. </div></li>
  18127. </ul>
  18128. !! html/parsoid
  18129. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"widths":"70em","heights":"40em"},"body":{"extsrc":"\nFile:Foobar.jpg\n"}}'>
  18130. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18131. </ul>
  18132. !! end
  18133. !! test
  18134. Gallery with link that has fragment
  18135. !! options
  18136. parsoid={
  18137. "modes": ["wt2html", "html2html"],
  18138. "nativeGallery": true
  18139. }
  18140. !! wikitext
  18141. <gallery>
  18142. image:foobar.jpg|link=Main_Page
  18143. image:foobar.jpg|link=Main_Page#section
  18144. image:foobar.jpg|link=Main Page#section|caption
  18145. </gallery>
  18146. !! html/php
  18147. <ul class="gallery mw-gallery-traditional">
  18148. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18149. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18150. <div class="gallerytext">
  18151. </div>
  18152. </div></li>
  18153. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18154. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18155. <div class="gallerytext">
  18156. </div>
  18157. </div></li>
  18158. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18159. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Main_Page#section"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18160. <div class="gallerytext">
  18161. <p>caption
  18162. </p>
  18163. </div>
  18164. </div></li>
  18165. </ul>
  18166. !! html/parsoid
  18167. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18168. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18169. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18170. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Main_Page#section"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
  18171. </ul>
  18172. !! end
  18173. ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
  18174. !! test
  18175. Gallery with template inside caption
  18176. !! options
  18177. parsoid={
  18178. "nativeGallery": true
  18179. }
  18180. !! wikitext
  18181. <gallery caption="{{echo|hi}}">
  18182. File:Foobar.jpg|{{echo|ho}}
  18183. </gallery>
  18184. !! html/php
  18185. <ul class="gallery mw-gallery-traditional">
  18186. <li class='gallerycaption'>{{echo|hi}}</li>
  18187. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18188. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18189. <div class="gallerytext">
  18190. <p>ho
  18191. </p>
  18192. </div>
  18193. </div></li>
  18194. </ul>
  18195. !! html/parsoid
  18196. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18197. <li class="gallerycaption"><span about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span></li>
  18198. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt5" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho"}},"i":0}}]}'>ho</span></div></li>
  18199. </ul>
  18200. !! end
  18201. !! test
  18202. Gallery with wikitext inside caption
  18203. !! options
  18204. parsoid={
  18205. "nativeGallery": true
  18206. }
  18207. !! wikitext
  18208. <gallery>
  18209. File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
  18210. File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
  18211. </gallery>
  18212. !! html/php
  18213. <ul class="gallery mw-gallery-traditional">
  18214. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18215. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18216. <div class="gallerytext">
  18217. <p><a href="/wiki/File:Foobar.jpg" class="image" title="desc"><img alt="inneralt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
  18218. </p>
  18219. </div>
  18220. </div></li>
  18221. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18222. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18223. <div class="gallerytext">
  18224. <p>This is a test template
  18225. </p>
  18226. </div>
  18227. </div></li>
  18228. </ul>
  18229. !! html/parsoid
  18230. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18231. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image" data-mw='{"caption":"desc"}'><a href="./File:Foobar.jpg"><img alt="inneralt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline></div></li>
  18232. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"param"}},"i":0}}]}'>This is a test template</span></div></li>
  18233. </ul>
  18234. !! end
  18235. !! test
  18236. Gallery (with showfilename option)
  18237. !! options
  18238. parsoid={
  18239. "nativeGallery": true
  18240. }
  18241. !! wikitext
  18242. <gallery showfilename="">
  18243. File:Nonexistent.jpg|caption
  18244. File:Nonexistent.jpg
  18245. File:Foobar.jpg|some '''caption''' [[Main Page]]
  18246. File:Foobar.jpg
  18247. </gallery>
  18248. !! html/php
  18249. <ul class="gallery mw-gallery-traditional">
  18250. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18251. <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
  18252. <div class="gallerytext">
  18253. <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
  18254. caption
  18255. </p>
  18256. </div>
  18257. </div></li>
  18258. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18259. <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
  18260. <div class="gallerytext">
  18261. <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
  18262. </p>
  18263. </div>
  18264. </div></li>
  18265. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18266. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18267. <div class="gallerytext">
  18268. <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
  18269. some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  18270. </p>
  18271. </div>
  18272. </div></li>
  18273. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18274. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18275. <div class="gallerytext">
  18276. <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
  18277. </p>
  18278. </div>
  18279. </div></li>
  18280. </ul>
  18281. !! html/parsoid
  18282. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
  18283. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a>caption</div></li>
  18284. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">File:Nonexistent.jpg</a></div></li>
  18285. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a>some <b>caption</b> <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></div></li>
  18286. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><a href="./File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">File:Foobar.jpg</a></div></li>
  18287. </ul>
  18288. !! end
  18289. ## Should Parsoid be preserving these variations? See T151367
  18290. !! test
  18291. Gallery (with namespace-less filenames)
  18292. !! options
  18293. parsoid={
  18294. "modes": ["wt2html", "html2html"],
  18295. "nativeGallery": true
  18296. }
  18297. !! wikitext
  18298. <gallery>
  18299. File:Nonexistent.jpg
  18300. Nonexistent.jpg
  18301. image:foobar.jpg
  18302. foobar.jpg
  18303. </gallery>
  18304. !! html/php
  18305. <ul class="gallery mw-gallery-traditional">
  18306. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18307. <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
  18308. <div class="gallerytext">
  18309. </div>
  18310. </div></li>
  18311. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18312. <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
  18313. <div class="gallerytext">
  18314. </div>
  18315. </div></li>
  18316. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18317. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18318. <div class="gallerytext">
  18319. </div>
  18320. </div></li>
  18321. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18322. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18323. <div class="gallerytext">
  18324. </div>
  18325. </div></li>
  18326. </ul>
  18327. !! html/parsoid
  18328. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18329. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18330. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Error mw:Image"><a href="./File:Nonexistent.jpg"><img resource="./File:Nonexistent.jpg" src="./Special:FilePath/Nonexistent.jpg" height="120" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18331. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18332. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18333. </ul>
  18334. !! end
  18335. !! test
  18336. Gallery override link with wikilink (T36852)
  18337. !! options
  18338. parsoid={
  18339. "nativeGallery": true
  18340. }
  18341. !! wikitext
  18342. <gallery>
  18343. File:Foobar.jpg|alt=galleryalt|link=Wikilink
  18344. </gallery>
  18345. !! html/php
  18346. <ul class="gallery mw-gallery-traditional">
  18347. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18348. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/Wikilink"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18349. <div class="gallerytext">
  18350. </div>
  18351. </div></li>
  18352. </ul>
  18353. !! html/parsoid
  18354. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18355. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./Wikilink"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18356. </ul>
  18357. !! end
  18358. !! test
  18359. Gallery override link with absolute external link (T36852)
  18360. !! options
  18361. parsoid={
  18362. "nativeGallery": true
  18363. }
  18364. !! wikitext
  18365. <gallery>
  18366. File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
  18367. </gallery>
  18368. !! html/php
  18369. <ul class="gallery mw-gallery-traditional">
  18370. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18371. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18372. <div class="gallerytext">
  18373. </div>
  18374. </div></li>
  18375. </ul>
  18376. !! html/parsoid
  18377. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18378. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18379. </ul>
  18380. !! end
  18381. !! test
  18382. Gallery override link with absolute external link with LanguageConverter
  18383. !! options
  18384. language=zh
  18385. !! wikitext
  18386. <gallery>
  18387. File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
  18388. </gallery>
  18389. !! html/php
  18390. <ul class="gallery mw-gallery-traditional">
  18391. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18392. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="http://www.example.org"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18393. <div class="gallerytext">
  18394. <p>caption
  18395. </p>
  18396. </div>
  18397. </div></li>
  18398. </ul>
  18399. !! html/parsoid
  18400. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org\n"}}'>
  18401. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="http://www.example.org"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">caption</div></li>
  18402. </ul>
  18403. !! end
  18404. !! test
  18405. Gallery override link with malicious javascript (T36852)
  18406. !! options
  18407. parsoid={
  18408. "modes": ["wt2html", "html2html"],
  18409. "nativeGallery": true
  18410. }
  18411. !! wikitext
  18412. <gallery>
  18413. File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
  18414. </gallery>
  18415. !! html/php
  18416. <ul class="gallery mw-gallery-traditional">
  18417. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18418. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/%22_onclick%3D%22alert(%27malicious_javascript_code!%27);"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18419. <div class="gallerytext">
  18420. </div>
  18421. </div></li>
  18422. </ul>
  18423. !! html/parsoid
  18424. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18425. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./%22_onclick=%22alert('malicious_javascript_code!');"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18426. </ul>
  18427. !! end
  18428. # Note that parsoid uses the invalid link as a caption, PHP does not.
  18429. !! test
  18430. Gallery with invalid title as link (T45964)
  18431. !! options
  18432. parsoid={
  18433. "modes": ["wt2html", "html2html"],
  18434. "nativeGallery": true
  18435. }
  18436. !! wikitext
  18437. <gallery>
  18438. File:Foobar.jpg|link=<
  18439. </gallery>
  18440. !! html/php
  18441. <ul class="gallery mw-gallery-traditional">
  18442. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18443. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18444. <div class="gallerytext">
  18445. </div>
  18446. </div></li>
  18447. </ul>
  18448. !! html/parsoid
  18449. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
  18450. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext">link=&lt;</div></li>
  18451. </ul>
  18452. !! end
  18453. !! test
  18454. Serialize gallery without attrs in data-mw
  18455. !! options
  18456. parsoid={
  18457. "modes": ["html2wt"],
  18458. "nativeGallery": true
  18459. }
  18460. !! html/parsoid
  18461. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
  18462. <li class="gallerycaption">123</li>
  18463. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><span>File:Test.png</span></div><div class="gallerytext"></div></li>
  18464. </ul>
  18465. !! wikitext
  18466. <gallery caption="123">
  18467. File:Test.png
  18468. </gallery>
  18469. !! end
  18470. !! test
  18471. Gallery with class and style attributes
  18472. !! options
  18473. parsoid={
  18474. "nativeGallery": true
  18475. }
  18476. !! wikitext
  18477. <gallery class="center" style="text-align: center;">
  18478. File:Foobar.jpg
  18479. </gallery>
  18480. !! html/php
  18481. <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
  18482. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18483. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18484. <div class="gallerytext">
  18485. </div>
  18486. </div></li>
  18487. </ul>
  18488. !! html/parsoid
  18489. <ul class="gallery mw-gallery-traditional center" style="text-align: center;" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"class":"center","style":"text-align: center;"},"body":{}}'>
  18490. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18491. </ul>
  18492. !! end
  18493. !! test
  18494. Gallery in slideshow mode
  18495. !! options
  18496. parsoid={
  18497. "nativeGallery": true
  18498. }
  18499. !! wikitext
  18500. <gallery mode="slideshow" showthumbnails="">
  18501. File:Foobar.jpg
  18502. </gallery>
  18503. !! html/php
  18504. <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
  18505. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  18506. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  18507. <div class="gallerytext">
  18508. </div>
  18509. </div></li>
  18510. </ul>
  18511. !! html/parsoid
  18512. <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
  18513. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"></div></li>
  18514. </ul>
  18515. !! end
  18516. !! test
  18517. HTML Hex character encoding (spells the word "JavaScript")
  18518. !! options
  18519. parsoid=wt2html,wt2wt,html2html
  18520. !! wikitext
  18521. &#x4A;&#x061;&#x0076;&#x00061;&#x000053;&#x0000063;&#114;&#x0000069;&#00000112;&#x0000000074;
  18522. !! html/php
  18523. <p>&#x4a;&#x61;&#x76;&#x61;&#x53;&#x63;&#114;&#x69;&#112;&#x74;
  18524. </p>
  18525. !! html/parsoid
  18526. <p><span typeof="mw:Entity">J</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">v</span><span typeof="mw:Entity">a</span><span typeof="mw:Entity">S</span><span typeof="mw:Entity">c</span><span typeof="mw:Entity">r</span><span typeof="mw:Entity">i</span><span typeof="mw:Entity">p</span><span typeof="mw:Entity">t</span></p>
  18527. !! end
  18528. !! test
  18529. HTML Hex character encoding bogus encoding (T28437 regression check)
  18530. !! wikitext
  18531. &#xsee;&#XSEE;
  18532. !! html
  18533. <p>&amp;#xsee;&amp;#XSEE;
  18534. </p>
  18535. !! end
  18536. !! test
  18537. HTML Hex character encoding mixed case
  18538. !! options
  18539. parsoid=wt2html,wt2wt,html2html
  18540. !! wikitext
  18541. &#xEE;&#Xee;
  18542. !! html/php
  18543. <p>&#xee;&#xee;
  18544. </p>
  18545. !! html/parsoid
  18546. <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
  18547. !! end
  18548. # See: https://www.w3.org/TR/html5/syntax.html#character-references
  18549. # Note that U+000C (form feed) is not a valid XML character, so
  18550. # it is banned even though allowed in HTML5.
  18551. !! test
  18552. Illegal character references (T106578)
  18553. !! wikitext
  18554. ; Null: &#00;
  18555. ; FF: &#xC;
  18556. ; CR: &#xD;
  18557. ; Control (low): &#8;
  18558. ; Control (high): &#x7F; &#x9F;
  18559. ; Surrogate: &#xD83D;&#xDCA9;
  18560. ; This is an okay astral character: &#x1F4A9;
  18561. !! html+tidy
  18562. <dl><dt>Null</dt>
  18563. <dd>&amp;#00;</dd>
  18564. <dt>FF</dt>
  18565. <dd>&amp;#xC;</dd>
  18566. <dt>CR</dt>
  18567. <dd>&amp;#xD;</dd>
  18568. <dt>Control (low)</dt>
  18569. <dd>&amp;#8;</dd>
  18570. <dt>Control (high)</dt>
  18571. <dd>&amp;#x7F; &amp;#x9F;</dd>
  18572. <dt>Surrogate</dt>
  18573. <dd>&amp;#xD83D;&amp;#xDCA9;</dd>
  18574. <dt>This is an okay astral character</dt>
  18575. <dd>&#x1f4a9;</dd></dl>
  18576. !! end
  18577. !! test
  18578. __FORCETOC__ override
  18579. !! wikitext
  18580. __NEWSECTIONLINK__
  18581. __FORCETOC__
  18582. !! html/php
  18583. <p><br />
  18584. </p>
  18585. !! end
  18586. !! test
  18587. ISBN code coverage
  18588. !! wikitext
  18589. ISBN 978-0-1234-56&#x20;789
  18590. !! html/php
  18591. <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a>&#x20;789
  18592. </p>
  18593. !! html/parsoid
  18594. <p><a href="./Special:BookSources/9780123456" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978-0-1234-56</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>789</p>
  18595. !! end
  18596. !! test
  18597. ISBN followed by 5 spaces
  18598. !! wikitext
  18599. ISBN
  18600. !! html
  18601. <p>ISBN
  18602. </p>
  18603. !! end
  18604. !! test
  18605. Double ISBN
  18606. !! wikitext
  18607. ISBN ISBN 1234567890
  18608. !! html/php
  18609. <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
  18610. </p>
  18611. !! html/parsoid
  18612. <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
  18613. !! end
  18614. # Uppercase X and lowercase x as well
  18615. !! test
  18616. ISBN with an X
  18617. !! wikitext
  18618. ISBN 3-462-04561-X
  18619. ISBN 3-462-04561-x
  18620. ISBN 080442957X
  18621. ISBN 080442957x
  18622. ISBN 978080442957X
  18623. ISBN 978080442957x
  18624. !! html/php
  18625. <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
  18626. <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
  18627. <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
  18628. <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
  18629. <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
  18630. <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
  18631. </p>
  18632. !! html/parsoid
  18633. <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
  18634. <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
  18635. <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
  18636. <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
  18637. <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
  18638. <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
  18639. !! end
  18640. !! test
  18641. ISBN with empty prefix (parsoid test)
  18642. !! wikitext
  18643. ISBN 1234567890
  18644. !! html/php
  18645. <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
  18646. </p>
  18647. !! html/parsoid
  18648. <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
  18649. !! end
  18650. !! test
  18651. T24905: <abbr> followed by ISBN followed by </a>
  18652. !! wikitext
  18653. <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
  18654. !! html/php
  18655. <p><abbr>(fr)</abbr> <a href="/wiki/Special:BookSources/2753300917" class="internal mw-magiclink-isbn">ISBN 2753300917</a> <a rel="nofollow" class="external text" href="http://www.example.com">example.com</a>
  18656. </p>
  18657. !! html/parsoid
  18658. <p><abbr data-parsoid='{"stx":"html"}'>(fr)</abbr> <a href="./Special:BookSources/2753300917" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 2753300917</a> <a rel="mw:ExtLink" class="external text" href="http://www.example.com">example.com</a></p>
  18659. !! end
  18660. !! test
  18661. Double RFC
  18662. !! wikitext
  18663. RFC RFC 1234
  18664. !! html
  18665. <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
  18666. </p>
  18667. !! end
  18668. !! test
  18669. Double RFC with a wiki link
  18670. !! wikitext
  18671. RFC [[RFC 1234]]
  18672. !! html
  18673. <p>RFC <a href="/index.php?title=RFC_1234&amp;action=edit&amp;redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
  18674. </p>
  18675. !! end
  18676. !! test
  18677. RFC code coverage
  18678. !! wikitext
  18679. RFC 983&#x20;987
  18680. !! html/php
  18681. <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a>&#x20;987
  18682. </p>
  18683. !! html/parsoid
  18684. <p><a href="https://tools.ietf.org/html/rfc983" rel="mw:ExtLink" class="external text" data-parsoid='{"stx":"magiclink"}'>RFC 983</a><span typeof="mw:Entity" data-parsoid='{"src":"&amp;#x20;","srcContent":" "}'> </span>987</p>
  18685. !! end
  18686. !! test
  18687. Centre-aligned image
  18688. !! wikitext
  18689. [[Image:foobar.jpg|centre]]
  18690. !! html/php
  18691. <div class="center"><div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div></div>
  18692. !! html/parsoid
  18693. <figure class="mw-default-size mw-halign-center" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"center","ak":"centre"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
  18694. !! end
  18695. !! test
  18696. None-aligned image
  18697. !! wikitext
  18698. [[Image:foobar.jpg|none]]
  18699. !! html/php
  18700. <div class="floatnone"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></div>
  18701. !! html/parsoid
  18702. <figure class="mw-default-size mw-halign-none" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure>
  18703. !! end
  18704. !! test
  18705. Width + Height sized image (using px) (height is ignored)
  18706. !! wikitext
  18707. [[Image:foobar.jpg|640x480px]]
  18708. !! html/php
  18709. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
  18710. </p>
  18711. !! html/parsoid
  18712. <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640x480px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
  18713. !! end
  18714. !! test
  18715. Width-sized image (using px, no following whitespace)
  18716. !! wikitext
  18717. [[Image:foobar.jpg|640px]]
  18718. !! html/php
  18719. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
  18720. </p>
  18721. !! html/parsoid
  18722. <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
  18723. !! end
  18724. !! test
  18725. Width-sized image (using px, with following whitespace - test regression from r39467)
  18726. !! wikitext
  18727. [[Image:foobar.jpg|640px ]]
  18728. !! html/php
  18729. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
  18730. </p>
  18731. !! html/parsoid
  18732. <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"640px "}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
  18733. !!end
  18734. !! test
  18735. Width-sized image (using px, with preceding whitespace - test regression from r39467)
  18736. !! wikitext
  18737. [[Image:foobar.jpg| 640px]]
  18738. !! html/php
  18739. <p><a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" width="640" height="73" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/960px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/1280px-Foobar.jpg 2x" /></a>
  18740. </p>
  18741. !! html/parsoid
  18742. <p><figure-inline typeof="mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":" 640px"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/640px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="73" width="640" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"73","width":"640"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></p>
  18743. !! end
  18744. !! test
  18745. Image with page parameter
  18746. !! options
  18747. djvu
  18748. !! wikitext
  18749. [[File:LoremIpsum.djvu|page=2]]
  18750. !! html/php
  18751. <p><a href="/index.php?title=File:LoremIpsum.djvu&amp;page=2" class="image"><img alt="LoremIpsum.djvu" src="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-2480px-LoremIpsum.djvu.jpg" width="2480" height="3508" srcset="http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-3720px-LoremIpsum.djvu.jpg 1.5x, http://example.com/images/thumb/5/5f/LoremIpsum.djvu/page2-4960px-LoremIpsum.djvu.jpg 2x" /></a>
  18752. </p>
  18753. !! html/parsoid
  18754. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"page","ak":"page=2"}]}' data-mw='{"page":"2"}'><a href="./File:LoremIpsum.djvu" data-parsoid='{"a":{"href":"./File:LoremIpsum.djvu"},"sa":{"href":"File:LoremIpsum.djvu"}}'><img resource="./File:LoremIpsum.djvu" src="//example.com/images/5/5f/LoremIpsum.djvu" data-file-width="2480" data-file-height="3508" data-file-type="bitmap" height="3508" width="2480" data-parsoid='{"a":{"resource":"./File:LoremIpsum.djvu","height":"3508","width":"2480"},"sa":{"resource":"File:LoremIpsum.djvu"}}'/></a></figure-inline></p>
  18755. !! end
  18756. !! test
  18757. Another italics / bold test
  18758. !! wikitext
  18759. ''' ''x'
  18760. !! html
  18761. <pre>'<i> </i>x'
  18762. </pre>
  18763. !!end
  18764. # FIXME: The php output seems broken. It's interleaving some open/close tags.
  18765. !! test
  18766. dt/dd/dl test
  18767. !! wikitext
  18768. :;;;::
  18769. !! html/php
  18770. <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
  18771. !! html/parsoid
  18772. <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
  18773. !!end
  18774. # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
  18775. !! test
  18776. Images with the "|" character in the comment
  18777. !! wikitext
  18778. [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|&param2=|x external] URL]]
  18779. !! html/php
  18780. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>An <a rel="nofollow" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx">external</a> URL</div></div></div>
  18781. !! html/parsoid
  18782. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>An <a rel="mw:ExtLink" class="external text" href="http://test/?param1=%7Cleft%7C&amp;param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&amp;param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&amp;param2=|x"}}'>external</a> URL</figcaption></figure>
  18783. !! end
  18784. !! test
  18785. [Before] HTML without raw HTML enabled ($wgRawHtml==false)
  18786. !! wikitext
  18787. <html><script>alert(1);</script></html>
  18788. !! html
  18789. <p>&lt;html&gt;&lt;script&gt;alert(1);&lt;/script&gt;&lt;/html&gt;
  18790. </p>
  18791. !! end
  18792. !! test
  18793. HTML with raw HTML ($wgRawHtml==true)
  18794. !! options
  18795. wgRawHtml=1
  18796. !! wikitext
  18797. <html><script>alert(1);</script></html>
  18798. !! html/php
  18799. <p><script>alert(1);</script>
  18800. </p>
  18801. !! end
  18802. !! test
  18803. Parents of subpages, one level up
  18804. !! options
  18805. subpage title=[[Subpage test/L1/L2/L3]]
  18806. !! wikitext
  18807. [[../|L2]]
  18808. !! html
  18809. <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
  18810. </p>
  18811. !! end
  18812. !! test
  18813. Parents of subpages, one level up, not named
  18814. !! options
  18815. subpage title=[[Subpage test/L1/L2/L3]]
  18816. !! wikitext
  18817. [[../]]
  18818. !! html
  18819. <p><a href="/index.php?title=Subpage_test/L1/L2&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
  18820. </p>
  18821. !! end
  18822. !! test
  18823. Parents of subpages, two levels up
  18824. !! options
  18825. subpage title=[[Subpage test/L1/L2/L3]]
  18826. !! wikitext
  18827. [[../../|L1]]2
  18828. [[../../|L1]]l
  18829. !! html
  18830. <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
  18831. </p><p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
  18832. </p>
  18833. !! end
  18834. !! test
  18835. Parents of subpages, two levels up, without trailing slash or name.
  18836. !! options
  18837. subpage title=[[Subpage test/L1/L2/L3]]
  18838. !! wikitext
  18839. [[../..]]
  18840. !! html
  18841. <p>[[../..]]
  18842. </p>
  18843. !! end
  18844. !! test
  18845. Parents of subpages, two levels up, with lots of extra trailing slashes.
  18846. !! options
  18847. subpage title=[[Subpage test/L1/L2/L3]]
  18848. !! wikitext
  18849. [[../../////]]
  18850. !! html
  18851. <p><a href="/index.php?title=Subpage_test/L1&amp;action=edit&amp;redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
  18852. </p>
  18853. !! end
  18854. !! article
  18855. Subpage test/L1/L2/L3Sibling
  18856. !! text
  18857. Sibling article
  18858. !! endarticle
  18859. !! test
  18860. Transclusion of a sibling page (one level up)
  18861. !! options
  18862. subpage title=[[Subpage test/L1/L2/L3]]
  18863. !! wikitext
  18864. {{../L3Sibling}}
  18865. !! html
  18866. <p>Sibling article
  18867. </p>
  18868. !! end
  18869. !! test
  18870. Transclusion of a child page
  18871. !! options
  18872. subpage title=[[Subpage test/L1/L2]]
  18873. !! wikitext
  18874. {{/L3Sibling}}
  18875. !! html
  18876. <p>Sibling article
  18877. </p>
  18878. !! end
  18879. # This is wt2html only in Parsoid because we add <nowiki>
  18880. # because of {{..}} and we don't expect to fix that to
  18881. # eliminate the nowikis selective for {{..}} markup.
  18882. !! test
  18883. Non-transclusion because of too many up levels
  18884. !! options
  18885. subpage title=[[Subpage test/L1/L2/L3]]
  18886. parsoid=wt2html
  18887. !! wikitext
  18888. {{../../../../More than parent}}
  18889. !! html/php
  18890. <p>{{../../../../More than parent}}
  18891. </p>
  18892. !! html/parsoid
  18893. <p>{{../../../../More than parent}}</p>
  18894. !! end
  18895. !! test
  18896. Definition list code coverage
  18897. !! wikitext
  18898. ;title : def
  18899. ;title : def
  18900. ;title: def
  18901. !! html/php
  18902. <dl><dt>title &#160;</dt>
  18903. <dd>def</dd>
  18904. <dt>title&#160;</dt>
  18905. <dd>def</dd>
  18906. <dt>title</dt>
  18907. <dd>def</dd></dl>
  18908. !! html/parsoid
  18909. <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
  18910. <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
  18911. <dt>title</dt><dd> def</dd></dl>
  18912. !! end
  18913. !! test
  18914. Don't fall for the self-closing div
  18915. !! wikitext
  18916. <div>hello world</div/>
  18917. !! html
  18918. <div>hello world</div>
  18919. !! end
  18920. !! test
  18921. MSGNW magic word
  18922. !! wikitext
  18923. {{MSGNW:msg}}
  18924. !! html/php
  18925. <p>&#91;&#91;:Template:Msg&#93;&#93;
  18926. </p>
  18927. !! end
  18928. !! test
  18929. RAW magic word
  18930. !! wikitext
  18931. {{RAW:QUERTY}}
  18932. !! html
  18933. <p><a href="/index.php?title=Template:QUERTY&amp;action=edit&amp;redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
  18934. </p>
  18935. !! end
  18936. # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
  18937. !! test
  18938. Always escape literal '>' in output, not just after '<'
  18939. !! wikitext
  18940. ><>
  18941. !! html
  18942. <p>&gt;&lt;&gt;
  18943. </p>
  18944. !! end
  18945. !! test
  18946. Template caching
  18947. !! wikitext
  18948. {{Test}}
  18949. {{Test}}
  18950. !! html
  18951. <p>This is a test template
  18952. This is a test template
  18953. </p>
  18954. !! end
  18955. !! article
  18956. MediaWiki:Fake
  18957. !! text
  18958. ==header==
  18959. !! endarticle
  18960. !! test
  18961. Inclusion of !userCanEdit() content
  18962. !! wikitext
  18963. {{MediaWiki:Fake}}
  18964. !! html
  18965. <h2><span class="mw-headline" id="header">header</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=MediaWiki:Fake&amp;action=edit&amp;section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  18966. !! end
  18967. !! test
  18968. Out-of-order TOC heading levels
  18969. !! wikitext
  18970. ==2==
  18971. ======6======
  18972. ===3===
  18973. =1=
  18974. =====5=====
  18975. ==2==
  18976. !! html
  18977. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  18978. <ul>
  18979. <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
  18980. <ul>
  18981. <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
  18982. <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
  18983. </ul>
  18984. </li>
  18985. <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
  18986. <ul>
  18987. <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
  18988. <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
  18989. </ul>
  18990. </li>
  18991. </ul>
  18992. </div>
  18993. <h2><span class="mw-headline" id="2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  18994. <h6><span class="mw-headline" id="6">6</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  18995. <h3><span class="mw-headline" id="3">3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
  18996. <h1><span class="mw-headline" id="1">1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  18997. <h5><span class="mw-headline" id="5">5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
  18998. <h2><span class="mw-headline" id="2_2">2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  18999. !! end
  19000. !! test
  19001. ISBN with a dummy number
  19002. !! wikitext
  19003. ISBN ---
  19004. !! html
  19005. <p>ISBN ---
  19006. </p>
  19007. !! end
  19008. !! test
  19009. ISBN with space-delimited number
  19010. !! wikitext
  19011. ISBN 92 9017 032 8
  19012. !! html/php
  19013. <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
  19014. </p>
  19015. !! html/parsoid
  19016. <p data-parsoid='{"dsr":[0,18,0,0]}'><a href="./Special:BookSources/9290170328" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink","dsr":[0,18,2,2]}'>ISBN 92 9017 032 8</a></p>
  19017. !! end
  19018. !! test
  19019. ISBN with multiple spaces, no number
  19020. !! wikitext
  19021. ISBN foo
  19022. !! html
  19023. <p>ISBN foo
  19024. </p>
  19025. !! end
  19026. !! test
  19027. ISBN length
  19028. !! wikitext
  19029. ISBN 123456789
  19030. ISBN 1234567890
  19031. ISBN 12345678901
  19032. !! html/php
  19033. <p>ISBN 123456789
  19034. </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
  19035. </p><p>ISBN 12345678901
  19036. </p>
  19037. !! html/parsoid
  19038. <p>ISBN 123456789</p>
  19039. <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
  19040. <p>ISBN 12345678901</p>
  19041. !! end
  19042. !! test
  19043. ISBN with trailing year (T9110)
  19044. !! wikitext
  19045. ISBN 1-234-56789-0 - 2006
  19046. ISBN 1 234 56789 0 - 2006
  19047. !! html/php
  19048. <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
  19049. </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
  19050. </p>
  19051. !! html/parsoid
  19052. <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
  19053. <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
  19054. !! end
  19055. !! test
  19056. anchorencode
  19057. !! config
  19058. wgFragmentMode=[ 'html5', 'legacy' ]
  19059. !! wikitext
  19060. {{anchorencode:foo bar©#%n}}
  19061. !! html/php
  19062. <p>foo_bar©#%n
  19063. </p>
  19064. !! html/parsoid
  19065. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:foo bar©#%n","function":"anchorencode"},"params":{},"i":0}}]}'>foo_bar©#%n</p>
  19066. !! end
  19067. !! test
  19068. anchorencode (legacy)
  19069. !! config
  19070. wgFragmentMode=[ 'legacy' ]
  19071. !! wikitext
  19072. {{anchorencode:foo bar©#%n}}
  19073. !! html/php
  19074. <p>foo_bar.C2.A9.23.25n
  19075. </p>
  19076. !! end
  19077. !! test
  19078. anchorencode trims spaces
  19079. !! config
  19080. wgFragmentMode=[ 'html5', 'legacy' ]
  19081. !! wikitext
  19082. {{anchorencode: __pretty__please__}}
  19083. !! html/php
  19084. <p>pretty_please
  19085. </p>
  19086. !! html/parsoid
  19087. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
  19088. !! end
  19089. !! test
  19090. anchorencode deals with links
  19091. !! config
  19092. wgFragmentMode=[ 'html5', 'legacy' ]
  19093. !! wikitext
  19094. {{anchorencode: [[hello|world]] [[hi]]}}
  19095. !! html/php
  19096. <p>world_hi
  19097. </p>
  19098. !! html/parsoid
  19099. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
  19100. !! end
  19101. !! test
  19102. anchorencode deals with templates
  19103. !! config
  19104. wgFragmentMode=[ 'html5', 'legacy' ]
  19105. !! wikitext
  19106. {{anchorencode: {{Foo}} x}}
  19107. !! html/php
  19108. <p>FOO_x
  19109. </p>
  19110. !! html/parsoid
  19111. <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
  19112. !! end
  19113. !! test
  19114. anchorencode encodes like the TOC generator: (T20431)
  19115. !! config
  19116. wgFragmentMode=[ 'html5', 'legacy' ]
  19117. !! wikitext
  19118. ===_ +:.3A%3A _ &&amp;]] x===
  19119. {{anchorencode: _ +:.3A%3A _ &&amp;]] x}}
  19120. __NOEDITSECTION__
  19121. !! html/php
  19122. <h3><span id=".2B:.3A.253A_.26.26.5D.5D_x"></span><span class="mw-headline" id="+:.3A%3A_&amp;&amp;]]_x">_ +:.3A%3A _ &amp;&amp;]] x</span></h3>
  19123. <p>+:.3A%3A_&amp;&amp;&#93;&#93;_x
  19124. </p>
  19125. !! html/parsoid
  19126. <h3 id="+:.3A%3A_&amp;&amp;]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x" typeof="mw:FallbackId"></span>_ +:.3A%3A _ &amp;<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;","dsr":[18,23,null,null]}'>&amp;</span>]] x</h3>
  19127. <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: _ +:.3A%3A _ &amp;&amp;amp;]] x","function":"anchorencode"},"params":{},"i":0}}]}'>+:.3A%3A_&amp;&amp;<span typeof="mw:Entity">]</span><span typeof="mw:Entity">]</span>_x</p>
  19128. <meta property="mw:PageProp/noeditsection"/>
  19129. !! end
  19130. !! test
  19131. anchorencode encodes like the TOC generator: (T20431) (legacy)
  19132. !! config
  19133. wgFragmentMode=[ 'legacy' ]
  19134. !! wikitext
  19135. ===_ +:.3A%3A&&amp;]]===
  19136. {{anchorencode: _ +:.3A%3A&&amp;]] }}
  19137. __NOEDITSECTION__
  19138. !! html/php
  19139. <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&amp;&amp;]]</span></h3>
  19140. <p>.2B:.3A.253A.26.26.5D.5D
  19141. </p>
  19142. !! end
  19143. !! test
  19144. T8200: blockquotes and paragraph formatting
  19145. !! wikitext
  19146. <blockquote>
  19147. foo
  19148. </blockquote>
  19149. bar
  19150. baz
  19151. !! html
  19152. <blockquote>
  19153. <p>foo
  19154. </p>
  19155. </blockquote>
  19156. <p>bar
  19157. </p>
  19158. <pre>baz
  19159. </pre>
  19160. !! end
  19161. !! test
  19162. T10293: Use of center tag ruins paragraph formatting
  19163. !! wikitext
  19164. <center>
  19165. foo
  19166. </center>
  19167. bar
  19168. baz
  19169. !! html
  19170. <center>
  19171. <p>foo
  19172. </p>
  19173. </center>
  19174. <p>bar
  19175. </p>
  19176. <pre>baz
  19177. </pre>
  19178. !! end
  19179. !!test
  19180. Parsing of overlapping (improperly nested) inline html tags
  19181. !! wikitext
  19182. <span><s>x</span></s>
  19183. !! html/php
  19184. <p><span><s>x&lt;/span&gt;</s></span>
  19185. </p>
  19186. !! html/parsoid
  19187. <p><span><s>x</s></span>
  19188. </p>
  19189. !!end
  19190. ###
  19191. ### Language variants related tests
  19192. ###
  19193. # Parsoid does not mark self-links.
  19194. # Parsoid does not convert links; PHP will do any necessary redirects.
  19195. !! test
  19196. Self-link in language variants
  19197. !! options
  19198. title=[[Dunav]] language=sr
  19199. !! wikitext
  19200. Both [[Dunav]] and [[Дунав]] are names for this river.
  19201. !! html/php
  19202. <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
  19203. </p>
  19204. !! html/parsoid
  19205. <p>Both <a rel="mw:WikiLink" href="./Dunav" title="Dunav">Dunav</a> and <a rel="mw:WikiLink" href="./Дунав" title="Дунав">Дунав</a> are names for this river.</p>
  19206. !! end
  19207. !! article
  19208. Дуна
  19209. !! text
  19210. content
  19211. !! endarticle
  19212. !! test
  19213. Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
  19214. !! options
  19215. title=[[Duna]] language=sr
  19216. !! wikitext
  19217. [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
  19218. !! html/php
  19219. <p><a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Дуна</a> is not a self-link while <a class="mw-selflink selflink">Duna</a> and <a class="mw-selflink selflink">Dуна</a> are still self-links.
  19220. </p>
  19221. !! html/parsoid
  19222. <p><a rel="mw:WikiLink" href="./Дуна" title="Дуна">Дуна</a> is not a self-link while <a rel="mw:WikiLink" href="./Duna" title="Duna">Duna</a> and <a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> are still self-links.</p>
  19223. !! end
  19224. !! test
  19225. Link to a section of a variant of this title shouldn't be parsed as self-link
  19226. !! options
  19227. title=[[Duna]] language=sr
  19228. !! wikitext
  19229. [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
  19230. !! html/php
  19231. <p><a class="mw-selflink selflink">Dуна</a> is a self-link while <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dunа#Foo</a> and <a href="/wiki/%D0%94%D1%83%D0%BD%D0%B0" title="Дуна">Dуна#Foo</a> are not self-links.
  19232. </p>
  19233. !! html/parsoid
  19234. <p><a rel="mw:WikiLink" href="./Dуна" title="Dуна">Dуна</a> is a self-link while <a rel="mw:WikiLink" href="./Dunа#Foo" title="Dunа">Dunа#Foo</a> and <a rel="mw:WikiLink" href="./Dуна#Foo" title="Dуна">Dуна#Foo</a> are not self-links.</p>
  19235. !! end
  19236. !! test
  19237. Link to pages in language variants
  19238. !! options
  19239. language=sr
  19240. !! wikitext
  19241. Main Page can be written as [[Маин Паге]]
  19242. !! html/php
  19243. <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
  19244. </p>
  19245. !! html/parsoid
  19246. <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
  19247. !! end
  19248. !! test
  19249. Multiple links to pages in language variants
  19250. !! options
  19251. language=sr
  19252. !! wikitext
  19253. [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
  19254. !! html/php
  19255. <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a> can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a> same as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>.
  19256. </p>
  19257. !! html/parsoid
  19258. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a> can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a> same as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a>.</p>
  19259. !! end
  19260. !! test
  19261. Simple template in language variants
  19262. !! options
  19263. language=sr
  19264. !! wikitext
  19265. {{тест}}
  19266. !! html/php
  19267. <p>This is a test template
  19268. </p>
  19269. !! end
  19270. !! test
  19271. Template with explicit namespace in language variants
  19272. !! options
  19273. language=sr
  19274. !! wikitext
  19275. {{Template:тест}}
  19276. !! html/php
  19277. <p>This is a test template
  19278. </p>
  19279. !! end
  19280. !! test
  19281. Basic test for template parameter in language variants
  19282. !! options
  19283. language=sr
  19284. !! wikitext
  19285. {{парамтест|param=foo}}
  19286. !! html/php
  19287. <p>This is a test template with parameter foo
  19288. </p>
  19289. !! end
  19290. !! test
  19291. Simple category in language variants
  19292. !! options
  19293. language=sr cat
  19294. !! wikitext
  19295. [[Category:МедиаWики Усер'с Гуиде]]
  19296. !! html/php
  19297. cat=МедиаWики_Усер'с_Гуиде sort=
  19298. !! html/parsoid
  19299. <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер&#39;с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер&#39;с Гуиде"}}'/>
  19300. !! end
  19301. !! article
  19302. Category:分类
  19303. !! text
  19304. blah
  19305. !! endarticle
  19306. !! article
  19307. Category:分類
  19308. !! text
  19309. blah
  19310. !! endarticle
  19311. ## We used to, but no longer wt2wt this test since the default serializer
  19312. ## will normalize all categories to serialize on their own line.
  19313. ## This wikitext usage is going to be fairly uncommon in production and
  19314. ## selser will take care of preserving formatting in those scenarios.
  19315. !! test
  19316. Don't convert blue categorylinks to another variant (T35210)
  19317. !! options
  19318. cat
  19319. language=zh
  19320. parsoid=wt2html
  19321. !! wikitext
  19322. [[A]][[Category:分类]]
  19323. !! html/php
  19324. cat=分类 sort=
  19325. !! html/parsoid
  19326. <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
  19327. <link rel="mw:PageProp/Category" href="./Category:分类"/>
  19328. !! end
  19329. !! test
  19330. Stripping -{}- tags (language variants)
  19331. !! options
  19332. language=sr
  19333. !! wikitext
  19334. Latin proverb: -{Ne nuntium necare}-
  19335. !! html/php
  19336. <p>Latin proverb: Ne nuntium necare
  19337. </p>
  19338. !! html/parsoid
  19339. <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
  19340. !! end
  19341. !! test
  19342. Prevent conversion with -{}- tags (language variants)
  19343. !! options
  19344. language=sr variant=sr-ec
  19345. !! wikitext
  19346. Latinski: -{Ne nuntium necare}-
  19347. !! html/php
  19348. <p>Латински: Ne nuntium necare
  19349. </p>
  19350. !! html/parsoid
  19351. <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
  19352. !! end
  19353. !! test
  19354. Prevent conversion of text with -{}- tags (language variants)
  19355. !! options
  19356. language=sr variant=sr-ec
  19357. !! wikitext
  19358. Latinski: -{Ne nuntium necare}-
  19359. !! html/php
  19360. <p>Латински: Ne nuntium necare
  19361. </p>
  19362. !! html/parsoid
  19363. <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
  19364. !! end
  19365. !! test
  19366. Prevent conversion of links with -{}- tags (language variants)
  19367. !! options
  19368. language=sr variant=sr-ec
  19369. !! wikitext
  19370. -{[[Main Page]]}-
  19371. !! html/php
  19372. <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  19373. </p>
  19374. !! html/parsoid
  19375. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[2,15,2,2]}&#39;>Main Page&lt;/a>"}}'></span></p>
  19376. !! end
  19377. !! test
  19378. -{}- tags within headlines (within html for parserConvert())
  19379. !! config
  19380. wgFragmentMode=[ 'html5', 'legacy' ]
  19381. !! options
  19382. language=sr variant=sr-ec
  19383. !! wikitext
  19384. ==-{Naslov}-==
  19385. Note that even an unprotected headline ID is not affected by language
  19386. conversion:
  19387. ==Latinski==
  19388. !! html/php
  19389. <h2><span id="-.7BNaslov.7D-"></span><span class="mw-headline" id="-{Naslov}-">Naslov</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Уреди одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
  19390. <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
  19391. цонверсион:
  19392. </p>
  19393. <h2><span class="mw-headline" id="Latinski">Латински</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Уреди одељак „Латински“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
  19394. !! html/parsoid
  19395. <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
  19396. <p>Note that even an unprotected headline ID is not affected by language
  19397. conversion:</p>
  19398. <h2 id="Latinski">Latinski</h2>
  19399. !! end
  19400. !! test
  19401. Explicit definition of language variant alternatives
  19402. !! options
  19403. language=zh variant=zh-tw
  19404. !! wikitext
  19405. -{zh:China;zh-tw:Taiwan}-, not China
  19406. !! html/php
  19407. <p>Taiwan, not China
  19408. </p>
  19409. !! html/parsoid
  19410. <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, not China</p>
  19411. !! end
  19412. !! test
  19413. Filter syntax for language variants
  19414. !! options
  19415. language=zh variant=zh-tw
  19416. !! wikitext
  19417. foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
  19418. !! html/php
  19419. <p>fooblog, WEBJOURNAL, WEBLOGquux
  19420. </p>
  19421. !! html/parsoid
  19422. <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
  19423. !! end
  19424. # Note that Parsoid post-processing for language variants needs to
  19425. # update the `title` attribute here, based on the mw:ExpandedAttrs property
  19426. !! test
  19427. Conversion around HTML tags
  19428. !! options
  19429. language=sr variant=sr-ec
  19430. !! wikitext
  19431. -{H|span=>sr-ec:script;title=>sr-ec:src}-
  19432. <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
  19433. !! html/php
  19434. <p>
  19435. <span title="ЛаCтин">ски</span>
  19436. </p>
  19437. !! html/parsoid
  19438. <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"span","l":"sr-ec","t":"script"},{"f":"title","l":"sr-ec","t":"src"}]}'/>
  19439. <span title="Latin" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"La&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"sr-el\",\"t\":\"L\"},{\"l\":\"sr-ec\",\"t\":\"C\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[57,76,null,2]}&#39;>&lt;/span>tin"}]]}'>ski</span></p>
  19440. !! end
  19441. !! test
  19442. Explicit session-wise two-way language variant mapping (A flag and - flag)
  19443. !! options
  19444. language=zh variant=zh-tw
  19445. !! wikitext
  19446. This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
  19447. Taiwan is not China.
  19448. But -{A|zh:China; zh-tw:Taiwan}- is China,
  19449. (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
  19450. and -{China}- is China.
  19451. !! html/php
  19452. <p>This is Taiwan, but we'll forget that now.
  19453. </p><p>Taiwan is not China.
  19454. </p><p>But Taiwan is Taiwan,
  19455. </p><p>(This should be stripped!)
  19456. </p><p>and China is China.
  19457. </p>
  19458. !! html/parsoid
  19459. <p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p>
  19460. <p>Taiwan is not China.</p>
  19461. <p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'></span> is China,</p>
  19462. <p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"remove":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
  19463. <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
  19464. !! end
  19465. !! test
  19466. Explicit session-wise one-way language variant mapping (A flag and - flag)
  19467. !! options
  19468. language=zh variant=zh-tw
  19469. !! wikitext
  19470. This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
  19471. COUNTRY is China or Taiwan.
  19472. But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
  19473. (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
  19474. and -{COUNTRY}- is COUNTRY.
  19475. !! html/php
  19476. <p>This is Taiwan, but we'll forget that now.
  19477. </p><p>COUNTRY is China or Taiwan.
  19478. </p><p>But Taiwan is Taiwan,
  19479. </p><p>(This should be stripped!)
  19480. </p><p>and COUNTRY is COUNTRY.
  19481. </p>
  19482. !! html/parsoid
  19483. <p>This is <span typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span>, but we'll forget that now.</p>
  19484. <p>COUNTRY is China or Taiwan.</p>
  19485. <p>But <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'></span> is COUNTRY,</p>
  19486. <p>(This<meta typeof="mw:LanguageVariant" data-mw-variant='{"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}],"remove":true}'/> should be stripped!)</p>
  19487. <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
  19488. !! end
  19489. !! test
  19490. Explicit session-wise two-way language variant mapping (H flag for hide)
  19491. !! options
  19492. language=zh variant=zh-tw
  19493. !! wikitext
  19494. (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
  19495. Taiwan is China.
  19496. !! html/php
  19497. <p>(This should be stripped!)
  19498. </p><p>Taiwan is Taiwan.
  19499. </p>
  19500. !! html/parsoid
  19501. <p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
  19502. <p>Taiwan is China.</p>
  19503. !! end
  19504. !! test
  19505. Explicit session-wise one-way language variant mapping (H flag for hide)
  19506. !! options
  19507. language=zh variant=zh-tw
  19508. !! wikitext
  19509. (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
  19510. COUNTRY is Taiwan or China.
  19511. !! html/php
  19512. <p>(This should be stripped!)
  19513. </p><p>Taiwan is Taiwan or China.
  19514. </p>
  19515. !! html/parsoid
  19516. <p>(This<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[8]}' data-mw-variant='{"add":true,"oneway":[{"f":"COUNTRY","l":"zh","t":"China"},{"f":"COUNTRY","l":"zh-tw","t":"Taiwan"}]}'/> should be stripped!)</p>
  19517. <p>COUNTRY is Taiwan or China.</p>
  19518. !! end
  19519. ## Note that parsoid test runner does not support 'showtitle' option.
  19520. !! test
  19521. Adding explicit conversion rule for title (T flag)
  19522. !! options
  19523. language=zh variant=zh-tw showtitle
  19524. !! wikitext
  19525. Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
  19526. Taiwan is China.
  19527. !! html/php
  19528. Taiwan
  19529. <p>Should be stripped!
  19530. </p><p>Taiwan is China.
  19531. </p>
  19532. !! html/parsoid
  19533. <p>Should be stripped<meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
  19534. <p>Taiwan is China.</p>
  19535. !! end
  19536. !! test
  19537. Code coverage: T combined with H flag
  19538. !! options
  19539. language=zh variant=zh-tw showtitle
  19540. !! wikitext
  19541. Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
  19542. Taiwan is China.
  19543. !! html/php
  19544. Taiwan
  19545. <p>Should be stripped!
  19546. </p><p>Taiwan is Taiwan.
  19547. </p>
  19548. !! html/parsoid
  19549. <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
  19550. <p>Taiwan is China.</p>
  19551. !! end
  19552. !! test
  19553. Code coverage: T with no variants
  19554. !! options
  19555. language=zh variant=zh-tw showtitle
  19556. !! wikitext
  19557. -{H|zh:China; zh-tw:Taiwan}-
  19558. Taiwan is China.-{T|Taiwan is China}-
  19559. !! html/php
  19560. Taiwan is China
  19561. <p>
  19562. Taiwan is Taiwan.
  19563. </p>
  19564. !! html/parsoid
  19565. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
  19566. Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
  19567. !! end
  19568. !! test
  19569. Code coverage: rules with no variants
  19570. !! options
  19571. language=zh variant=zh-tw
  19572. !! wikitext
  19573. -{H|zh:China; zh-tw:Taiwan}-
  19574. Taiwan is China.
  19575. -{H|China}-
  19576. Taiwan is China.
  19577. !! html/php
  19578. <p>
  19579. Taiwan is Taiwan.
  19580. Taiwan is China.
  19581. </p>
  19582. !! html/parsoid
  19583. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
  19584. Taiwan is China.
  19585. <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
  19586. Taiwan is China.</p>
  19587. !! end
  19588. !! test
  19589. Code coverage: D flag for conversion rule
  19590. !! options
  19591. language=zh variant=zh-tw
  19592. !! wikitext
  19593. -{D|zh-cn:XA; zh-tw:YA}-
  19594. -{A;D|zh-cn:XB; zh-tw:YB}-
  19595. -{D;H|zh-cn:XC; zh-tw:YC}-
  19596. -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
  19597. -{D|0=>zh-tw:1}-
  19598. -{A;D|2=>zh-tw:3}-
  19599. -{D;H|4=>zh-tw:5}-
  19600. XA XB XC YA YB YC FOO BAR BAT 012345
  19601. !! html/php
  19602. <p>大陆:XA;台灣:YA;
  19603. 大陆:XC;台灣:YC;
  19604. </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
  19605. </p><p>0⇒台灣:1;
  19606. 4⇒台灣:5;
  19607. </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
  19608. </p>
  19609. !! html/parsoid
  19610. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
  19611. <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
  19612. <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
  19613. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"FOO","l":"zh-tw","t":"BAR"},{"f":"FOO","l":"zh-cn","t":"BAT"}]}'></span></p>
  19614. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
  19615. <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
  19616. <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
  19617. <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
  19618. !! end
  19619. !! test
  19620. Code coverage: N flag for conversion rule
  19621. !! options
  19622. language=zh variant=zh-cn
  19623. !! wikitext
  19624. -{N|zh-cn}-
  19625. -{N|zh-tw}-
  19626. -{N|sr-ec}-
  19627. !! html/php
  19628. <p>大陆
  19629. </p><p>台灣
  19630. </p><p>српски (ћирилица)‎
  19631. </p>
  19632. !! html/parsoid
  19633. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
  19634. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
  19635. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
  19636. !! end
  19637. # html2wt suppresses the bogus 'D' flag, so this is wt2html only
  19638. !! test
  19639. Code coverage: N flag for conversion rule (wt2html only)
  19640. !! options
  19641. language=zh variant=zh-cn
  19642. parsoid=wt2html,html2html
  19643. !! wikitext
  19644. -{D;N|en}-
  19645. !! html/php
  19646. <p>English
  19647. </p>
  19648. !! html/parsoid
  19649. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
  19650. !! end
  19651. !! test
  19652. Testing that changing the language variant here in the tests actually works
  19653. !! options
  19654. language=zh variant=zh showtitle
  19655. !! wikitext
  19656. Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
  19657. !! html/php
  19658. China
  19659. <p>Should be stripped!
  19660. </p>
  19661. !! html/parsoid
  19662. <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
  19663. !! end
  19664. !! test
  19665. Recursive conversion of alt and title attrs shouldn't clear converter state
  19666. !! options
  19667. language=zh variant=zh-cn
  19668. showtitle
  19669. !! wikitext
  19670. -{H|zh-cn:Exclamation; zh-tw:exclamation}-
  19671. Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
  19672. !! html/php
  19673. China
  19674. <p>
  19675. Should be stripped<span title="Exclamation">!</span>
  19676. </p>
  19677. !! html/parsoid
  19678. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
  19679. Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/><span title="exclamation">!</span></p>
  19680. !! end
  19681. !! test
  19682. T26072: more test on conversion rule for title
  19683. !! options
  19684. language=zh variant=zh-tw showtitle
  19685. !! wikitext
  19686. This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
  19687. This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
  19688. !! html/php
  19689. Taiwan
  19690. <p>This should be stripped!
  19691. </p><p>This won't take interferes with the title rule.
  19692. </p>
  19693. !! html/parsoid
  19694. <p>This should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
  19695. <p>This won't take interferes with the title rule<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"Beijing"},{"l":"zh-tw","t":"Taipei"}]}'/>.</p>
  19696. !! end
  19697. !! test
  19698. Partly disable title conversion if variant == main language code
  19699. !! options
  19700. language=zh variant=zh title=[[ZH]] showtitle
  19701. !! wikitext
  19702. -{T|zh-cn:CN;zh-tw:TW}-
  19703. !! html/php
  19704. ZH
  19705. <p>
  19706. </p>
  19707. !! html/parsoid
  19708. <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"title":true,"twoway":[{"l":"zh-cn","t":"CN"},{"l":"zh-tw","t":"TW"}]}'/></p>
  19709. !! end
  19710. !! test
  19711. Partly disable title conversion if variant == main language code, more
  19712. !! options
  19713. language=zh variant=zh title=[[ZH]] showtitle
  19714. !! wikitext
  19715. -{T|TW}-
  19716. !! html/php
  19717. ZH
  19718. <p>
  19719. </p>
  19720. !! html/parsoid
  19721. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
  19722. !! end
  19723. !! test
  19724. Raw output of variant escape tags (R flag)
  19725. !! options
  19726. language=zh variant=zh-tw
  19727. !! wikitext
  19728. Raw: -{R|zh:China;zh-tw:Taiwan}-
  19729. !! html/php
  19730. <p>Raw: zh:China;zh-tw:Taiwan
  19731. </p>
  19732. !! html/parsoid
  19733. <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
  19734. !! end
  19735. # html2wt suppresses the bogus 'D' flags, so this is wt2html only
  19736. !! test
  19737. Raw output of variant escape tags (R flag) (wt2html only)
  19738. !! options
  19739. language=zh variant=zh-tw
  19740. parsoid=wt2html,html2html
  19741. !! wikitext
  19742. -{Variant}- -{D|syntax}- -{D;R|options}-
  19743. !! html/php
  19744. <p>Variant syntax options
  19745. </p>
  19746. !! html/parsoid
  19747. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Variant"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"syntax"}}'></span> <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"options"}}'></span></p>
  19748. !! end
  19749. !! test
  19750. Nested markup inside raw output of variant escape tags (R flag)
  19751. !! options
  19752. language=zh variant=zh-tw
  19753. !! wikitext
  19754. Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
  19755. !! html/php
  19756. <p>Nested raw: nested Taiwan nested
  19757. </p>
  19758. !! html/parsoid
  19759. <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"twoway\":[{\"l\":\"zh\",\"t\":\"China\"},{\"l\":\"zh-tw\",\"t\":\"Taiwan\"}]}&#39; data-parsoid=&#39;{\"fl\":[],\"tSp\":[6],\"dsr\":[23,48,null,2]}&#39;>&lt;/span> nested"}}'></span></p>
  19760. !! end
  19761. !! test
  19762. Nested markup and spaces inside raw output of variant escape tags (R flag)
  19763. !! options
  19764. language=zh variant=zh-tw
  19765. !! wikitext
  19766. X-{ outer -{ inner }- outer }-X
  19767. !! html/php
  19768. <p>X outer inner outer X
  19769. </p>
  19770. !! html/parsoid
  19771. <p>X<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":" outer &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\" inner \"}}&#39; data-parsoid=&#39;{\"fl\":[],\"dsr\":[10,21,null,2]}&#39;>&lt;/span> outer "}}'></span>X</p>
  19772. !! end
  19773. !! test
  19774. Templates inside raw output of variant escape tags (R flag)
  19775. !! options
  19776. language=zh variant=zh-tw
  19777. !! wikitext
  19778. Nested raw: -{R|nested {{echo|hi}} templates}-
  19779. !! html/php
  19780. <p>Nested raw: nested hi templates
  19781. </p>
  19782. !! html/parsoid
  19783. <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested &lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[23,34,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}&#39;>hi&lt;/span> templates"}}'></span></p>
  19784. !! end
  19785. !! test
  19786. Strings evaluating false shouldn't be ignored by Language converter (T51072)
  19787. !! options
  19788. language=zh variant=zh-cn
  19789. !! wikitext
  19790. -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
  19791. !! html/php
  19792. <p>0
  19793. </p>
  19794. !! html/parsoid
  19795. <p><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[12]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"0"},{"l":"zh-sg","t":"1"},{"l":"zh-tw","t":"2"},{"l":"zh-hk","t":"3"}]}'></span></p>
  19796. !! end
  19797. !! test
  19798. Conversion rules from [numeric-only string] to [something else] (T48634)
  19799. !! options
  19800. language=zh variant=zh-cn
  19801. !! wikitext
  19802. -{H|0=>zh-cn:B}--{H|0=>zh-cn:C;0=>zh-cn:D}--{H|0=>zh-hans:A}-012345-{A|zh-tw:0;zh-cn:E;}-012345
  19803. !! html/php
  19804. <p>D12345EE12345
  19805. </p>
  19806. !! html/parsoid
  19807. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"B"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"C"},{"f":"0","l":"zh-cn","t":"D"}]}'/><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-hans","t":"A"}]}'/>012345<span typeof="mw:LanguageVariant" data-parsoid='{"fl":["A"],"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"0"},{"l":"zh-cn","t":"E"}]}'></span>012345</p>
  19808. !! end
  19809. !! test
  19810. Two-way converter rule entries with an empty value should be ignored (T53551)
  19811. !! options
  19812. language=zh variant=zh-cn
  19813. !! wikitext
  19814. -{H|zh-cn:foo;zh-tw:;}-foobar
  19815. !! html/php
  19816. <p>foobar
  19817. </p>
  19818. !! html/parsoid
  19819. <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"foo"},{"l":"zh-tw","t":""}]}'/>foobar</p>
  19820. !! end
  19821. !! test
  19822. One-way converter rule entries with an empty "from" string should be ignored (T53551)
  19823. !! options
  19824. language=zh variant=zh-cn
  19825. !! wikitext
  19826. -{H|=>zh-cn:foo;}-foobar
  19827. !! html/php
  19828. <p>foobar
  19829. </p>
  19830. !! html/parsoid
  19831. <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
  19832. !! end
  19833. !! test
  19834. Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
  19835. !! options
  19836. language=zh variant=zh-cn
  19837. !! wikitext
  19838. -{H|}-foobar
  19839. !! html/php
  19840. <p>foobar
  19841. </p>
  19842. !! html/parsoid
  19843. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
  19844. !! end
  19845. !! test
  19846. Nested using of manual convert syntax
  19847. !! options
  19848. language=zh variant=zh-hk
  19849. !! wikitext
  19850. Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
  19851. !! html/php
  19852. <p>Nested: Hello Hong Kong!
  19853. </p>
  19854. !! html/parsoid
  19855. <p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}&apos;>&lt;/span>"},{"l":"zh-hant","t":"Hello &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&apos;{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&amp;apos;>&amp;lt;/span> K&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&amp;apos;>&amp;lt;/span>ong\"}]}&apos; data-parsoid=&apos;{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}&apos;>&lt;/span>"}]}'></span>!</p>
  19856. !! end
  19857. !! test
  19858. HTML markups with conversion syntax in attribs, nested in other conversion blocks
  19859. !! options
  19860. language=zh variant=zh-cn
  19861. !! wikitext
  19862. -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
  19863. !! html/php
  19864. <p><span title="X">A</span>
  19865. </p>
  19866. !! html/parsoid
  19867. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[21,49,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[34,39,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
  19868. !! end
  19869. !! test
  19870. HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
  19871. !! options
  19872. language=zh variant=zh-cn
  19873. !! wikitext
  19874. -{<span title="-{X}-">A</span>}-
  19875. !! html/php+disabled
  19876. <p><span title="X">A</span>
  19877. </p>
  19878. !! html/parsoid
  19879. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid=&#39;{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[2,30,20,7]}&#39; data-mw=&#39;{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&amp;lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&amp;apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&amp;apos; data-parsoid=&amp;apos;{\\\"fl\\\":[],\\\"dsr\\\":[15,20,null,2]}&amp;apos;>&amp;lt;/span>\"}]]}&#39;>A&lt;/span>"}}'></span></p>
  19880. !! end
  19881. # Parsoid and PHP disagree on how to parse this example: Parsoid
  19882. # insists that the content of a language converter element be a valid
  19883. # DOM fragment or attribute string
  19884. !! test
  19885. Language converter markup with block content
  19886. !! options
  19887. language=zh variant=zh-cn
  19888. !! wikitext
  19889. <span>a-{b<div>c}-d
  19890. <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
  19891. <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
  19892. !! html/php+tidy
  19893. <span>ab<div>cd
  19894. <span>ab<div>cd
  19895. <span>ad
  19896. </span></div></span></div></span>
  19897. !! html/parsoid
  19898. <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
  19899. <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}&#39;>c&lt;/div>"}}'></div><p>d</p>
  19900. <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a<meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"0","l":"zh-cn","t":"x&lt;span data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}&#39;>y&lt;/span>"},{"f":"0","l":"zh-tw","t":"b&lt;div data-parsoid=&#39;{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}&#39;>c&lt;/div>"}]}'/>d</span></p>
  19901. !! end
  19902. !! test
  19903. LanguageConverter selser (1)
  19904. !! options
  19905. language=zh variant=zh-cn
  19906. parsoid={
  19907. "modes": ["wt2wt", "selser"],
  19908. "changes": [
  19909. ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
  19910. ]
  19911. }
  19912. !! wikitext
  19913. -{raw}-
  19914. !! wikitext/edited
  19915. -{edited}-
  19916. !! end
  19917. !! test
  19918. LanguageConverter selser (2)
  19919. !! options
  19920. language=zh variant=zh-cn
  19921. parsoid={
  19922. "modes": ["wt2wt", "selser"],
  19923. "changes": [
  19924. ["span[class='x']", "contents", "text", "-{foo}-"],
  19925. ["a", "contents", "text", "-{"],
  19926. ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
  19927. ]
  19928. }
  19929. !! wikitext
  19930. <span class="x">TEXT1</span>
  19931. [http://example.com TEXT2]
  19932. [[Foo|TEXT3]]
  19933. {{echo|TEXT4}}
  19934. !! wikitext/edited
  19935. <span class="x"><nowiki>-{foo}-</nowiki></span>
  19936. [http://example.com -{]
  19937. [[Foo|<nowiki>-{</nowiki>]]
  19938. {{1x|<nowiki>-{</nowiki>}}
  19939. !! end
  19940. # Tests LanguageVariantText in ConstrainedText
  19941. !! test
  19942. LanguageConverter selser (3)
  19943. !! options
  19944. language=zh variant=zh-cn
  19945. parsoid={
  19946. "modes": ["wt2wt", "selser"],
  19947. "changes": [
  19948. ["td > span", "attr", "typeof", "mw:LanguageVariant"],
  19949. ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
  19950. ]
  19951. }
  19952. !! wikitext
  19953. {|
  19954. |-
  19955. |<span>Foo</span>
  19956. |}
  19957. !! wikitext/edited
  19958. {|
  19959. |-
  19960. |<nowiki/>-{edited}-
  19961. |}
  19962. !! end
  19963. # Tests LanguageVariantText._fromSelSer
  19964. !! test
  19965. LanguageConverter selser (4)
  19966. !! options
  19967. language=zh variant=zh-cn
  19968. parsoid={
  19969. "modes": ["wt2wt", "selser"],
  19970. "changes": [
  19971. ["td > span.x", "remove"]
  19972. ]
  19973. }
  19974. !! wikitext
  19975. {|
  19976. |-
  19977. |<span class="x">Foo</span>-{Bar}-
  19978. ||<span class="x">Foo</span>-{Bar}-
  19979. |}
  19980. !! wikitext/edited
  19981. {|
  19982. |-
  19983. |<nowiki/>-{Bar}-
  19984. ||-{Bar}-
  19985. |}
  19986. !! end
  19987. # Since Parsoid is starting to emit canonical wikitext for links,
  19988. # [http://example.com http://example.com] will not RT back to that
  19989. # form anymore.
  19990. # Parsoid does not language-convert links (it is done in a
  19991. # post-processing step)
  19992. !! test
  19993. Proper conversion of text in external links
  19994. !! options
  19995. language=sr variant=sr-ec
  19996. parsoid=wt2html
  19997. !! wikitext
  19998. http://www.google.com
  19999. gopher://www.google.com
  20000. [http://www.google.com http://www.google.com]
  20001. [gopher://www.google.com gopher://www.google.com]
  20002. [https://www.google.com irc://www.google.com]
  20003. [ftp://www.google.com www.google.com/ftp://dir]
  20004. [//www.google.com www.google.com]
  20005. !! html/php
  20006. <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
  20007. <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
  20008. <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
  20009. <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
  20010. <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
  20011. <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
  20012. <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
  20013. </p>
  20014. !! html/parsoid
  20015. <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
  20016. <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
  20017. <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
  20018. <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
  20019. <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
  20020. <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
  20021. <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
  20022. !! end
  20023. !! test
  20024. Do not convert roman numbers to language variants
  20025. !! options
  20026. language=sr variant=sr-ec
  20027. !! wikitext
  20028. Fridrih IV je car.
  20029. !! html/php
  20030. <p>Фридрих IV је цар.
  20031. </p>
  20032. !! html/parsoid
  20033. <p>Fridrih IV je car.</p>
  20034. !! end
  20035. !! test
  20036. Unclosed language converter markup "-{"
  20037. !! options
  20038. language=sr
  20039. !! wikitext
  20040. -{T|hello
  20041. !! html
  20042. <p>-{T|hello
  20043. </p>
  20044. !! end
  20045. !! test
  20046. Don't convert raw rule "-{R|=&gt;}-" to "=>"
  20047. !! options
  20048. language=sr
  20049. !! wikitext
  20050. -{R|=&gt;}-
  20051. !! html/php
  20052. <p>=&gt;
  20053. </p>
  20054. !! html/parsoid
  20055. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"=&lt;span typeof=\"mw:Entity\" data-parsoid=&#39;{\"src\":\"&amp;amp;gt;\",\"srcContent\":\">\",\"dsr\":[5,9,null,null]}&#39;>>&lt;/span>"}}'></span></p>
  20056. !!end
  20057. !! test
  20058. Don't break link parsing if language converter markup is in the caption.
  20059. !! options
  20060. language=sr variant=sr-ec
  20061. !! wikitext
  20062. [[Main Page|-{R|main page}-]]
  20063. !! html/php
  20064. <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
  20065. </p>
  20066. !! html/parsoid
  20067. <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"main page"}}' data-parsoid='{"fl":["R"]}'></span></a></p>
  20068. !! end
  20069. !! test
  20070. T146304: Don't break template parsing if language converter markup is in the parameter.
  20071. !! options
  20072. language=sr variant=sr-ec
  20073. !! wikitext
  20074. {{echo|-{R|foo}-}}
  20075. !! html/php
  20076. <p>foo
  20077. </p>
  20078. !! html/parsoid
  20079. <p><span typeof="mw:Transclusion mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo"}}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Шаблон:Echo"},"params":{"1":{"wt":"-{R|foo}-"}},"i":0}}]}'></span></p>
  20080. !! end
  20081. !! test
  20082. T146305: Don't break image parsing if language converter markup is in the caption.
  20083. !! options
  20084. language=sr
  20085. !! wikitext
  20086. [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
  20087. !! html/php
  20088. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/%D0%94%D0%B0%D1%82%D0%BE%D1%82%D0%B5%D0%BA%D0%B0:Foobar.jpg" class="internal" title="Повећај"></a></div>caption:</div></div></div>
  20089. !! html/parsoid
  20090. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"}]}'><a href="./Датотека:Foobar.jpg"><img resource="./Датотека:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"caption:"}}' data-parsoid='{"fl":["R"]}'></span></figcaption></figure>
  20091. !! end
  20092. !! test
  20093. T146305: Don't break image parsing if nested language converter markup is in the caption.
  20094. !! options
  20095. language=zh variant=zh-cn
  20096. !! wikitext
  20097. [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
  20098. !! html/php
  20099. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="放大"></a></div>blog (hk: WEBJOURNAL, tw: WEBLOG)</div></div></div>
  20100. !! html/parsoid
  20101. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"blog (hk: &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBJOURNAL\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[43,65,null,2]}&#39;>&lt;/span>, tw: &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBLOG\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[71,89,null,2]}&#39;>&lt;/span>)"}]}'></span></figcaption></figure>
  20102. !! end
  20103. # XXX html2wt disabled because rich markup in alt is not preserved.
  20104. !! test
  20105. Don't break gallery if language converter markup is inside.
  20106. !! options
  20107. language=zh
  20108. !! wikitext
  20109. <gallery>
  20110. File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
  20111. File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
  20112. </gallery>
  20113. !! html/php
  20114. <ul class="gallery mw-gallery-traditional">
  20115. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  20116. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="bat" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  20117. <div class="gallerytext">
  20118. <p><a href="/wiki/File:Foobar.jpg" class="image" title="bar"><img alt="foo" src="http://example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" width="20" height="2" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/30px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/40px-Foobar.jpg 2x" /></a>
  20119. </p>
  20120. </div>
  20121. </div></li>
  20122. <li class="gallerybox" style="width: 155px"><div style="width: 155px">
  20123. <div class="thumb" style="width: 150px;"><div style="margin:68px auto;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="galleryalt" src="http://example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" width="120" height="14" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/240px-Foobar.jpg 2x" /></a></div></div>
  20124. <div class="gallerytext">
  20125. <p>This is a test template
  20126. </p>
  20127. </div>
  20128. </div></li>
  20129. </ul>
  20130. !! html/parsoid
  20131. <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{"extsrc":"\nFile:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-\nFile:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt\n"}}'>
  20132. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><figure-inline typeof="mw:Image" data-mw='{"caption":"&lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\"bar\"}}&#39; data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[68,77,null,2]}&#39;>&lt;/span>"}'><a href="./File:Foobar.jpg"><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/20px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="2" width="20"/></a></figure-inline></div></li>
  20133. <li class="gallerybox" style="width: 155px;"><div class="thumb" style="width: 150px; height: 150px;"><figure-inline typeof="mw:Image"><a href="./File:Foobar.jpg"><img alt="galleryalt" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/120px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="14" width="120"/></a></figure-inline></div><div class="gallerytext"><span about="#mwt4" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Test","href":"./Template:Test"},"params":{"1":{"wt":"unamedParam"},"alt":{"wt":"-{R|param}-"}},"i":0}}]}'>This is a test template</span></div></li>
  20134. </ul>
  20135. !! end
  20136. !! test
  20137. T153135: Don't break list handling if language converter markup is in the item.
  20138. !! options
  20139. language=zh variant=zh-cn
  20140. !! wikitext
  20141. ;-{zh-cn:AAA;zh-tw:BBB}-
  20142. ;-{R|foo:bar}-
  20143. !! html/php
  20144. <dl><dt>AAA</dt>
  20145. <dt>foo:bar</dt></dl>
  20146. !! html/parsoid
  20147. <dl><dt data-parsoid='{"dsr":[0,24,1,0]}'><span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[6]}' data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA"},{"l":"zh-tw","t":"BBB"}]}'></span></dt>
  20148. <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
  20149. </dl>
  20150. !! end
  20151. // Note that parsoid does not protect colons unless language converter
  20152. // markup is properly nested, because it is a backtracking parser.
  20153. !! test
  20154. T153135: Unclosed markup in definition list (code coverage)
  20155. !! options
  20156. language=zh variant=zh-cn
  20157. !! wikitext
  20158. ;<b>foo:bar
  20159. ;-{zh-cn:AAA
  20160. !! html/php+tidy
  20161. <dl><dt><b>foo:bar</b></dt><b>
  20162. <dt>-{zh-cn:AAA</dt></b></dl><p><b>
  20163. </b></p>
  20164. !! html/parsoid
  20165. <dl><dt data-parsoid='{"dsr":[0,11,1,0]}'><b data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo:bar</b></dt><b data-parsoid='{"stx":"html","autoInsertedEnd":true,"autoInsertedStart":true}'>
  20166. <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
  20167. <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
  20168. </b></dl>
  20169. !! end
  20170. !! test
  20171. T153135: Nested language converter markup in definition list (code coverage)
  20172. !! options
  20173. language=zh variant=zh-cn
  20174. !! wikitext
  20175. ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
  20176. !! html/php
  20177. <dl><dt>AAA foo:bar bat:baz</dt>
  20178. <dd>def</dd></dl>
  20179. !! html/parsoid
  20180. <dl><dt data-parsoid='{"dsr":[0,49,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"foo:bar\"}}&#39; data-parsoid=&#39;{\"fl\":[\"zh-hans\"],\"dsr\":[14,33,null,2]}&#39;>&lt;/span> &lt;span typeof=\"mw:LanguageVariant\" data-mw-variant=&#39;{\"disabled\":{\"t\":\"bat:baz\"}}&#39; data-parsoid=&#39;{\"fl\":[\"R\"],\"dsr\":[34,47,null,2]}&#39;>&lt;/span>"}]}'></span></dt>
  20181. <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
  20182. </dl>
  20183. !! end
  20184. # html2wt mode disabled due to <nowiki> insertion.
  20185. !! test
  20186. T153140: Don't break table handling if language converter markup is in the cell.
  20187. !! options
  20188. language=sr variant=sr-ec
  20189. parsoid=wt2html,wt2wt,html2html
  20190. !! wikitext
  20191. {|
  20192. |-
  20193. | -{R|B}-
  20194. |}
  20195. !! html/php
  20196. <table>
  20197. <tr>
  20198. <td>B
  20199. </td></tr></table>
  20200. !! html/parsoid
  20201. <table>
  20202. <tbody>
  20203. <tr>
  20204. <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
  20205. </tr>
  20206. </tbody>
  20207. </table>
  20208. !! end
  20209. !! test
  20210. Language converter tricky html2wt cases (1)
  20211. !! options
  20212. language=sr
  20213. parsoid=html2wt,wt2wt
  20214. !! html/parsoid
  20215. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
  20216. !! wikitext
  20217. -{<nowiki>}-</nowiki>}-
  20218. !! html/php
  20219. <p>&#125;-
  20220. </p>
  20221. !! end
  20222. !! test
  20223. Language converter tricky html2wt cases (2)
  20224. !! options
  20225. language=sr
  20226. parsoid=html2wt,wt2wt
  20227. !! html/parsoid
  20228. <p>-{foo}-</p>
  20229. !! wikitext
  20230. <nowiki>-{foo}-</nowiki>
  20231. !! html/php
  20232. <p>-&#123;foo&#125;-
  20233. </p>
  20234. !! end
  20235. !! test
  20236. Language converter tricky html2wt cases (3)
  20237. !! options
  20238. language=sr
  20239. parsoid=html2wt,wt2wt
  20240. !! html/parsoid
  20241. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
  20242. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
  20243. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
  20244. !! wikitext
  20245. -{R||}-
  20246. -{R|R|raw}-
  20247. -{<nowiki>-{foo}-</nowiki>}-
  20248. !! html/php
  20249. <p>|
  20250. </p><p>R|raw
  20251. </p><p>-&#123;foo&#125;-
  20252. </p>
  20253. !! end
  20254. !! test
  20255. Language converter tricky html2wt cases (4)
  20256. !! options
  20257. language=sr
  20258. parsoid=html2wt,wt2wt
  20259. !! html/parsoid
  20260. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hey\"}},\"i\":0}}]}&#39;>hey&lt;/span>"}}'></span></p>
  20261. !! wikitext
  20262. -{R|{{echo|hey}}}-
  20263. !! html/php
  20264. <p>hey
  20265. </p>
  20266. !! end
  20267. # Note that the <nowiki> escaping added by parsoid for source text,
  20268. # destination text, and language names only works on the PHP side
  20269. # for *destination text*. (HTML entity escaping wouldn't work
  20270. # any better.) This is probably a bug, at least for source texts.
  20271. # (For language names PHP uses a precise regexp based on the languages
  20272. # it currently knows have variants, which is fragile since this set
  20273. # can grow/shrink over time.)
  20274. !! test
  20275. Language converter tricky html2wt cases (5)
  20276. !! options
  20277. language=zh variant=zh-cn
  20278. !! html/parsoid
  20279. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"a:b=>c","l":"zh-cn","t":"x;foo=>zh-cn:boo"},{"f":"bar","l":"zh-cn","t":"bat;xyz=>zh-cn:abc"}]}'/>foobar</p>
  20280. <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
  20281. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-tw","t":"xyz"},{"l":"zh-cn","t":"0;zh-tw:bar"}]}'></span></p>
  20282. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
  20283. <p>a:b=>c xyz</p>
  20284. !! wikitext
  20285. -{H|<nowiki>a:b=>c</nowiki>=>zh-cn:<nowiki>x;foo=>zh-cn:boo</nowiki>;bar=>zh-cn:<nowiki>bat;xyz=>zh-cn:abc</nowiki>}-foobar
  20286. -{H|A=><nowiki>bo:g;us</nowiki>:B}-
  20287. -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
  20288. -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
  20289. a:b=>c xyz
  20290. !! html/php+disabled
  20291. <p>foobat;xyz=&gt;zh-cn:abc
  20292. </p><p>A
  20293. </p><p>0;zh-tw:bar
  20294. </p><p>abc
  20295. </p><p>a:b=&gt;c 0;zh-tw:bar
  20296. </p>
  20297. !! end
  20298. !! test
  20299. T179579: Nowiki and lc interaction
  20300. !! options
  20301. parsoid=wt2html
  20302. language=sr
  20303. !! wikitext
  20304. -{</nowiki>123}-
  20305. -{123<nowiki>|</nowiki>456}-
  20306. !! html/parsoid
  20307. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&amp;lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{&lt;/nowiki>123}-"}'></span></p>
  20308. <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"123&lt;span typeof=\"mw:Nowiki\" data-parsoid=&#39;{\"dsr\":[23,41,8,9]}&#39;>|&lt;/span>456"}}' data-parsoid='{"fl":[],"src":"-{123&lt;nowiki>|&lt;/nowiki>456}-"}'></span></p>
  20309. !! end
  20310. !! test
  20311. T2529: Uncovered bullet
  20312. !! wikitext
  20313. *Foo {{bullet}}
  20314. !! html
  20315. <ul><li>Foo</li>
  20316. <li>Bar</li></ul>
  20317. !! end
  20318. !! test
  20319. T2529: Uncovered bullet in a deeply nested list
  20320. !! wikitext
  20321. *******Foo {{bullet}}
  20322. !! html
  20323. <ul><li><ul><li><ul><li><ul><li><ul><li><ul><li><ul><li>Foo</li></ul></li></ul></li></ul></li></ul></li></ul></li></ul></li>
  20324. <li>Bar</li></ul>
  20325. !! end
  20326. !! test
  20327. T2529: Uncovered table already at line-start
  20328. !! wikitext
  20329. x
  20330. {{table}}
  20331. y
  20332. !! html
  20333. <p>x
  20334. </p>
  20335. <table>
  20336. <tr>
  20337. <td>1</td>
  20338. <td>2
  20339. </td></tr>
  20340. <tr>
  20341. <td>3</td>
  20342. <td>4
  20343. </td></tr></table>
  20344. <p>y
  20345. </p>
  20346. !! end
  20347. !! test
  20348. T2529: Uncovered bullet in parser function result
  20349. !! wikitext
  20350. *Foo {{lc:{{bullet}} }}
  20351. !! html
  20352. <ul><li>Foo</li>
  20353. <li>bar</li></ul>
  20354. !! end
  20355. !! test
  20356. T7678: Double-parsed template argument
  20357. !! wikitext
  20358. {{lc:{{{1}}}|hello}}
  20359. !! html
  20360. <p>{{{1}}}
  20361. </p>
  20362. !! end
  20363. !! test
  20364. T7678: Double-parsed template invocation
  20365. !! wikitext
  20366. {{lc:{{paramtest {{!}} param = hello }} }}
  20367. !! html
  20368. <p>{{paramtest | param = hello }}
  20369. </p>
  20370. !! end
  20371. !! test
  20372. Case insensitivity of parser functions for non-ASCII characters (T10143)
  20373. !! options
  20374. language=cs
  20375. title=[[Main Page]]
  20376. !! wikitext
  20377. {{PRVNÍVELKÉ:ěščř}}
  20378. {{prvnívelké:ěščř}}
  20379. {{PRVNÍMALÉ:ěščř}}
  20380. {{prvnímalé:ěščř}}
  20381. {{MALÁ:ěščř}}
  20382. {{malá:ěščř}}
  20383. {{VELKÁ:ěščř}}
  20384. {{velká:ěščř}}
  20385. !! html
  20386. <p>Ěščř
  20387. Ěščř
  20388. ěščř
  20389. ěščř
  20390. ěščř
  20391. ěščř
  20392. ĚŠČŘ
  20393. ĚŠČŘ
  20394. </p>
  20395. !! end
  20396. !! test
  20397. Morwen/13: Unclosed link followed by heading
  20398. !! wikitext
  20399. [[link
  20400. ==heading==
  20401. !! html
  20402. <p>[[link
  20403. </p>
  20404. <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  20405. !! end
  20406. !! test
  20407. HHP2.1: Heuristics for headings in preprocessor parenthetical structures
  20408. !! wikitext
  20409. {{foo|
  20410. =heading=
  20411. !! html
  20412. <p>{{foo|
  20413. </p>
  20414. <h1><span class="mw-headline" id="heading">heading</span></h1>
  20415. !! end
  20416. !! test
  20417. HHP2.2: Heuristics for headings in preprocessor parenthetical structures
  20418. !! wikitext
  20419. {{foo|
  20420. ==heading==
  20421. !! html
  20422. <p>{{foo|
  20423. </p>
  20424. <h2><span class="mw-headline" id="heading">heading</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  20425. !! end
  20426. !! test
  20427. Tildes in comments
  20428. !! options
  20429. pst
  20430. !! wikitext
  20431. <!-- ~~~~ -->
  20432. !! html/php
  20433. <!-- ~~~~ -->
  20434. !! end
  20435. !! test
  20436. Paragraphs inside divs (no extra line breaks)
  20437. !! wikitext
  20438. <div>Line one
  20439. Line two</div>
  20440. !! html
  20441. <div>Line one
  20442. Line two</div>
  20443. !! end
  20444. !! test
  20445. Paragraphs inside divs (extra line break on open)
  20446. !! wikitext
  20447. <div>
  20448. Line one
  20449. Line two</div>
  20450. !! html
  20451. <div>
  20452. <p>Line one
  20453. </p>
  20454. Line two</div>
  20455. !! end
  20456. !! test
  20457. Paragraphs inside divs (extra line break on close)
  20458. !! wikitext
  20459. <div>Line one
  20460. Line two
  20461. </div>
  20462. !! html
  20463. <div>Line one
  20464. <p>Line two
  20465. </p>
  20466. </div>
  20467. !! end
  20468. !! test
  20469. Paragraphs inside divs (extra line break on open and close)
  20470. !! wikitext
  20471. <div>
  20472. Line one
  20473. Line two
  20474. </div>
  20475. !! html
  20476. <div>
  20477. <p>Line one
  20478. </p><p>Line two
  20479. </p>
  20480. </div>
  20481. !! end
  20482. # doBlockLevels screws up this output and Remex cleans up as much as it can.
  20483. # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
  20484. !! test
  20485. Nesting tags, paragraphs on lines which begin with <div>
  20486. !! wikitext
  20487. <div></div><strong>A
  20488. B</strong>
  20489. !! html/php+tidy
  20490. <div></div><p><strong>A
  20491. </strong></p><strong></strong><p><strong>B</strong>
  20492. </p>
  20493. !! html/parsoid
  20494. <div></div>
  20495. <p><strong>A
  20496. B</strong>
  20497. </p>
  20498. !! end
  20499. # T8200: <blockquote> should behave like <div> with respect to line breaks
  20500. !! test
  20501. T8200: paragraphs inside blockquotes (no extra line breaks)
  20502. !! wikitext
  20503. <blockquote>Line one
  20504. Line two</blockquote>
  20505. !! html
  20506. <blockquote>Line one
  20507. Line two</blockquote>
  20508. !! html+tidy
  20509. <blockquote><p>Line one
  20510. Line two</p></blockquote>
  20511. !! end
  20512. !! test
  20513. T8200: paragraphs inside blockquotes (extra line break on open)
  20514. !! wikitext
  20515. <blockquote>
  20516. Line one
  20517. Line two</blockquote>
  20518. !! html
  20519. <blockquote>
  20520. <p>Line one
  20521. </p>
  20522. Line two</blockquote>
  20523. !! html+tidy
  20524. <blockquote>
  20525. <p>Line one
  20526. </p><p>
  20527. Line two</p></blockquote>
  20528. !! end
  20529. # Parsoid's output is broken on this because of Tidy-compatibility cruft
  20530. !! test
  20531. T8200: paragraphs inside blockquotes (extra line break on close)
  20532. !! wikitext
  20533. <blockquote>Line one
  20534. Line two
  20535. </blockquote>
  20536. !! html
  20537. <blockquote>Line one
  20538. <p>Line two
  20539. </p>
  20540. </blockquote>
  20541. !! html+tidy
  20542. <blockquote><p>Line one
  20543. </p><p>Line two
  20544. </p>
  20545. </blockquote>
  20546. !! end
  20547. !! test
  20548. T8200: paragraphs inside blockquotes (extra line break on open and close)
  20549. !! wikitext
  20550. <blockquote>
  20551. Line one
  20552. Line two
  20553. </blockquote>
  20554. !! html
  20555. <blockquote>
  20556. <p>Line one
  20557. </p><p>Line two
  20558. </p>
  20559. </blockquote>
  20560. !! end
  20561. # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
  20562. !! test
  20563. Paragraphs inside blockquotes/divs (no extra line breaks)
  20564. !! wikitext
  20565. <blockquote><div>Line one
  20566. Line two</div></blockquote>
  20567. !! html
  20568. <blockquote><div>Line one
  20569. Line two</div></blockquote>
  20570. !! end
  20571. !! test
  20572. Paragraphs inside blockquotes/divs (extra line break on open)
  20573. !! wikitext
  20574. <blockquote><div>
  20575. Line one
  20576. Line two</div></blockquote>
  20577. !! html
  20578. <blockquote><div>
  20579. <p>Line one
  20580. </p>
  20581. Line two</div></blockquote>
  20582. !! end
  20583. !! test
  20584. Paragraphs inside blockquotes/divs (extra line break on close)
  20585. !! wikitext
  20586. <blockquote><div>Line one
  20587. Line two
  20588. </div></blockquote>
  20589. !! html
  20590. <blockquote><div>Line one
  20591. <p>Line two
  20592. </p>
  20593. </div></blockquote>
  20594. !! end
  20595. !! test
  20596. Paragraphs inside blockquotes/divs (extra line break on open and close)
  20597. !! wikitext
  20598. <blockquote><div>
  20599. Line one
  20600. Line two
  20601. </div></blockquote>
  20602. !! html
  20603. <blockquote><div>
  20604. <p>Line one
  20605. </p><p>Line two
  20606. </p>
  20607. </div></blockquote>
  20608. !! end
  20609. !! test
  20610. Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
  20611. !! options
  20612. wgLinkHolderBatchSize=0
  20613. !! wikitext
  20614. [[meatball:1]]
  20615. [[meatball:2]]
  20616. [[meatball:3]]
  20617. !! html
  20618. <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
  20619. <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
  20620. <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
  20621. </p>
  20622. !! end
  20623. !! test
  20624. Free external link invading image caption
  20625. !! wikitext
  20626. [[Image:Foobar.jpg|thumb|http://x|hello]]
  20627. !! html/php
  20628. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div>hello</div></div></div>
  20629. !! html/parsoid
  20630. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"bogus","ak":"http://x"},{"ck":"caption","ak":"hello"}]}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"resource":"Image:Foobar.jpg"}}'/></a><figcaption>hello</figcaption></figure>
  20631. !! end
  20632. !! test
  20633. T17196: localised external link numbers
  20634. !! options
  20635. language=fa
  20636. !! wikitext
  20637. [http://en.wikipedia.org/]
  20638. !! html/php
  20639. <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
  20640. </p>
  20641. !! html/parsoid
  20642. <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
  20643. !! end
  20644. !! test
  20645. Multibyte character in padleft
  20646. !! wikitext
  20647. {{padleft:-Hello|7|Æ}}
  20648. !! html/php
  20649. <p>Æ-Hello
  20650. </p>
  20651. !! html/parsoid
  20652. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
  20653. !! end
  20654. !! test
  20655. Multibyte character in padright
  20656. !! wikitext
  20657. {{padright:Hello-|7|Æ}}
  20658. !! html/php
  20659. <p>Hello-Æ
  20660. </p>
  20661. !! html/parsoid
  20662. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
  20663. !! end
  20664. !!test
  20665. formatdate parser function
  20666. !! wikitext
  20667. {{#formatdate:2009-03-24}}
  20668. !! html
  20669. <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
  20670. </p>
  20671. !! end
  20672. !!test
  20673. formatdate parser function, with default format
  20674. !! wikitext
  20675. {{#formatdate:2009-03-24|mdy}}
  20676. !! html
  20677. <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
  20678. </p>
  20679. !! end
  20680. !! test
  20681. Spacing of numbers in formatted dates
  20682. !! wikitext
  20683. {{#formatdate:January 15}}
  20684. !! html
  20685. <p><span class="mw-formatted-date" title="01-15">January 15</span>
  20686. </p>
  20687. !! end
  20688. !! test
  20689. formatdate parser function, with default format and on a page of which the content language is always English and different from the wiki content language
  20690. !! options
  20691. language=nl title=[[MediaWiki:Common.css]]
  20692. !! wikitext
  20693. {{#formatdate:2009-03-24|dmy}}
  20694. !! html
  20695. <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
  20696. </p>
  20697. !! end
  20698. #
  20699. #
  20700. #
  20701. #
  20702. # Edit comments
  20703. #
  20704. !! test
  20705. Edit comment with link
  20706. !! options
  20707. comment
  20708. !! wikitext
  20709. I like the [[Main Page]] a lot
  20710. !! html/php
  20711. I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
  20712. !!end
  20713. !! test
  20714. Edit comment with link and link text
  20715. !! options
  20716. comment
  20717. !! wikitext
  20718. I like the [[Main Page|best pages]] a lot
  20719. !! html/php
  20720. I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
  20721. !!end
  20722. !! test
  20723. Edit comment with link and link text with suffix
  20724. !! options
  20725. comment
  20726. !! wikitext
  20727. I like the [[Main Page|best page]]s a lot
  20728. !! html/php
  20729. I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
  20730. !!end
  20731. !! test
  20732. Edit comment with section link (non-local, eg in history list)
  20733. !! options
  20734. comment title=[[Main Page]]
  20735. !! wikitext
  20736. /* External links */ removed bogus entries
  20737. !! html/php
  20738. <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
  20739. !!end
  20740. !! test
  20741. Edit comment with section link and text before it (non-local, eg in history list)
  20742. !! options
  20743. comment title=[[Main Page]]
  20744. !! wikitext
  20745. pre-comment text /* External links */ removed bogus entries
  20746. !! html/php
  20747. pre-comment text <a href="/wiki/Main_Page#External_links" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
  20748. !!end
  20749. !! test
  20750. Edit comment with section link (local, eg in diff view)
  20751. !! options
  20752. comment local title=[[Main Page]]
  20753. !! wikitext
  20754. /* External links */ removed bogus entries
  20755. !! html/php
  20756. <a href="#External_links">→</a>‎<span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
  20757. !!end
  20758. !! test
  20759. Edit comment with subpage link (T16080)
  20760. !! options
  20761. comment
  20762. subpage
  20763. title=[[Subpage test]]
  20764. !! wikitext
  20765. Poked at a [[/subpage]] here...
  20766. !! html/php
  20767. Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
  20768. !!end
  20769. !! test
  20770. Edit comment with subpage link and link text (T16080)
  20771. !! options
  20772. comment
  20773. subpage
  20774. title=[[Subpage test]]
  20775. !! wikitext
  20776. Poked at a [[/subpage|neat little page]] here...
  20777. !! html/php
  20778. Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
  20779. !!end
  20780. !! test
  20781. Edit comment with bogus subpage link in non-subpage NS (T16080)
  20782. !! options
  20783. comment
  20784. title=[[Subpage test]]
  20785. !! wikitext
  20786. Poked at a [[/subpage]] here...
  20787. !! html/php
  20788. Poked at a <a href="/index.php?title=/subpage&amp;action=edit&amp;redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
  20789. !!end
  20790. !! test
  20791. Edit comment with bare anchor link (local, as on diff)
  20792. !! options
  20793. comment
  20794. local
  20795. title=[[Main Page]]
  20796. !! wikitext
  20797. [[#section]]
  20798. !! html/php
  20799. <a href="#section">#section</a>
  20800. !! end
  20801. !! test
  20802. Edit comment with bare anchor link (non-local, as on history)
  20803. !! options
  20804. comment
  20805. title=[[Main Page]]
  20806. !! wikitext
  20807. [[#section]]
  20808. !! html/php
  20809. <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
  20810. !! end
  20811. !! test
  20812. Anchor starting with underscore
  20813. !! options
  20814. title=[[Foo]]
  20815. !! wikitext
  20816. [[#_ref|One]]
  20817. !! html/php
  20818. <p><a href="#_ref">One</a>
  20819. </p>
  20820. !! html/parsoid
  20821. <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
  20822. !! end
  20823. !! test
  20824. Id starting with underscore
  20825. !! wikitext
  20826. <div id="_ref"></div>
  20827. !! html/*
  20828. <div id="_ref"></div>
  20829. !! end
  20830. !! test
  20831. Edit comment with link with more than one pipe (T99346)
  20832. !! options
  20833. comment
  20834. !! wikitext
  20835. [[Main Page|Many|pipes]]
  20836. !! html/php
  20837. <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
  20838. !! end
  20839. !! test
  20840. Complex edit comment with link with more than one pipe (T99346)
  20841. !! options
  20842. comment
  20843. !! wikitext
  20844. Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
  20845. !! html/php
  20846. Created page with &quot;&lt;noinclude&gt;<a href="/index.php?title=Category:Requests_for_permissions/Bot&amp;action=edit&amp;redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a>&lt;/noinclude&gt; === <a href="/index.php?title=User:MineoBot&amp;action=edit&amp;redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo...&quot;
  20847. !! end
  20848. !! test
  20849. Space normalisation on autocomment (T24784)
  20850. !! options
  20851. comment
  20852. title=[[Main Page]]
  20853. !! wikitext
  20854. /* __hello__world__ */
  20855. !! html/php
  20856. <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a>‎<span dir="auto"><span class="autocomment">__hello__world__</span></span>
  20857. !! end
  20858. !! test
  20859. percent-encoding and + signs in comments (T28410)
  20860. !! options
  20861. comment
  20862. !! wikitext
  20863. [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
  20864. !! html/php
  20865. <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&amp;action=edit&amp;redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
  20866. !! end
  20867. # Parsoid doesn't support this yet: see T75581
  20868. # but it *should* omit the 'src' attribute if the image is bad.
  20869. # PHP side of tests was disabled in
  20870. # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
  20871. # because of issues in the PHP parserTests infrastructure
  20872. # (but the output below is indeed what the PHP side emits)
  20873. !! test
  20874. Bad images - basic functionality
  20875. !! wikitext
  20876. [[File:Bad.jpg]]
  20877. !! html/php+disabled
  20878. !! html/parsoid
  20879. <p><span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span></p>
  20880. !! end
  20881. !! test
  20882. Bad images - T18039: text after bad image disappears
  20883. !! wikitext
  20884. Foo bar
  20885. [[File:Bad.jpg]]
  20886. Bar foo
  20887. !! html/php+disabled
  20888. <p>Foo bar
  20889. </p><p>Bar foo
  20890. </p>
  20891. !! html/parsoid
  20892. <p>Foo bar
  20893. <span class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"bad-image","message":"This image is blacklisted in this context."}]}'><a href="./File:Bad.jpg"><img resource="./File:Bad.jpg" height="220" width="220"/></a></span>
  20894. Bar foo</p>
  20895. !! end
  20896. !! test
  20897. Verify that displaytitle works (T24501) no displaytitle
  20898. !! options
  20899. showtitle
  20900. !! config
  20901. wgAllowDisplayTitle=true
  20902. wgRestrictDisplayTitle=false
  20903. !! wikitext
  20904. this is not the the title
  20905. !! html/php
  20906. Parser test
  20907. <p>this is not the the title
  20908. </p>
  20909. !! end
  20910. !! test
  20911. Verify that displaytitle works (T24501) RestrictDisplayTitle=false
  20912. !! options
  20913. showtitle
  20914. title=[[Screen]]
  20915. !! config
  20916. wgAllowDisplayTitle=true
  20917. wgRestrictDisplayTitle=false
  20918. !! wikitext
  20919. this is not the the title
  20920. {{DISPLAYTITLE:whatever}}
  20921. !! html/php
  20922. whatever
  20923. <p>this is not the the title
  20924. </p>
  20925. !! end
  20926. !! test
  20927. Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
  20928. !! options
  20929. showtitle
  20930. title=[[Screen]]
  20931. !! config
  20932. wgAllowDisplayTitle=true
  20933. wgRestrictDisplayTitle=true
  20934. !! wikitext
  20935. this is not the the title
  20936. {{DISPLAYTITLE:whatever}}
  20937. !! html/php
  20938. Screen
  20939. <p>this is not the the title
  20940. </p>
  20941. !! end
  20942. !! test
  20943. Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
  20944. !! options
  20945. showtitle
  20946. title=[[Screen]]
  20947. !! config
  20948. wgAllowDisplayTitle=true
  20949. wgRestrictDisplayTitle=true
  20950. !! wikitext
  20951. this is not the the title
  20952. {{DISPLAYTITLE:screen}}
  20953. !! html/php
  20954. screen
  20955. <p>this is not the the title
  20956. </p>
  20957. !! end
  20958. !! test
  20959. Verify that displaytitle works (T24501) AllowDisplayTitle=false
  20960. !! options
  20961. showtitle
  20962. title=[[Screen]]
  20963. !! config
  20964. wgAllowDisplayTitle=false
  20965. !! wikitext
  20966. this is not the the title
  20967. {{DISPLAYTITLE:screen}}
  20968. !! html/php
  20969. Screen
  20970. <p>this is not the the title
  20971. <a href="/index.php?title=Template:DISPLAYTITLE:screen&amp;action=edit&amp;redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
  20972. </p>
  20973. !! end
  20974. !! test
  20975. Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
  20976. !! options
  20977. showtitle
  20978. title=[[Screen]]
  20979. !! config
  20980. wgAllowDisplayTitle=false
  20981. !! wikitext
  20982. this is not the the title
  20983. !! html/php
  20984. Screen
  20985. <p>this is not the the title
  20986. </p>
  20987. !! end
  20988. !! test
  20989. Verify that displaytitle handles inline CSS styles (T28547) - rejected value
  20990. !! options
  20991. showtitle
  20992. title=[[Screen]]
  20993. !! config
  20994. wgAllowDisplayTitle=true
  20995. wgRestrictDisplayTitle=true
  20996. !! wikitext
  20997. this is not the the title
  20998. {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
  20999. !! html/php
  21000. <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
  21001. <p>this is not the the title
  21002. </p>
  21003. !! end
  21004. !! test
  21005. Verify that displaytitle handles inline CSS styles (T28547) - accepted value
  21006. !! options
  21007. showtitle
  21008. title=[[Screen]]
  21009. !! config
  21010. wgAllowDisplayTitle=true
  21011. wgRestrictDisplayTitle=true
  21012. !! wikitext
  21013. this is not the the title
  21014. {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
  21015. !! html/php
  21016. <span style="color: red;">s</span>creen
  21017. <p>this is not the the title
  21018. </p>
  21019. !! end
  21020. !! test
  21021. Page status indicators: Empty name is invalid
  21022. !! options
  21023. showindicators
  21024. !! wikitext
  21025. <indicator name=" "></indicator>
  21026. <indicator></indicator>
  21027. !! html/php
  21028. <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
  21029. <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
  21030. </p>
  21031. !! end
  21032. !! test
  21033. Page status indicators: Weird syntaxes that are okay
  21034. !! options
  21035. showindicators
  21036. !! wikitext
  21037. <indicator name="empty" />
  21038. <indicator name="name"></indicator>
  21039. !! html/php
  21040. empty=
  21041. name=
  21042. <p><br />
  21043. </p>
  21044. !! end
  21045. !! test
  21046. Page status indicators: Torture test
  21047. !! options
  21048. showindicators
  21049. !! wikitext
  21050. <indicator name="01">hello world</indicator>
  21051. <indicator name="02">[[Main Page]]</indicator>
  21052. <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
  21053. <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
  21054. <indicator name="05">*foo
  21055. *bar</indicator>
  21056. <indicator name="06"><nowiki>foo</nowiki></indicator>
  21057. <indicator name="07"> Preformatted</indicator>
  21058. <indicator name="08"><div>Broken tag</indicator>
  21059. <indicator name="09">{| class=wikitable
  21060. |cell
  21061. |}</indicator>
  21062. <indicator name="10">Two
  21063. paragraphs</indicator>
  21064. !! html/php
  21065. 01=hello world
  21066. 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
  21067. 03=<img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" />
  21068. 04=<a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/thumb/3/3a/Foobar.jpg/25px-Foobar.jpg" width="25" height="3" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/38px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/50px-Foobar.jpg 2x" /></a>
  21069. 05=<ul><li>foo</li>
  21070. <li>bar</li></ul>
  21071. 06=foo
  21072. 07=<pre>Preformatted
  21073. </pre>
  21074. 08=<div>Broken tag</div>
  21075. 09=<table class="wikitable">
  21076. <tr>
  21077. <td>cell
  21078. </td></tr></table>
  21079. 10=<p>Two
  21080. </p><p>paragraphs
  21081. </p>
  21082. <p><br />
  21083. </p><p><br />
  21084. </p><p><br />
  21085. </p><p><br />
  21086. </p><p><br />
  21087. </p>
  21088. !! end
  21089. !! test
  21090. preload: check <noinclude> and <includeonly>
  21091. !! options
  21092. preload
  21093. !! wikitext
  21094. Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
  21095. !! html/php
  21096. Hello kind world.
  21097. !! end
  21098. !! test
  21099. preload: check <onlyinclude>
  21100. !! options
  21101. preload
  21102. !! wikitext
  21103. Goodbye <onlyinclude>Hello world</onlyinclude>
  21104. !! html/php
  21105. Hello world
  21106. !! end
  21107. !! test
  21108. preload: can pass tags through if we want to
  21109. !! options
  21110. preload
  21111. !! wikitext
  21112. <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
  21113. !! html/php
  21114. <includeonly>Hello world</includeonly>
  21115. !! end
  21116. !! test
  21117. preload: check that it doesn't try to do tricks
  21118. !! options
  21119. preload
  21120. !! wikitext
  21121. * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
  21122. !! html/php
  21123. * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
  21124. !! end
  21125. !! test
  21126. Play a bit with r67090 and T5158
  21127. !! wikitext
  21128. <div style="width:50% !important">&nbsp;</div>
  21129. <div style="width:50%&nbsp;!important">&nbsp;</div>
  21130. <div style="width:50%&#160;!important">&nbsp;</div>
  21131. <div style="border : solid;">&nbsp;</div>
  21132. !! html/php
  21133. <div style="width:50% !important">&#160;</div>
  21134. <div style="width:50% !important">&#160;</div>
  21135. <div style="width:50% !important">&#160;</div>
  21136. <div style="border&#160;: solid;">&#160;</div>
  21137. !! html/parsoid
  21138. <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
  21139. <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
  21140. <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&amp;#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
  21141. <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
  21142. !! end
  21143. !! test
  21144. HTML5 data attributes
  21145. !! wikitext
  21146. <span data-foo="bar">Baz</span>
  21147. <p data-abc-def_hij="">Quuz</p>
  21148. !! html/php
  21149. <p><span data-foo="bar">Baz</span>
  21150. </p>
  21151. <p data-abc-def_hij="">Quuz</p>
  21152. !! html/parsoid
  21153. <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
  21154. <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
  21155. !! end
  21156. !! test
  21157. Strip reserved data attributes
  21158. !! wikitext
  21159. <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
  21160. !! html/php
  21161. <div data-ok="fred">d</div>
  21162. !! html/parsoid
  21163. <div data-x-data-mw="foo" data-x-data-parsoid="bar" data-x-data-mw-someext="baz" data-ok="fred" data-parsoid='{"stx":"html","a":{"data-ooui":null,"data-bad:ns":null},"sa":{"data-ooui":"xyzzy","data-bad:ns":"ns"}}'>d</div>
  21164. !! end
  21165. !! test
  21166. percent-encoding and + signs in internal links (T28410)
  21167. !! wikitext
  21168. [[User:+%]] [[Page+title%]]
  21169. [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
  21170. [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
  21171. [[%33%45]] [[%33%45+]]
  21172. !! html/php
  21173. <p><a href="/index.php?title=User:%2B%25&amp;action=edit&amp;redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&amp;action=edit&amp;redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
  21174. <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&amp;action=edit&amp;redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&amp;action=edit&amp;redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
  21175. <a href="/index.php?title=%25&amp;action=edit&amp;redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&amp;action=edit&amp;redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&amp;wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
  21176. <a href="/index.php?title=3E&amp;action=edit&amp;redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&amp;action=edit&amp;redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
  21177. </p>
  21178. !! html/parsoid
  21179. <p><a rel="mw:WikiLink" href="./User:+%25" title="User:+%" data-parsoid='{"stx":"simple","a":{"href":"./User:+%25"},"sa":{"href":"User:+%"}}'>User:+%</a> <a rel="mw:WikiLink" href="./Page+title%25" title="Page+title%" data-parsoid='{"stx":"simple","a":{"href":"./Page+title%25"},"sa":{"href":"Page+title%"}}'>Page+title%</a>
  21180. <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%+</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"piped","a":{"href":"./%25+"},"sa":{"href":"%+"}}'>%20</a> <a rel="mw:WikiLink" href="./%25+" title="%+" data-parsoid='{"stx":"simple","a":{"href":"./%25+"},"sa":{"href":"%+ "}}'>%+ </a> <a rel="mw:WikiLink" href="./%25+r" title="%+r" data-parsoid='{"stx":"simple","a":{"href":"./%25+r"},"sa":{"href":"%+r"}}'>%+r</a>
  21181. <a rel="mw:WikiLink" href="./%25" title="%" data-parsoid='{"stx":"simple","a":{"href":"./%25"},"sa":{"href":"%"}}'>%</a> <a rel="mw:WikiLink" href="./+" title="+" data-parsoid='{"stx":"simple","a":{"href":"./+"},"sa":{"href":"+"}}'>+</a> <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"bogus","ak":"foo"},{"ck":"caption","ak":"[[bar]]"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid=&#39;{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}&#39;>bar&lt;/a>"}'><a href="./File:%25+abc9" data-parsoid='{"a":{"href":"./File:%25+abc9"},"sa":{}}'><img resource="./File:%25+abc9" src="./Special:FilePath/%25+abc9" height="220" width="220" data-parsoid='{"a":{"resource":"./File:%25+abc9","height":"220","width":"220"},"sa":{"resource":"File:%+abc%39"}}'/></a></figure-inline>
  21182. <a rel="mw:WikiLink" href="./3E" title="3E" data-parsoid='{"stx":"simple","a":{"href":"./3E"},"sa":{"href":"%33%45"}}'>3E</a> <a rel="mw:WikiLink" href="./3E+" title="3E+" data-parsoid='{"stx":"simple","a":{"href":"./3E+"},"sa":{"href":"%33%45+"}}'>3E+</a></p>
  21183. !! end
  21184. !! test
  21185. Special characters in embedded file links (T29679)
  21186. !! wikitext
  21187. [[File:Contains & ampersand.jpg]]
  21188. [[File:Does not exist.jpg|Title with & ampersand]]
  21189. !! html/php
  21190. <p><a href="/index.php?title=Special:Upload&amp;wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains &amp; ampersand.jpg">File:Contains &amp; ampersand.jpg</a>
  21191. <a href="/index.php?title=Special:Upload&amp;wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with &amp; ampersand</a>
  21192. </p>
  21193. !! html/parsoid
  21194. <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}]}'><a href="./File:Contains_&amp;_ampersand.jpg"><img resource="./File:Contains_&amp;_ampersand.jpg" src="./Special:FilePath/Contains_&amp;_ampersand.jpg" height="220" width="220"/></a></figure-inline>
  21195. <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"Title with &amp;amp; ampersand"}'><a href="./File:Does_not_exist.jpg"><img resource="./File:Does_not_exist.jpg" src="./Special:FilePath/Does_not_exist.jpg" height="220" width="220"/></a></figure-inline></p>
  21196. !! end
  21197. !! test
  21198. Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
  21199. !! wikitext
  21200. Text&apos;s been normalized?
  21201. !! html
  21202. <p>Text&#39;s been normalized?
  21203. </p>
  21204. !! end
  21205. !! test
  21206. T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
  21207. !! wikitext
  21208. http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
  21209. !! html
  21210. <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> &lt;-- U+3000 (vim: ^Vu3000)
  21211. </p>
  21212. !! end
  21213. !! test
  21214. T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
  21215. !! wikitext
  21216. [http://www.example.org/ ideograms]
  21217. !! html
  21218. <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
  21219. </p>
  21220. !! end
  21221. !! test
  21222. T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
  21223. !! wikitext
  21224. http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
  21225. !! html
  21226. <p><img src="http://www.example.org/pic.png" alt="pic.png"/> &lt;-- U+3000 (vim: ^Vu3000)
  21227. </p>
  21228. !! end
  21229. !! article
  21230. Mediawiki:loop1
  21231. !! text
  21232. {{Identical|A}}
  21233. !! endarticle
  21234. !! article
  21235. Mediawiki:loop2
  21236. !! text
  21237. {{Identical|B}}
  21238. !! endarticle
  21239. !! article
  21240. Template:Identical
  21241. !! text
  21242. {{int:loop1}}
  21243. {{int:loop2}}
  21244. !! endarticle
  21245. !! test
  21246. T33098 Template which includes system messages which includes the template
  21247. !! wikitext
  21248. {{Identical}}
  21249. !! html
  21250. <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
  21251. <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
  21252. </p>
  21253. !! end
  21254. !! test
  21255. T33490 Turkish: ucfirst 'blah'
  21256. !! options
  21257. language=tr
  21258. !! wikitext
  21259. {{ucfirst:blah}}
  21260. !! html
  21261. <p>Blah
  21262. </p>
  21263. !! end
  21264. !! test
  21265. T33490 Turkish: ucfirst 'ix'
  21266. !! options
  21267. language=tr
  21268. !! wikitext
  21269. {{ucfirst:ix}}
  21270. !! html
  21271. <p>İx
  21272. </p>
  21273. !! end
  21274. !! test
  21275. T33490 Turkish: lcfirst 'BLAH'
  21276. !! options
  21277. language=tr
  21278. !! wikitext
  21279. {{lcfirst:BLAH}}
  21280. !! html
  21281. <p>bLAH
  21282. </p>
  21283. !! end
  21284. !! test
  21285. T33490 Turkish: ucfırst (with a dotless i)
  21286. !! options
  21287. language=tr
  21288. !! wikitext
  21289. {{ucfırst:blah}}
  21290. !! html
  21291. <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
  21292. </p>
  21293. !! end
  21294. !! test
  21295. T33490 ucfırst (with a dotless i) with English language
  21296. !! options
  21297. language=en
  21298. !! wikitext
  21299. {{ucfırst:blah}}
  21300. !! html
  21301. <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&amp;action=edit&amp;redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
  21302. </p>
  21303. !! end
  21304. # Note that Parsoid doesn't emit an explicit TOC.
  21305. # Note also that the html2wt direction tends to emit an extra newline
  21306. # between the __TOC__ magicword and the first heading unless *both*
  21307. # the <meta> and the <h2> have a data-parsoid attribute set (even if
  21308. # it's "{}").
  21309. !! test
  21310. T28375: TOC with italics
  21311. !! options
  21312. title=[[Main Page]]
  21313. !! wikitext
  21314. __TOC__
  21315. ==''Lost'' episodes==
  21316. !! html/php
  21317. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21318. <ul>
  21319. <li class="toclevel-1 tocsection-1"><a href="#Lost_episodes"><span class="tocnumber">1</span> <span class="toctext"><i>Lost</i> episodes</span></a></li>
  21320. </ul>
  21321. </div>
  21322. <h2><span class="mw-headline" id="Lost_episodes"><i>Lost</i> episodes</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21323. !! html/parsoid
  21324. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21325. <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
  21326. !! end
  21327. !! test
  21328. T28375: TOC with bold
  21329. !! options
  21330. title=[[Main Page]]
  21331. !! wikitext
  21332. __TOC__
  21333. =='''should be bold''' then normal text==
  21334. !! html/php
  21335. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21336. <ul>
  21337. <li class="toclevel-1 tocsection-1"><a href="#should_be_bold_then_normal_text"><span class="tocnumber">1</span> <span class="toctext"><b>should be bold</b> then normal text</span></a></li>
  21338. </ul>
  21339. </div>
  21340. <h2><span class="mw-headline" id="should_be_bold_then_normal_text"><b>should be bold</b> then normal text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21341. !! html/parsoid
  21342. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21343. <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
  21344. !! end
  21345. !! test
  21346. T35845: Headings become cursive in TOC when they contain an image
  21347. !! options
  21348. title=[[Main Page]]
  21349. !! wikitext
  21350. __TOC__
  21351. ==Image [[Image:foobar.jpg]]==
  21352. !! html/php
  21353. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21354. <ul>
  21355. <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
  21356. </ul>
  21357. </div>
  21358. <h2><span class="mw-headline" id="Image">Image <a href="/wiki/File:Foobar.jpg" class="image"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21359. !! html/parsoid
  21360. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21361. <h2 id="Image" data-parsoid='{}'>Image <figure-inline class="mw-default-size" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"Image:foobar.jpg"}}'/></a></figure-inline></h2>
  21362. !! end
  21363. !! test
  21364. T35845 (2): Headings become bold in TOC when they contain a blockquote
  21365. !! options
  21366. title=[[Main Page]]
  21367. !! wikitext
  21368. __TOC__
  21369. ==<blockquote>Quote</blockquote>==
  21370. !! html/php
  21371. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21372. <ul>
  21373. <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
  21374. </ul>
  21375. </div>
  21376. <h2><span class="mw-headline" id="Quote"><blockquote>Quote</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21377. !! html/php+tidy
  21378. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21379. <ul>
  21380. <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
  21381. </ul>
  21382. </div>
  21383. <h2><span class="mw-headline" id="Quote"><blockquote><p>Quote</p></blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21384. !! html/parsoid
  21385. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21386. <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
  21387. !! end
  21388. !! test
  21389. Unclosed tags in TOC
  21390. !! config
  21391. wgFragmentMode=[ 'html5', 'legacy' ]
  21392. !! options
  21393. title=[[Main Page]]
  21394. !! wikitext
  21395. __TOC__
  21396. ==Proof: 2 < 3==
  21397. <small>Hanc marginis exiguitas non caperet.</small>
  21398. QED
  21399. !! html/php
  21400. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21401. <ul>
  21402. <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_&lt;_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 &lt; 3</span></a></li>
  21403. </ul>
  21404. </div>
  21405. <h2><span id="Proof:_2_.3C_3"></span><span class="mw-headline" id="Proof:_2_&lt;_3">Proof: 2 &lt; 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Proof: 2 &lt; 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21406. <p><small>Hanc marginis exiguitas non caperet.</small>
  21407. QED
  21408. </p>
  21409. !! html/parsoid
  21410. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21411. <h2 id="Proof:_2_&lt;_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 &lt; 3</h2>
  21412. <p><small>Hanc marginis exiguitas non caperet.</small>
  21413. QED</p>
  21414. !! end
  21415. !! test
  21416. Multiple tags in TOC
  21417. !! wikitext
  21418. __TOC__
  21419. ==<i>Foo</i> <b>Bar</b>==
  21420. ==<i>Foo</i> <blockquote>Bar</blockquote>==
  21421. !! html/php
  21422. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21423. <ul>
  21424. <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
  21425. <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
  21426. </ul>
  21427. </div>
  21428. <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21429. <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote>Bar</blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21430. !! html/php+tidy
  21431. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21432. <ul>
  21433. <li class="toclevel-1 tocsection-1"><a href="#Foo_Bar"><span class="tocnumber">1</span> <span class="toctext"><i>Foo</i> <b>Bar</b></span></a></li>
  21434. <li class="toclevel-1 tocsection-2"><a href="#Foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext"><i>Foo</i> Bar</span></a></li>
  21435. </ul>
  21436. </div>
  21437. <h2><span class="mw-headline" id="Foo_Bar"><i>Foo</i> <b>Bar</b></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21438. <h2><span class="mw-headline" id="Foo_Bar_2"><i>Foo</i> <blockquote><p>Bar</p></blockquote></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21439. !! html/parsoid
  21440. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21441. <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
  21442. <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
  21443. !! end
  21444. # Don't expect Parsoid to roundtrip this until the php parser comes closer to
  21445. # html5 tag parsing.
  21446. !! test
  21447. Tags with parameters in TOC
  21448. !! options
  21449. parsoid=wt2html
  21450. !! wikitext
  21451. __TOC__
  21452. ==<sup class="in-h2">Hello</sup>==
  21453. ==<sup class="a > b">Evilbye</sup>==
  21454. !! html/php
  21455. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21456. <ul>
  21457. <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
  21458. <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b"&gt;Evilbye</sup></span></a></li>
  21459. </ul>
  21460. </div>
  21461. <h2><span class="mw-headline" id="Hello"><sup class="in-h2">Hello</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21462. <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b"&gt;Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: b&quot;&gt;Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21463. !! html/parsoid
  21464. <meta property="mw:PageProp/toc" />
  21465. <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
  21466. <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
  21467. !! end
  21468. !! test
  21469. span tags with directionality in TOC
  21470. !! wikitext
  21471. __TOC__
  21472. ==<span dir="ltr">C++</span>==
  21473. ==<span dir="rtl">זבנג!</span>==
  21474. ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
  21475. ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
  21476. ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
  21477. !! html/php
  21478. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21479. <ul>
  21480. <li class="toclevel-1 tocsection-1"><a href="#C.2B.2B"><span class="tocnumber">1</span> <span class="toctext"><span dir="ltr">C++</span></span></a></li>
  21481. <li class="toclevel-1 tocsection-2"><a href="#.D7.96.D7.91.D7.A0.D7.92.21"><span class="tocnumber">2</span> <span class="toctext"><span dir="rtl">זבנג!</span></span></a></li>
  21482. <li class="toclevel-1 tocsection-3"><a href="#The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">3</span> <span class="toctext"><span>The attributes on these span tags must be deleted from the TOC</span></span></a></li>
  21483. <li class="toclevel-1 tocsection-4"><a href="#All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">4</span> <span class="toctext"><span>All attributes on these span tags must be deleted from the TOC</span></span></a></li>
  21484. <li class="toclevel-1 tocsection-5"><a href="#Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span class="tocnumber">5</span> <span class="toctext"><span dir="ltr">Attributes after dir on these span tags must be deleted from the TOC</span></span></a></li>
  21485. </ul>
  21486. </div>
  21487. <h2><span class="mw-headline" id="C.2B.2B"><span dir="ltr">C++</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21488. <h2><span class="mw-headline" id=".D7.96.D7.91.D7.A0.D7.92.21"><span dir="rtl">זבנג!</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21489. <h2><span class="mw-headline" id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: The attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21490. <h2><span class="mw-headline" id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: All attributes on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21491. <h2><span class="mw-headline" id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Attributes after dir on these span tags must be deleted from the TOC">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21492. !! html/parsoid
  21493. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21494. <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
  21495. <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
  21496. <h2 id="The_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span></h2>
  21497. <h2 id="All_attributes_on_these_span_tags_must_be_deleted_from_the_TOC"><span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span></h2>
  21498. <h2 id="Attributes_after_dir_on_these_span_tags_must_be_deleted_from_the_TOC"><span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span></h2>
  21499. !! end
  21500. !! test
  21501. T74884: bdi element in ToC
  21502. !! wikitext
  21503. __TOC__
  21504. ==<bdi>test</bdi>==
  21505. !! html/php
  21506. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21507. <ul>
  21508. <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
  21509. </ul>
  21510. </div>
  21511. <h2><span class="mw-headline" id="test"><bdi>test</bdi></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21512. !! html/parsoid
  21513. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21514. <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
  21515. !! end
  21516. !! test
  21517. T35715: s/strike element in ToC
  21518. !! wikitext
  21519. __TOC__
  21520. ==<s>test</s> test <strike>test</strike>==
  21521. !! html/php
  21522. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21523. <ul>
  21524. <li class="toclevel-1 tocsection-1"><a href="#test_test_test"><span class="tocnumber">1</span> <span class="toctext"><s>test</s> test <strike>test</strike></span></a></li>
  21525. </ul>
  21526. </div>
  21527. <h2><span class="mw-headline" id="test_test_test"><s>test</s> test <strike>test</strike></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: test test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21528. !! html/parsoid
  21529. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21530. <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
  21531. !! end
  21532. !! test
  21533. Empty <p> tag in TOC, removed by Sanitizer (T92892)
  21534. !! wikitext
  21535. __TOC__
  21536. ==x==
  21537. !! html/php
  21538. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  21539. <ul>
  21540. <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
  21541. </ul>
  21542. </div>
  21543. <h2><span class="mw-headline" id="x">x</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21544. !! html/parsoid
  21545. <meta property="mw:PageProp/toc" data-parsoid='{}'/>
  21546. <h2 id="x" data-parsoid='{}'>x</h2>
  21547. !! end
  21548. !! article
  21549. MediaWiki:T34057
  21550. !! text
  21551. == {{int:headline_sample}} ==
  21552. !! endarticle
  21553. !! test
  21554. T34057: Title needed when expanding <h> nodes.
  21555. !! options
  21556. title=[[Main Page]]
  21557. !! wikitext
  21558. {{int:T34057}}
  21559. !! html
  21560. <h2><span class="mw-headline" id="Headline_text">Headline text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&amp;action=edit&amp;section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21561. !! end
  21562. !! test
  21563. Strip marker in urlencode
  21564. !! wikitext
  21565. {{urlencode:x<nowiki/>y}}
  21566. {{urlencode:x<nowiki/>y|wiki}}
  21567. {{urlencode:x<nowiki/>y|path}}
  21568. {{urlencode:x<pre id="one">two</pre>y}}
  21569. !! html/php
  21570. <p>xy
  21571. xy
  21572. xy
  21573. xy
  21574. </p>
  21575. !! end
  21576. !! test
  21577. Strip marker in lc
  21578. !! wikitext
  21579. {{lc:x<nowiki/>y}}
  21580. !! html
  21581. <p>xy
  21582. </p>
  21583. !! end
  21584. !! test
  21585. Strip marker in uc
  21586. !! wikitext
  21587. {{uc:x<nowiki/>y}}
  21588. !! html
  21589. <p>XY
  21590. </p>
  21591. !! end
  21592. !! test
  21593. Strip marker in formatNum
  21594. !! wikitext
  21595. {{formatnum:1<nowiki/>2}}
  21596. {{formatnum:1<nowiki/>2|R}}
  21597. !! html
  21598. <p>12
  21599. 12
  21600. </p>
  21601. !! end
  21602. !! test
  21603. Check noCommafy in formatNum
  21604. !! options
  21605. language=be-tarask
  21606. !! wikitext
  21607. {{formatnum:123456.78}}
  21608. {{formatnum:123456.78|NOSEP}}
  21609. !! html
  21610. <p>123 456,78
  21611. 123456.78
  21612. </p>
  21613. !! end
  21614. !! test
  21615. Wrong option for formatNum (T58199)
  21616. !! wikitext
  21617. {{formatnum:1,234.56|Random}}
  21618. {{formatnum:1,234.56|EVERYTHING}}
  21619. {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
  21620. !! html
  21621. <p>1,234.56
  21622. 1,234.56
  21623. 1,234.56
  21624. </p>
  21625. !! end
  21626. !! test
  21627. Strip marker in grammar
  21628. !! options
  21629. language=fi
  21630. !! wikitext
  21631. {{grammar:elative|foo<nowiki/>bar}}
  21632. !! html
  21633. <p>foobarista
  21634. </p>
  21635. !! end
  21636. !! test
  21637. Strip marker in padleft
  21638. !! wikitext
  21639. {{padleft:|2|x<nowiki/>y}}
  21640. !! html
  21641. <p>xy
  21642. </p>
  21643. !! end
  21644. !! test
  21645. Strip marker in padright
  21646. !! wikitext
  21647. {{padright:|2|x<nowiki/>y}}
  21648. !! html
  21649. <p>xy
  21650. </p>
  21651. !! end
  21652. !! test
  21653. Strip marker in anchorencode
  21654. !! wikitext
  21655. {{anchorencode:x<nowiki/>y}}
  21656. !! html/php
  21657. <p>xy
  21658. </p>
  21659. !! html/parsoid
  21660. <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:x&lt;nowiki/>y","function":"anchorencode"},"params":{},"i":0}}]}'>xy</p>
  21661. !! end
  21662. !! test
  21663. nowiki inside link inside heading (T20295)
  21664. !! wikitext
  21665. ==[[foo|x<nowiki>y</nowiki>z]]==
  21666. !! html
  21667. <h2><span class="mw-headline" id="xyz"><a href="/wiki/Foo" title="Foo">xyz</a></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21668. !! end
  21669. !! test
  21670. new support for bdi element (T33817)
  21671. !! wikitext
  21672. <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
  21673. !! html
  21674. <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
  21675. !!end
  21676. !! test
  21677. Ignore pipe between table row attributes
  21678. !! wikitext
  21679. {|
  21680. |quux
  21681. |- id=foo | style='color: red'
  21682. |bar
  21683. |}
  21684. !! html
  21685. <table>
  21686. <tr>
  21687. <td>quux
  21688. </td></tr>
  21689. <tr id="foo" style="color: red">
  21690. <td>bar
  21691. </td></tr></table>
  21692. !! end
  21693. !!test
  21694. Language parser function
  21695. !! wikitext
  21696. {{#language:ar}}
  21697. !! html
  21698. <p>العربية
  21699. </p>
  21700. !! end
  21701. !!test
  21702. Padleft and padright (default 0-padding)
  21703. !! wikitext
  21704. {{padleft:xyz|5}}
  21705. {{padright:xyz|5}}
  21706. !! html/php
  21707. <p>00xyz
  21708. xyz00
  21709. </p>
  21710. !! html/parsoid
  21711. <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
  21712. <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
  21713. !! end
  21714. !!test
  21715. Padleft and padright (partial fill)
  21716. !! wikitext
  21717. {{padleft:xyz|6|ab}}
  21718. {{padright:xyz|6|ab}}
  21719. !! html/php
  21720. <p>abaxyz
  21721. xyzaba
  21722. </p>
  21723. !! html/parsoid
  21724. <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>abaxyz</span>
  21725. <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"6"},"2":{"wt":"ab"}},"i":0}}]}'>xyzaba</span></p>
  21726. !! end
  21727. !!test
  21728. Padleft and padright as substr
  21729. !! wikitext
  21730. {{padleft:|3|abcde}}
  21731. {{padright:|3|abcde}}
  21732. !! html/php
  21733. <p>abc
  21734. abc
  21735. </p>
  21736. !! html/parsoid
  21737. <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:","function":"padleft"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span>
  21738. <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:","function":"padright"},"params":{"1":{"wt":"3"},"2":{"wt":"abcde"}},"i":0}}]}'>abc</span></p>
  21739. !! end
  21740. !! test
  21741. Padleft and padright with non-numerical length (T180403)
  21742. !! wikitext
  21743. {{padleft:abcdef|junk}}
  21744. {{padright:abcdef|junk}}
  21745. !! html/php
  21746. <p>abcdef
  21747. abcdef
  21748. </p>
  21749. !! end
  21750. !!test
  21751. Special parser function
  21752. !! wikitext
  21753. {{#special:RandomPage}}
  21754. {{#special:BaDtItLe}}
  21755. {{#special:Foobar}}
  21756. !! html
  21757. <p>Special:Random
  21758. Special:Badtitle
  21759. Special:Foobar
  21760. </p>
  21761. !! end
  21762. !!test
  21763. T36939 - Case insensitive link parsing ([HttP://])
  21764. !! wikitext
  21765. [HttP://MediaWiki.Org/]
  21766. !! html/php
  21767. <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
  21768. </p>
  21769. !! html/parsoid
  21770. <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
  21771. !! end
  21772. !!test
  21773. T36939 - Case insensitive link parsing ([HttP:// title])
  21774. !! wikitext
  21775. [HttP://MediaWiki.Org/ MediaWiki]
  21776. !! html
  21777. <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
  21778. </p>
  21779. !! end
  21780. !!test
  21781. T36939 - Case insensitive link parsing (HttP://)
  21782. !! wikitext
  21783. HttP://MediaWiki.Org/
  21784. !! html/php
  21785. <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
  21786. </p>
  21787. !! html/parsoid
  21788. <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
  21789. !! end
  21790. !!test
  21791. Disable TOC
  21792. !! options
  21793. notoc
  21794. !! wikitext
  21795. Lead
  21796. ==Section 1==
  21797. ==Section 2==
  21798. ==Section 3==
  21799. ==Section 4==
  21800. ==Section 5==
  21801. !! html
  21802. <p>Lead
  21803. </p>
  21804. <h2><span class="mw-headline" id="Section_1">Section 1</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21805. <h2><span class="mw-headline" id="Section_2">Section 2</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21806. <h2><span class="mw-headline" id="Section_3">Section 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21807. <h2><span class="mw-headline" id="Section_4">Section 4</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21808. <h2><span class="mw-headline" id="Section_5">Section 5</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  21809. !! end
  21810. ###
  21811. ### Parsoid-specific tests
  21812. ### Parsoid-PHP parser incompatibilities
  21813. ###
  21814. !!test
  21815. 1. SOL-sensitive wikitext tokens as template-args
  21816. !!options
  21817. parsoid=wt2html,wt2wt
  21818. !! wikitext
  21819. {{echo|*a}}
  21820. {{echo|#a}}
  21821. {{echo|:a}}
  21822. !! html
  21823. <span about="#mwt1" typeof="mw:Transclusion">
  21824. </span><ul about="#mwt1"><li>a</li>
  21825. </ul>
  21826. <span about="#mwt2" typeof="mw:Transclusion">
  21827. </span><ol about="#mwt2"><li>a</li>
  21828. </ol>
  21829. <span about="#mwt3" typeof="mw:Transclusion">
  21830. </span><dl about="#mwt3"><dd>a</dd>
  21831. </dl>
  21832. !!end
  21833. #### -----------------------------------------------------------------
  21834. #### Parsoid-specific functionality tests
  21835. #### -----------------------------------------------------------------
  21836. # T65642/T68749: Formatting elt fixup around images is cleaned up.
  21837. # We know wt2wt will fail, but we expect selser to pass.
  21838. # Due to the nature of our testing, wt2wt and selser tests will enter the
  21839. # blacklist and we'll catch selser regressions based on changes to the
  21840. # blacklist entries for selser tests.
  21841. !! test
  21842. 1. Bad treebuilder fixup of formatting elt is cleaned up
  21843. !! options
  21844. parsoid=wt2html,wt2wt
  21845. !! wikitext
  21846. {|
  21847. |
  21848. <small>
  21849. [[Image:Foobar.jpg|right|Test]]
  21850. </small>
  21851. |}
  21852. !! html/parsoid
  21853. <table>
  21854. <tbody><tr><td>
  21855. <small>
  21856. <figure class="mw-default-size mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></a><figcaption>Test</figcaption></figure>
  21857. </small>
  21858. </td></tr>
  21859. </tbody></table>
  21860. !! end
  21861. !! test
  21862. 2. Bad treebuilder fixup of formatting elt is cleaned up
  21863. !! options
  21864. parsoid=wt2html,wt2wt
  21865. !! wikitext
  21866. '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
  21867. <small>[[Image:Foobar.jpg|right|300px]]</small>
  21868. !! html/parsoid
  21869. <p><b>foo</b></p>
  21870. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><b>caption</b></figcaption></figure>
  21871. <p><b>bar</b></p>
  21872. <small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small>
  21873. !! end
  21874. !! test
  21875. 3. Bad treebuilder fixup of formatting elt is cleaned up
  21876. !! options
  21877. parsoid=wt2html,wt2wt
  21878. !! wikitext
  21879. <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
  21880. !! html/parsoid
  21881. <p><small><b>foo</b></small></p>
  21882. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><small><b>caption</b></small></figcaption></figure>
  21883. <p><small><b>bar</b></small></p>
  21884. !! end
  21885. !! test
  21886. 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
  21887. !! options
  21888. parsoid=wt2html,wt2wt
  21889. !! wikitext
  21890. '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
  21891. !! html/parsoid
  21892. <b><small><figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a></figure></small></b>
  21893. !! end
  21894. #### ----------------------------------------------------------------
  21895. #### Parsoid-only testing of Parsoid's impl of LST
  21896. #### Not implemented yet, see
  21897. #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
  21898. #### ----------------------------------------------------------------
  21899. ## We still need to support serializing the older format while content is stored.
  21900. !! test
  21901. LST Sections: Backwards compatibility
  21902. !! options
  21903. parsoid={
  21904. "suppressErrors": true,
  21905. "modes": ["html2wt"]
  21906. }
  21907. !! wikitext
  21908. <section begin="2011-05-16" />
  21909. <section end="2014-04-10 (MW 1.23wmf22)" />
  21910. !! html/parsoid
  21911. <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
  21912. <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
  21913. !! end
  21914. !! test
  21915. LST Sections: Newfangled approach
  21916. !! wikitext
  21917. <section begin="2011-05-16" />
  21918. <section end="2014-04-10 (MW 1.23wmf22)" />
  21919. !! html/parsoid
  21920. <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
  21921. </span>
  21922. <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
  21923. </span></p>
  21924. !! end
  21925. #--------- Test stripping of empty nodes in template content ----------
  21926. !! test
  21927. Empty LI and TR nodes should be stripped from template content
  21928. !! wikitext
  21929. {{EmptyLITest}}
  21930. {{EmptyTRTest}}
  21931. !! html/parsoid
  21932. <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
  21933. <li>a</li>
  21934. <li>b</li>
  21935. </ul>
  21936. <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
  21937. <tbody>
  21938. <tr>
  21939. <td>foo</td>
  21940. </tr>
  21941. <tr>
  21942. <td>bar</td>
  21943. </tr>
  21944. </tbody>
  21945. </table>
  21946. !! end
  21947. !! test
  21948. Empty LI and TR nodes should not be stripped from top-level content
  21949. !! wikitext
  21950. * a
  21951. *
  21952. * b
  21953. {|
  21954. |-
  21955. |-
  21956. |foo
  21957. |}
  21958. !! html/parsoid
  21959. <ul>
  21960. <li> a</li>
  21961. <li class='mw-empty-elt'></li>
  21962. <li> b</li>
  21963. </ul>
  21964. <table>
  21965. <tbody>
  21966. <tr class='mw-empty-elt'></tr>
  21967. <tr>
  21968. <td>foo</td>
  21969. </tr>
  21970. </tbody>
  21971. </table>
  21972. !! end
  21973. !! test
  21974. Empty TR nodes should not be stripped if they have any attributes set
  21975. !! wikitext
  21976. {{EmptyTRWithHTMLAttrTest}}
  21977. !! html/parsoid
  21978. <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
  21979. <tr align='center'></tr>
  21980. <tr><td>foo</td></tr>
  21981. <tr align='center'></tr>
  21982. <tr><td>bar</td></tr>
  21983. </table>
  21984. !! end
  21985. #### ----------------------------------------------------------------
  21986. #### The following section of tests are primarily to test
  21987. #### wikitext escaping capabilities of Parsoid. Given that
  21988. #### escaping can be done any number of ways, the wikitext (input)
  21989. #### is always adjusted to reflect how Parsoid adds nowiki
  21990. #### escape tags.
  21991. ####
  21992. #### We are marking several tests as parsoid-only since the
  21993. #### HTML in the result section is different from what the
  21994. #### PHP parser generates for it.
  21995. #### ----------------------------------------------------------------
  21996. #### --------------- Headings ---------------
  21997. #### 0. Unnested
  21998. #### 1. Nested inside html <h1>=foo=</h1>
  21999. #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
  22000. #### 3. Nested inside html with wikitext split by html tags
  22001. #### 4. No escape needed
  22002. #### 5. Empty headings <h1></h1>
  22003. #### 6. Heading chars in SOL context
  22004. #### ----------------------------------------
  22005. !! test
  22006. Headings: 0. Unnested
  22007. !! options
  22008. parsoid=html2wt
  22009. !! html/parsoid
  22010. <p>=foo=</p>
  22011. <p> =foo=
  22012. <!--cmt-->
  22013. =foo=</p>
  22014. <p>=foo<i>a</i>=</p>
  22015. !! wikitext
  22016. <nowiki>=foo=</nowiki>
  22017. <nowiki> </nowiki>=foo=
  22018. <!--cmt-->
  22019. <nowiki>=foo=</nowiki>
  22020. =foo''a''<nowiki>=</nowiki>
  22021. !!end
  22022. # New headings and existing headings are handled differently
  22023. !! test
  22024. Headings: 1. Nested inside html
  22025. !! options
  22026. parsoid=html2wt
  22027. !! html/parsoid
  22028. <h1>=foo=</h1>
  22029. <h2>=foo=</h2>
  22030. <h3>=foo=</h3>
  22031. <h1 data-parsoid=''>=foo=</h1>
  22032. <h2 data-parsoid=''>=foo=</h2>
  22033. <h3 data-parsoid=''>=foo=</h3>
  22034. <h4 data-parsoid=''>=foo=</h4>
  22035. <h5 data-parsoid=''>=foo=</h5>
  22036. <h6 data-parsoid=''>=foo=</h6>
  22037. !! wikitext
  22038. = =foo= =
  22039. == =foo= ==
  22040. === =foo= ===
  22041. =<nowiki>=foo=</nowiki>=
  22042. ==<nowiki>=foo=</nowiki>==
  22043. ===<nowiki>=foo=</nowiki>===
  22044. ====<nowiki>=foo=</nowiki>====
  22045. =====<nowiki>=foo=</nowiki>=====
  22046. ======<nowiki>=foo=</nowiki>======
  22047. !!end
  22048. !! test
  22049. Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
  22050. !! options
  22051. parsoid=html2wt
  22052. !! html/parsoid
  22053. <h1>foo</h1>*bar
  22054. <h1>foo</h1>=bar
  22055. <h1>foo</h1>=bar=
  22056. !! wikitext
  22057. = foo =
  22058. <nowiki>*</nowiki>bar
  22059. = foo =
  22060. =bar
  22061. = foo =
  22062. <nowiki>=bar=</nowiki>
  22063. !!end
  22064. !! test
  22065. Headings: 3. Nested inside html with wikitext split by html tags
  22066. !! options
  22067. parsoid=html2wt
  22068. !! html/parsoid
  22069. <h1>=<b>bold</b>foo=</h1>
  22070. !! wikitext
  22071. = ='''bold'''foo= =
  22072. !!end
  22073. !! test
  22074. Headings: 4a. No escaping needed (testing just h1 and h2)
  22075. !! options
  22076. parsoid=html2wt
  22077. !! html/parsoid
  22078. <h1>=foo</h1>
  22079. <h1>foo=</h1>
  22080. <h1> =foo= </h1>
  22081. <h1>=foo= bar</h1>
  22082. <h2>=foo</h2>
  22083. <h2>foo=</h2>
  22084. <h1>=</h1>
  22085. <h1><i>=</i>foo=</h1>
  22086. !! wikitext
  22087. = =foo =
  22088. = foo= =
  22089. = =foo= =
  22090. = =foo= bar =
  22091. == =foo ==
  22092. == foo= ==
  22093. = = =
  22094. = ''=''foo= =
  22095. !!end
  22096. !! test
  22097. Headings: 4b. No escaping needed (inside p-tags)
  22098. !! options
  22099. parsoid=html2wt
  22100. !! html/parsoid
  22101. <p>=foo= x
  22102. =foo= <s></s>
  22103. </p>
  22104. !! wikitext
  22105. =foo= x
  22106. =foo= <s></s>
  22107. !! html/php
  22108. <p>=foo= x
  22109. =foo= <s></s>
  22110. </p>
  22111. !!end
  22112. !! test
  22113. Headings: 4c. Short headings (1)
  22114. !! options
  22115. parsoid=html2wt
  22116. !! html/parsoid
  22117. <p>===
  22118. </p>
  22119. !! wikitext
  22120. <nowiki>===</nowiki>
  22121. !! html/php
  22122. <p>===
  22123. </p>
  22124. !! end
  22125. # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
  22126. !! test
  22127. Headings: 4d. Short headings (2)
  22128. !! options
  22129. parsoid=wt2html,html2html
  22130. !! wikitext
  22131. =
  22132. ==
  22133. ===
  22134. ====
  22135. =====
  22136. !! html/php
  22137. <p>=
  22138. ==
  22139. </p>
  22140. <h1><span class="mw-headline" id=".3D">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  22141. <h1><span class="mw-headline" id=".3D.3D">==</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: ==">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
  22142. <h2><span class="mw-headline" id=".3D_2">=</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  22143. !! html/parsoid
  22144. <p>=
  22145. ==</p>
  22146. <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
  22147. <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
  22148. <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
  22149. !! end
  22150. !! test
  22151. Headings: 5. Empty headings
  22152. !! options
  22153. parsoid=html2wt
  22154. !! html/parsoid
  22155. <h1 data-parsoid='{}'></h1>
  22156. <h2 data-parsoid='{}'></h2>
  22157. <h3 data-parsoid='{}'></h3>
  22158. <h4 data-parsoid='{}'></h4>
  22159. <h5 data-parsoid='{}'></h5>
  22160. <h6 data-parsoid='{}'></h6>
  22161. !! wikitext
  22162. =<nowiki/>=
  22163. ==<nowiki/>==
  22164. ===<nowiki/>===
  22165. ====<nowiki/>====
  22166. =====<nowiki/>=====
  22167. ======<nowiki/>======
  22168. !!end
  22169. !! test
  22170. Headings: 6a. Heading chars in SOL context (with trailing spaces)
  22171. !! options
  22172. parsoid=html2wt
  22173. !! html/parsoid
  22174. <p>=a=</p>
  22175. <p>=a=</p>
  22176. <p>=a=</p>
  22177. !! wikitext
  22178. <nowiki>=a=</nowiki>
  22179. <nowiki>=a=</nowiki>
  22180. <nowiki>=a=</nowiki>
  22181. !!end
  22182. !! test
  22183. Headings: 6b. Heading chars in SOL context (with trailing newlines)
  22184. !! options
  22185. parsoid=html2wt
  22186. !! html/parsoid
  22187. <p>=a=
  22188. b</p>
  22189. <p>=a=
  22190. b</p>
  22191. <p>=a=
  22192. b</p>
  22193. !! wikitext
  22194. <nowiki>=a=</nowiki>
  22195. b
  22196. <nowiki>=a=</nowiki>
  22197. b
  22198. <nowiki>=a=</nowiki>
  22199. b
  22200. !!end
  22201. !! test
  22202. Headings: 6c. Heading chars in SOL context (leading newline break)
  22203. !! options
  22204. parsoid=html2wt
  22205. !! html/parsoid
  22206. <p>a
  22207. =b=</p>
  22208. !! wikitext
  22209. a
  22210. <nowiki>=b=</nowiki>
  22211. !!end
  22212. !! test
  22213. Headings: 6d. Heading chars in SOL context (with interspersed comments)
  22214. !! options
  22215. parsoid=html2wt
  22216. !! html/parsoid
  22217. <!--c0--><p>=a=</p>
  22218. <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
  22219. !! wikitext
  22220. <!--c0--><nowiki>=a=</nowiki>
  22221. <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
  22222. !!end
  22223. !! test
  22224. Headings: 6d. Heading chars in SOL context (No escaping needed)
  22225. !! options
  22226. parsoid=html2wt
  22227. !! html/parsoid
  22228. =a=<div>b</div>
  22229. !! wikitext
  22230. =a=<div>b</div>
  22231. !!end
  22232. !! test
  22233. Headings: 7. Insert a newline between new content and headings
  22234. !! options
  22235. parsoid=html2wt
  22236. !! html/parsoid
  22237. <h2>NEW</h2>
  22238. <p>new</p>
  22239. <h2 data-parsoid='{}'>A</h2>
  22240. <p data-parsoid='{}'>a</p>
  22241. !! wikitext
  22242. == NEW ==
  22243. new
  22244. ==A==
  22245. a
  22246. !! end
  22247. !! test
  22248. Headings: Used as horizontal rule
  22249. !! config
  22250. wgFragmentMode=[ 'html5', 'legacy' ]
  22251. !! options
  22252. parsoid=wt2html
  22253. !! wikitext
  22254. ===============
  22255. !! html/php
  22256. <h6><span id=".3D.3D.3D"></span><span class="mw-headline" id="===">===</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: ===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
  22257. !! html/parsoid
  22258. <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
  22259. !! end
  22260. #### --------------- Lists ---------------
  22261. #### 0. Outside nests (*foo, etc.)
  22262. #### 1. Nested inside html <ul><li>*foo</li></ul>
  22263. #### 2. Inside definition lists
  22264. #### 3. Only bullets at start should be escaped
  22265. #### 4. No escapes needed
  22266. #### 5. No unnecessary escapes
  22267. #### 6. Escape bullets in SOL position
  22268. #### 7. Escape bullets in a multi-line context
  22269. #### ----------------------------------------
  22270. !! test
  22271. Lists: 0. Outside nests
  22272. !! options
  22273. parsoid=html2wt
  22274. !! html/parsoid
  22275. <p>*foo</p>
  22276. <p>#foo</p>
  22277. <p>;Foo:bar</p>
  22278. !! wikitext
  22279. <nowiki>*</nowiki>foo
  22280. <nowiki>#</nowiki>foo
  22281. <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
  22282. !!end
  22283. ## Making these next 3 tests Parsoid-only since they are html2wt tests
  22284. ## to test wikitext escaping, and insignificant whitespace diffs
  22285. ## cause PHP parser tests to barf
  22286. !! test
  22287. Lists: 1. Nested inside html (No unnecessary escapes)
  22288. !! options
  22289. parsoid=html2wt
  22290. !! html/parsoid
  22291. <ul>
  22292. <li>*foo</li>
  22293. <li>#foo</li>
  22294. <li>:foo</li>
  22295. <li>;foo</li>
  22296. <li data-parsoid='{}'>*foo</li>
  22297. <li data-parsoid='{}'>#foo</li>
  22298. <li data-parsoid='{}'>:foo</li>
  22299. <li data-parsoid='{}'>;foo</li>
  22300. </ul>
  22301. <ol>
  22302. <li>*foo</li>
  22303. <li>#foo</li>
  22304. <li>:foo</li>
  22305. <li>;foo</li>
  22306. <li data-parsoid='{}'>*foo</li>
  22307. <li data-parsoid='{}'>#foo</li>
  22308. <li data-parsoid='{}'>:foo</li>
  22309. <li data-parsoid='{}'>;foo</li>
  22310. </ol>
  22311. !! wikitext
  22312. * *foo
  22313. * #foo
  22314. * :foo
  22315. * ;foo
  22316. *<nowiki>*foo</nowiki>
  22317. *<nowiki>#foo</nowiki>
  22318. *<nowiki>:foo</nowiki>
  22319. *<nowiki>;foo</nowiki>
  22320. # *foo
  22321. # #foo
  22322. # :foo
  22323. # ;foo
  22324. #<nowiki>*foo</nowiki>
  22325. #<nowiki>#foo</nowiki>
  22326. #<nowiki>:foo</nowiki>
  22327. #<nowiki>;foo</nowiki>
  22328. !!end
  22329. !! test
  22330. Lists: 2. Inside definition lists
  22331. !! options
  22332. parsoid=html2wt
  22333. !! html/parsoid
  22334. <dl><dt>;foo</dt></dl>
  22335. <dl><dt>:foo</dt></dl>
  22336. <dl><dt>:foo</dt>
  22337. <dd>bar</dd></dl>
  22338. <dl><dd>:foo</dd></dl>
  22339. !! wikitext
  22340. ; ;foo
  22341. ; <nowiki>:foo</nowiki>
  22342. ; <nowiki>:foo</nowiki>
  22343. : bar
  22344. : :foo
  22345. !!end
  22346. !! test
  22347. Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
  22348. !! options
  22349. parsoid=html2wt
  22350. !! html/parsoid
  22351. <ul>
  22352. <li>*foo*bar</li>
  22353. <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
  22354. </ul>
  22355. !! wikitext
  22356. * *foo*bar
  22357. *<nowiki>*foo</nowiki>''it''*bar
  22358. !!end
  22359. !! test
  22360. Lists: 4. No escapes needed
  22361. !! options
  22362. parsoid=html2wt
  22363. !! html/parsoid
  22364. <ul>
  22365. <li>foo*bar
  22366. </li>
  22367. </ul>
  22368. <ul>
  22369. <li><i>foo</i>*bar
  22370. </li>
  22371. </ul>
  22372. <ul>
  22373. <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
  22374. </li>
  22375. </ul>
  22376. <ul>
  22377. <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
  22378. </li>
  22379. </ul>
  22380. !! wikitext
  22381. *foo*bar
  22382. *''foo''*bar
  22383. *[[Foo]]: bar
  22384. *[[Foo]]*bar
  22385. !!end
  22386. !! test
  22387. Lists: 5. No unnecessary escapes
  22388. !! options
  22389. parsoid=html2wt
  22390. !! html/parsoid
  22391. <ul><li> bar <span>[[foo]]</span></li></ul>
  22392. <ul><li> =bar <span>[[foo]]</span></li></ul>
  22393. <ul><li> [[bar <span>[[foo]]</span></li></ul>
  22394. <ul><li> ]]bar <span>[[foo]]</span></li></ul>
  22395. <ul><li> =bar <span>foo]]</span>=</li></ul>
  22396. <ul><li> <s></s>: a</li></ul>
  22397. <ul><li> <i>* foo</i></li></ul>
  22398. !! wikitext
  22399. * bar <span><nowiki>[[foo]]</nowiki></span>
  22400. * =bar <span><nowiki>[[foo]]</nowiki></span>
  22401. * [[bar <span><nowiki>[[foo]]</nowiki></span>
  22402. * ]]bar <span><nowiki>[[foo]]</nowiki></span>
  22403. * =bar <span>foo]]</span>=
  22404. * <s></s>: a
  22405. * ''* foo''
  22406. !!end
  22407. !! test
  22408. Lists: 6. Escape bullets in SOL position
  22409. !! options
  22410. parsoid=html2wt
  22411. !! html/parsoid
  22412. <p><!--cmt-->*foo</p>
  22413. !! wikitext
  22414. <!--cmt--><nowiki>*</nowiki>foo
  22415. !!end
  22416. !! test
  22417. Lists: 7. Escape bullets in a multi-line context
  22418. !! options
  22419. parsoid=html2wt
  22420. !! html/parsoid
  22421. <p>a
  22422. *b
  22423. </p>
  22424. !! wikitext
  22425. a
  22426. <nowiki>*</nowiki>b
  22427. !!end
  22428. !! test
  22429. Lists: 8. Escape colons only if not present in tags
  22430. !! options
  22431. parsoid=html2wt
  22432. !! html/parsoid
  22433. <dl><dt>a:b<i>c:d</i></dt></dl>
  22434. !! wikitext
  22435. ; <nowiki>a:b</nowiki>''c:d''
  22436. !! end
  22437. #### --------------- HRs ---------------
  22438. #### 1. Single line
  22439. #### -----------------------------------
  22440. !! test
  22441. HRs: 1. Single line
  22442. !! options
  22443. parsoid=html2wt
  22444. !! html/parsoid
  22445. <hr />----
  22446. <hr />=foo=
  22447. <hr />*foo
  22448. !! wikitext
  22449. ----<nowiki>----</nowiki>
  22450. ----=foo=
  22451. ----*foo
  22452. !! end
  22453. #### --------------- Tables ---------------
  22454. #### 1a. Simple example
  22455. #### 1b. No escaping needed (!foo)
  22456. #### 1c. No escaping needed (|foo)
  22457. #### 1d. No escaping needed (|}foo)
  22458. ####
  22459. #### 2a. Nested in td (<td>foo|bar</td>)
  22460. #### 2b. Nested in td (<td>foo||bar</td>)
  22461. #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
  22462. ####
  22463. #### 3a. Nested in th (<th>foo!bar</th>)
  22464. #### 3b. Nested in th (<th>foo!!bar</th>)
  22465. #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
  22466. ####
  22467. #### 4a. Escape -
  22468. #### 4b. Escape +
  22469. #### 4c. No escaping needed
  22470. #### --------------------------------------
  22471. !! test
  22472. Tables: 1a. Simple example
  22473. !! options
  22474. parsoid=html2wt
  22475. !! html/parsoid
  22476. <p>{|
  22477. |}
  22478. </p>
  22479. !! wikitext
  22480. <nowiki>{|</nowiki>
  22481. |}
  22482. !! end
  22483. !! test
  22484. Tables: 1b. No escaping needed
  22485. !! options
  22486. parsoid=html2wt
  22487. !! html/parsoid
  22488. <p>!foo
  22489. </p>
  22490. !! wikitext
  22491. !foo
  22492. !! end
  22493. !! test
  22494. Tables: 1c. No escaping needed
  22495. !! options
  22496. parsoid=html2wt
  22497. !! html/parsoid
  22498. <p>|foo
  22499. </p>
  22500. !! wikitext
  22501. |foo
  22502. !! end
  22503. !! test
  22504. Tables: 1d. No escaping needed
  22505. !! options
  22506. parsoid=html2wt
  22507. !! html/parsoid
  22508. <p>|}foo
  22509. </p>
  22510. !! wikitext
  22511. |}foo
  22512. !! end
  22513. !! test
  22514. Tables: 2a. Nested in td
  22515. !! options
  22516. parsoid=html2wt
  22517. !! html/parsoid
  22518. <table><tbody><tr>
  22519. <td>foo|bar</td></tr>
  22520. <tr><td>x<div>a|b</div></td>
  22521. </tbody></table>
  22522. !! wikitext
  22523. {|
  22524. |<nowiki>foo|bar</nowiki>
  22525. |-
  22526. |x<div><nowiki>a|b</nowiki></div>
  22527. |}
  22528. !! html/php+tidy
  22529. <table>
  22530. <tbody><tr>
  22531. <td>foo|bar
  22532. </td></tr>
  22533. <tr>
  22534. <td>x<div>a|b</div>
  22535. </td></tr></tbody></table>
  22536. !! end
  22537. !! test
  22538. Tables: 2b. Nested in td
  22539. !! options
  22540. parsoid=html2wt
  22541. !! html/parsoid
  22542. <table><tbody><tr>
  22543. <td>foo||bar</td>
  22544. <td>a<i>b||c</i></td>
  22545. <td>a<i><div>b||c</div></i></td>
  22546. </tr></tbody></table>
  22547. !! wikitext
  22548. {|
  22549. |<nowiki>foo||bar</nowiki>
  22550. |a''<nowiki>b||c</nowiki>''
  22551. |a''<div><nowiki>b||c</nowiki></div>''
  22552. |}
  22553. !! html/php
  22554. <table>
  22555. <tr>
  22556. <td>foo||bar
  22557. </td>
  22558. <td>a<i>b||c</i>
  22559. </td>
  22560. <td>a<i><div>b||c</div></i>
  22561. </td></tr></table>
  22562. !! end
  22563. !! test
  22564. Tables: 2c. Nested in td -- no escaping needed
  22565. !! options
  22566. parsoid=html2wt
  22567. !! html/*
  22568. <table>
  22569. <tr>
  22570. <td>foo!!bar
  22571. </td></tr></table>
  22572. !! wikitext
  22573. {|
  22574. |foo!!bar
  22575. |}
  22576. !! end
  22577. !! test
  22578. Tables: 3a. Nested in th
  22579. !! options
  22580. parsoid=html2wt
  22581. !! html/*
  22582. <table>
  22583. <tr>
  22584. <th>foo!bar
  22585. </th></tr></table>
  22586. !! wikitext
  22587. {|
  22588. !foo!bar
  22589. |}
  22590. !! end
  22591. !! test
  22592. Tables: 3b. Nested in th
  22593. !! options
  22594. parsoid=html2wt
  22595. !! html/parsoid
  22596. <table><tbody>
  22597. <tr><th>foo!!bar</th>
  22598. <th><i>foo|bar</i></th>
  22599. <th><i>foo!!bar</i></th>
  22600. <th><i><span>foo!!bar</span></i></th>
  22601. </tr></tbody></table>
  22602. !! wikitext
  22603. {|
  22604. !<nowiki>foo!!bar</nowiki>
  22605. !''<nowiki>foo|bar</nowiki>''
  22606. !''<nowiki>foo!!bar</nowiki>''
  22607. !''<span><nowiki>foo!!bar</nowiki></span>''
  22608. |}
  22609. !! html/php
  22610. <table>
  22611. <tr>
  22612. <th>foo!!bar
  22613. </th>
  22614. <th><i>foo|bar</i>
  22615. </th>
  22616. <th><i>foo!!bar</i>
  22617. </th>
  22618. <th><i><span>foo!!bar</span></i>
  22619. </th></tr></table>
  22620. !! end
  22621. !! test
  22622. Tables: 3c. Nested in th
  22623. !! options
  22624. parsoid=html2wt
  22625. !! html/parsoid
  22626. <table><tbody>
  22627. <tr><th>foo||bar</th>
  22628. <th><span typeof="mw:Nowiki">foo||bar</span></th>
  22629. </tr></tbody></table>
  22630. !! wikitext
  22631. {|
  22632. !<nowiki>foo||bar</nowiki>
  22633. !<nowiki>foo||bar</nowiki>
  22634. |}
  22635. !! html/php
  22636. <table>
  22637. <tr>
  22638. <th>foo||bar
  22639. </th>
  22640. <th>foo||bar
  22641. </th></tr></table>
  22642. !! end
  22643. !! test
  22644. Tables: 4a. Escape -
  22645. !! options
  22646. parsoid=html2wt
  22647. !! html/*
  22648. <table>
  22649. <tr>
  22650. <th>-bar
  22651. </th></tr>
  22652. <tr>
  22653. <td>-bar
  22654. </td></tr></table>
  22655. !! wikitext
  22656. {|
  22657. !-bar
  22658. |-
  22659. |<nowiki>-bar</nowiki>
  22660. |}
  22661. !! end
  22662. !! test
  22663. Tables: 4b. Escape +
  22664. !! options
  22665. parsoid=html2wt
  22666. !! html/*
  22667. <table>
  22668. <tr>
  22669. <th>+bar
  22670. </th></tr>
  22671. <tr>
  22672. <td>+bar
  22673. </td></tr></table>
  22674. !! wikitext
  22675. {|
  22676. !+bar
  22677. |-
  22678. |<nowiki>+bar</nowiki>
  22679. |}
  22680. !! end
  22681. !! test
  22682. Tables: 4c. No escaping needed
  22683. !! options
  22684. parsoid=html2wt
  22685. !! html/parsoid
  22686. <table><tbody>
  22687. <tr><td>foo-bar</td><td>foo+bar</td></tr>
  22688. <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
  22689. <tr><td>foo
  22690. <p>bar|baz
  22691. +bar
  22692. -bar</p></td></tr>
  22693. <tr><td>x
  22694. <div>a|b</div></td>
  22695. </tbody></table>
  22696. !! wikitext
  22697. {|
  22698. |foo-bar
  22699. |foo+bar
  22700. |-
  22701. |''foo''-bar
  22702. |''foo''+bar
  22703. |-
  22704. |foo
  22705. bar|baz
  22706. +bar
  22707. -bar
  22708. |-
  22709. |x
  22710. <div>a|b</div>
  22711. |}
  22712. !! html/php
  22713. <table>
  22714. <tr>
  22715. <td>foo-bar
  22716. </td>
  22717. <td>foo+bar
  22718. </td></tr>
  22719. <tr>
  22720. <td><i>foo</i>-bar
  22721. </td>
  22722. <td><i>foo</i>+bar
  22723. </td></tr>
  22724. <tr>
  22725. <td>foo
  22726. <p>bar|baz
  22727. +bar
  22728. -bar
  22729. </p>
  22730. </td></tr>
  22731. <tr>
  22732. <td>x
  22733. <div>a|b</div>
  22734. </td></tr></table>
  22735. !! end
  22736. !! test
  22737. Tables: 4d. No escaping needed
  22738. !! options
  22739. parsoid=html2wt
  22740. !! html/parsoid
  22741. <table>
  22742. <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
  22743. <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
  22744. <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
  22745. </tbody></table>
  22746. !! wikitext
  22747. {|
  22748. |[[Foo]]-bar
  22749. ||+1
  22750. ||-2
  22751. |}
  22752. !! html/php
  22753. <table>
  22754. <tr>
  22755. <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
  22756. </td>
  22757. <td>+1
  22758. </td>
  22759. <td>-2
  22760. </td></tr></table>
  22761. !! end
  22762. !! test
  22763. T97430: Don't emit empty nowiki pairs around marker meta tags
  22764. !! options
  22765. parsoid=html2wt
  22766. !! html/parsoid
  22767. <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
  22768. |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
  22769. !! wikitext
  22770. <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
  22771. |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
  22772. !! end
  22773. !! test
  22774. Unclosed xmlish element in table line shouldn't eat end delimiters
  22775. !! options
  22776. parsoid=html2wt
  22777. !! html/parsoid
  22778. <table>
  22779. <tbody><tr><td> &lt;foo</td>
  22780. <td> bar></td></tr>
  22781. </tbody></table>
  22782. !! wikitext
  22783. {|
  22784. | <foo
  22785. | bar>
  22786. |}
  22787. !! html/php
  22788. <table>
  22789. <tr>
  22790. <td>&lt;foo
  22791. </td>
  22792. <td>bar&gt;
  22793. </td></tr></table>
  22794. !! end
  22795. #### --------------- Links ----------------
  22796. #### 1. Quote marks in link text
  22797. #### 2. Wikilinks: Escapes needed
  22798. #### 3. Wikilinks: No escapes needed
  22799. #### 4. Extlinks: Escapes needed
  22800. #### 5. Extlinks: No escapes needed
  22801. #### --------------------------------------
  22802. !! test
  22803. Links 1. WikiLinks: No escapes needed
  22804. !! options
  22805. parsoid=html2wt
  22806. !! html/parsoid
  22807. <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
  22808. <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
  22809. <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
  22810. !! wikitext
  22811. [[Foo|Foo''boo'']]
  22812. [[Foo|[Foobar]]]
  22813. [[Foo|x [Foobar] x]]
  22814. !! html/php
  22815. <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
  22816. <a href="/wiki/Foo" title="Foo">[Foobar]</a>
  22817. <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
  22818. </p>
  22819. !! end
  22820. !! test
  22821. Links 2. WikiLinks: Escapes needed
  22822. !! options
  22823. parsoid=html2wt
  22824. !! html/parsoid
  22825. <a href="Foo" rel="mw:WikiLink">Foobar]</a>
  22826. <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
  22827. <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
  22828. <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
  22829. <a href="Foo" rel="mw:WikiLink">|Bar</a>
  22830. <a href="Foo" rel="mw:WikiLink">]]bar</a>
  22831. <a href="Foo" rel="mw:WikiLink">[[bar</a>
  22832. <a href="Foo" rel="mw:WikiLink">x [[ y</a>
  22833. <a href="Foo" rel="mw:WikiLink">x ]] y</a>
  22834. <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
  22835. !! wikitext
  22836. [[Foo|<nowiki>Foobar]</nowiki>]]
  22837. [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
  22838. [[Foo|<nowiki>[[Bar]]</nowiki>]]
  22839. [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
  22840. [[Foo|<nowiki>|Bar</nowiki>]]
  22841. [[Foo|<nowiki>]]bar</nowiki>]]
  22842. [[Foo|<nowiki>[[bar</nowiki>]]
  22843. [[Foo|<nowiki>x [[ y</nowiki>]]
  22844. [[Foo|<nowiki>x ]] y</nowiki>]]
  22845. [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
  22846. !! html/php
  22847. <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
  22848. <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
  22849. <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
  22850. <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
  22851. <a href="/wiki/Foo" title="Foo">|Bar</a>
  22852. <a href="/wiki/Foo" title="Foo">]]bar</a>
  22853. <a href="/wiki/Foo" title="Foo">[[bar</a>
  22854. <a href="/wiki/Foo" title="Foo">x [[ y</a>
  22855. <a href="/wiki/Foo" title="Foo">x ]] y</a>
  22856. <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
  22857. </p>
  22858. !! end
  22859. !! test
  22860. Links 3. WikiLinks: No escapes needed
  22861. !! options
  22862. parsoid=html2wt
  22863. !! html/parsoid
  22864. <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
  22865. <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
  22866. !! wikitext
  22867. [[Foo|[Foobar]]
  22868. [[Foo|foo|bar]]
  22869. !! html/php
  22870. <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
  22871. <a href="/wiki/Foo" title="Foo">foo|bar</a>
  22872. </p>
  22873. !! end
  22874. !! test
  22875. Links 4. ExtLinks: Escapes needed
  22876. !! options
  22877. parsoid=html2wt
  22878. !! html/parsoid
  22879. <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
  22880. <a rel="mw:ExtLink" href="http://google.com">google]</a>
  22881. <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
  22882. <p>[http://google.com]</p>
  22883. <p>[http://google.com google]</p>
  22884. <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
  22885. <p>[<a rel="mw:ExtLink" href="http://google.com" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://google.com"}},"i":0}}]}'>http://google.com</a>]</p>
  22886. !! wikitext
  22887. [http://google.com <nowiki>[google]</nowiki>]
  22888. [http://google.com <nowiki>google]</nowiki>]
  22889. [http://google.com <nowiki>goog] le</nowiki>]
  22890. <nowiki>[http://google.com]</nowiki>
  22891. <nowiki>[http://google.com google]</nowiki>
  22892. [http://google.com<nowiki>]</nowiki>
  22893. [{{echo|http://google.com}}<nowiki>]</nowiki>
  22894. !! html/php
  22895. <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
  22896. <a rel="nofollow" class="external text" href="http://google.com">google]</a>
  22897. <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
  22898. </p><p>[http://google.com]
  22899. </p><p>[http://google.com google]
  22900. </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
  22901. </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
  22902. </p>
  22903. !! end
  22904. !! test
  22905. Links 5. ExtLinks: No escapes needed
  22906. !! options
  22907. parsoid=html2wt
  22908. !! html/parsoid
  22909. <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
  22910. <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
  22911. !! wikitext
  22912. [http://google.com [google]
  22913. [[http://google.com]]
  22914. !! html/php
  22915. <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
  22916. </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
  22917. </p>
  22918. !! end
  22919. !! test
  22920. Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
  22921. !! options
  22922. parsoid=html2wt
  22923. !! html/parsoid
  22924. <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
  22925. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
  22926. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&amp;x
  22927. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
  22928. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
  22929. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
  22930. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
  22931. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
  22932. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
  22933. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
  22934. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
  22935. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
  22936. <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
  22937. </p>
  22938. !! wikitext
  22939. x<nowiki/>http://example.com<nowiki/>y
  22940. http://example.com<nowiki/>?x
  22941. http://example.com<nowiki/>&x
  22942. http://example.com<nowiki/>'x
  22943. http://example.com<nowiki/>,x
  22944. http://example.com<nowiki/>.x
  22945. http://example.com<nowiki/>;x
  22946. http://example.com<nowiki/>:x
  22947. http://example.com<nowiki/>;x
  22948. http://example.com<nowiki/>!x
  22949. http://example.com<nowiki/>=x
  22950. http://example.com<nowiki/>(x)
  22951. http://example.com(x<nowiki/>)
  22952. !! end
  22953. !! test
  22954. Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
  22955. !! options
  22956. parsoid=html2wt
  22957. !! html/parsoid
  22958. <p>x
  22959. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
  22960. y
  22961. "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
  22962. (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
  22963. (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
  22964. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
  22965. <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
  22966. </p>
  22967. !! wikitext
  22968. x
  22969. http://example.com
  22970. y
  22971. "http://example.com"
  22972. (http://example.com)
  22973. (http://example.com) foo
  22974. http://example.com,
  22975. http://example.com, foo
  22976. !! html/php
  22977. <p>x
  22978. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
  22979. y
  22980. "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
  22981. (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
  22982. (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
  22983. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
  22984. <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
  22985. </p>
  22986. !! end
  22987. !! test
  22988. Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
  22989. !! options
  22990. parsoid=html2wt
  22991. !! html/parsoid
  22992. <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
  22993. -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
  22994. !! wikitext
  22995. http://example.com.,;:!?\
  22996. -http://example.com:
  22997. !! html/php
  22998. <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
  22999. -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
  23000. </p>
  23001. !! end
  23002. !! test
  23003. Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
  23004. !! options
  23005. parsoid=html2wt
  23006. !! html/parsoid
  23007. <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
  23008. <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
  23009. X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
  23010. !! wikitext
  23011. RFC 123<nowiki/>4
  23012. RFC 123<nowiki/>y
  23013. X<nowiki/>RFC 123<nowiki/>y
  23014. !! end
  23015. !! test
  23016. Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
  23017. !! options
  23018. parsoid=html2wt
  23019. !! html/parsoid
  23020. <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
  23021. <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&amp;foo
  23022. -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
  23023. </p>
  23024. !! wikitext
  23025. RFC 123?foo
  23026. RFC 123&foo
  23027. -RFC 123-
  23028. !! html/php
  23029. <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
  23030. <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&amp;foo
  23031. -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
  23032. </p>
  23033. !! end
  23034. !! test
  23035. Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
  23036. !! options
  23037. parsoid=html2wt
  23038. !! html/parsoid
  23039. <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
  23040. <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
  23041. X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
  23042. !! wikitext
  23043. PMID 123<nowiki/>4
  23044. PMID 123<nowiki/>y
  23045. X<nowiki/>PMID 123<nowiki/>y
  23046. !! end
  23047. !! test
  23048. Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
  23049. !! options
  23050. parsoid=html2wt
  23051. !! html/parsoid
  23052. <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
  23053. <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
  23054. -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
  23055. </p>
  23056. !! wikitext
  23057. PMID 123?foo
  23058. PMID 123&foo
  23059. -PMID 123-
  23060. !! html/php
  23061. <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
  23062. <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&amp;foo
  23063. -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
  23064. </p>
  23065. !! end
  23066. !! test
  23067. Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
  23068. !! options
  23069. parsoid=html2wt
  23070. !! html/parsoid
  23071. <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
  23072. <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
  23073. a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
  23074. </p>
  23075. !! wikitext
  23076. ISBN 1234567890<nowiki/>1
  23077. ISBN 1234567890<nowiki/>x
  23078. a<nowiki/>ISBN 1234567890<nowiki/>b
  23079. !! end
  23080. !! test
  23081. Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
  23082. !! options
  23083. parsoid=html2wt
  23084. !! html/parsoid
  23085. <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
  23086. !! wikitext
  23087. -ISBN 1234567890's
  23088. !! html/php
  23089. <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
  23090. </p>
  23091. !! end
  23092. !! test
  23093. Links 14. Protect link-like plain text. (Parsoid bug T78425)
  23094. !! options
  23095. parsoid=html2wt
  23096. !! html/*
  23097. <p>this is not a link: http://example.com
  23098. </p>
  23099. !! wikitext
  23100. this is not a link: <nowiki>http://example.com</nowiki>
  23101. !! end
  23102. !! test
  23103. Links 15. Link trails can't become link prefixes.
  23104. !! options
  23105. language=is
  23106. parsoid=html2wt
  23107. !! html/parsoid
  23108. <p><a rel="mw:WikiLink" href="Söfnuður" title="Söfnuður" data-parsoid='{"stx":"simple","tail":"-"}'>Söfnuður-</a><a rel="mw:WikiLink" href="00" title="00">00</a></p>
  23109. !! wikitext
  23110. [[Söfnuður]]-[[00]]
  23111. !! html/php
  23112. <p><a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">Söfnuður-</a><a href="/wiki/00" title="00">00</a>
  23113. </p>
  23114. !! end
  23115. #### --------------- Quotes ---------------
  23116. #### 1. Quotes inside <b> and <i>
  23117. #### 2. Link fragments separated by <i> and <b> tags
  23118. #### 3. Link fragments inside <i> and <b>
  23119. #### 4. No escaping needed
  23120. #### --------------------------------------
  23121. !! test
  23122. 1a. Quotes inside <b> and <i>
  23123. !! options
  23124. parsoid=html2wt
  23125. !! html/*
  23126. <p><i>'foo'</i>
  23127. <i>''foo''</i>
  23128. <i>'''foo'''</i>
  23129. <i>foo</i>'s
  23130. <b>'foo'</b>
  23131. <b>''foo''</b>
  23132. <b>'''foo'''</b>
  23133. <b>foo'<i>bar'</i>baz</b>
  23134. <b>foo</b>'s
  23135. '<i>foo</i>
  23136. <i>foo</i>'
  23137. <i>foo'</i>'
  23138. '<i>foo</i>'
  23139. '<b>foo</b>
  23140. <b>foo</b>'
  23141. '<b>foo</b>'
  23142. <i>fools'<span> errand</span></i>
  23143. <i><span>fool</span>'s errand</i>
  23144. '<i>foo</i> bar '<i>baz</i>
  23145. a|!*#-:;+-~[]{}b'<i>x</i>
  23146. </p>
  23147. !! wikitext
  23148. ''<nowiki/>'foo'''
  23149. ''<nowiki>''foo''</nowiki>''
  23150. ''<nowiki>'''foo'''</nowiki>''
  23151. ''foo''<nowiki/>'s
  23152. '''<nowiki/>'foo''''
  23153. '''<nowiki>''foo''</nowiki>'''
  23154. '''<nowiki>'''foo'''</nowiki>'''
  23155. '''foo'<nowiki/>''bar'<nowiki/>''baz'''
  23156. '''foo'''<nowiki/>'s
  23157. '''foo''
  23158. ''foo''<nowiki/>'
  23159. ''foo'''<nowiki/>'
  23160. '''foo''<nowiki/>'
  23161. ''''foo'''
  23162. '''foo'''<nowiki/>'
  23163. ''''foo'''<nowiki/>'
  23164. ''fools'<span> errand</span>''
  23165. ''<span>fool</span>'s errand''
  23166. '<nowiki/>''foo'' bar '''baz''
  23167. a|!*#-:;+-~[]{}b'''x''
  23168. !! end
  23169. !! test
  23170. 1b. Quotes inside <b> and <i> with other tags on same line
  23171. !! options
  23172. parsoid=html2wt
  23173. !! html/parsoid
  23174. '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
  23175. <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
  23176. <i>a'</i> foo <b><a rel="mw:WikiLink" href="Bar" title="Bar" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[bar]]"}},"i":0}}]}'>bar</a></b>
  23177. <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
  23178. '<i>foo</i> <span class="mw-ref" id="cite_ref-1-0" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span>
  23179. '<i>foo</i> <div title="name">test</div>
  23180. '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
  23181. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt5" data-mw='{"name":"references","attrs":{}}'>
  23182. <li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">test</span></li>
  23183. </ol>
  23184. !! wikitext
  23185. '''a'' foo ''[[bar]]''
  23186. ''a''' foo ''[[bar]]''
  23187. ''a''' foo '''{{echo|[[bar]]}}'''
  23188. [[foo]] x'''[[bar]]''
  23189. '''foo'' <ref>test</ref>
  23190. '''foo'' <div title="name">test</div>
  23191. '''foo'' and <br> bar
  23192. <references />
  23193. !! end
  23194. !! test
  23195. 2. Link fragments separated by <i> and <b> tags
  23196. !! options
  23197. parsoid=html2wt
  23198. !! html/parsoid
  23199. <p>[[<i>foo</i>hello]]</p>
  23200. <p>[[<b>foo</b>hello]]</p>
  23201. !! wikitext
  23202. [[''foo''<nowiki>hello]]</nowiki>
  23203. [['''foo'''<nowiki>hello]]</nowiki>
  23204. !! end
  23205. # FIXME: Escaping one or both of [[ and ]] is also acceptable --
  23206. # this is one of the shortcomings of this format
  23207. !! test
  23208. 3. Link fragments inside <i> and <b>
  23209. !! options
  23210. parsoid=html2wt
  23211. !! html/parsoid
  23212. <p><i>[[foo</i>]]</p>
  23213. <p><b>[[foo</b>]]</p>
  23214. !! wikitext
  23215. ''[[foo''<nowiki>]]</nowiki>
  23216. '''[[foo'''<nowiki>]]</nowiki>
  23217. !! end
  23218. !! test
  23219. 4. No escaping needed
  23220. !! options
  23221. parsoid=html2wt
  23222. !! html/parsoid
  23223. <p>'<span><i>bar</i></span>'
  23224. '<span><b>bar</b></span>'
  23225. 'a:b'foo
  23226. </p>
  23227. !! wikitext
  23228. '<span>''bar''</span>'
  23229. '<span>'''bar'''</span>'
  23230. 'a:b'foo
  23231. !! end
  23232. #### ----------- Paragraphs ---------------
  23233. #### 1. No unnecessary escapes
  23234. #### --------------------------------------
  23235. !! test
  23236. 1. No unnecessary escapes
  23237. !! options
  23238. parsoid=html2wt
  23239. !! html/parsoid
  23240. <p>bar <span>[[foo]]</span>
  23241. </p><p>=bar <span>[[foo]]</span>
  23242. </p><p>[[bar <span>[[foo]]</span>
  23243. </p><p>]]bar <span>[[foo]]</span>
  23244. </p><p>=bar <span>foo]]</span>=
  23245. </p>
  23246. !! wikitext
  23247. bar <span><nowiki>[[foo]]</nowiki></span>
  23248. =bar <span><nowiki>[[foo]]</nowiki></span>
  23249. [[bar <span><nowiki>[[foo]]</nowiki></span>
  23250. ]]bar <span><nowiki>[[foo]]</nowiki></span>
  23251. =bar <span>foo]]</span><nowiki>=</nowiki>
  23252. !!end
  23253. #### ----------------------- PRE --------------------------
  23254. #### 1. Leading whitespace in SOL context should be escaped
  23255. #### ------------------------------------------------------
  23256. !! test
  23257. 1. Leading whitespace in SOL context should be escaped
  23258. !! options
  23259. parsoid=html2wt
  23260. !! html/parsoid
  23261. <p> a</p>
  23262. <p> a</p>
  23263. <p> a(tab)</p>
  23264. <p> a
  23265. <!--cmt-->
  23266. a</p>
  23267. <p>a
  23268. b</p>
  23269. <p>a
  23270. b</p>
  23271. <p>a
  23272. b</p>
  23273. !! wikitext
  23274. <nowiki> </nowiki>a
  23275. <nowiki> </nowiki> a
  23276. a(tab)
  23277. <nowiki> </nowiki> a
  23278. <!--cmt-->
  23279. <nowiki> </nowiki>a
  23280. a
  23281. <nowiki> </nowiki>b
  23282. a
  23283. b
  23284. a
  23285. b
  23286. !! html/php
  23287. <p> a
  23288. </p><p> a
  23289. </p><p> a(tab)
  23290. </p><p> a
  23291. a
  23292. </p><p>a
  23293. b
  23294. </p><p>a
  23295. b
  23296. </p><p>a
  23297. b
  23298. </p>
  23299. !! end
  23300. !! test
  23301. 2. Leading whitespace in non-indent-pre contexts should not be escaped
  23302. !! options
  23303. parsoid=html2wt
  23304. !! html/parsoid
  23305. <p>foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span></p>
  23306. <ol class="mw-references references" typeof="mw:Extension/references" about="#mwt4" data-mw='{"name":"references","attrs":{}}'>
  23307. <li about="#cite_note-1" id="cite_note-1"><a href="./Main_Page#cite_ref-1" rel="mw:referencedBy"><span class="mw-linkback-text">↑ </span></a> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><i>a</i>
  23308. b</span></li>
  23309. </ol>
  23310. !! wikitext
  23311. foo <ref>''a''
  23312. b</ref>
  23313. <references />
  23314. !! end
  23315. !! test
  23316. 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
  23317. !! options
  23318. parsoid=html2wt
  23319. !! html/parsoid
  23320. <blockquote>
  23321. <p>
  23322. a
  23323. <span>b</span>
  23324. c</p>
  23325. </blockquote>
  23326. !! wikitext
  23327. <blockquote>
  23328. a
  23329. <span>b</span>
  23330. c
  23331. </blockquote>
  23332. !! end
  23333. !! test
  23334. 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
  23335. !! options
  23336. parsoid=html2wt
  23337. !! html/parsoid
  23338. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption>caption</figcaption></figure>
  23339. !! wikitext
  23340. [[File:Foobar.jpg|thumb|caption]]
  23341. !! end
  23342. !! test
  23343. 5. Nowiki escaping should account for indent-pres
  23344. !! options
  23345. parsoid=html2wt
  23346. !! html/parsoid
  23347. <pre>==foo==</pre>
  23348. !! wikitext
  23349. ==foo==
  23350. !! end
  23351. !!test
  23352. T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
  23353. !! options
  23354. parsoid=html2wt
  23355. !! html/parsoid
  23356. <pre>
  23357. * foo
  23358. * bar
  23359. </pre>
  23360. !! wikitext
  23361. * foo
  23362. * bar
  23363. !! end
  23364. #### --------------- Behavior Switches --------------------
  23365. !! test
  23366. 1. Valid behavior switches should be escaped
  23367. !! options
  23368. parsoid=html2wt
  23369. !! html/parsoid
  23370. __TOC__
  23371. <i>__TOC__</i>
  23372. !! wikitext
  23373. <nowiki>__TOC__</nowiki>
  23374. ''<nowiki>__TOC__</nowiki>''
  23375. !! end
  23376. !! test
  23377. 2. Invalid behavior switches should not be escaped
  23378. !! options
  23379. parsoid=html2wt
  23380. !! html/parsoid
  23381. __TOO__
  23382. __|__
  23383. !! wikitext
  23384. __TOO__
  23385. __|__
  23386. !! end
  23387. # We use indent-pre as an indirect way to test for sol-transparent behavior.
  23388. !! test
  23389. Behavior switches should be SOL-transparent
  23390. !! options
  23391. parsoid=html2wt
  23392. !! html/parsoid
  23393. <meta property="mw:PageProp/toc" />
  23394. <!-- this one's bogus -->
  23395. <pre>__TOO__</pre>
  23396. <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
  23397. <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
  23398. !! wikitext
  23399. __TOC__
  23400. <!-- this one's bogus -->
  23401. __TOO__
  23402. __TOC__ foo
  23403. __TOC__
  23404. bar
  23405. !! end
  23406. #### --------------- HTML tags ---------------
  23407. #### 1. a tags
  23408. #### 2. other tags
  23409. #### 3. multi-line html tag
  23410. #### 4. extension tags
  23411. #### -----------------------------------------
  23412. !! test
  23413. 1. a tags
  23414. !! options
  23415. parsoid=html2wt
  23416. !! html/parsoid
  23417. &lt;a href=&quot;http://google.com&quot;&gt;google&lt;/a&gt;
  23418. !! wikitext
  23419. <a href="http://google.com">google</a>
  23420. !! end
  23421. !! test
  23422. 2. other tags
  23423. !! options
  23424. parsoid=html2wt
  23425. !! html/parsoid
  23426. <ul><li> &lt;div&gt;foo&lt;/div&gt;</li>
  23427. <li> &lt;div style=&quot;color:red&quot;&gt;foo&lt;/div&gt;</li>
  23428. <li> &lt;td&gt;</li></ul>
  23429. !! wikitext
  23430. * <nowiki><div>foo</div></nowiki>
  23431. * <nowiki><div style="color:red">foo</div></nowiki>
  23432. * <nowiki><td></nowiki>
  23433. !! end
  23434. !! test
  23435. 3. multi-line html tag
  23436. !! options
  23437. parsoid=html2wt
  23438. !! html/parsoid
  23439. <p>&lt;div
  23440. &gt;foo&lt;/div
  23441. &gt;
  23442. </p>
  23443. !! wikitext
  23444. <nowiki><div
  23445. >foo</div
  23446. ></nowiki>
  23447. !! end
  23448. !! test
  23449. 4. extension tags
  23450. !! options
  23451. parsoid=html2wt
  23452. !! html/parsoid
  23453. <p>&lt;ref&gt;foo&lt;/ref&gt;
  23454. </p><p>&lt;ref&gt;bar
  23455. </p><p>baz&lt;/ref&gt;
  23456. </p>
  23457. !! wikitext
  23458. <nowiki><ref>foo</ref></nowiki>
  23459. <nowiki><ref>bar</nowiki>
  23460. baz<nowiki></ref></nowiki>
  23461. !! end
  23462. #### --------------- Others ---------------
  23463. !! test
  23464. Escaping nowikis
  23465. !! options
  23466. parsoid=html2wt
  23467. !! html/parsoid
  23468. <p>&lt;nowiki&gt;foo&lt;/nowiki&gt;
  23469. </p>
  23470. !! wikitext
  23471. &lt;nowiki&gt;foo&lt;/nowiki&gt;
  23472. !! end
  23473. ## The quote-char in the input is necessary for triggering the bug
  23474. !! test
  23475. (T54035) Nowiki-escaping should not get tripped by " :" in text
  23476. !! options
  23477. parsoid=html2wt
  23478. !! html/parsoid
  23479. <p>foo's bar :</p>
  23480. !! wikitext
  23481. foo's bar :
  23482. !! end
  23483. #----------- End of wikitext escaping tests --------------
  23484. !! test
  23485. Tag-like HTML structures are passed through as text
  23486. !! wikitext
  23487. <x y>
  23488. <x.y>
  23489. <x-y>
  23490. 1>2
  23491. x<y
  23492. a>b
  23493. 1<d e>f
  23494. !! html
  23495. <p>&lt;x y&gt;
  23496. </p><p>&lt;x.y&gt;
  23497. </p><p>&lt;x-y&gt;
  23498. </p><p>1&gt;2
  23499. </p><p>x&lt;y
  23500. </p><p>a&gt;b
  23501. </p><p>1&lt;d e&gt;f
  23502. </p>
  23503. !! end
  23504. !! test
  23505. HTML tag with necessary entities in attributes
  23506. !! wikitext
  23507. <span title="&amp;amp;">foo</span>
  23508. !! html
  23509. <p><span title="&amp;amp;">foo</span>
  23510. </p>
  23511. !! end
  23512. !! test
  23513. HTML tag with 'unnecessary' entity encoding in attributes
  23514. !! wikitext
  23515. <span title="&amp;">foo</span>
  23516. !! html
  23517. <p><span title="&amp;">foo</span>
  23518. </p>
  23519. !! end
  23520. !! test
  23521. HTML tag with broken attribute value quoting
  23522. !! options
  23523. parsoid=wt2html,html2html
  23524. !! wikitext
  23525. <span title="Hello world>Foo</span>
  23526. !! html/php
  23527. <p><span title="Hello world">Foo</span>
  23528. </p>
  23529. !! html/parsoid
  23530. <p><span title="Hello world">Foo</span></p>
  23531. !! end
  23532. !! test
  23533. Self-closed tag with broken attribute value quoting
  23534. !! options
  23535. parsoid=wt2html,html2html
  23536. !! wikitext
  23537. <div title="Hello world />Foo
  23538. !! html/php+tidy
  23539. <div title="Hello world"></div><p>Foo
  23540. </p>
  23541. !! html/parsoid
  23542. <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
  23543. !! end
  23544. !! test
  23545. Table with broken attribute value quoting
  23546. !! options
  23547. parsoid=wt2html,html2html
  23548. !! wikitext
  23549. {|
  23550. | title="Hello world|Foo
  23551. |}
  23552. !! html/php
  23553. <table>
  23554. <tr>
  23555. <td title="Hello world">Foo
  23556. </td></tr></table>
  23557. !! html/parsoid
  23558. <table>
  23559. <tr>
  23560. <td title="Hello world">Foo
  23561. </td></tr></table>
  23562. !! end
  23563. !! test
  23564. Table with broken attribute value quoting on consecutive lines
  23565. !! options
  23566. parsoid=wt2html,html2html
  23567. !! wikitext
  23568. {|
  23569. | title="Hello world|Foo
  23570. | style="color:red|Bar
  23571. |}
  23572. !! html/php
  23573. <table>
  23574. <tr>
  23575. <td title="Hello world">Foo
  23576. </td>
  23577. <td style="color:red">Bar
  23578. </td></tr></table>
  23579. !! html/parsoid
  23580. <table><tbody>
  23581. <tr>
  23582. <td title="Hello world">Foo
  23583. </td><td style="color: red">Bar
  23584. </td></tr></tbody></table>
  23585. !! end
  23586. !!test
  23587. Accept empty td cell attribute
  23588. !! wikitext
  23589. {|
  23590. | align="center" |foo|| |
  23591. |}
  23592. !! html
  23593. <table>
  23594. <tr>
  23595. <td align="center">foo</td>
  23596. <td>
  23597. </td></tr></table>
  23598. !!end
  23599. !!test
  23600. Non-empty attributes in th-cells
  23601. !! wikitext
  23602. {|
  23603. !Foo!! style="color: red" |Bar
  23604. |}
  23605. !! html
  23606. <table>
  23607. <tr>
  23608. <th>Foo</th>
  23609. <th style="color: red">Bar
  23610. </th></tr></table>
  23611. !!end
  23612. !!test
  23613. Accept empty attributes in th-cells
  23614. !! wikitext
  23615. {|
  23616. !|foo!!|bar
  23617. |}
  23618. !! html
  23619. <table>
  23620. <tr>
  23621. <th>foo</th>
  23622. <th>bar
  23623. </th></tr></table>
  23624. !!end
  23625. !!test
  23626. Empty table rows go away
  23627. !! wikitext
  23628. {|
  23629. |Hello
  23630. |there
  23631. |- class="foo"
  23632. |-
  23633. |}
  23634. !! html
  23635. <table>
  23636. <tr>
  23637. <td>Hello
  23638. </td>
  23639. <td>there
  23640. </td></tr>
  23641. </table>
  23642. !! end
  23643. ###
  23644. ### Parsoid-centric tests for testing RTing of inter-element separators
  23645. ### Edge cases not tested by existing parser tests and specific to
  23646. ### Parsoid-specific serialization strategies.
  23647. ###
  23648. !!test
  23649. RT-ed inter-element separators should be valid separators
  23650. !! wikitext
  23651. {|
  23652. |- [[foo]]
  23653. |}
  23654. !! html/php
  23655. <table>
  23656. </table>
  23657. !! html/parsoid
  23658. <table>
  23659. <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
  23660. </tbody></table>
  23661. !!end
  23662. # Parsoid-only test of a DOM pass
  23663. !!test
  23664. Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
  23665. !! wikitext
  23666. {|
  23667. |<small>foo
  23668. bar
  23669. |}
  23670. {|
  23671. |<small>foo<small>
  23672. |}
  23673. !! html/parsoid
  23674. <table>
  23675. <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
  23676. <p>bar</p></small></td></tr>
  23677. </tbody></table>
  23678. <table>
  23679. <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo<small data-parsoid='{"stx":"html","autoInsertedEnd":true}'></small></small></td></tr>
  23680. </tbody></table>
  23681. !!end
  23682. # Note that the "style" attribute is really a template parameter here.
  23683. # The = would have to be {{=}} if you wanted the literal.
  23684. !!test
  23685. Empty TD followed by TD with tpl-generated attribute
  23686. !! wikitext
  23687. {|
  23688. |-
  23689. |
  23690. |{{echo|style='color:red'}}|foo
  23691. |}
  23692. !! html
  23693. <table>
  23694. <tr>
  23695. <td>
  23696. </td>
  23697. <td>foo
  23698. </td></tr></table>
  23699. !!end
  23700. !!test
  23701. Indented table with an empty td
  23702. !! wikitext
  23703. {|
  23704. |-
  23705. |
  23706. |foo
  23707. |}
  23708. !! html
  23709. <table>
  23710. <tr>
  23711. <td>
  23712. </td>
  23713. <td>foo
  23714. </td></tr></table>
  23715. !!end
  23716. ## We have some newline diffs RT-ing this edge case
  23717. ## and it is not important enough -- we seem to be emitting
  23718. ## at most 2 newlines after a </tr> and this is unrelated to
  23719. ## the issue from T85627 that this is testing.
  23720. !!test
  23721. Indented table with blank lines in between (T85627)
  23722. !! options
  23723. parsoid=wt2html
  23724. !! wikitext
  23725. {|
  23726. |foo
  23727. |}
  23728. !! html
  23729. <table>
  23730. <tr>
  23731. <td>foo
  23732. </td></tr></table>
  23733. !!end
  23734. !!test
  23735. Indented block & table
  23736. !! wikitext
  23737. <div>foo</div>
  23738. {|
  23739. |foo
  23740. |}
  23741. !! html/php
  23742. <div>foo</div>
  23743. <table>
  23744. <tr>
  23745. <td>foo
  23746. </td></tr></table>
  23747. !! html/parsoid
  23748. <div data-parsoid='{"stx":"html"}'>foo</div>
  23749. <table><tbody>
  23750. <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
  23751. </tbody></table>
  23752. !!end
  23753. !! test
  23754. Indent and comment before table row
  23755. !! wikitext
  23756. {|
  23757. <!--hi-->|-
  23758. |there
  23759. |}
  23760. !! html/php
  23761. <table>
  23762. <tr>
  23763. <td>there
  23764. </td></tr></table>
  23765. !! html/parsoid
  23766. <table>
  23767. <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
  23768. <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
  23769. </tbody></table>
  23770. !! end
  23771. # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
  23772. !!test
  23773. Empty TR followed by a template-generated TR
  23774. !!options
  23775. parsoid
  23776. !! wikitext
  23777. {|
  23778. |-
  23779. {{echo|<tr><td>foo</td></tr>}}
  23780. |}
  23781. !! html
  23782. <table>
  23783. <tbody>
  23784. <tr class='mw-empty-elt'></tr>
  23785. <tr about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<tr><td>foo</td></tr>"}},"i":0}}]}'>
  23786. <td>foo</td></tr>
  23787. </tbody></table>
  23788. !!end
  23789. ## PHP and parsoid output differ for this, and since this is primarily
  23790. ## for testing Parsoid's serializer, marking this Parsoid only
  23791. !!test
  23792. Empty TR followed by mixed-ws-comment line should RT correctly
  23793. !!options
  23794. parsoid
  23795. !! wikitext
  23796. {|
  23797. |-
  23798. <!--c-->
  23799. |-
  23800. <!--c--> <!--d-->
  23801. |}
  23802. !! html
  23803. <table>
  23804. <tbody>
  23805. <tr class='mw-empty-elt'></tr>
  23806. <!--c-->
  23807. <tr>
  23808. <!--c--> </tr><!--d-->
  23809. </tbody></table>
  23810. !!end
  23811. !!test
  23812. Multi-line image caption generated by templates with/without trailing newlines
  23813. !! wikitext
  23814. [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
  23815. [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
  23816. !! html/parsoid
  23817. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt9" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt10" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt11" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span></figcaption></figure>
  23818. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/300px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="34" width="300"/></a><figcaption>foo\n<span about="#mwt12" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"A"}},"i":0}}]}'>A</span>\n<span about="#mwt13" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"B"}},"i":0}}]}'>B</span>\n<span about="#mwt14" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"C"}},"i":0}}]}'>C</span>\n\n</figcaption></figure>
  23819. !!end
  23820. !! test
  23821. New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
  23822. !! options
  23823. parsoid=html2wt
  23824. !! html/parsoid
  23825. <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"&lt;includeonly>foo&lt;/includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
  23826. <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
  23827. !! wikitext
  23828. <includeonly>foo</includeonly>
  23829. new para
  23830. [[Category:Foo]]
  23831. = new heading =
  23832. !! end
  23833. ## PHP emits broken html for this, and since this is primarily
  23834. ## a Parsoid serializer test, marking this Parsoid only
  23835. !!test
  23836. Improperly nested inline or quotes tags with whitespace in between
  23837. !! wikitext
  23838. <span> <s>x</span> </s>
  23839. ''' ''x''' ''
  23840. !! html/parsoid
  23841. <p><span> <s>x</s></span><s> </s>
  23842. <b> <i>x</i></b><i> </i>
  23843. </p>
  23844. !!end
  23845. !!test
  23846. Encapsulate protected attributes from wt
  23847. !! wikitext
  23848. <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
  23849. {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
  23850. | ok
  23851. |}
  23852. !! html/parsoid
  23853. <div data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">foo</div>
  23854. <table data-x-typeof="mw:placeholder stuff" data-x-data-mw="whoo" data-x-data-parsoid="weird" data-x-data-parsoid-other="no" data-x-about="time" data-x-rel="mw:true">
  23855. <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
  23856. </tbody></table>
  23857. !!end
  23858. ## Currently the p-wrapper is fragile in how it adds / removes transformations.
  23859. ## Having nested or stray pre tags results in the attempt to add duplicates,
  23860. ## causing an assertion fail. This test tries to prevent that situation.
  23861. !!test
  23862. Ensure ParagraphWrapper can deal with stray closing pre tags
  23863. !!options
  23864. parsoid=wt2html
  23865. !! wikitext
  23866. plain text</pre>
  23867. !! html/parsoid
  23868. plain text
  23869. !!end
  23870. !!test
  23871. 1. Ensure fostered text content is wrapped in element nodes
  23872. !!options
  23873. parsoid=wt2html
  23874. !! wikitext
  23875. <table>hi</table><table>ho</table>
  23876. !! html/parsoid
  23877. <p>hi</p>
  23878. <table></table>
  23879. <p>ho</p>
  23880. <table></table>
  23881. !!end
  23882. !!test
  23883. 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
  23884. !!options
  23885. parsoid=wt2html,wt2wt
  23886. !! wikitext
  23887. <table>
  23888. <tr> || ||
  23889. <td> a
  23890. </table>
  23891. !! html/parsoid
  23892. <p> || ||
  23893. </p><table>
  23894. <tbody><tr><td> a</td></tr>
  23895. </tbody></table>
  23896. !!end
  23897. !!test
  23898. Encapsulation properly handles null DSR information from foster box
  23899. !!options
  23900. parsoid=wt2html,wt2wt
  23901. !! wikitext
  23902. {{echo|<table>foo<tr><td>bar</td></tr></table>}}
  23903. !! html/parsoid
  23904. <span typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<table>foo<tr><td>bar</td></tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
  23905. !!end
  23906. !!test
  23907. 1. Encapsulate foster-parented transclusion content
  23908. !!options
  23909. parsoid=wt2wt,wt2html
  23910. !! wikitext
  23911. <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
  23912. !! html/parsoid
  23913. <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo<tr><td>bar</td></tr>&quot;}},&quot;i&quot;:0}},&quot;</table>&quot;]}">foo</p><table>
  23914. <tbody>
  23915. <tr>
  23916. <td>bar</td>
  23917. </tr>
  23918. </tbody>
  23919. </table>
  23920. !!end
  23921. !!test
  23922. 2. Encapsulate foster-parented transclusion content
  23923. !!options
  23924. parsoid=wt2wt,wt2html
  23925. !! wikitext
  23926. <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
  23927. !! html/parsoid
  23928. <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo&quot;}},&quot;i&quot;:0}},&quot;</div><tr><td>bar</td></tr></table>&quot;]}">foo</div>
  23929. <table>
  23930. <tbody>
  23931. <tr>
  23932. <td>bar</td>
  23933. </tr>
  23934. </tbody>
  23935. </table>
  23936. !!end
  23937. !!test
  23938. 3. Encapsulate foster-parented transclusion content
  23939. !!options
  23940. parsoid=wt2wt,wt2html
  23941. !! wikitext
  23942. <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
  23943. !! html/parsoid
  23944. <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
  23945. <p>foo</p>
  23946. </div>
  23947. <table>
  23948. <tbody>
  23949. <tr>
  23950. <td>bar</td>
  23951. </tr>
  23952. </tbody>
  23953. </table>
  23954. !!end
  23955. !!test
  23956. 4. Encapsulate foster-parented transclusion content
  23957. !!options
  23958. parsoid=wt2wt,wt2html
  23959. !! wikitext
  23960. <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
  23961. !! html/parsoid
  23962. <div typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div><tr><td>&quot;}},&quot;i&quot;:0}},&quot;bar</td></tr></table>&quot;]}">
  23963. <p>foo</p>
  23964. </div>
  23965. <table>
  23966. <tbody>
  23967. <tr>
  23968. <td>bar</td>
  23969. </tr>
  23970. </tbody>
  23971. </table>
  23972. !!end
  23973. !!test
  23974. 5. Encapsulate foster-parented transclusion content
  23975. !!options
  23976. parsoid=wt2wt,wt2html
  23977. !! wikitext
  23978. <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
  23979. !! html/parsoid
  23980. <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo&quot;}},&quot;i&quot;:0}},&quot;</tr></table>&quot;]}">foo</p>
  23981. <table>
  23982. <tbody>
  23983. <tr>
  23984. <td>
  23985. <div>
  23986. <p>foo</p>
  23987. </div>
  23988. </td>
  23989. </tr>
  23990. </tbody>
  23991. </table>
  23992. !!end
  23993. !!test
  23994. 6. Encapsulate foster-parented transclusion content
  23995. !!options
  23996. parsoid=wt2wt,wt2html
  23997. !! wikitext
  23998. <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
  23999. !! html/parsoid
  24000. <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table><tr><td><div><p>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;foo</p></div></td>foo</tr></table>&quot;}},&quot;i&quot;:0}}]}">foo</p>
  24001. <table>
  24002. <tbody>
  24003. <tr>
  24004. <td>
  24005. <div>
  24006. <p>foo</p>
  24007. </div>
  24008. </td>
  24009. </tr>
  24010. </tbody>
  24011. </table>
  24012. <p>ok</p>
  24013. !!end
  24014. !!test
  24015. 7. Encapsulate foster-parented transclusion content
  24016. !!options
  24017. parsoid=wt2wt,wt2html
  24018. !! wikitext
  24019. <table>{{echo|<p>foo</p>}}<td>bar</td></table>
  24020. !! html/parsoid
  24021. <p typeof="mw:Transclusion" data-mw="{&quot;parts&quot;:[&quot;<table>&quot;,{&quot;template&quot;:{&quot;target&quot;:{&quot;wt&quot;:&quot;echo&quot;,&quot;href&quot;:&quot;./Template:Echo&quot;},&quot;params&quot;:{&quot;1&quot;:{&quot;wt&quot;:&quot;<p>foo</p>&quot;}},&quot;i&quot;:0}},&quot;<td>bar</td></table>&quot;]}">foo</p>
  24022. <table>
  24023. <tbody>
  24024. <tr>
  24025. <td>bar</td>
  24026. </tr>
  24027. </tbody>
  24028. </table>
  24029. !!end
  24030. # Note that the wt is broken on purpose: the = should be {{=}} if you
  24031. # don't want it to be a template parameter key.
  24032. !!test
  24033. 8. Encapsulate foster-parented transclusion content
  24034. !!options
  24035. parsoid=wt2wt,wt2html
  24036. !! wikitext
  24037. {{echo|a
  24038. }}{|{{echo|style='color:red'}}
  24039. |-
  24040. |b
  24041. |}
  24042. !! html/parsoid
  24043. <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
  24044. <span> </span>
  24045. <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"&#39;color:red&#39;"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
  24046. <table>
  24047. <tbody>
  24048. <tr>
  24049. <td>b</td>
  24050. </tr>
  24051. </tbody>
  24052. </table>
  24053. !!end
  24054. !!test
  24055. 9. Encapsulate foster-parented transclusion content
  24056. !!options
  24057. parsoid=wt2wt,wt2html
  24058. !! wikitext
  24059. <table>{{echo|hi</table>hello}}
  24060. !! html/parsoid
  24061. <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi&lt;/table>hello"}},"i":0}}]}' data-parsoid='{"fostered":true,"autoInsertedEnd":true,"autoInsertedStart":true,"pi":[[{"k":"1"}]]}'>hi</p><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><p about="#mwt2">hello</p>
  24062. !!end
  24063. !!test
  24064. Table in fosterable position
  24065. !!options
  24066. parsoid=wt2html
  24067. !! wikitext
  24068. {{OpenTable}}
  24069. <div>
  24070. {|
  24071. |}
  24072. </div>
  24073. |}
  24074. !! html/parsoid
  24075. <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n&lt;div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
  24076. </span>
  24077. <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
  24078. <table>
  24079. </table>
  24080. !!end
  24081. # Parsoid only for T66747
  24082. !! test
  24083. Properly encapsulate empty-content transclusions in fosterable positions
  24084. !! wikitext
  24085. <table>
  24086. {{#if:|
  24087. <td>foo</td>
  24088. }}
  24089. </table>
  24090. !! html/parsoid
  24091. <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["&lt;table>\n",{"template":{"target":{"wt":"#if:","function":"if"},"params":{"1":{"wt":"\n&lt;td>foo&lt;/td>\n"}},"i":0}},"\n&lt;/table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}'>
  24092. </table>
  24093. !! end
  24094. !! test
  24095. Always encapsulate foster box when template range is expanded to table
  24096. !! options
  24097. parsoid=wt2wt
  24098. !! wikitext
  24099. {|
  24100. hello
  24101. {{OpenTable}}
  24102. |}
  24103. !! html/parsoid
  24104. !! end
  24105. !! test
  24106. T115289: Unclosed table
  24107. !! wikitext
  24108. {{echo|<table>}}<!--c-->[[Category:Two]]
  24109. !! html/parsoid
  24110. <link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;table>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
  24111. !! end
  24112. !! test
  24113. T115289: Don't migrate newlines out of tables with fostered content
  24114. !! wikitext
  24115. <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
  24116. !! html/parsoid
  24117. <link rel="mw:PageProp/Category" href="./Category:One" about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"stx":"simple","a":{"href":"./Category:One"},"sa":{"href":"Category:One"},"fostered":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":["&lt;table>&lt;td>&lt;/td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>[[Category:One]]"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'/><link rel="mw:PageProp/Category" href="./Category:Two" about="#mwt2"/><table about="#mwt2" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr><td></td></tr><tr><!--c--></tr></tbody></table>
  24118. !! end
  24119. !! test
  24120. T73074: More fostering fun
  24121. !! wikitext
  24122. <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
  24123. !! html/parsoid
  24124. <link rel="mw:PageProp/Category" href="./Category:Two" data-parsoid='{"stx":"simple","a":{"href":"./Category:Two"},"sa":{"href":"Category:Two"},"fostered":true}'/><table data-parsoid='{"stx":"html","autoInsertedEnd":true}'><tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"stx":"html"}'></td></tr><tr about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;tr>"}},"i":0}},"&lt;!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
  24125. !! end
  24126. !!test
  24127. Support <object> element with .data attribute
  24128. !!options
  24129. parsoid=html2wt
  24130. !! html/parsoid
  24131. <object data="test.swf"></object>
  24132. !! wikitext
  24133. <object data="test.swf"></object>
  24134. !!end
  24135. !! test
  24136. Don't block XML namespace declaration
  24137. !! wikitext
  24138. <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
  24139. !! html/php
  24140. <p><span xmlns:dct="http&#58;//purl.org/dc/terms/" property="dct:title">MediaWiki</span>
  24141. </p>
  24142. !! html/parsoid
  24143. <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
  24144. !! end
  24145. # -----------------------------------------------------------------
  24146. # The following section of tests are primarily to spec requirements
  24147. # around Parsoid's serialization (old, new, edited content)
  24148. #
  24149. # All these tests are marked Parsoid html2wt and html2html only
  24150. # ----------------------------------------------------------------
  24151. !! test
  24152. Ignore rel attribute in a-tags during serialization to url-links
  24153. !! options
  24154. parsoid=html2wt
  24155. !! html/parsoid
  24156. <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
  24157. <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
  24158. <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
  24159. !! wikitext
  24160. http://en.wikipedia.org/wiki/Foobar
  24161. http://en.wikipedia.org/wiki/Foobar
  24162. http://en.wikipedia.org/wiki/Foobar
  24163. !! end
  24164. # 'mi' is a localinterwiki prefix as well as a language
  24165. !! test
  24166. Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
  24167. !! options
  24168. parsoid=html2wt
  24169. !! html/parsoid
  24170. <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
  24171. !! wikitext
  24172. [[Foo]]
  24173. !! end
  24174. !! test
  24175. Parsoid should accept interwiki shortcuts
  24176. !! options
  24177. parsoid=html2wt
  24178. !! html/parsoid
  24179. <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
  24180. <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
  24181. <a href='./fr:Foo'>Foo</a></p>
  24182. <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
  24183. <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
  24184. <a href='fr%3AFoo'>Foo</a></p>
  24185. <p><a href='FR%3AFoo'>Foo</a>
  24186. <a href='./FR:Foo'>Foo</a></p>
  24187. !! wikitext
  24188. [[:fr:Foo|Foo]]
  24189. [[:fr:Foo|Foo]]
  24190. [[:fr:Foo|Foo]]
  24191. [[:fr:Foo|Foo]]
  24192. [[:fr:Foo|Foo]]
  24193. [[:fr:Foo|Foo]]
  24194. [[:fr:Foo|Foo]]
  24195. [[:fr:Foo|Foo]]
  24196. !! end
  24197. !! test
  24198. Parsoid should not accept invalid interwiki shortcuts
  24199. !! options
  24200. parsoid=html2wt
  24201. !! html/parsoid
  24202. <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
  24203. <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
  24204. <a href='news:Foo'>Foo</a></p>
  24205. !! wikitext
  24206. [news:Foo Foo]
  24207. [news:Foo Foo]
  24208. [news:Foo Foo]
  24209. !! end
  24210. # See T93839
  24211. !! test
  24212. New wikilinks should be serialized properly
  24213. !! options
  24214. parsoid=html2wt
  24215. !! html/parsoid
  24216. <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
  24217. <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
  24218. <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
  24219. <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
  24220. <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
  24221. !! wikitext
  24222. [[Foo]]
  24223. [[Foo]]
  24224. [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
  24225. http://en.wikipedia.org/wiki/Foo
  24226. [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
  24227. !! end
  24228. !! test
  24229. New wiki links (href variations)
  24230. !! options
  24231. parsoid=html2wt
  24232. !! html/parsoid
  24233. <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
  24234. <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
  24235. <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
  24236. <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
  24237. !! wikitext
  24238. [[Foo_bar]]
  24239. [[Foo_bar]]
  24240. [[Foo_bar]]
  24241. [[Toxine bactérienne]]
  24242. !! end
  24243. !! test
  24244. New wiki links (content string variations)
  24245. !! options
  24246. parsoid=html2wt
  24247. !! html/parsoid
  24248. <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
  24249. <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
  24250. <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
  24251. !! wikitext
  24252. [[Foo_bar]]
  24253. [[Foo bar]]
  24254. [[Foo_bar|./Foo_bar]]
  24255. !! end
  24256. !! test
  24257. New category links (href variations)
  24258. !! options
  24259. parsoid=html2wt
  24260. !! html/parsoid
  24261. <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
  24262. <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
  24263. <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
  24264. !! wikitext
  24265. [[Category:Toxine bactérienne]]
  24266. [[Category:Toxine bactérienne]]
  24267. [[Category:Toxine bactérienne]]
  24268. !! end
  24269. !! test
  24270. New sol transparent links don't need indent-pre nowiki protection
  24271. !! options
  24272. parsoid=html2wt
  24273. language=de
  24274. !! html/parsoid
  24275. <link rel="mw:PageProp/redirect" href="./Main_Page">
  24276. <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
  24277. <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
  24278. !! wikitext
  24279. #WEITERLEITUNG [[Main Page]]
  24280. <!-- this is good --> [[Category:Good]]
  24281. <!-- this is great --> [[Kategorie:Great]]
  24282. !! end
  24283. !! test
  24284. New interlanguage links (href variations)
  24285. !! options
  24286. parsoid=html2wt
  24287. !! html/parsoid
  24288. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
  24289. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
  24290. <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
  24291. !! wikitext
  24292. [[es:Toxine bactérienne]]
  24293. [[es:Toxine_bactérienne]]
  24294. [[es:Toxine_bactérienne]]
  24295. !! end
  24296. !! test
  24297. Image: Modifying size of an image (1)
  24298. !! options
  24299. parsoid={
  24300. "modes": ["wt2wt"],
  24301. "changes": [
  24302. ["img[height]", "attr", "height", "22"],
  24303. ["img[width]", "attr", "width", "200"]
  24304. ]
  24305. }
  24306. !! wikitext
  24307. [[Image:Foobar.jpg|230x230px]]
  24308. !! wikitext/edited
  24309. [[Image:Foobar.jpg|200x200px]]
  24310. !!end
  24311. !! test
  24312. Image: Modifying size of an image (2)
  24313. !! options
  24314. parsoid={
  24315. "modes": ["wt2wt"],
  24316. "changes": [
  24317. ["img[height]", "attr", "height", "100"],
  24318. ["img[width]", "attr", "width", "500"]
  24319. ]
  24320. }
  24321. !! wikitext
  24322. [[Image:Foobar.jpg|230x230px]]
  24323. !! wikitext/edited
  24324. [[Image:Foobar.jpg|500x500px]]
  24325. !!end
  24326. # Change in size is ignored so long as class='mw-default-size'
  24327. !! test
  24328. Image: Modifying size of an image (3)
  24329. !! options
  24330. parsoid={
  24331. "modes": ["wt2wt"],
  24332. "changes": [
  24333. ["figure[class]", "removeClass", "mw-default-size"],
  24334. ["figure img", "attr", "height", "19"],
  24335. ["figure img", "attr", "width", "170"]
  24336. ]
  24337. }
  24338. !! wikitext
  24339. [[Image:Foobar.jpg|thumb]]
  24340. !! wikitext/edited
  24341. [[Image:Foobar.jpg|thumb|170x170px]]
  24342. !!end
  24343. !! test
  24344. Image: Modifying alignment of an image (T50665)
  24345. !! options
  24346. parsoid={
  24347. "modes": ["wt2wt"],
  24348. "changes": [
  24349. ["figure[class]", "removeClass", "mw-halign-right"],
  24350. ["figure[class]", "addClass", "mw-halign-left"]
  24351. ]
  24352. }
  24353. !! wikitext
  24354. [[Image:Foobar.jpg|thumb|caption|right]]
  24355. !! wikitext/edited
  24356. [[Image:Foobar.jpg|thumb|caption|left]]
  24357. !! end
  24358. !! test
  24359. Image: Modifying mw-default-size of an frameless image (T64805)
  24360. !! options
  24361. parsoid={
  24362. "modes": ["wt2wt"],
  24363. "changes": [
  24364. ["figure.mw-default-size", "removeClass", "mw-default-size"]
  24365. ]
  24366. }
  24367. !! wikitext
  24368. [[Image:Foobar.jpg|frameless|right]]
  24369. !! wikitext/edited
  24370. [[Image:Foobar.jpg|frameless|right|220x220px]]
  24371. !! end
  24372. !! test
  24373. Image: Modifying valign of an image (T51221)
  24374. !! options
  24375. parsoid={
  24376. "modes": ["wt2wt"],
  24377. "changes": [
  24378. ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
  24379. ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
  24380. ]
  24381. }
  24382. !! wikitext
  24383. [[File:Foobar.jpg|20px|middle]]
  24384. !! wikitext/edited
  24385. [[File:Foobar.jpg|20px|text-top]]
  24386. !! end
  24387. !! test
  24388. Image: Modifying alt attribute of an image (T58400)
  24389. !! options
  24390. parsoid={
  24391. "modes": ["wt2wt"],
  24392. "changes": [
  24393. ["img[alt]", "attr", "alt", "some alternate edited text"]
  24394. ]
  24395. }
  24396. !! wikitext
  24397. [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
  24398. !! wikitext/edited
  24399. [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
  24400. !!end
  24401. !! test
  24402. Image: Modifying caption of an image
  24403. !! options
  24404. parsoid={
  24405. "modes": ["wt2wt"],
  24406. "changes": [
  24407. ["figcaption", "text", "new caption"]
  24408. ]
  24409. }
  24410. !! wikitext
  24411. [[Image:Foobar.jpg|thumb|original caption]]
  24412. !! wikitext/edited
  24413. [[Image:Foobar.jpg|thumb|new caption]]
  24414. !!end
  24415. !! test
  24416. Image: empty alt attribute (T50924)
  24417. !! options
  24418. parsoid
  24419. !! wikitext
  24420. [[File:Foobar.jpg|thumb|alt=|bar]]
  24421. !! html
  24422. <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"alt","ak":"alt="},{"ck":"caption","ak":"bar"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img alt="" resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220" data-parsoid='{"a":{"alt":"","resource":"./File:Foobar.jpg","height":"25","width":"220"},"sa":{"alt":"alt=","resource":"File:Foobar.jpg"}}'/></a><figcaption>bar</figcaption></figure>
  24423. !! end
  24424. !! test
  24425. Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
  24426. !! options
  24427. parsoid=html2wt
  24428. language=ar
  24429. disabled
  24430. !! html/parsoid
  24431. <figure class="mw-default-size mw-halign-right" typeof="mw:Image/Thumb"><a href="./Imagen:Foobar.jpg"><img resource="./Imagen:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="20" width="180"/></a></figure>
  24432. !! wikitext
  24433. [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
  24434. !! end
  24435. !! test
  24436. Image: Block level image should have \n before and after
  24437. !! wikitext
  24438. 123
  24439. [[File:Foobar.jpg|right|thumb|150x150px]]
  24440. 456
  24441. !! html/parsoid
  24442. <p>123</p>
  24443. <figure class="mw-halign-right" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150"/></a></figure>
  24444. <p>456</p>
  24445. !! end
  24446. !! test
  24447. Image: New block level image should have \n before and after (existing content)
  24448. !! wikitext
  24449. 123
  24450. [[File:Foobar.jpg|right|thumb|150x150px]]
  24451. 456
  24452. !! html/parsoid
  24453. <p>123</p>
  24454. <figure class="mw-halign-right" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"right","ak":"right"},{"ck":"thumbnail","ak":"thumb"},{"ck":"width","ak":"150x150px"}]}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"}}'><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/150px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="17" width="150" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"17","width":"150"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure>
  24455. <p>456</p>
  24456. !! end
  24457. !! test
  24458. Image: upright option (parsoid)
  24459. !! wikitext
  24460. [[File:Foobar.jpg|thumb|upright|caption]]
  24461. [[File:Foobar.jpg|thumb|upright=0.5|caption]]
  24462. [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
  24463. !! html/parsoid
  24464. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/170px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="19" width="170"/></a><figcaption>caption</figcaption></figure>
  24465. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/110px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="12" width="110"/></a><figcaption>caption</figcaption></figure>
  24466. <figure typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a><figcaption>caption</figcaption></figure>
  24467. !! end
  24468. !! test
  24469. Image: upright option is ignored on inline and frame images (parsoid)
  24470. !! wikitext
  24471. [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
  24472. !! html/parsoid
  24473. <p><figure-inline typeof="mw:Image" data-mw='{"caption":"caption"}'><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/500px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="57" width="500"/></a></figure-inline></p>
  24474. !! end
  24475. !! test
  24476. Image: in template parameter with empty parameter
  24477. !! wikitext
  24478. {{echo|[[File:Foobar.jpg|link=]]}}
  24479. !! html/parsoid
  24480. <p><figure-inline class="mw-default-size" typeof="mw:Transclusion mw:Image" about="#mwt1" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[File:Foobar.jpg|link=]]"}},"i":0}}]}'><span><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941"/></span></figure-inline></p>
  24481. !! end
  24482. !! test
  24483. Image: from basic HTML (1)
  24484. !! options
  24485. parsoid=html2wt
  24486. !! html/parsoid
  24487. <span typeof="mw:Image">
  24488. <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
  24489. </span>
  24490. !! wikitext
  24491. [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
  24492. !! end
  24493. !! test
  24494. Image: from basic HTML (2)
  24495. !! options
  24496. parsoid=html2wt
  24497. !! html/parsoid
  24498. <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
  24499. !! wikitext
  24500. [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
  24501. !! end
  24502. !! test
  24503. Image: from basic HTML (3)
  24504. !! options
  24505. parsoid=html2wt
  24506. !! html/parsoid
  24507. <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
  24508. !! wikitext
  24509. [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
  24510. !! end
  24511. !! test
  24512. Image: from basic HTML (4)
  24513. !! options
  24514. parsoid=html2wt
  24515. !! html/parsoid
  24516. <img src="./File:Foobar.jpg">
  24517. !! wikitext
  24518. [[File:Foobar.jpg|link=]]
  24519. !! end
  24520. !! test
  24521. Image: Invalid title as link
  24522. !! wikitext
  24523. [[File:Foobar.jpg|link=<]]
  24524. !! html/php
  24525. <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=&lt;"><img alt="link=&lt;" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
  24526. </p>
  24527. !! html/parsoid
  24528. <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=&lt;"}]}' data-mw='{"caption":"link=&amp;lt;"}'><a href="./File:Foobar.jpg" data-parsoid='{"a":{"href":"./File:Foobar.jpg"},"sa":{}}'><img resource="./File:Foobar.jpg" src="//example.com/images/3/3a/Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="220" width="1941" data-parsoid='{"a":{"resource":"./File:Foobar.jpg","height":"220","width":"1941"},"sa":{"resource":"File:Foobar.jpg"}}'/></a></figure-inline></p>
  24529. !! end
  24530. !! test
  24531. Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
  24532. !! options
  24533. parsoid=html2wt
  24534. !! html/parsoid
  24535. <ul>
  24536. <li><p>foo</p></li>
  24537. </ul>
  24538. !! wikitext
  24539. * foo
  24540. !! end
  24541. !! test
  24542. Lists: Serialize correctly even when list tags has unneeded whitespace between tags
  24543. !! options
  24544. parsoid=html2wt
  24545. !! html/parsoid
  24546. <ul> <li>foo</li></ul>
  24547. !! wikitext
  24548. * foo
  24549. !! end
  24550. !! test
  24551. Don't strip leading whitespace when handling indent-pre suppressing tags
  24552. !! options
  24553. parsoid=html2wt
  24554. !! html/parsoid
  24555. <table>
  24556. <tr><td> indented row</td></tr>
  24557. </table>
  24558. <blockquote><p>
  24559. <b>This is very bold of you!</b>
  24560. </p>
  24561. <table><tr><td>
  24562. indented cell (no pre-wrapping!)
  24563. </td></tr></table>
  24564. </blockquote>
  24565. <p>foo</p>
  24566. <div>bar</div>
  24567. !! wikitext
  24568. {|
  24569. | indented row
  24570. |}
  24571. <blockquote>
  24572. '''This is very bold of you!'''
  24573. {|
  24574. |
  24575. indented cell (no pre-wrapping!)
  24576. |}
  24577. </blockquote>
  24578. foo
  24579. <div>bar</div>
  24580. !! end
  24581. !! test
  24582. Nowiki-wrap leading whitespace when handling indent-pre inducing tags
  24583. !! options
  24584. parsoid=html2wt
  24585. !! html/parsoid
  24586. <p>foo</p>
  24587. <span>bar</span>
  24588. <span>foo2
  24589. </span>bar2
  24590. <div>foo</div>
  24591. <span>bar</span>
  24592. <div>
  24593. <span>foo</span>
  24594. </div>
  24595. !! wikitext
  24596. foo
  24597. <span>bar</span>
  24598. <span>foo2
  24599. <nowiki> </nowiki></span>bar2
  24600. <div>foo</div>
  24601. <nowiki> </nowiki><span>bar</span>
  24602. <div>
  24603. <nowiki> </nowiki><span>foo</span>
  24604. </div>
  24605. !! end
  24606. !! test
  24607. Lists: Dont insert newlines in a serialized list item.
  24608. !! options
  24609. parsoid=html2wt
  24610. !! html/parsoid
  24611. <ul><li>a<br>b</li><li>c</li></ul>
  24612. !! wikitext
  24613. * a<br />b
  24614. * c
  24615. !! end
  24616. !! test
  24617. 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
  24618. !! options
  24619. parsoid={
  24620. "modes": ["html2wt"],
  24621. "scrubWikitext": false
  24622. }
  24623. !! html/parsoid
  24624. <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
  24625. <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
  24626. <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
  24627. <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
  24628. <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
  24629. <h2><meta property="mw:PageProp/toc" /> ok</h2>
  24630. !! wikitext
  24631. == hello there [[Category:A1]] ==
  24632. == [[Category:A2]] hi pal ==
  24633. == <!--foo--> [[Category:A3]] how goes it ==
  24634. == it goes well [[Category:A4]] <!--bar--> ==
  24635. ==howdy [[Category:A5]]==
  24636. == __TOC__ ok ==
  24637. !! end
  24638. !! test
  24639. 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
  24640. !! options
  24641. parsoid={
  24642. "modes": ["html2wt"],
  24643. "scrubWikitext": true
  24644. }
  24645. !! html/parsoid
  24646. <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
  24647. <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
  24648. <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
  24649. <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
  24650. <h2><meta property="mw:PageProp/toc" /> ok</h2>
  24651. !! wikitext
  24652. == hello there ==
  24653. [[Category:A1]]
  24654. [[Category:A2]]
  24655. == hi pal ==
  24656. <!--foo--> [[Category:A3]]
  24657. == how goes it ==
  24658. == it goes well ==
  24659. [[Category:A4]] <!--bar-->
  24660. __TOC__
  24661. == ok ==
  24662. !! end
  24663. !! test
  24664. Headings: Don't hoist metas that come from templates
  24665. !! options
  24666. parsoid={
  24667. "modes": ["html2wt"],
  24668. "scrubWikitext": true
  24669. }
  24670. !! html/parsoid
  24671. <h2><span about="#mwt1" typeof="mw:Transclusion" data-parsoid="{}" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo [[Category:Foo]]"}},"i":0}}]}'>foo </span><link rel="mw:PageProp/Category" href="./Category:Foo" about="#mwt1" data-parsoid="{}" /></h2>
  24672. !! wikitext
  24673. == {{echo|foo [[Category:Foo]]}} ==
  24674. !! end
  24675. !! test
  24676. Headings: Category in ref isn't hoisted
  24677. !! options
  24678. parsoid={
  24679. "modes": ["html2wt"],
  24680. "scrubWikitext": true
  24681. }
  24682. !! html/parsoid
  24683. <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
  24684. <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text">bar <link rel="mw:PageProp/Category" href="./Category:Baz" /> </span></li></ol>
  24685. !! wikitext
  24686. == foo <ref>bar
  24687. [[Category:Baz]] </ref> ==
  24688. <references />
  24689. !! end
  24690. !! test
  24691. Parsoid: Serialize positional parameters with = in them as named parameter
  24692. !! options
  24693. parsoid=html2wt
  24694. !! html/parsoid
  24695. <p about="#mwt1" typeof="mw:Transclusion"
  24696. data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
  24697. <p about="#mwt1" typeof="mw:Transclusion"
  24698. data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}, "2":{"wt":"bar"}},"i":0}}]}'>foo</p>
  24699. <!--Orig params with data-parsoid has heuristics for handling = chars-->
  24700. <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
  24701. <p data-parsoid='{"pi":[[{"k":"1"},{"k":"2"}]]}' about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"},"2":{"wt":"bar"}},"i":0}}]}'>foo</p>
  24702. !! wikitext
  24703. {{echo|1=f=oo}}
  24704. {{echo|1=f=oo|2=bar}}
  24705. <!--Orig params with data-parsoid has heuristics for handling = chars-->
  24706. <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
  24707. {{echo|<nowiki>f=oo</nowiki>|bar}}
  24708. !! end
  24709. !! test
  24710. Parsoid: Serialize positional parameters with = in extlink as named parameter
  24711. !! options
  24712. parsoid=html2wt
  24713. !! html/parsoid
  24714. <p><a rel="mw:ExtLink" href="http://stuff?is=ok" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"http://stuff?is=ok"}},"i":0}}]}'>http://stuff?is=ok</a></p>
  24715. !! wikitext
  24716. {{echo|1=http://stuff?is=ok}}
  24717. !! end
  24718. !! test
  24719. Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
  24720. !! options
  24721. parsoid=html2wt
  24722. !! html/parsoid
  24723. <div>a<p>b</p></div>
  24724. <div>a
  24725. <p>b</p></div>
  24726. <div>
  24727. a
  24728. <p>b</p></div>
  24729. !! wikitext
  24730. <div>a
  24731. b
  24732. </div>
  24733. <div>a
  24734. b
  24735. </div>
  24736. <div>
  24737. a
  24738. b
  24739. </div>
  24740. !! end
  24741. !! test
  24742. Substrings resembling wikitext in hrefs should not get nowiki escapes
  24743. !! options
  24744. parsoid=html2wt
  24745. !! html/parsoid
  24746. <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
  24747. !! wikitext
  24748. [[Foo''bar''baz]]
  24749. !! end
  24750. !! test
  24751. Enforce single-line context in the serializer
  24752. !! options
  24753. parsoid=html2wt
  24754. !! html/parsoid
  24755. <h2>testing
  24756. 123</h2>
  24757. <h2> hi <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"bogus","href":"./Template:Bogus"},"params":{"1":{"wt":"there\nyou"}},"i":0}}]}'>there</span><span about="#mwt1">
  24758. </span><span about="#mwt1">you</span> </h2>
  24759. <h2> foo <span about="#mwt2" class="mw-ref" id="cite_ref-1" rel="dc:references" typeof="mw:Extension/ref" data-mw='{"name":"ref","body":{"id":"mw-reference-text-cite_note-1"},"attrs":{}}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></span> </h2>
  24760. <ol class="references" typeof="mw:Extension/references" about="#mwt3" data-mw='{"name":"references","attrs":{}}'><li about="#cite_note-1" id="cite_note-1"><span rel="mw:referencedBy"><a href="./Main_Page#cite_ref-1">↑</a></span> <span id="mw-reference-text-cite_note-1" class="mw-reference-text" data-parsoid="{}">hello
  24761. there</span></li></ol>
  24762. <ul><li>asd
  24763. sdf</li></ul>
  24764. <ul><li>foo
  24765. bar
  24766. baz</li>
  24767. <li>foo <b>bar</b>
  24768. baz</li></ul>
  24769. <dl><dt>hi
  24770. ho </dt><dd data-parsoid='{"stx":"row"}'> hi
  24771. ho</dd></dl>
  24772. <dl><dd> <table>
  24773. <tbody><tr><td> ha
  24774. ha
  24775. ha</td></tr>
  24776. </tbody></table></dd></dl>
  24777. !! wikitext
  24778. == testing 123 ==
  24779. == hi {{bogus|there
  24780. you}} ==
  24781. == foo <ref>hello
  24782. there</ref> ==
  24783. <references />
  24784. * asd sdf
  24785. * foo bar baz
  24786. * foo '''bar''' baz
  24787. ; hi ho : hi ho
  24788. : {|
  24789. | ha
  24790. ha
  24791. ha
  24792. |}
  24793. !! end
  24794. !! test
  24795. Serialize new placeholder space without spans
  24796. !! options
  24797. parsoid=html2wt
  24798. !! html/parsoid
  24799. <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
  24800. <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
  24801. <span typeof="mw:Extension/ref" data-mw="{&quot;name&quot;:&quot;ref&quot;,&quot;body&quot;:{&quot;html&quot;:&quot;foo<span typeof=\&quot;mw:Placeholder\&quot;>&amp;nbsp;</span>: bar&quot;}}"><sup>[1]</sup></span>ok</p>
  24802. !! wikitext
  24803. foo : bar
  24804. foo : bar
  24805. <ref>foo : bar</ref>ok
  24806. !! end
  24807. #-----------------------
  24808. # Tag minimization tests
  24809. #-----------------------
  24810. !! test
  24811. 1. I/B quote minimization: wikitext-only tags should be combined
  24812. !! options
  24813. parsoid=html2wt
  24814. !! html/parsoid
  24815. <p><i>A</i><i>B</i></p>
  24816. <p><b>A</b><b>B</b></p>
  24817. <p><i>A</i><b><i>B</i></b></p>
  24818. <p><b>A</b><i><b>B</b></i></p>
  24819. <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
  24820. <p><i><b>A</b></i><i><b>B</b></i></p>
  24821. <p><i><b>A</b></i><b><i>B</i></b></p>
  24822. <p><b><i>A</i></b><i><b>B</b></i></p>
  24823. !! wikitext
  24824. ''AB''
  24825. '''AB'''
  24826. ''A'''B'''''
  24827. '''A''B'''''
  24828. '''A''BC''D'''
  24829. '''''AB'''''
  24830. '''''AB'''''
  24831. '''''AB'''''
  24832. !! end
  24833. !! test
  24834. 2. I/B quote minimization: wikitext and html tags should not be combined
  24835. !! options
  24836. parsoid=html2wt
  24837. !! html/parsoid
  24838. <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
  24839. <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
  24840. !! wikitext
  24841. ''A''<i>B</i>
  24842. ''A''<nowiki/>'''<i>B</i>'''
  24843. !! end
  24844. !! test
  24845. 3. I/B quote minimization: templated content stops minimization
  24846. !! options
  24847. parsoid=html2wt
  24848. !! html/parsoid
  24849. <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;B&#39;&#39;"}},"i":0}}]}'>B</i>
  24850. <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&#39;&#39;&#39;&#39;&#39;B&#39;&#39;&#39;&#39;&#39;"}},"i":0}}]}'><i>B</i></b>
  24851. !! wikitext
  24852. ''A''{{echo|''B''}}
  24853. ''A''{{echo|'''''B'''''}}
  24854. !! end
  24855. !! test
  24856. 4. I/B quote minimization: new content should be mimimized with adjacent old content
  24857. !! options
  24858. parsoid=html2wt
  24859. !! html/parsoid
  24860. <p><i>A</i><i>B</i></p>
  24861. <p><b>A</b><b>B</b></p>
  24862. <p><i>A</i><b><i>B</i></b></p>
  24863. !! wikitext
  24864. ''AB''
  24865. '''AB'''
  24866. ''A'''B'''''
  24867. !! end
  24868. !! test
  24869. 5a. Merge adjacent quote nodes if they've been edited
  24870. !! options
  24871. parsoid={
  24872. "modes": ["wt2wt", "selser"],
  24873. "changes": [
  24874. ["p", "contents", "remove", ":contains('b')"]
  24875. ]
  24876. }
  24877. !! wikitext
  24878. ''a''b''c''
  24879. !! wikitext/edited
  24880. ''ac''
  24881. !! end
  24882. !! test
  24883. 5b. Merge adjacent quote nodes if they've been edited
  24884. !! options
  24885. parsoid={
  24886. "modes": ["wt2wt", "selser"],
  24887. "changes": [
  24888. ["#x", "remove"]
  24889. ]
  24890. }
  24891. !! wikitext
  24892. ''a''<span id="x">b</span>''c''
  24893. !! wikitext/edited
  24894. ''ac''
  24895. !! end
  24896. !! test
  24897. 1. Merge adjacent link nodes as long as at least one element is new
  24898. !! options
  24899. parsoid={
  24900. "modes": ["html2wt"],
  24901. "scrubWikitext": true
  24902. }
  24903. !! html/parsoid
  24904. <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
  24905. <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
  24906. <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
  24907. !! wikitext
  24908. [[Football]]
  24909. [[Football]]
  24910. [[Football|Foot]][[Football|ball]]
  24911. !! end
  24912. !! test
  24913. 2. Merge adjacent link nodes and enable additional normalizations
  24914. !! options
  24915. parsoid={
  24916. "modes": ["html2wt"],
  24917. "scrubWikitext": true
  24918. }
  24919. !! html/parsoid
  24920. <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
  24921. !! wikitext
  24922. [[Football|''Football'']]
  24923. !! end
  24924. !! test
  24925. 3. Don't merge adjacent link nodes if scrubWikitext is false
  24926. !! options
  24927. parsoid={
  24928. "modes": ["html2wt"],
  24929. "scrubWikitext": false
  24930. }
  24931. !! html/parsoid
  24932. <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
  24933. !! wikitext
  24934. [[Football|Foot]][[Football|ball]]
  24935. !! end
  24936. #------------------------------
  24937. # End of tag minimization tests
  24938. #------------------------------
  24939. !!test
  24940. T56262: New entities
  24941. !! options
  24942. parsoid=html2wt
  24943. !! html/parsoid
  24944. <span typeof="mw:Entity">&nbsp;</span>
  24945. !! wikitext
  24946. &nbsp;
  24947. !! end
  24948. ## Note that there is no wikitext output for 'unknownproperty' ##
  24949. ## Unknown magic words are silently dropped ##
  24950. !! test
  24951. Magic words
  24952. !! options
  24953. parsoid=html2wt
  24954. !! html/parsoid
  24955. <meta property='mw:PageProp/toc' />
  24956. <meta property='mw:PageProp/notoc' />
  24957. <meta property='mw:PageProp/forcetoc' />
  24958. <meta property='mw:PageProp/index' />
  24959. <meta property='mw:PageProp/noindex' />
  24960. <meta property='mw:PageProp/nogallery' />
  24961. <meta property='mw:PageProp/noeditsection' />
  24962. <meta property='mw:PageProp/notitleconvert' />
  24963. <meta property='mw:PageProp/nocontentconvert' />
  24964. <meta property='mw:PageProp/unknownproperty' />
  24965. !! wikitext
  24966. __TOC__
  24967. __NOTOC__
  24968. __FORCETOC__
  24969. __INDEX__
  24970. __NOINDEX__
  24971. __NOGALLERY__
  24972. __NOEDITSECTION__
  24973. __NOTITLECONVERT__
  24974. __NOCONTENTCONVERT__
  24975. !! end
  24976. !! test
  24977. Consecutive <pre>s should not get merged
  24978. !! options
  24979. parsoid=html2wt,html2html
  24980. !! html/parsoid
  24981. <pre>a</pre><pre>b</pre>
  24982. <pre>c
  24983. </pre><pre>
  24984. d</pre>
  24985. <pre>e
  24986. </pre><pre>
  24987. f</pre>
  24988. !! wikitext
  24989. a
  24990. b
  24991. c
  24992. d
  24993. e
  24994. f
  24995. !! end
  24996. !! test
  24997. Edited ISBN links not serializable as ISBN links should serialize as wikilinks
  24998. !! options
  24999. parsoid=html2wt
  25000. !! html/parsoid
  25001. <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
  25002. !! wikitext
  25003. [[Special:BookSources/1234567890|ISBN 1234567895]]
  25004. !! end
  25005. !! test
  25006. Edited RFC links not serializable as RFC links should serialize as extlinks
  25007. !! options
  25008. parsoid=html2wt
  25009. !! html/parsoid
  25010. <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
  25011. !! wikitext
  25012. [https://tools.ietf.org/html/rfc123 New RFC]
  25013. !! end
  25014. !! test
  25015. Edited PMID links not serializable as PMID links should serialize as extlinks
  25016. !! options
  25017. parsoid=html2wt
  25018. !! html/parsoid
  25019. <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
  25020. !! wikitext
  25021. [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
  25022. !! end
  25023. !! test
  25024. WTS of autolinks with trailing/surrounding context
  25025. !! options
  25026. parsoid=html2wt
  25027. !! html/parsoid
  25028. <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
  25029. <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
  25030. <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
  25031. <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
  25032. <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
  25033. <p><a href="http://cscott.net">http://cscott.net</a>x</p>
  25034. !! wikitext
  25035. http://cscott.net'''foo'''
  25036. http://cscott.net<b>foo</b>
  25037. '''http://cscott.net'''
  25038. '''http://cscott.net '''
  25039. '''http://cscott.net<nowiki/>x'''
  25040. http://cscott.net<nowiki/>x
  25041. !! end
  25042. !! test
  25043. WTS of autolinks with nowikis (round-trip)
  25044. !! wikitext
  25045. x<nowiki/>http://cscott.net<nowiki/>x
  25046. !! html/parsoid
  25047. <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
  25048. !! end
  25049. # this is the "easy" test because it leaves in place all the
  25050. # data-parsoid information indicating this is an autolink
  25051. !! test
  25052. WTS of autolinks with escapes (editing)
  25053. !! options
  25054. parsoid={
  25055. "modes": ["wt2wt"],
  25056. "changes": [
  25057. [ "span", "remove" ]
  25058. ]
  25059. }
  25060. !! wikitext
  25061. x<nowiki/>http://cscott.net<nowiki/>x
  25062. !! wikitext/edited
  25063. x<nowiki/>http://cscott.net<nowiki/>x
  25064. !! end
  25065. !! test
  25066. WTS of edited autolink-like text (T103364)
  25067. !! options
  25068. parsoid={
  25069. "modes": ["wt2wt"],
  25070. "changes": [
  25071. [ "span[typeof]", "removeAttr", "typeof" ]
  25072. ]
  25073. }
  25074. !! wikitext
  25075. Not a link: <nowiki>http://example.com</nowiki>.
  25076. !! wikitext/edited
  25077. Not a link: <span><nowiki>http://example.com</nowiki></span>.
  25078. !! end
  25079. !! test
  25080. WTS of newly-authored autolink-like text (T103364)
  25081. !! options
  25082. parsoid=html2wt
  25083. !! html/parsoid
  25084. <p>http://example.com is not a link.</p>
  25085. !! wikitext
  25086. <nowiki>http://example.com</nowiki> is not a link.
  25087. !! end
  25088. !! test
  25089. WTS of autolink-like text after an autolink (T108563)
  25090. !! options
  25091. parsoid=html2wt
  25092. !! html/parsoid
  25093. <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
  25094. !! wikitext
  25095. http://example.com <nowiki>http://example.com</nowiki> is not a link.
  25096. !! end
  25097. !! test
  25098. Magic links inside links (not autolinked)
  25099. !! wikitext
  25100. [[Foo|http://example.com]]
  25101. [[Foo|RFC 1234]]
  25102. [[Foo|PMID 1234]]
  25103. [[Foo|ISBN 123456789x]]
  25104. [http://foo.com http://example.com]
  25105. [http://foo.com RFC 1234]
  25106. [http://foo.com PMID 1234]
  25107. [http://foo.com ISBN 123456789x]
  25108. !! html+tidy
  25109. <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
  25110. <a href="/wiki/Foo" title="Foo">RFC 1234</a>
  25111. <a href="/wiki/Foo" title="Foo">PMID 1234</a>
  25112. <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
  25113. </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
  25114. <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
  25115. <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
  25116. <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
  25117. </p>
  25118. !! html/parsoid
  25119. <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
  25120. <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
  25121. <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
  25122. <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
  25123. <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
  25124. <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
  25125. <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
  25126. <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
  25127. !! end
  25128. !! test
  25129. Magic links inside image captions (autolinked)
  25130. !! wikitext
  25131. [[File:Foobar.jpg|thumb|http://example.com]]
  25132. [[File:Foobar.jpg|thumb|RFC 1234]]
  25133. [[File:Foobar.jpg|thumb|PMID 1234]]
  25134. [[File:Foobar.jpg|thumb|ISBN 123456789x]]
  25135. !! html+tidy
  25136. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></div></div></div>
  25137. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a></div></div></div>
  25138. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a></div></div></div>
  25139. <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/wiki/File:Foobar.jpg" class="image"><img alt="" src="http://example.com/images/thumb/3/3a/Foobar.jpg/180px-Foobar.jpg" width="180" height="20" class="thumbimage" srcset="http://example.com/images/thumb/3/3a/Foobar.jpg/270px-Foobar.jpg 1.5x, http://example.com/images/thumb/3/3a/Foobar.jpg/360px-Foobar.jpg 2x" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Foobar.jpg" class="internal" title="Enlarge"></a></div><a href="/wiki/Special:BookSources/123456789X" class="internal mw-magiclink-isbn">ISBN 123456789x</a></div></div></div>
  25140. !! html/parsoid
  25141. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></figcaption></figure>
  25142. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="https://tools.ietf.org/html/rfc1234" rel="mw:ExtLink" class="external text">RFC 1234</a></figcaption></figure>
  25143. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></figcaption></figure>
  25144. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/220px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="25" width="220"/></a><figcaption><a href="./Special:BookSources/123456789X" rel="mw:WikiLink">ISBN 123456789x</a></figcaption></figure>
  25145. !! end
  25146. !! test
  25147. WTS of magic word text (T109371)
  25148. !! options
  25149. parsoid=html2wt
  25150. !! html/parsoid
  25151. <p>RFC 1234</p>
  25152. <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
  25153. <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
  25154. !! wikitext
  25155. <nowiki>RFC 1234</nowiki>
  25156. [http://foo.com RFC 1234]
  25157. [[Foo|RFC 1234]]
  25158. !! end
  25159. !! test
  25160. Edited Redirect link should emit a non-piped wikitext link
  25161. !! options
  25162. parsoid=html2wt
  25163. !! html/parsoid
  25164. <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
  25165. !! wikitext
  25166. #REDIRECT [[Bar]]
  25167. !! end
  25168. !! test
  25169. T75121: Infer extension name from typeOf if data-mw is not present
  25170. !! options
  25171. parsoid={ "modes": ["html2wt"], "suppressErrors": true }
  25172. !! html/parsoid
  25173. <div typeOf="mw:Extension/foo"></div>
  25174. !! wikitext
  25175. <foo />
  25176. !! end
  25177. # Note that the <p> wrapping isn't present in PHP parser output
  25178. # The important thing for this test is that P-wrapping doesn't
  25179. # interfere with the <nowiki> protection for leading - in <td>
  25180. # (which isn't necessary for <th>).
  25181. !! test
  25182. T88318: p-wrapped dash in table.
  25183. !! options
  25184. parsoid=html2wt,wt2wt
  25185. !! html/parsoid
  25186. <table><tbody>
  25187. <tr><th><p>-</p></th><th><p>- </p></th></tr>
  25188. <tr><td><p>-</p></td><td><p>- </p></td></tr>
  25189. <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
  25190. </tbody></table>
  25191. !! wikitext
  25192. {|
  25193. !-
  25194. !-
  25195. |-
  25196. |<nowiki>-</nowiki>
  25197. |<nowiki>- </nowiki>
  25198. |-
  25199. |<small>-</small>
  25200. |<br />
  25201. -
  25202. |<br />
  25203. -
  25204. |}
  25205. !! html/php+tidy
  25206. <table>
  25207. <tbody><tr>
  25208. <th>-
  25209. </th>
  25210. <th>-
  25211. </th></tr>
  25212. <tr>
  25213. <td>-
  25214. </td>
  25215. <td>-
  25216. </td></tr>
  25217. <tr>
  25218. <td><small>-</small>
  25219. </td>
  25220. <td><br />
  25221. <p>-
  25222. </p>
  25223. </td>
  25224. <td><br />
  25225. <p>-
  25226. </p>
  25227. </td></tr></tbody></table>
  25228. !! end
  25229. !! test
  25230. T149209: WTS: Handle newlines in table cells properly
  25231. !! options
  25232. parsoid=html2wt
  25233. !! html/parsoid
  25234. <table>
  25235. <tbody>
  25236. <tr><td>a
  25237. b
  25238. </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
  25239. <tr><td><p>x</p>
  25240. </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
  25241. </tbody></table>
  25242. <table>
  25243. <tbody>
  25244. <tr><th>a
  25245. b
  25246. </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
  25247. <tr><th><p>x</h>
  25248. </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
  25249. </tbody></table>
  25250. !! wikitext
  25251. {|
  25252. |a
  25253. b
  25254. |c
  25255. |-
  25256. |x
  25257. {{!}}y
  25258. |}
  25259. {|
  25260. !a
  25261. b
  25262. !c
  25263. |-
  25264. !x
  25265. !y
  25266. |}
  25267. !! end
  25268. !! test
  25269. T149209: Selser: Handle newlines in table cells properly
  25270. !! options
  25271. parsoid={
  25272. "modes": ["selser"],
  25273. "changes": [
  25274. [ "#h1", "html", "a\nb\n" ],
  25275. [ "#h2", "html", "a\nb\n" ],
  25276. [ "#c1", "html", "a\nb\n" ],
  25277. [ "#c2", "html", "<p>a</p>" ],
  25278. [ "#c3", "html", "<p>a</p>" ],
  25279. [ "#c4", "html", "edit-me<p>a</p>" ]
  25280. ]
  25281. }
  25282. !! wikitext
  25283. {|
  25284. ! id="h1" |edit-me!!1
  25285. |-
  25286. ! id="h2" |edit-me||2
  25287. |-
  25288. | id="c1" |edit-me||3
  25289. |-
  25290. | id="c2" |edit-me||4
  25291. |-
  25292. | id="c3" |edit-me||p||q||r
  25293. |-
  25294. | id="c4" |edit-me||p||q||r
  25295. |}
  25296. !! wikitext/edited
  25297. {|
  25298. ! id="h1" |a
  25299. b
  25300. !1
  25301. |-
  25302. ! id="h2" |a
  25303. b
  25304. !2
  25305. |-
  25306. | id="c1" |a
  25307. b
  25308. |3
  25309. |-
  25310. | id="c2" |a
  25311. |4
  25312. |-
  25313. | id="c3" |a
  25314. |p||q||r
  25315. |-
  25316. | id="c4" |edit-me
  25317. a
  25318. |p||q||r
  25319. |}
  25320. !! end
  25321. !! test
  25322. HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
  25323. !! options
  25324. parsoid=html2wt
  25325. !! html/parsoid
  25326. <table id='mwAb'>
  25327. <td id='mwAc'>foo</td>
  25328. <td id='serialize-this'>bar</td>
  25329. </table>
  25330. !! wikitext
  25331. {|
  25332. |foo
  25333. | id="serialize-this" |bar
  25334. |}
  25335. !! end
  25336. !! test
  25337. Parsoid-like element ids should not be serialized to wikitext unless shadowed
  25338. !! options
  25339. parsoid=html2wt
  25340. !! html/parsoid
  25341. <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
  25342. !! wikitext
  25343. <div id="hello">ok</div>
  25344. !! end
  25345. !! test
  25346. WTS change modes
  25347. !! options
  25348. parsoid={
  25349. "modes": ["wt2wt"],
  25350. "changes": [
  25351. [ "#xyz", "before", "<b>before</b> stuff " ],
  25352. [ "#xyz", "after", " stuff <i>after</i>" ],
  25353. [ "#xyz", "html", "x <b>y</b> z" ]
  25354. ]
  25355. }
  25356. !! wikitext
  25357. <span id="xyz">hello</span>
  25358. !! wikitext/edited
  25359. '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
  25360. !! end
  25361. !! test
  25362. Never serialize a-tag as html, regardless of what data-parsoid has to say
  25363. !! options
  25364. parsoid={ "modes": ["html2wt"], "suppressErrors": true }
  25365. !! html/parsoid
  25366. <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
  25367. !! wikitext
  25368. [[Foo]]
  25369. !! end
  25370. ## SSS FIXME: This is broken output nevertheless.
  25371. ## What might be a reasonable non-broken output for this?
  25372. ## This is an edge case unlikely to be seen in production
  25373. ## that I am not wasting more time on this right now.
  25374. !! test
  25375. Never serialize a-tag as html, no matter what attributes it has
  25376. !! options
  25377. parsoid={ "modes": ["html2wt"], "suppressErrors": true }
  25378. !! html/parsoid
  25379. <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
  25380. !! wikitext
  25381. [http://boo.org http://boohoo.org]
  25382. !! end
  25383. # Misnested is an indication that selser can reuse the source but these have
  25384. # shown to sneak through on occasion. See T101768.
  25385. # The original wikitext here is: [http://test.com [[one]] two three]
  25386. !! test
  25387. Strip span tags added to mark misnested links
  25388. !! options
  25389. parsoid=html2wt
  25390. !! html/parsoid
  25391. <p data-parsoid='{}'><a rel="mw:ExtLink" href="http://test.com" data-parsoid='{"targetOff":17,"contentOffsets":[17,34]}'></a><a rel="mw:WikiLink" href="./One" title="One" data-parsoid='{"stx":"simple","a":{"href":"./One"},"sa":{"href":"one"},"misnested":true}'>one</a><span data-parsoid='{"misnested":true}'> two three</span></p>
  25392. !! wikitext
  25393. [http://test.com][[one]] two three
  25394. !! end
  25395. !! test
  25396. Catch regression when unpacking misnested links
  25397. !! options
  25398. parsoid=wt2html
  25399. !! wikitext
  25400. {{echo|hi}}[http://example.com [[ho]]]
  25401. !! html/parsoid
  25402. <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</span><a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a><a rel="mw:WikiLink" href="./Ho" title="Ho" data-parsoid='{"misnested":true}'>ho</a></p>
  25403. !! end
  25404. !! test
  25405. Catch regression when unpacking with trailing content
  25406. !! wikitext
  25407. {{echo|Foo <references/> bar}}
  25408. !! html/parsoid
  25409. <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Foo &lt;references/> bar"}},"i":0}}]}'>Foo </p><ol class="mw-references references" typeof="mw:Extension/references" about="#mwt2" data-mw='{"name":"references","attrs":{}}'></ol><p about="#mwt2"> bar</p>
  25410. !! end
  25411. !! test
  25412. Use data-parsoid.firstWikitextNode to compute newline constraints for template content
  25413. !! options
  25414. parsoid=html2wt
  25415. !! html/parsoid
  25416. <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a"}},"i":0}}]}'>a</span><table about="#mwt2" typeof="mw:Transclusion mw:ExpandedAttrs" data-parsoid='{"a":{"{{echo|c\n{{!}}d\n}}":null},"sa":{"{{echo|c\n{{!}}d\n}}":""},"firstWikitextNode":"table","pi":[[{"k":"1"}]]}' data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"c\n{{!}}d\n"}},"i":0}},"\n|}"]}'>
  25417. <tbody><tr><td>d
  25418. </td></tr>
  25419. </tbody></table>
  25420. !! wikitext
  25421. {{echo|a}}
  25422. {|{{echo|c
  25423. {{!}}d
  25424. }}
  25425. |}
  25426. !! end
  25427. ## This test verifies the presence and computation of this attribute indirectly
  25428. ## by making an edit and ensuring that the serialization is correct (which it would be
  25429. ## only if firstWikitextNode is properly set).
  25430. !! test
  25431. data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
  25432. !! options
  25433. parsoid= {
  25434. "modes": ["wt2wt"],
  25435. "changes": [
  25436. [ "div#x", "remove" ],
  25437. [ "div", "before", "<div>new</div>" ]
  25438. ]
  25439. }
  25440. !! wikitext
  25441. <div id="x">foo</div>
  25442. {|
  25443. {{echo|<div>boo</div>
  25444. {{!}}b}}
  25445. |c
  25446. |}
  25447. !! wikitext/edited
  25448. <div>new</div>
  25449. {|
  25450. {{echo|<div>boo</div>
  25451. {{!}}b}}
  25452. |c
  25453. |}
  25454. !! end
  25455. # --------------------------------------------
  25456. # Tests spec'ing wikitext serialization norms |
  25457. # --------------------------------------------
  25458. !! test
  25459. Serialize multi-line indent-pre starting with wikitext syntax
  25460. !! options
  25461. parsoid=html2wt
  25462. !! html/parsoid
  25463. <pre>* 1
  25464. ** 2
  25465. * 3</pre>
  25466. !! wikitext
  25467. * 1
  25468. ** 2
  25469. * 3
  25470. !! end
  25471. !! test
  25472. 1. Categories should always be serialized on their own line
  25473. !! options
  25474. parsoid=html2wt
  25475. !! html/parsoid
  25476. foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
  25477. !! wikitext
  25478. foo
  25479. [[Category:Foo]]
  25480. bar
  25481. !! end
  25482. !! test
  25483. 2. Categories that are part of templates should not introduce a line break
  25484. !! wikitext
  25485. foo {{echo|<span>bar</span> [[Category:baz]]}} bar
  25486. !! html/parsoid
  25487. <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;span>bar&lt;/span> [[Category:baz]]"}},"i":0}}]}'>bar</span><span about="#mwt1"> </span><link rel="mw:PageProp/Category" href="./Category:Baz" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:baz"}}'/> bar</p>
  25488. !! end
  25489. # Careful while editing these next 2 tests. There are \u200f characters
  25490. # before and after the <link> tags in the HTML and following some
  25491. # of the categories in wikitext
  25492. # Do not remove these characters in edits.
  25493. #
  25494. # As part of the serialization, these bidi characters will get stripped.
  25495. !! test
  25496. RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
  25497. !! options
  25498. parsoid={
  25499. "modes": ["html2wt"],
  25500. "scrubWikitext": true
  25501. }
  25502. !! html/parsoid
  25503. <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏
  25504. ‏<link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" />‏</p>
  25505. !! wikitext
  25506. [[קטגוריה:טקסים]]
  25507. [[קטגוריה: שיטות משפט]]
  25508. !! end
  25509. !! test
  25510. RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
  25511. !! options
  25512. parsoid={
  25513. "modes": ["html2wt"],
  25514. "scrubWikitext": true
  25515. }
  25516. !! html/parsoid
  25517. <p>‏<link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />‏y</p>
  25518. !! wikitext
  25519. [[קטגוריה:טקסים]]
  25520. ‏y
  25521. !! end
  25522. !! test
  25523. Lists: Add space after bullets
  25524. !! options
  25525. parsoid=html2wt
  25526. !! html/parsoid
  25527. <ul>
  25528. <li>foo</li>
  25529. <li> bar</li>
  25530. <li><span> baz</span></li>
  25531. </ul>
  25532. !! wikitext
  25533. * foo
  25534. * bar
  25535. * <span> baz</span>
  25536. !! end
  25537. !! test
  25538. 1. Headings: Add space before/after == (T53744)
  25539. !! options
  25540. parsoid=html2wt
  25541. !! html/parsoid
  25542. <h2>foo</h2>
  25543. <h2> bar</h2>
  25544. <h2>baz </h2>
  25545. <h2><span> baz</span></h2>
  25546. !! wikitext
  25547. == foo ==
  25548. == bar ==
  25549. == baz ==
  25550. == <span> baz</span> ==
  25551. !! end
  25552. !! test
  25553. 2. Headings: Add space before/after == even after hoisted content
  25554. !! options
  25555. parsoid={
  25556. "modes": ["html2wt"],
  25557. "scrubWikitext": true
  25558. }
  25559. !! html/parsoid
  25560. <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
  25561. !! wikitext
  25562. [[Category:A2]]
  25563. == ok ==
  25564. !! end
  25565. !! test
  25566. 1. Headings: suppress newly created empty headings
  25567. !! options
  25568. parsoid={
  25569. "modes": ["html2wt"],
  25570. "scrubWikitext": true
  25571. }
  25572. !! html/parsoid
  25573. <h2></h2>
  25574. !! wikitext
  25575. !! end
  25576. !! test
  25577. 2. Headings: don't suppress empty headings if scrubWikitext is false
  25578. !! options
  25579. parsoid=html2wt
  25580. !! html/parsoid
  25581. <h2></h2>
  25582. !! wikitext
  25583. ==<nowiki/>==
  25584. !! end
  25585. !! test
  25586. 3. Headings: suppress empty headings on edits
  25587. !! options
  25588. parsoid={
  25589. "modes": ["selser"],
  25590. "scrubWikitext": true,
  25591. "changes": [
  25592. [ "#x", "remove"]
  25593. ]
  25594. }
  25595. !! wikitext
  25596. ==<span id="x">foo</span>==
  25597. !! wikitext/edited
  25598. !! end
  25599. !! test
  25600. Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
  25601. !! options
  25602. parsoid={
  25603. "modes": ["html2wt"],
  25604. "scrubWikitext": true
  25605. }
  25606. !! html/parsoid
  25607. <h2>foo<br/>bar</h2>
  25608. <h2>foo <span><br/>bar</span> baz</h2>
  25609. !! wikitext
  25610. == foo bar ==
  25611. == foo <span> bar</span> baz ==
  25612. !! end
  25613. !! test
  25614. Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
  25615. !! options
  25616. parsoid={
  25617. "modes": ["html2wt"],
  25618. "scrubWikitext": false
  25619. }
  25620. !! html/parsoid
  25621. <h2>foo<br/>bar</h2>
  25622. !! wikitext
  25623. == foo<br /> bar ==
  25624. !! end
  25625. !! test
  25626. 1. WT Quote Tags: suppress newly created empty style tags
  25627. !! options
  25628. parsoid={
  25629. "modes": ["html2wt"],
  25630. "scrubWikitext": true
  25631. }
  25632. !! html/parsoid
  25633. <i></i><b></b>
  25634. !! wikitext
  25635. !! end
  25636. !! test
  25637. 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
  25638. !! options
  25639. parsoid=html2wt
  25640. !! html/parsoid
  25641. <i></i><b></b>
  25642. !! wikitext
  25643. ''<nowiki/>'''''<nowiki/>'''
  25644. !! end
  25645. !! test
  25646. 3. WT Quote Tags: suppress empty style tags on edits
  25647. !! options
  25648. parsoid={
  25649. "modes": ["selser"],
  25650. "scrubWikitext": true,
  25651. "changes": [
  25652. [ "#x", "remove"]
  25653. ]
  25654. }
  25655. !! wikitext
  25656. '''<span id="x">foo</span>'''
  25657. !! wikitext/edited
  25658. !! end
  25659. !! test
  25660. 1. Anchors: suppress newly created empty anchors
  25661. !! options
  25662. parsoid={
  25663. "modes": ["html2wt"],
  25664. "scrubWikitext": true
  25665. }
  25666. !! html/parsoid
  25667. <a rel="mw:WikiLink" href="./Test" title="Test"></a>
  25668. !! wikitext
  25669. !! end
  25670. !! test
  25671. 2. Anchors: don't suppress empty anchors if scrubWikitext is false
  25672. !! options
  25673. parsoid={
  25674. "modes": ["html2wt"],
  25675. "scrubWikitext": false
  25676. }
  25677. !! html/parsoid
  25678. <a rel="mw:WikiLink" href="./Test" title="Test"></a>
  25679. !! wikitext
  25680. [[Test|<nowiki/>]]
  25681. !! end
  25682. !! test
  25683. 3. Anchors: suppress empty anchors on edits
  25684. !! options
  25685. parsoid={
  25686. "modes": ["selser"],
  25687. "scrubWikitext": true,
  25688. "changes": [
  25689. [ "#x", "remove"]
  25690. ]
  25691. }
  25692. !! wikitext
  25693. [[Test|<span id="x">foo</span>]]
  25694. !! wikitext/edited
  25695. !! end
  25696. !! test
  25697. 3a. Anchors: do not suppress numbered extlinks
  25698. !! options
  25699. parsoid={
  25700. "modes": ["wt2wt"],
  25701. "scrubWikitext": true
  25702. }
  25703. !! wikitext
  25704. [http://foo.com]
  25705. !! html/parsoid
  25706. <a rel="mw:ExtLink" href="http://foo.com"></a>
  25707. !! end
  25708. !! test
  25709. 3b. Anchors: do not suppress numbered extlinks
  25710. !! options
  25711. parsoid={
  25712. "modes": ["wt2wt"],
  25713. "scrubWikitext": true,
  25714. "changes": [
  25715. [ "#x", "remove"]
  25716. ]
  25717. }
  25718. !! wikitext
  25719. [http://foo.com <span id="x">foo</span>]
  25720. !! wikitext/edited
  25721. [http://foo.com]
  25722. !! end
  25723. !!test
  25724. Normalizations should be restricted to edited content
  25725. !!options
  25726. parsoid={
  25727. "modes": ["selser"],
  25728. "scrubWikitext": true,
  25729. "changes": [
  25730. [ "h1", "before", "<i></i>"]
  25731. ]
  25732. }
  25733. !!wikitext
  25734. a
  25735. = =
  25736. b
  25737. !!wikitext/edited
  25738. a
  25739. = =
  25740. b
  25741. !!end
  25742. !! test
  25743. 1. Multiple normalizations (html2wt)
  25744. !! options
  25745. parsoid={
  25746. "modes": ["html2wt"],
  25747. "scrubWikitext": true
  25748. }
  25749. !! html
  25750. <h2><i></i></h2>
  25751. <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
  25752. </a><b><i></i></b>x</p>
  25753. !! wikitext
  25754. [[foo]]
  25755. x
  25756. !! end
  25757. !! test
  25758. 2. Multiple normalizations (selser)
  25759. !! options
  25760. parsoid={
  25761. "modes": ["selser"],
  25762. "scrubWikitext": true,
  25763. "changes": [
  25764. [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
  25765. ]
  25766. }
  25767. !! wikitext
  25768. <span id="x">foo</span>
  25769. !! wikitext/edited
  25770. <span id="x">foo</span>
  25771. x
  25772. !! end
  25773. !! test
  25774. 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
  25775. !! options
  25776. parsoid={
  25777. "modes": ["html2wt"],
  25778. "scrubWikitext": true
  25779. }
  25780. !! html/parsoid
  25781. <p> hi</p>
  25782. <p> hello</p>
  25783. !! wikitext
  25784. hi
  25785. hello
  25786. !! end
  25787. !! test
  25788. 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
  25789. !! options
  25790. parsoid=html2wt
  25791. !! html/parsoid
  25792. <p> hi</p>
  25793. <p> hello</p>
  25794. !! wikitext
  25795. <nowiki> </nowiki>hi
  25796. <nowiki> </nowiki> hello
  25797. !! end
  25798. !! test
  25799. 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
  25800. !! options
  25801. parsoid={
  25802. "modes": ["html2wt"],
  25803. "scrubWikitext": true
  25804. }
  25805. !! html/parsoid
  25806. <p>Foo
  25807. bar
  25808. baz</p>
  25809. <table><tr><td>Foo
  25810. bar
  25811. baz bang</td></tr></table>
  25812. <p><!--boo--> foo
  25813. bar</p>
  25814. <p> foo
  25815. bar<span>boo</span></p>
  25816. !! wikitext
  25817. Foo
  25818. bar
  25819. baz
  25820. {|
  25821. |Foo
  25822. bar
  25823. baz bang
  25824. |}
  25825. <!--boo-->foo
  25826. bar
  25827. foo
  25828. bar<span>boo</span>
  25829. !! end
  25830. !! test
  25831. 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
  25832. !! options
  25833. parsoid={
  25834. "modes": ["selser"],
  25835. "scrubWikitext": true,
  25836. "changes": [
  25837. [ "p", "html", " a\n b" ]
  25838. ]
  25839. }
  25840. !! wikitext
  25841. xyz
  25842. !! wikitext/edited
  25843. a
  25844. b
  25845. !! end
  25846. !! test
  25847. 1. New links that end in spaces
  25848. !! options
  25849. parsoid={
  25850. "modes": ["html2wt"],
  25851. "scrubWikitext": false
  25852. }
  25853. !! html/parsoid
  25854. <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
  25855. <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
  25856. <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
  25857. !! wikitext
  25858. [[Berlin ]]<nowiki/>is the capital of Germany.
  25859. [[Foo ]]'''bar'''
  25860. [[Boston ]] is a city.
  25861. !! end
  25862. !! test
  25863. 2. New links that end in spaces
  25864. !! options
  25865. parsoid={
  25866. "modes": ["html2wt"],
  25867. "scrubWikitext": true
  25868. }
  25869. !! html/parsoid
  25870. <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
  25871. <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
  25872. <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
  25873. !! wikitext
  25874. [[Berlin]] is the capital of Germany.
  25875. [[Foo]] '''bar'''
  25876. [[Boston]] is a city.
  25877. !! end
  25878. !! test
  25879. 1. Table cells with escapable prefixes
  25880. !! options
  25881. parsoid={
  25882. "modes": ["html2wt"],
  25883. "scrubWikitext": false
  25884. }
  25885. !! html
  25886. <table>
  25887. <tr><td>a</td></tr>
  25888. <tr><td>-</td></tr>
  25889. <tr><td>+</td></tr>
  25890. </table>
  25891. !! wikitext
  25892. {|
  25893. |a
  25894. |-
  25895. |<nowiki>-</nowiki>
  25896. |-
  25897. |<nowiki>+</nowiki>
  25898. |}
  25899. !! end
  25900. !! test
  25901. 2. Table cells with escapable prefixes
  25902. !! options
  25903. parsoid={
  25904. "modes": ["html2wt"],
  25905. "scrubWikitext": true
  25906. }
  25907. !! html
  25908. <table>
  25909. <tr><td>a</td></tr>
  25910. <tr><td>-</td></tr>
  25911. <tr><td>+</td></tr>
  25912. </table>
  25913. !! wikitext
  25914. {|
  25915. |a
  25916. |-
  25917. | -
  25918. |-
  25919. | +
  25920. |}
  25921. !! end
  25922. !! test
  25923. 3a. Table cells with escapable prefixes after edits
  25924. !! options
  25925. parsoid={
  25926. "modes": ["selser"],
  25927. "scrubWikitext": true,
  25928. "changes": [
  25929. [ "table tbody tr:first-child td:first-child", "remove"]
  25930. ]
  25931. }
  25932. !! wikitext
  25933. {|
  25934. |a||-
  25935. |}
  25936. !! wikitext/edited
  25937. {|
  25938. | -
  25939. |}
  25940. !! end
  25941. !! test
  25942. 3b. Table cells with escapable prefixes after edits
  25943. !! options
  25944. parsoid={
  25945. "modes": ["selser"],
  25946. "scrubWikitext": true,
  25947. "changes": [
  25948. [ "table tbody tr:first-child td:first-child", "html", "-" ],
  25949. [ "#x", "remove" ]
  25950. ]
  25951. }
  25952. !! wikitext
  25953. {|
  25954. |pqr
  25955. |<span id="x">foo</span>+
  25956. |}
  25957. !! wikitext/edited
  25958. {|
  25959. | -
  25960. | +
  25961. |}
  25962. !! end
  25963. # FIXME: This test will fail because
  25964. # normalization doesn't realize that the id attribute
  25965. # will eliminate the escapable scenario
  25966. !! test
  25967. 4a. Table cells without escapable prefixes after edits
  25968. !! options
  25969. parsoid={
  25970. "modes": ["selser"],
  25971. "scrubWikitext": true,
  25972. "changes": [
  25973. [ "#x", "html", "-" ]
  25974. ]
  25975. }
  25976. !! wikitext
  25977. {|
  25978. | id="x" |abcd
  25979. |}
  25980. !! wikitext/edited
  25981. {|
  25982. | id="x" |-
  25983. |}
  25984. !! end
  25985. ## This tests normalizer's ability to discriminate between
  25986. ## cells having identical content.
  25987. !! test
  25988. 4b. Table cells without escapable prefixes after edits
  25989. !! options
  25990. parsoid={
  25991. "modes": ["selser"],
  25992. "scrubWikitext": true,
  25993. "changes": [
  25994. [ "td", "html", "-" ]
  25995. ]
  25996. }
  25997. !! wikitext
  25998. {|
  25999. |a||b
  26000. |}
  26001. !! wikitext/edited
  26002. {|
  26003. | -||-
  26004. |}
  26005. !! end
  26006. ## This tests normalizer's ability to not be tripped by
  26007. ## comments (and whitespace)
  26008. !! test
  26009. 4c. Table cells without escapable prefixes after edits
  26010. !! options
  26011. parsoid={
  26012. "modes": ["selser"],
  26013. "scrubWikitext": true,
  26014. "changes": [
  26015. [ "table tbody tr td:first-child", "remove" ]
  26016. ]
  26017. }
  26018. !! wikitext
  26019. {|
  26020. |-
  26021. <!--foo--> |a||-
  26022. |}
  26023. !! wikitext/edited
  26024. {|
  26025. |-
  26026. <!--foo--> | -
  26027. |}
  26028. !! end
  26029. ## This tests normalizer's ability to handle HTML cells
  26030. !! test
  26031. 4d. Table cells without escapable prefixes after edits
  26032. !! options
  26033. parsoid={
  26034. "modes": ["selser"],
  26035. "scrubWikitext": true,
  26036. "changes": [
  26037. [ "td", "html", "-" ]
  26038. ]
  26039. }
  26040. !! wikitext
  26041. <table>
  26042. <tr><td>a</td></tr>
  26043. </table>
  26044. !! wikitext/edited
  26045. <table>
  26046. <tr><td>-</td></tr>
  26047. </table>
  26048. !! end
  26049. ## T111151 Remove font elements without attributes
  26050. !! test
  26051. 5a. font tags without attributes should be dropped in scrubWikitext mode
  26052. !! options
  26053. parsoid={
  26054. "modes": ["html2wt"],
  26055. "scrubWikitext": true
  26056. }
  26057. !! html
  26058. <font>foo</font>
  26059. <font><font>bar</font></font>
  26060. <font class="x">boo</font>
  26061. !! wikitext
  26062. foo
  26063. bar
  26064. <font class="x">boo</font>
  26065. !! end
  26066. !! test
  26067. 5b. font tags should not be dropped without scrubWikitext being enabled
  26068. !! options
  26069. parsoid={
  26070. "modes": ["html2wt"],
  26071. "scrubWikitext": false
  26072. }
  26073. !! html
  26074. <font>foo</font>
  26075. !! wikitext
  26076. <font>foo</font>
  26077. !! end
  26078. !! test
  26079. Escape nowiki DOM elements
  26080. !! options
  26081. parsoid=html2wt
  26082. !! html/parsoid
  26083. <nowiki><i>foo</i></nowiki>
  26084. !! wikitext
  26085. &lt;nowiki&gt;''foo''&lt;/nowiki&gt;
  26086. !! end
  26087. # This is meant to be an interim fix while we go about figuring out
  26088. # how to not introduce these trailing <nowiki/>s in the first place.
  26089. !! test
  26090. T115717: Strip trailing <nowiki/>s (without affecting valid uses)
  26091. !! options
  26092. parsoid=html2wt
  26093. !! html/parsoid
  26094. <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"&lt;nowiki/>"}'/>
  26095. y</p>
  26096. <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ",""]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
  26097. <p><span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1","named":true,"spc":["\n"," "," ","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;nowiki/>"}},"i":0}}]}'></span></p>
  26098. !! wikitext
  26099. x
  26100. y
  26101. {{echo|
  26102. 1 = <nowiki/>}}
  26103. {{echo|
  26104. 1 = <nowiki/>
  26105. }}
  26106. !! end
  26107. !! test
  26108. New list is serialized on newlines
  26109. !! options
  26110. parsoid=html2wt
  26111. !! html/parsoid
  26112. <p>The quick brown fox jumps over the lazy dog.</p><ul>
  26113. <li>Yesterday</li>
  26114. <li>Today</li>
  26115. <li>Tomorrow</li>
  26116. </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
  26117. !! wikitext
  26118. The quick brown fox jumps over the lazy dog.
  26119. * Yesterday
  26120. * Today
  26121. * Tomorrow
  26122. The quick onyx goblin jumps over the lazy dwarf.
  26123. !! end
  26124. !! test
  26125. New lists in formatting elements serialized w/o newlines
  26126. !! options
  26127. parsoid=html2wt
  26128. !! html/parsoid
  26129. <small>
  26130. <ul>
  26131. <li>123</li>
  26132. </ul>
  26133. </small>
  26134. <small><ul><li>hi</li></ul></small>
  26135. !! wikitext
  26136. <small>
  26137. * 123
  26138. </small>
  26139. <small>
  26140. * hi
  26141. </small>
  26142. !! end
  26143. !! test
  26144. New list in table doesn't need newlines
  26145. !! options
  26146. parsoid=html2wt
  26147. !! html/parsoid
  26148. <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
  26149. !! wikitext
  26150. {|
  26151. |
  26152. * test
  26153. * 123
  26154. |}
  26155. !! end
  26156. # ---------------------------------------------------
  26157. # End of tests spec'ing wikitext serialization norms |
  26158. # ---------------------------------------------------
  26159. # T104032
  26160. !! test
  26161. Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
  26162. !! options
  26163. parsoid=html2wt
  26164. !! html/parsoid
  26165. a<p>b</p>
  26166. <b>c</b><p>d</p>
  26167. <table><tr>
  26168. <td>a<p>b</p></td>
  26169. <td><b>c</b><p>d</p></td>
  26170. </tr></table>
  26171. !! wikitext
  26172. a
  26173. b
  26174. '''c'''
  26175. d
  26176. {|
  26177. |a
  26178. b
  26179. |'''c'''
  26180. d
  26181. |}
  26182. !! end
  26183. !! test
  26184. Anchor without href scenarios
  26185. !! options
  26186. parsoid={ "modes": ["html2wt"], "suppressErrors": true }
  26187. !! html/parsoid
  26188. <a class="bc"></a>
  26189. <a class="no">dice</a>
  26190. <a name="foo"></a>
  26191. !! wikitext
  26192. dice
  26193. <span name="foo"></span>
  26194. !! end
  26195. !! test
  26196. New transclusion added after a list should be serialized after the list
  26197. !! options
  26198. parsoid=html2wt
  26199. !! html/parsoid
  26200. <ul><li>a</li></ul><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>
  26201. !! wikitext
  26202. * a
  26203. {{echo|foo}}
  26204. !! end
  26205. # -----------------------------------------------------------------
  26206. # End of section for Parsoid-only html2wt tests for serialization
  26207. # of new content
  26208. # -----------------------------------------------------------------
  26209. # -----------------------------------------------------------------
  26210. # The following section of tests are primarily to spec behavior of
  26211. # the selective serializer. All these tests have manual selser
  26212. # changes. The automated selser changes for all tests handle the
  26213. # wide variation of changes, but these tests here capture specs
  26214. # deterministically.
  26215. # ----------------------------------------------------------------
  26216. ## T90517
  26217. !! test
  26218. Selser: New comments should not be lost
  26219. !! options
  26220. parsoid={
  26221. "modes": ["selser"],
  26222. "changes": [
  26223. [ "#a", "after", "<!--c1-->" ],
  26224. [ "#b", "before", "<!--c2-->" ]
  26225. ]
  26226. }
  26227. !! wikitext
  26228. <span id="a">a</span>
  26229. <span id="b">b</span>
  26230. !! wikitext/edited
  26231. <span id="a">a</span><!--c1-->
  26232. <!--c2--><span id="b">b</span>
  26233. !! end
  26234. ## T89383
  26235. !! test
  26236. Selser: Check for validity of DSR before using it
  26237. !! options
  26238. parsoid={
  26239. "modes": ["selser"],
  26240. "changes": [
  26241. [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
  26242. ]
  26243. }
  26244. !! wikitext
  26245. <span id="a">a</span>
  26246. !! wikitext/edited
  26247. {{DISPLAYTITLE:foo}}
  26248. <span id="a">a</span>
  26249. !! end
  26250. !! test
  26251. 1. DOMDiff: Changes to <ref> content should be looked up using id
  26252. !! options
  26253. parsoid={
  26254. "modes": ["selser"],
  26255. "changes": [
  26256. ["#X", "after", "bar"],
  26257. ["#Y", "after", "baz"]
  26258. ]
  26259. }
  26260. !! wikitext
  26261. X <ref><span id="X">foo</span></ref>
  26262. Y <ref name="a" />
  26263. <references>
  26264. <ref name="a"><span id="Y">foo</span></ref>
  26265. </references>
  26266. !! wikitext/edited
  26267. X <ref><span id="X">foo</span>bar</ref>
  26268. Y <ref name="a" />
  26269. <references>
  26270. <ref name="a"><span id="Y">foo</span>baz</ref>
  26271. </references>
  26272. !! end
  26273. !! test
  26274. 2. DOMDiff: Changes to <ref> content should be looked up using id
  26275. !! options
  26276. parsoid={
  26277. "modes": ["selser"],
  26278. "changes": [
  26279. ["#Z", "after", "bar"]
  26280. ]
  26281. }
  26282. !! wikitext
  26283. A <ref>foo bar for a</ref>
  26284. B <ref group="X" name="b" />
  26285. <references />
  26286. <references group="X">
  26287. <ref name="b"><span id="Z">foo</span></ref>
  26288. </references>
  26289. !! wikitext/edited
  26290. A <ref>foo bar for a</ref>
  26291. B <ref group="X" name="b" />
  26292. <references />
  26293. <references group="X">
  26294. <ref name="b"><span id="Z">foo</span>bar</ref>
  26295. </references>
  26296. !! end
  26297. !! test
  26298. DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
  26299. !! options
  26300. parsoid={
  26301. "modes": ["selser"],
  26302. "changes": [
  26303. [ "div:first-child", "text", "bar" ]
  26304. ]
  26305. }
  26306. !! wikitext
  26307. <div style="{{1x|color:red;}}%">foo</div>
  26308. !! wikitext/edited
  26309. <div style="{{1x|color:red;}}%">bar</div>
  26310. !! end
  26311. !! test
  26312. Empty LI (T49673)
  26313. !! wikitext
  26314. *a
  26315. *
  26316. *
  26317. *b
  26318. !! html+tidy
  26319. <ul><li>a</li>
  26320. <li class="mw-empty-elt"></li>
  26321. <li class="mw-empty-elt"></li>
  26322. <li>b</li></ul>
  26323. !! end
  26324. !! test
  26325. Thumbnail output
  26326. !! wikitext
  26327. [[File:Thumb.png|thumb]]
  26328. !! html/php+tidy
  26329. <div class="thumb tright"><div class="thumbinner" style="width:137px;"><a href="/wiki/File:Thumb.png" class="image"><img alt="Thumb.png" src="http://example.com/images/e/ea/Thumb.png" width="135" height="135" class="thumbimage" /></a> <div class="thumbcaption"><div class="magnify"><a href="/wiki/File:Thumb.png" class="internal" title="Enlarge"></a></div></div></div></div>
  26330. !! html/parsoid
  26331. <figure class="mw-default-size" typeof="mw:Image/Thumb"><a href="./File:Thumb.png"><img resource="./File:Thumb.png" src="//example.com/images/e/ea/Thumb.png" data-file-width="135" data-file-height="135" data-file-type="bitmap" height="135" width="135"/></a></figure>
  26332. !! end
  26333. !! test
  26334. unclosed internal link XSS (T137264)
  26335. !! wikitext
  26336. [[#%3Cscript%3Ealert(1)%3C/script%3E|
  26337. !! html/php
  26338. <p>[[#&lt;script&gt;alert(1)&lt;/script&gt;|
  26339. </p>
  26340. !! html/parsoid
  26341. <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
  26342. !! end
  26343. !! test
  26344. Validating that <style> isn't eaten by tidy (T167349)
  26345. !! options
  26346. styletag=1
  26347. !! wikitext
  26348. <div class="foo">
  26349. <style>.foo::before { content: "<foo>"; }</style>
  26350. <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
  26351. </div>
  26352. !! html/php+tidy
  26353. <div class="foo">
  26354. <style>.foo::before { content: "<foo>"; }</style>
  26355. <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
  26356. </div>
  26357. !! end
  26358. !! test
  26359. Validating that <style> isn't wrapped in a paragraph (T186965)
  26360. !! options
  26361. styletag=1
  26362. !! wikitext
  26363. A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
  26364. <style>.foo::before { content: "<foo>"; }</style>
  26365. <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
  26366. But if it's on a line with other content, let it be wrapped.
  26367. <style>.foo::before { content: "<foo>"; }</style> bar
  26368. foo <style>.foo::before { content: "<foo>"; }</style>
  26369. foo <style>.foo::before { content: "<foo>"; }</style> bar
  26370. And the same if we have non-paragraph-breaking whitespace
  26371. foo
  26372. <style>.foo::before { content: "<foo>"; }</style>
  26373. bar
  26374. !! html/php
  26375. <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
  26376. </p>
  26377. <style>.foo::before { content: "<foo>"; }</style>
  26378. <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
  26379. <p>But if it's on a line with other content, let it be wrapped.
  26380. </p><p><style>.foo::before { content: "<foo>"; }</style> bar
  26381. </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
  26382. </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
  26383. </p><p>And the same if we have non-paragraph-breaking whitespace
  26384. </p><p>foo
  26385. <style>.foo::before { content: "<foo>"; }</style>
  26386. bar
  26387. </p>
  26388. !! end
  26389. !! test
  26390. Validating that <link> isn't wrapped in a paragraph (T186965)
  26391. !! options
  26392. styletag=1
  26393. !! wikitext
  26394. A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
  26395. <link rel="foo" href="bar"/>
  26396. <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
  26397. But if it's on a line with other content, let it be wrapped.
  26398. <link rel="foo" href="bar"/> bar
  26399. foo <link rel="foo" href="bar"/>
  26400. foo <link rel="foo" href="bar"/> bar
  26401. And the same if we have non-paragraph-breaking whitespace
  26402. foo
  26403. <link rel="foo" href="bar"/>
  26404. bar
  26405. !! html/php
  26406. <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
  26407. </p>
  26408. <link rel="foo" href="bar"/>
  26409. <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
  26410. <p>But if it's on a line with other content, let it be wrapped.
  26411. </p><p><link rel="foo" href="bar"/> bar
  26412. </p><p>foo <link rel="foo" href="bar"/>
  26413. </p><p>foo <link rel="foo" href="bar"/> bar
  26414. </p><p>And the same if we have non-paragraph-breaking whitespace
  26415. </p><p>foo
  26416. <link rel="foo" href="bar"/>
  26417. bar
  26418. </p>
  26419. !! end
  26420. !! test
  26421. Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
  26422. !! config
  26423. wgFragmentMode=[ 'html5', 'legacy' ]
  26424. !! wikitext
  26425. ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
  26426. [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
  26427. !! html/php
  26428. <h2><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE"></span><span class="mw-headline" id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26429. <p><a href="#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
  26430. </p>
  26431. !! html/parsoid
  26432. <h2 id="A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE" typeof="mw:FallbackId" data-parsoid="{}"></span>A&amp;B<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>C<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;D<span typeof="mw:Entity" data-parsoid='{"src":"&amp;amp;","srcContent":"&amp;"}'>&amp;</span>amp;amp;E</h2>
  26433. <p><a rel="mw:WikiLink" href="./Main_Page#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E"},"sa":{"href":"#A&amp;B&amp;amp;C&amp;amp;amp;D&amp;amp;amp;amp;E"}}'>#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a></p>
  26434. !! end
  26435. !! test
  26436. Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
  26437. !! config
  26438. wgFragmentMode=[ 'legacy' ]
  26439. !! wikitext
  26440. ==A&B&amp;C&amp;amp;D&amp;amp;amp;E==
  26441. [[#A&B&amp;C&amp;amp;D&amp;amp;amp;E]]
  26442. !! html/php
  26443. <h2><span class="mw-headline" id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26444. <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&amp;B&amp;C&amp;amp;D&amp;amp;amp;E</a>
  26445. </p>
  26446. !! end
  26447. !! test
  26448. Decoding of HTML entities in embedded HTML tags
  26449. !! wikitext
  26450. <table class="1&2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
  26451. !! html/php
  26452. <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"><tr><td>x</td></tr></table>
  26453. !! html/parsoid
  26454. <table class="1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5" data-parsoid='{"stx":"html","a":{"class":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"sa":{"class":"1&amp;2&amp;amp;3&amp;amp;amp;4&amp;amp;amp;amp;5"}}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>x</td></tr></tbody></table>
  26455. !! end
  26456. !! test
  26457. Decoding of HTML entities in indicator names for IDs (T104196)
  26458. !! options
  26459. parsoid=wt2html,html2html
  26460. showindicators
  26461. !! wikitext
  26462. <indicator name="1&2&amp;3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
  26463. !! html/php
  26464. 1&2&3&amp;4&amp;amp;5=Indicator
  26465. !! html/parsoid
  26466. <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
  26467. !! end
  26468. # this version of the test strips out the ambiguity so Parsoid rts cleanly
  26469. !! test
  26470. Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
  26471. !! options
  26472. showindicators
  26473. !! wikitext
  26474. <indicator name="1&2&3&amp;amp;4&amp;amp;amp;5">Indicator</indicator>
  26475. !! html/php
  26476. 1&2&3&amp;4&amp;amp;5=Indicator
  26477. !! html/parsoid
  26478. <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&amp;2&amp;3&amp;amp;4&amp;amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
  26479. !! end
  26480. # This fragment mode is what Parsoid supports.
  26481. !! test
  26482. HTML5 ids: fallback to legacy
  26483. !! config
  26484. wgFragmentMode=[ 'html5', 'legacy' ]
  26485. !! wikitext
  26486. ==Foo bar==
  26487. ==foo Bar==
  26488. ==Тест==
  26489. ==Тест==
  26490. ==тест==
  26491. ==Hey < # " > % : '==
  26492. [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
  26493. {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
  26494. <!-- These two links should produce identical HTML -->
  26495. [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
  26496. !! html/php
  26497. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  26498. <ul>
  26499. <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
  26500. <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
  26501. <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
  26502. <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
  26503. <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
  26504. <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
  26505. </ul>
  26506. </div>
  26507. <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26508. <h2><span class="mw-headline" id="foo_Bar_2">foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26509. <h2><span id=".D0.A2.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="Тест">Тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26510. <h2><span id=".D0.A2.D0.B5.D1.81.D1.82_2"></span><span class="mw-headline" id="Тест_2">Тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26511. <h2><span id=".D1.82.D0.B5.D1.81.D1.82"></span><span class="mw-headline" id="тест">тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26512. <h2><span id="Hey_.3C_.23_.22_.3E_.25_:_.27"></span><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26513. <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
  26514. </p><p>💩 <span id="💩"></span>
  26515. </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
  26516. </p>
  26517. !! html/parsoid
  26518. <h2 id="Foo_bar">Foo bar</h2>
  26519. <h2 id="foo_Bar_2">foo Bar</h2>
  26520. <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
  26521. <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
  26522. <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
  26523. <h2 id="Hey_&lt;_#_&quot;_>_%_:_'"><span id="Hey_.3C_.23_.22_.3E_.25_:_.27" typeof="mw:FallbackId"></span>Hey &lt; # " > %<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: '</h2>
  26524. <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar">#Foo bar</a> <a rel="mw:WikiLink" href="./Main_Page#foo_Bar">#foo Bar</a> <a rel="mw:WikiLink" href="./Main_Page#Тест">#Тест</a> <a rel="mw:WikiLink" href="./Main_Page#тест">#тест</a> <a rel="mw:WikiLink" href="./Main_Page#Hey_&lt;_#_&quot;_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Hey_&lt;_#_\"_>_%_:_&#39;"},"sa":{"href":"#Hey &lt; # \" > % : &#39;"}}'>#Hey &lt; # " > % : '</a></p>
  26525. <p><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:💩","function":"anchorencode"},"params":{},"i":0}}]}'>💩</span> <span id="💩" about="#mwt3" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid=&#39;{\"pi\":[[]],\"dsr\":[178,197,null,null]}&#39; data-mw=&#39;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&#39;>💩&lt;/span>"}]]}'></span></p>
  26526. <!-- These two links should produce identical HTML -->
  26527. <p><a rel="mw:WikiLink" href="./Main_Page#啤酒">#啤酒</a> <a rel="mw:WikiLink" href="./Main_Page#啤酒" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#啤酒"},"sa":{"href":"#%E5%95%A4%E9%85%92"}}'>#啤酒</a></p>
  26528. !! end
  26529. # Parsoid doesn't support this mode
  26530. !! test
  26531. HTML5 ids: legacy with a fallback to modern
  26532. !! config
  26533. wgFragmentMode=[ 'legacy', 'html5' ]
  26534. !! wikitext
  26535. ==Foo bar==
  26536. ==foo Bar==
  26537. ==Тест==
  26538. ==Тест==
  26539. ==тест==
  26540. ==Hey < # " > % : '==
  26541. [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
  26542. {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
  26543. <!-- These two links should produce identical HTML -->
  26544. [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
  26545. !! html/php
  26546. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  26547. <ul>
  26548. <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
  26549. <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
  26550. <li class="toclevel-1 tocsection-3"><a href="#.D0.A2.D0.B5.D1.81.D1.82"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
  26551. <li class="toclevel-1 tocsection-4"><a href="#.D0.A2.D0.B5.D1.81.D1.82_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
  26552. <li class="toclevel-1 tocsection-5"><a href="#.D1.82.D0.B5.D1.81.D1.82"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
  26553. <li class="toclevel-1 tocsection-6"><a href="#Hey_.3C_.23_.22_.3E_.25_:_.27"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
  26554. </ul>
  26555. </div>
  26556. <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26557. <h2><span class="mw-headline" id="foo_Bar_2">foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26558. <h2><span id="Тест"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82">Тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26559. <h2><span id="Тест_2"></span><span class="mw-headline" id=".D0.A2.D0.B5.D1.81.D1.82_2">Тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26560. <h2><span id="тест"></span><span class="mw-headline" id=".D1.82.D0.B5.D1.81.D1.82">тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26561. <h2><span id="Hey_&lt;_#_&quot;_&gt;_%_:_'"></span><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26562. <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#.D0.A2.D0.B5.D1.81.D1.82">#Тест</a> <a href="#.D1.82.D0.B5.D1.81.D1.82">#тест</a> <a href="#Hey_.3C_.23_.22_.3E_.25_:_.27">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
  26563. </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
  26564. </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
  26565. </p>
  26566. !! end
  26567. # Parsoid doesn't support this mode.
  26568. !! test
  26569. HTML5 ids: no legacy
  26570. !! config
  26571. wgFragmentMode=[ 'html5' ]
  26572. !! wikitext
  26573. ==Foo bar==
  26574. ==foo Bar==
  26575. ==Тест==
  26576. ==Тест==
  26577. ==тест==
  26578. ==Hey < # " > % : '==
  26579. [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
  26580. {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
  26581. <!-- These two links should produce identical HTML -->
  26582. [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
  26583. !! html/php
  26584. <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
  26585. <ul>
  26586. <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
  26587. <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
  26588. <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
  26589. <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
  26590. <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
  26591. <li class="toclevel-1 tocsection-6"><a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;"><span class="tocnumber">6</span> <span class="toctext">Hey &lt; # " &gt;&#160;%&#160;: '</span></a></li>
  26592. </ul>
  26593. </div>
  26594. <h2><span class="mw-headline" id="Foo_bar">Foo bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26595. <h2><span class="mw-headline" id="foo_Bar_2">foo Bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26596. <h2><span class="mw-headline" id="Тест">Тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=3" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26597. <h2><span class="mw-headline" id="Тест_2">Тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=4" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26598. <h2><span class="mw-headline" id="тест">тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=5" title="Edit section: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26599. <h2><span class="mw-headline" id="Hey_&lt;_#_&quot;_&gt;_%_:_'">Hey &lt; # " &gt;&#160;%&#160;: '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=6" title="Edit section: Hey &lt; # &quot; &gt; % : &#039;">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26600. <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_&lt;_#_&quot;_&gt;_%_:_&#39;">#Hey &lt; # " &gt;&#160;%&#160;: '</a>
  26601. </p><p>💩 <span id="💩"></span>
  26602. </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
  26603. </p>
  26604. !! end
  26605. !! test
  26606. T90902: Normalize weird characters in section IDs
  26607. !! config
  26608. wgFragmentMode=[ 'html5', 'legacy' ]
  26609. !! wikitext
  26610. ==Foo&nbsp;bar==
  26611. [[#Foo&nbsp;bar]]
  26612. !! html/php
  26613. <h2><span class="mw-headline" id="Foo_bar">Foo&#160;bar</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  26614. <p><a href="#Foo_bar">#Foo&#160;bar</a>
  26615. </p>
  26616. !! html/parsoid
  26617. <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&amp;nbsp;","srcContent":" "}'> </span>bar </h2>
  26618. <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Foo_bar"},"sa":{"href":"#Foo&amp;nbsp;bar"}}'>#Foo bar</a></p>
  26619. !! end
  26620. !! test
  26621. T51672: Test for brackets in attributes of elements in external link texts
  26622. !! wikitext
  26623. [http://example.com/ link <span title="title with [brackets]">span</span>]
  26624. [http://example.com/ link <span title="title with &#91;brackets&#93;">span</span>]
  26625. !! html/php
  26626. <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
  26627. <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with &#91;brackets&#93;">span</span></a>
  26628. </p>
  26629. !! html/parsoid
  26630. <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
  26631. <a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]" data-parsoid='{"stx":"html","a":{"title":"title with [brackets]"},"sa":{"title":"title with &amp;#91;brackets&amp;#93;"}}'>span</span></a></p>
  26632. !! end
  26633. !! test
  26634. T72875: Test for brackets in attributes of elements in internal link texts
  26635. !! wikitext
  26636. [[Foo|link <span title="title with [[double brackets]]">span</span>]]
  26637. [[Foo|link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span>]]
  26638. !! html/php
  26639. <p><a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
  26640. <a href="/wiki/Foo" title="Foo">link <span title="title with &#91;&#91;double brackets&#93;&#93;">span</span></a>
  26641. </p>
  26642. !! html/parsoid
  26643. <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
  26644. <a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]" data-parsoid='{"stx":"html","a":{"title":"title with [[double brackets]]"},"sa":{"title":"title with &amp;#91;&amp;#91;double brackets&amp;#93;&amp;#93;"}}'>span</span></a></p>
  26645. !! end
  26646. !! test
  26647. T179544: {{anchorencode:}} output should be always usable in links
  26648. !! config
  26649. wgFragmentMode=[ 'html5' ]
  26650. !! wikitext
  26651. <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
  26652. !! html/php
  26653. <p><span id="&#91;foo&#93;"></span><a href="#[foo]">#&#91;foo&#93;</a>
  26654. </p>
  26655. !! html/parsoid
  26656. <p><span id="[foo]" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"id":"[foo]"},"sa":{"id":"{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"id"},{"html":"&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[10,32,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt1\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'></span><a typeof="mw:ExpandedAttrs" about="#mwt4" rel="mw:WikiLink" href="./Main_Page#[foo]" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#[foo]"},"sa":{"href":"#{{anchorencode:[foo]}}"}}' data-mw='{"attribs":[[{"txt":"href"},{"html":"#&lt;span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"srcContent\":\"[\",\"dsr\":[44,66,null,null],\"pi\":[[]]}&apos; data-mw=&apos;{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}&apos;>[&lt;/span>&lt;span about=\"#mwt2\" data-parsoid=\"{}\">foo&lt;/span>&lt;span typeof=\"mw:Entity\" about=\"#mwt2\" data-parsoid=&apos;{\"src\":\"&amp;amp;#x5D;\",\"srcContent\":\"]\"}&apos;>]&lt;/span>"}]]}'>#[foo]</a></p>
  26657. !! end
  26658. ## ------------------------------
  26659. ## Parsoid section-wrapping tests
  26660. ## ------------------------------
  26661. !! test
  26662. Section wrapping for well-nested sections (no leading content)
  26663. !! options
  26664. parsoid={
  26665. "wrapSections": true
  26666. }
  26667. !! wikitext
  26668. =1=
  26669. a
  26670. =2=
  26671. b
  26672. ==2.1==
  26673. c
  26674. ==2.2==
  26675. d
  26676. ===2.2.1===
  26677. e
  26678. =3=
  26679. f
  26680. !! html/parsoid
  26681. <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
  26682. <p>a</p>
  26683. </section><section data-mw-section-id="2"><h1 id="2">2</h1>
  26684. <p>b</p>
  26685. <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
  26686. <p>c</p>
  26687. </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
  26688. <p>d</p>
  26689. <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
  26690. <p>e</p>
  26691. </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
  26692. <p>f</p>
  26693. </section>
  26694. !! end
  26695. !! test
  26696. Section wrapping for well-nested sections (with leading content)
  26697. !! options
  26698. parsoid={
  26699. "wrapSections": true
  26700. }
  26701. !! wikitext
  26702. Para 1.
  26703. Para 2 with a <div>nested in it</div>
  26704. Para 3.
  26705. =1=
  26706. a
  26707. =2=
  26708. b
  26709. ==2.1==
  26710. c
  26711. !! html/parsoid
  26712. <section data-mw-section-id="0"><p>Para 1.</p>
  26713. <p>Para 2 with a </p><div>nested in it</div>
  26714. <p>Para 3.</p>
  26715. </section><section data-mw-section-id="1"><h1 id="1">1</h1>
  26716. <p>a</p>
  26717. </section><section data-mw-section-id="2"><h1 id="2">2</h1>
  26718. <p>b</p>
  26719. <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
  26720. <p>c</p>
  26721. </section></section>
  26722. !! end
  26723. !! test
  26724. Section wrapping with template-generated sections (good nesting 1)
  26725. !! options
  26726. parsoid={
  26727. "wrapSections": true
  26728. }
  26729. !! wikitext
  26730. =1=
  26731. a
  26732. {{echo|1=
  26733. ==1.1==
  26734. b
  26735. }}
  26736. ==1.2==
  26737. c
  26738. =2=
  26739. d
  26740. !! html/parsoid
  26741. <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
  26742. <p>a</p>
  26743. <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.1" data-parsoid='{"dsr":[9,33,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.1==\nb"}},"i":0}}]}'>1.1</h2><span about="#mwt1">
  26744. </span><p about="#mwt1">b</p>
  26745. </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
  26746. <p>c</p>
  26747. </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
  26748. <p>d</p></section>
  26749. !! end
  26750. # In this example, the template scope is mildly expanded to incorporate the
  26751. # trailing newline after the transclusion since that is part of section 1.1.1
  26752. !! test
  26753. Section wrapping with template-generated sections (good nesting 2)
  26754. !! options
  26755. parsoid={
  26756. "wrapSections": true,
  26757. "modes": ["wt2html", "wt2wt"]
  26758. }
  26759. !! wikitext
  26760. =1=
  26761. a
  26762. {{echo|1=
  26763. ==1.1==
  26764. b
  26765. ===1.1.1===
  26766. d
  26767. }}
  26768. =2=
  26769. e
  26770. !! html/parsoid
  26771. <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
  26772. <p>a</p>
  26773. <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.1" data-parsoid='{"dsr":[9,50,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.1==\nb\n===1.1.1===\nd"}},"i":0}},"\n"]}'>1.1</h2><span about="#mwt1">
  26774. </span><p about="#mwt1">b</p><span about="#mwt1">
  26775. </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
  26776. </span><p about="#mwt1">d</p><span about="#mwt1">
  26777. </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
  26778. <p>e</p></section>
  26779. !! end
  26780. # In this example, the template scope is mildly expanded to incorporate the
  26781. # trailing newline after the transclusion since that is part of section 1.2.1
  26782. !! test
  26783. Section wrapping with template-generated sections (good nesting 3)
  26784. !! options
  26785. parsoid={
  26786. "wrapSections": true,
  26787. "modes": ["wt2html", "wt2wt"]
  26788. }
  26789. !! wikitext
  26790. =1=
  26791. a
  26792. {{echo|1=
  26793. x
  26794. ==1.1==
  26795. b
  26796. ==1.2==
  26797. c
  26798. ===1.2.1===
  26799. d
  26800. }}
  26801. =2=
  26802. e
  26803. !! html/parsoid
  26804. <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
  26805. <p>a</p>
  26806. <p about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"dsr":[9,60,0,0],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"x\n==1.1==\nb\n==1.2==\nc\n===1.2.1===\nd"}},"i":0}},"\n"]}'>x</p><span about="#mwt1">
  26807. </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
  26808. </span><p about="#mwt1">b</p><span about="#mwt1">
  26809. </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
  26810. </span><p about="#mwt1">c</p><span about="#mwt1">
  26811. </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
  26812. </span><p about="#mwt1">d</p><span about="#mwt1">
  26813. </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
  26814. <p>e</p></section>
  26815. !! end
  26816. # Because of section-wrapping and template-wrapping interactions,
  26817. # the scope of the template is expanded so that the template markup
  26818. # is valid in the presence of <section> tags.
  26819. # This exercises the s1 is null scenario in the wrapSections code
  26820. !! test
  26821. Section wrapping with template-generated sections (bad nesting 1)
  26822. !! options
  26823. parsoid={
  26824. "wrapSections": true
  26825. }
  26826. !! wikitext
  26827. <div>
  26828. a
  26829. {{echo|
  26830. =1=
  26831. b
  26832. }}
  26833. c
  26834. </div>
  26835. !! html/parsoid
  26836. <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
  26837. <p>a</p>
  26838. <span about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n=1=\nb\n"}},"i":0}},"\n\nc\n"]}'>
  26839. </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
  26840. </span><p about="#mwt1">b
  26841. </p><span about="#mwt1">
  26842. </span><p about="#mwt1">c</p><span about="#mwt1">
  26843. </span></section></div></section>
  26844. !! end
  26845. # Because of section-wrapping and template-wrapping interactions,
  26846. # the scope of the template is expanded so that the template markup
  26847. # is valid in the presence of <section> tags.
  26848. # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
  26849. !! test
  26850. Section wrapping with template-generated sections (bad nesting 2)
  26851. !! options
  26852. parsoid={
  26853. "wrapSections": true
  26854. }
  26855. !! wikitext
  26856. =1=
  26857. a
  26858. {{echo|1=
  26859. =2=
  26860. b
  26861. ==2.1==
  26862. c
  26863. }}
  26864. d
  26865. =3=
  26866. e
  26867. !! html/parsoid
  26868. <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
  26869. <p>a</p>
  26870. </section><section data-mw-section-id="-1"><h1 about="#mwt1" typeof="mw:Transclusion" id="2" data-parsoid='{"dsr":[9,45,null,null],"pi":[[{"k":"1","named":true,"spc":["","","\n","\n"]}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"=2=\nb\n==2.1==\nc"}},"i":0}},"\n\nd\n\n"]}'>2</h1><span about="#mwt1">
  26871. </span><p about="#mwt1">b</p><span about="#mwt1">
  26872. </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
  26873. </span><p about="#mwt1">c</p><span about="#mwt1">
  26874. </span><p about="#mwt1">d</p><span about="#mwt1">
  26875. </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
  26876. <p>e</p></section>
  26877. !! end
  26878. # Because of section-wrapping and template-wrapping interactions,
  26879. # additional template wrappers are added to <section> tags
  26880. # so that template wrapping semantics are valid whether section
  26881. # tags are retained or stripped. But, the template scope can expand
  26882. # greatly when accounting for section tags.
  26883. # This exercises the s1 and s2 are in different subtrees scenario
  26884. !! test
  26885. Section wrapping with template-generated sections (bad nesting 3)
  26886. !! options
  26887. parsoid={
  26888. "wrapSections": true,
  26889. "modes": ["wt2html", "wt2wt"]
  26890. }
  26891. !! wikitext
  26892. =1=
  26893. a
  26894. {{echo|1=
  26895. ==1.2==
  26896. b
  26897. =2=
  26898. c
  26899. }}
  26900. d
  26901. =3=
  26902. e
  26903. !! html/parsoid
  26904. <section data-mw-section-id="0"></section><section data-mw-section-id="1" about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["=1=\na\n\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.2==\nb\n=2=\nc"}},"i":0}},"\n\nd\n\n"]}'><h1 id="1">1</h1>
  26905. <p>a</p>
  26906. <section data-mw-section-id="-1"><h2 about="#mwt1" typeof="mw:Transclusion" id="1.2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"==1.2==\nb\n=2=\nc"}},"i":0}}]}'>1.2</h2><span about="#mwt1">
  26907. </span><p about="#mwt1">b</p><span about="#mwt1">
  26908. </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
  26909. </span><p about="#mwt1">c</p>
  26910. <p>d</p>
  26911. </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
  26912. <p>e</p></section>
  26913. !! end
  26914. !! test
  26915. Section wrapping with uneditable lead section + div wrapping multiple sections
  26916. !! options
  26917. parsoid={
  26918. "wrapSections": true
  26919. }
  26920. !! wikitext
  26921. foo
  26922. <div style="border:1px solid red;">
  26923. =1=
  26924. a
  26925. ==1.1==
  26926. b
  26927. =2=
  26928. c
  26929. </div>
  26930. =3=
  26931. d
  26932. ==3.1==
  26933. e
  26934. !! html/parsoid
  26935. <section data-mw-section-id="-1"><p>foo</p>
  26936. </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
  26937. <section data-mw-section-id="1"><h1 id="1">1</h1>
  26938. <p>a</p>
  26939. <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
  26940. <p>b</p>
  26941. </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
  26942. <p>c</p>
  26943. </section></div>
  26944. </section><section data-mw-section-id="4"><h1 id="3">3</h1>
  26945. <p>d</p>
  26946. <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
  26947. <p>e</p>
  26948. </section></section>
  26949. !! end
  26950. !! test
  26951. Section wrapping with editable lead section + div overlapping multiple sections
  26952. !! options
  26953. parsoid={
  26954. "wrapSections": true
  26955. }
  26956. !! wikitext
  26957. foo
  26958. =1=
  26959. a
  26960. <div style="border:1px solid red;">
  26961. b
  26962. ==1.1==
  26963. c
  26964. =2=
  26965. d
  26966. </div>
  26967. e
  26968. =3=
  26969. f
  26970. ==3.1==
  26971. g
  26972. !! html/parsoid
  26973. <section data-mw-section-id="0"><p>foo</p>
  26974. </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
  26975. <p>a</p>
  26976. </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
  26977. <p>b</p>
  26978. <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
  26979. <p>c</p>
  26980. </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
  26981. <p>d</p>
  26982. </section></div>
  26983. <p>e</p>
  26984. </section><section data-mw-section-id="4"><h1 id="3">3</h1>
  26985. <p>f</p>
  26986. <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
  26987. <p>g</p>
  26988. </section></section>
  26989. !! end
  26990. !! test
  26991. HTML header tags should not be wrapped in section tags
  26992. !! options
  26993. parsoid={
  26994. "wrapSections": true
  26995. }
  26996. !! wikitext
  26997. foo
  26998. <h1>a</h1>
  26999. =b=
  27000. <h1>c</h1>
  27001. =d=
  27002. !! html/parsoid
  27003. <section data-mw-section-id="0"><p>foo</p>
  27004. <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
  27005. </section><section data-mw-section-id="1"><h1 id="b">b</h1>
  27006. <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
  27007. </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
  27008. !! end
  27009. !! test
  27010. Lead section containing only whitespace and comments.
  27011. !! options
  27012. parsoid={
  27013. "wrapSections": true
  27014. }
  27015. !! wikitext
  27016. <!-- this is a comment, presumably significant to editors -->
  27017. =1=
  27018. a
  27019. =2=
  27020. b
  27021. !! html/parsoid
  27022. <section data-mw-section-id="0" data-parsoid="{}">
  27023. <!-- this is a comment, presumably significant to editors -->
  27024. </section><section data-mw-section-id="1"><h1 id="1">1</h1>
  27025. <p>a</p>
  27026. </section><section data-mw-section-id="2"><h1 id="2">2</h1>
  27027. <p>b</p></section>
  27028. !! end
  27029. !! test
  27030. Pseudo-sections emitted by templates should have id -2
  27031. !! options
  27032. parsoid={
  27033. "wrapSections": true
  27034. }
  27035. !! wikitext
  27036. foo
  27037. {{echo|<div>
  27038. ==a==
  27039. ==b==
  27040. </div>
  27041. }}
  27042. !! html/parsoid
  27043. <section data-mw-section-id="-1"><p>foo</p>
  27044. </section><section data-mw-section-id="-2"><div about="#mwt1" typeof="mw:Transclusion" data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&lt;div>\n==a==\n==b==\n&lt;/div>\n"}},"i":0}}]}'>
  27045. <section data-mw-section-id="-1"><h2 id="a">a</h2>
  27046. </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
  27047. </section></div><span about="#mwt1">
  27048. </span></section>
  27049. !! end
  27050. ##########################################################################
  27051. Tests demonstrating white-space insensitivity in input wikitext
  27052. for wikitext headings, wikitext list items, and wikitext table captions,
  27053. headings, and cells. HTML versions of the same should preserve whitespace.
  27054. ##########################################################################
  27055. !! test
  27056. Trim whitespace in wikitext headings, list items, table captions, headings, and cells
  27057. !! wikitext
  27058. __NOTOC__
  27059. == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
  27060. == <!--c2--> <!--c2--> Tabs <!--c3--><!--c4--> ==
  27061. * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
  27062. ; <!--term to define--> term : <!--term's definition--> definition
  27063. {|
  27064. |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
  27065. |-
  27066. ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
  27067. |-
  27068. | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
  27069. |-
  27070. | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
  27071. |-
  27072. | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
  27073. |}
  27074. : {|
  27075. | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
  27076. |} foo <!--c1-->
  27077. !! html/php+tidy
  27078. <h2><span class="mw-headline" id="Spaces">Spaces</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=1" title="Edit section: Spaces">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  27079. <h2><span class="mw-headline" id="Tabs">Tabs</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&amp;action=edit&amp;section=2" title="Edit section: Tabs">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
  27080. <ul><li>List item</li></ul>
  27081. <dl><dt>term&#160;</dt>
  27082. <dd>definition</dd></dl>
  27083. <table>
  27084. <caption>Table Caption
  27085. </caption>
  27086. <tbody><tr>
  27087. <th>Table Heading 1</th>
  27088. <th>Table Heading 2
  27089. </th></tr>
  27090. <tr>
  27091. <td>Table Cell 1</td>
  27092. <td>Table Cell 2
  27093. </td></tr>
  27094. <tr>
  27095. <td>class="foo"</td>
  27096. <td>Table Cell 3
  27097. </td></tr>
  27098. <tr>
  27099. <td>testing <a href="/index.php?title=One&amp;action=edit&amp;redlink=1" class="new" title="One (page does not exist)">two</a> | some content
  27100. </td></tr></tbody></table>
  27101. <dl><dd><table>
  27102. <tbody><tr>
  27103. <td>Table Cell 1</td>
  27104. <td>Table Cell 2
  27105. </td></tr></tbody></table> foo</dd></dl>
  27106. !! end
  27107. # Looks like <caption> is not accepted in HTML
  27108. !! test
  27109. Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
  27110. !! wikitext
  27111. __NOTOC__
  27112. <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
  27113. <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
  27114. <table>
  27115. <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
  27116. <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
  27117. </table>
  27118. !! html/php+tidy
  27119. <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
  27120. <ul><li> List item </li></ul>
  27121. <table>
  27122. <tbody><tr><th> Table Heading </th><th></th></tr>
  27123. <tr><td> Table Cell </td><th></th></tr>
  27124. </tbody></table>
  27125. !! end
  27126. !! test
  27127. Do not trim whitespace in links and quotes
  27128. !! wikitext
  27129. foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
  27130. [[Foo| some text ]]
  27131. !! html/php+tidy
  27132. <p>foo <i> italic </i> and <b> bold </b>
  27133. <a href="/wiki/Foo" title="Foo"> some text </a>
  27134. </p>
  27135. !! end
  27136. !! test
  27137. Remove p tags surrounding a single element in a figcaption
  27138. !! options
  27139. parsoid=html2wt
  27140. !! wikitext
  27141. [[File:Foobar.jpg|right|200x200px|Caption]]
  27142. !! html/parsoid
  27143. <figure class="mw-halign-right" typeof="mw:Image"><a href="./File:Foobar.jpg"><img resource="./File:Foobar.jpg" src="//example.com/images/thumb/3/3a/Foobar.jpg/200px-Foobar.jpg" data-file-width="1941" data-file-height="220" data-file-type="bitmap" height="23" width="200"/></a><figcaption><p>Caption</p></figcaption></figure>
  27144. !! end
  27145. !! test
  27146. Selser preserves lack of newline before list and allows newline after the list
  27147. !! options
  27148. parsoid={
  27149. "modes": ["selser"],
  27150. "scrubWikitext": true,
  27151. "changes": [
  27152. [ "ul", "after", "<p>footer</p>" ]
  27153. ]
  27154. }
  27155. !! wikitext
  27156. header
  27157. *foo
  27158. *bar
  27159. !! wikitext/edited
  27160. header
  27161. *foo
  27162. *bar
  27163. footer
  27164. !! end
  27165. !! test
  27166. Selser does not introduce newlines between unedited paragraph preceding the list
  27167. !! options
  27168. parsoid={
  27169. "modes": ["selser"],
  27170. "changes": [
  27171. [ "table tbody tr td p:last-child", "empty" ]
  27172. ]
  27173. }
  27174. !! wikitext
  27175. {|
  27176. |
  27177. header
  27178. *foo
  27179. *bar
  27180. footer
  27181. |}
  27182. !! wikitext/edited
  27183. {|
  27184. |
  27185. header
  27186. *foo
  27187. *bar
  27188. |}
  27189. !! end
  27190. !! test
  27191. Selser does not introduce newlines between unedited paragraph following the list
  27192. !! options
  27193. parsoid={
  27194. "modes": ["selser"],
  27195. "changes": [
  27196. [ "table tbody tr td p:first-child", "empty" ]
  27197. ]
  27198. }
  27199. !! wikitext
  27200. {|
  27201. |
  27202. header
  27203. *foo
  27204. *bar
  27205. footer
  27206. |}
  27207. !! wikitext/edited
  27208. {|
  27209. |
  27210. *foo
  27211. *bar
  27212. footer
  27213. |}
  27214. !! end
  27215. !! test
  27216. Remove a list item but do not insert newline above list
  27217. !! options
  27218. parsoid={
  27219. "modes": ["selser"],
  27220. "changes": [
  27221. [ "ul li:last-child", "remove" ]
  27222. ]
  27223. }
  27224. !! wikitext
  27225. header
  27226. *foo
  27227. *bar
  27228. footer
  27229. !! wikitext/edited
  27230. header
  27231. *foo
  27232. footer
  27233. !! end