123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825 |
- # MediaWiki Parser test cases
- # Some taken from https://meta.wikimedia.org/wiki/Parser_testing
- # All (C) their respective authors and released under the GPL
- #
- # The syntax should be fairly self-explanatory.
- #
- # Currently supported test options:
- # One of the following three:
- #
- # (default) generate HTML output
- # pst apply pre-save transform
- # msg apply message transform
- #
- # Plus any combination of these:
- #
- # cat add category links
- # (ignored by Parsoid, since it emits <link>s)
- # ill add inter-language links
- # (ignored by Parsoid, since it emits <link>s)
- # subpage enable subpages (disabled by default)
- # title=[[XXX]] run test using article title XXX
- # language=XXX set content language to XXX for this test
- # variant=XXX set the variant of language for this test (eg zh-tw)
- # disabled do not run test
- # parsoid parsoid-specific options (not run by PHP parser unless
- # the test includes an html/php section)
- # php php-only test (not run by the parsoid parser unless
- # the test includes an html/parsoid section)
- # showtitle make the first line the title
- # showindicators make the first lines the page status indicators
- # comment run through Linker::formatComment() instead of main parser
- # local format section links in edit comment text as local links
- # notoc disable table of contents
- # thumbsize=NNN set the default thumb size to NNNpx for this test
- # wrap include the normal wrapper <div class="mw-parser-output"> (since 1.30)
- #
- # You can also set the following parser properties via test options:
- # wgEnableUploads, wgAllowExternalImages, wgMaxTocLevel,
- # wgLinkHolderBatchSize, wgRawHtml, wgInterwikiMagic,
- # wgEnableMagicLinks
- #
- # For testing purposes, temporary articles can created:
- # !!article / NAMESPACE:TITLE / !!text / ARTICLE TEXT / !!endarticle
- # where '/' denotes a newline.
- # This is the standard article assumed to exist.
- !! article
- Main Page
- !! text
- blah blah
- !! endarticle
- !!article
- Foo
- !!text
- FOO
- !!endarticle
- !!article
- Template:Foo
- !!text
- FOO
- !!endarticle
- !! article
- Template:Blank
- !! text
- !! endarticle
- !! article
- Template:pipe
- !! text
- |
- !! endarticle
- !! article
- Template:=
- !! text
- <nowiki>=</nowiki>
- !! endarticle
- !!article
- MediaWiki:bad image list
- !!text
- * [[File:Bad.jpg]] except [[Nasty page]]
- !!endarticle
- !! article
- Template:inner list
- !! text
- * item 1
- !! endarticle
- !! article
- Template:tbl-start
- !! text
- {|
- !! endarticle
- !! article
- Template:tbl-end
- !! text
- |}
- !! endarticle
- !! article
- Template:echo
- !! text
- {{{1}}}
- !! endarticle
- // For Serbian; localize Template namespace
- !! article
- Шаблон:Echo
- !! text
- {{{1}}}
- !! endarticle
- !! article
- Template:echo_with_span
- !! text
- <span>{{{1}}}</span>
- !! endarticle
- !! article
- Template:echo_with_div
- !! text
- <div>{{{1}}}</div>
- !! endarticle
- !! article
- Template:blank_param
- !! text
- {{{1}}}
- {{{}}}
- !! endarticle
- !! article
- Template:table_attribs
- !! text
- <noinclude>
- |</noinclude>style="color:red;"|Foo
- !! endarticle
- !! article
- Template:table_attribs_2
- !! text
- <noinclude>
- |</noinclude>style="color:red;"|Foo
- |Bar||Baz
- !! endarticle
- !! article
- Template:table_attribs_3
- !! text
- <noinclude>
- |</noinclude>style{{=}}"background:#f9f9f9;"|Foo
- !! endarticle
- !! article
- Template:table_attribs_4
- !! text
- | style="background-color:#DC241f;" width="10px" |
- !! endarticle
- !! article
- Template:table_attribs_5
- !! text
- <noinclude>
- |</noinclude>style="color:red;"||Bar
- !! endarticle
- !! article
- Template:table_attribs_6
- !! text
- style="background: <nowiki>
- red;</nowiki>" |
- !! endarticle
- !! article
- Template:table_attribs_7
- !! text
- <noinclude>
- |</noinclude>style{{=}}"background:#f9f9f9;"|Foo<ref>foo</ref>
- !! endarticle
- !! article
- Template:table_header_cells
- !! text
- {{table_attribs}}!!style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
- !! endarticle
- !! article
- Template:table_cells
- !! text
- {{table_attribs}}||style='color:red;'|''Bar''||style='color:brown;'|''Foo'' and Baz
- !! endarticle
- !! article
- Template:PartialTable
- !! text
- {|
- |-
- !! endarticle
- !! article
- Template:image_attribs
- !! text
- <noinclude>
- [[File:foobar.jpg|</noinclude>right|Caption text<noinclude>]]</noinclude>
- !! endarticle
- ## See T48811 for details
- !! article
- Template:mixed_attr_content_template
- !! text
- style="color:red;" title="T48811"
- |-
- |foo
- !! endarticle
- !! article
- Template:definition_list
- !! text
- one
- ::two
- !! endarticle
- !! article
- A?b
- !! text
- Weirdo titles!
- !! endarticle
- !!article
- Template:Bullet
- !!text
- * Bar
- !!endarticle
- !!article
- Template:OpenTable
- !!text
- {|
- !!endarticle
- !!article
- Template:EmptyLITest
- !!text
- *a
- *
- *
- *b
- !!endarticle
- !!article
- Template:EmptyTRTest
- !!text
- {|
- |-
- |-
- |foo
- |-
- |-
- |bar
- |}
- !!endarticle
- !!article
- Template:EmptyTRWithHTMLAttrTest
- !!text
- <table>
- <tr align="center"></tr>
- <tr><td>foo</td></tr>
- <tr align="center"></tr>
- <tr><td>bar</td></tr>
- </table>
- !!endarticle
- !! article
- Template:With: Colon
- !! text
- Template with colon
- !! endarticle
- ###
- ### Basic tests
- ###
- !! test
- Blank input
- !! wikitext
- !! html
- !! end
- !! test
- Simple paragraph
- !! wikitext
- This is a simple paragraph.
- !! html
- <p>This is a simple paragraph.
- </p>
- !! end
- !! test
- Paragraphs with extra newline spacing
- !! wikitext
- foo
- bar
- baz
- booz
- !! html
- <p>foo
- </p><p>bar
- </p><p><br />
- baz
- </p><p><br />
- </p><p>booz
- </p>
- !! end
- !! test
- Paragraphs with newline spacing with comment lines in between
- !! wikitext
- ----
- a
- <!--foo-->
- b
- ----
- a
- <!--foo--><!--More than 1 comment, still stripped-->
- b
- ----
- a
- <!--foo--> <!----> <!-- bar -->
- b
- ----
- a
- <!--foo-->
- b
- ----
- a
- <!--foo-->
- b
- ----
- a
- <!--foo-->
- b
- ----
- a
- <!--foo-->
- b
- ----
- !! html
- <hr />
- <p>a
- b
- </p>
- <hr />
- <p>a
- b
- </p>
- <hr />
- <p>a
- b
- </p>
- <hr />
- <p>a
- </p><p>b
- </p>
- <hr />
- <p>a
- </p><p>b
- </p>
- <hr />
- <p>a
- </p><p><br />
- b
- </p>
- <hr />
- <p>a
- </p><p><br />
- b
- </p>
- <hr />
- !! end
- !! test
- Paragraphs with newline spacing with non-empty white-space lines in between
- !! wikitext
- ----
- a
-
- b
- ----
- a
-
-
- b
- ----
- !! html
- <hr />
- <p>a
- </p><p>b
- </p>
- <hr />
- <p>a
- </p><p><br />
- b
- </p>
- <hr />
- !! end
- !! test
- Paragraphs with newline spacing with non-empty mixed comment and white-space lines in between
- !! wikitext
- ----
- a
- <!--foo-->
- b
- ----
- a
- <!--foo--><!--More than 1 comment doesn't disable stripping of this line!-->
- b
- ----
- a
-
- <!--foo-->
- <!--bar-->
- b
- ----
- a
-
- <!--foo-->
- <!--bar-->
-
- b
- ----
- !! html
- <hr />
- <p>a
- b
- </p>
- <hr />
- <p>a
- b
- </p>
- <hr />
- <p>a
- </p><p>b
- </p>
- <hr />
- <p>a
- </p><p><br />
- b
- </p>
- <hr />
- !! end
- !! test
- Extra newlines: More paragraphs with indented comment
- !! wikitext
- a
- <!--boo-->
- b
- !! html
- <p>a
- </p><p><br />
- b
- </p>
- !!end
- !! test
- Extra newlines followed by heading
- !! wikitext
- a
- =b=
- [[a]]
- =b=
- !! html
- <p>a
- </p><p><br />
- </p>
- <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&action=edit&section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <p><a href="/index.php?title=A&action=edit&redlink=1" class="new" title="A (page does not exist)">a</a>
- </p><p><br />
- </p>
- <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&action=edit&section=2" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- !! end
- !! test
- Extra newlines between heading and content are swallowed
- !! wikitext
- =b=
- [[a]]
- !! html
- <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&action=edit&section=1" title="Edit section: b">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <p><a href="/index.php?title=A&action=edit&redlink=1" class="new" title="A (page does not exist)">a</a>
- </p>
- !! end
- !! test
- Heading with line break in nowiki
- !! options
- parsoid=wt2html
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- ==A <nowiki>B
- C</nowiki>==
- !! html/php
- <h2><span id="A_B.0AC"></span><span class="mw-headline" id="A_B
- C">A B
- C</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: A B C">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <h2 id="A_B
- C"><span id="A_B.0AC" typeof="mw:FallbackId"></span>A <span typeof="mw:Nowiki">B
- C</span></h2>
- !! end
- !! test
- Parsing an URL
- !! wikitext
- http://fr.wikipedia.org/wiki/🍺
- <!-- EasterEgg we love beer, better be able be able to link to it -->
- !! html
- <p><a rel="nofollow" class="external free" href="http://fr.wikipedia.org/wiki/🍺">http://fr.wikipedia.org/wiki/🍺</a>
- </p>
- !! end
- !! test
- Simple list
- !! wikitext
- *Item 1
- *Item 2
- !! html
- <ul><li>Item 1</li>
- <li>Item 2</li></ul>
- !! end
- !! test
- Italics and bold
- !! wikitext
- *plain
- *plain''italic''plain
- *plain''italic''plain''italic''plain
- *plain'''bold'''plain
- *plain'''bold'''plain'''bold'''plain
- *plain''italic''plain'''bold'''plain
- *plain'''bold'''plain''italic''plain
- *plain''italic'''bold-italic'''italic''plain
- *plain'''bold''bold-italic''bold'''plain
- *plain'''''bold-italic'''italic''plain
- *plain'''''bold-italic''bold'''plain
- *plain''italic'''bold-italic'''''plain
- *plain'''bold''bold-italic'''''plain
- *plain l'''italic''plain
- *plain l''''bold''' plain
- !! html
- <ul><li>plain</li>
- <li>plain<i>italic</i>plain</li>
- <li>plain<i>italic</i>plain<i>italic</i>plain</li>
- <li>plain<b>bold</b>plain</li>
- <li>plain<b>bold</b>plain<b>bold</b>plain</li>
- <li>plain<i>italic</i>plain<b>bold</b>plain</li>
- <li>plain<b>bold</b>plain<i>italic</i>plain</li>
- <li>plain<i>italic<b>bold-italic</b>italic</i>plain</li>
- <li>plain<b>bold<i>bold-italic</i>bold</b>plain</li>
- <li>plain<i><b>bold-italic</b>italic</i>plain</li>
- <li>plain<b><i>bold-italic</i>bold</b>plain</li>
- <li>plain<i>italic<b>bold-italic</b></i>plain</li>
- <li>plain<b>bold<i>bold-italic</i></b>plain</li>
- <li>plain l'<i>italic</i>plain</li>
- <li>plain l'<b>bold</b> plain</li></ul>
- !! end
- # this example taken from the [[simple:Moon]] article (T49326)
- !! test
- Italics and possessives (1)
- !! wikitext
- obtained by ''[[Lunar Prospector]]'''s gamma-ray spectrometer
- !! html
- <p>obtained by <i><a href="/index.php?title=Lunar_Prospector&action=edit&redlink=1" class="new" title="Lunar Prospector (page does not exist)">Lunar Prospector</a>'</i>s gamma-ray spectrometer
- </p>
- !! end
- # this example taken from [[en:Flaming Pie]] (T51926)
- !! test
- Italics and possessives (2)
- !! wikitext
- '''''Flaming Pie''''' is ... released in 1997. In ''Flaming Pie'''s liner notes
- !! html
- <p><i><b>Flaming Pie</b></i> is ... released in 1997. In <i>Flaming Pie'</i>s liner notes
- </p>
- !! end
- # this example taken from [[en:Dictionary]] (T51926)
- !! test
- Italics and possessives (3)
- !! wikitext
- 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''.
- !! html
- <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&action=edit&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>.
- </p>
- !! end
- ###
- ### 2-quote opening sequence tests
- ###
- !! test
- Italics and bold: 2-quote opening sequence: (2,2)
- !! wikitext
- ''foo''
- !! html
- <p><i>foo</i>
- </p>
- !!end
- !! test
- Italics and bold: 2-quote opening sequence: (2,3)
- !! wikitext
- ''foo'''
- !! html/*
- <p><i>foo'</i>
- </p>
- !!end
- !! test
- Italics and bold: 2-quote opening sequence: (2,4)
- !! options
- parsoid=wt2html
- !! wikitext
- ''foo''''
- !! html/*
- <p><i>foo''</i>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 2-quote opening sequence: (2,4) w/ nowiki
- !! wikitext
- ''foo<nowiki>''</nowiki>''
- !! html
- <p><i>foo''</i>
- </p>
- !! end
- # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
- !! test
- Italics and bold: 2-quote opening sequence: (2,5)
- !! options
- parsoid=wt2html
- !! wikitext
- ''foo'''''
- !! html/php
- <p><i>foo</i>
- </p>
- !! html/parsoid
- <p><i>foo</i><b></b>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 2-quote opening sequence: (2,5+3) w/ nowiki
- !! wikitext
- ''foo'''''<nowiki/>'''
- !! html/php
- <p><i>foo</i>
- </p>
- !! html/parsoid
- <p><i>foo</i><b></b>
- </p>
- !! end
- ###
- ### 3-quote opening sequence tests
- ###
- !! test
- Italics and bold: 3-quote opening sequence: (3,2)
- !! wikitext
- '''foo''
- !! html/*
- <p>'<i>foo</i>
- </p>
- !!end
- !! test
- Italics and bold: 3-quote opening sequence: (3,3)
- !! wikitext
- '''foo'''
- !! html
- <p><b>foo</b>
- </p>
- !!end
- !! test
- Italics and bold: 3-quote opening sequence: (3,4)
- !! wikitext
- '''foo''''
- !! html/*
- <p><b>foo'</b>
- </p>
- !!end
- # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
- !! test
- Italics and bold: 3-quote opening sequence: (3,5)
- !! options
- parsoid=wt2html
- !! wikitext
- '''foo'''''
- !! html/php
- <p><b>foo</b>
- </p>
- !! html/parsoid
- <p><b>foo</b><i></i>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 3-quote opening sequence: (3,5+2) w/ nowiki
- !! wikitext
- '''foo'''''<nowiki/>''
- !! html/php
- <p><b>foo</b>
- </p>
- !! html/parsoid
- <p><b>foo</b><i></i>
- </p>
- !! end
- ###
- ### 4-quote opening sequence tests
- ###
- !! test
- Italics and bold: 4-quote opening sequence: (4,2)
- !! options
- parsoid=wt2html
- !! wikitext
- ''''foo''
- !! html/*
- <p>''<i>foo</i>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 4-quote opening sequence: (4,2) w/ nowiki
- !! wikitext
- <nowiki>''</nowiki>''foo''
- !! html
- <p>''<i>foo</i>
- </p>
- !! end
- !! test
- Italics and bold: 4-quote opening sequence: (4,3)
- !! wikitext
- ''''foo'''
- !! html/*
- <p>'<b>foo</b>
- </p>
- !!end
- !! test
- Italics and bold: 4-quote opening sequence: (4,4)
- !! options
- parsoid=wt2html
- !! wikitext
- ''''foo''''
- !! html/*
- <p>'<b>foo'</b>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 4-quote opening sequence: (4,4) w/ nowiki
- !! wikitext
- '<nowiki/>'''foo''''
- !! html
- <p>'<b>foo'</b>
- </p>
- !! end
- # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
- !! test
- Italics and bold: 4-quote opening sequence: (4,5)
- !! options
- parsoid=wt2html
- !! wikitext
- ''''foo'''''
- !! html/php
- <p>'<b>foo</b>
- </p>
- !! html/parsoid
- <p>'<b>foo</b><i></i>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 4-quote opening sequence: (4,5+2) w/ nowiki
- !! wikitext
- '<nowiki/>'''foo'''''<nowiki/>''
- !! html/php
- <p>'<b>foo</b>
- </p>
- !! html/parsoid
- <p>'<b>foo</b><i></i>
- </p>
- !! end
- ###
- ### 5-quote opening sequence tests
- ###
- !! test
- Italics and bold: 5-quote opening sequence: (5,2)
- !! options
- parsoid=wt2html
- !! wikitext
- '''''foo''
- !! html/*
- <p><b><i>foo</i></b>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 5-quote opening sequence: (5,2+3)
- !! wikitext
- '''''foo'''''
- !! html/*
- <p><i><b>foo</b></i>
- </p>
- !! end
- !! test
- Italics and bold: 5-quote opening sequence: (5,3)
- !! options
- parsoid=wt2html
- !! wikitext
- '''''foo'''
- !! html/*
- <p><i><b>foo</b></i>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: 5-quote opening sequence: (5,3+2)
- !! wikitext
- '''''foo'''''
- !! html
- <p><i><b>foo</b></i>
- </p>
- !! end
- !! test
- Italics and bold: 5-quote opening sequence: (5,4)
- !! options
- parsoid=wt2html
- !! wikitext
- '''''foo''''
- !! html/*
- <p><i><b>foo'</b></i>
- </p>
- !!end
- !! test
- Italics and bold: 5-quote opening sequence: (5,5)
- !! wikitext
- '''''foo'''''
- !! html
- <p><i><b>foo</b></i>
- </p>
- !!end
- !! test
- Italics and bold: 5-quote opening sequence: (5,6)
- !! wikitext
- '''''foo''''''
- !! html/*
- <p><i><b>foo'</b></i>
- </p>
- !! end
- ###
- ### multiple quote sequences in a line
- ###
- !! test
- Italics and bold: multiple quote sequences: (2,4,2)
- !! options
- parsoid=wt2html
- !! wikitext
- ''foo''''bar''
- !! html/*
- <p><i>foo'<b>bar</b></i>
- </p>
- !! end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: multiple quote sequences: (2,4,2+3) w/ nowiki
- !! wikitext
- ''foo'<nowiki/>'''bar'''''
- !! html
- <p><i>foo'<b>bar</b></i>
- </p>
- !! end
- !! test
- Italics and bold: multiple quote sequences: (2,4,3)
- !! options
- parsoid=wt2html
- !! wikitext
- ''foo''''bar'''
- !! html/*
- <p><i>foo'<b>bar</b></i>
- </p>
- !! end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: multiple quote sequences: (2,4,3+2) w/ nowiki
- !! wikitext
- ''foo'<nowiki/>'''bar'''''
- !! html
- <p><i>foo'<b>bar</b></i>
- </p>
- !! end
- !! test
- Italics and bold: multiple quote sequences: (2,4,4)
- !! options
- parsoid=wt2html
- !! wikitext
- ''foo''''bar''''
- !! html/*
- <p><i>foo'<b>bar'</b></i>
- </p>
- !! end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: multiple quote sequences: (2,4,4+2) w/ nowiki
- !! wikitext
- ''foo'<nowiki/>'''bar'<nowiki/>'''''
- !! html
- <p><i>foo'<b>bar'</b></i>
- </p>
- !! end
- # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
- !! test
- Italics and bold: multiple quote sequences: (3,4,2)
- !! options
- parsoid=wt2html
- !! wikitext
- '''foo''''bar''
- !! html/php
- <p><b>foo'</b>bar
- </p>
- !! html/parsoid
- <p><b>foo'</b>bar<i></i>
- </p>
- !! end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: multiple quote sequences: (3,4,2+2) w/ nowiki
- !! wikitext
- '''foo''''bar''<nowiki/>''
- !! html/php
- <p><b>foo'</b>bar
- </p>
- !! html/parsoid
- <p><b>foo'</b>bar<i></i>
- </p>
- !! end
- # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
- !! test
- Italics and bold: multiple quote sequences: (3,4,3)
- !! options
- parsoid=wt2html
- !! wikitext
- '''foo''''bar'''
- !! html/php
- <p><b>foo'</b>bar
- </p>
- !! html/parsoid
- <p><b>foo'</b>bar<b></b>
- </p>
- !! end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: multiple quote sequences: (3,4,3+3) w/ nowiki
- !! wikitext
- '''foo''''bar'''<nowiki/>'''
- !! html/php
- <p><b>foo'</b>bar
- </p>
- !! html/parsoid
- <p><b>foo'</b>bar<b></b>
- </p>
- !! end
- ###
- ### other quote tests
- ###
- !! test
- Italics and bold: other quote tests: (2,3,5)
- !! wikitext
- ''this is about '''foo's family'''''
- !! html
- <p><i>this is about <b>foo's family</b></i>
- </p>
- !!end
- !! test
- Italics and bold: other quote tests: (2,(3,3),2)
- !! wikitext
- ''this is about '''foo's''' family''
- !! html
- <p><i>this is about <b>foo's</b> family</i>
- </p>
- !!end
- !! test
- Italics and bold: other quote tests: (3,2,3,2)
- !! options
- parsoid=wt2html
- !! wikitext
- '''this is about ''foo'''s family''
- !! html/*
- <p><b>this is about <i>foo</i></b><i>s family</i>
- </p>
- !!end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- !! test
- Italics and bold: other quote tests: (3,2,3+2+2,2)
- !! wikitext
- '''this is about ''foo'''''<nowiki/>''s family''
- !! html
- <p><b>this is about <i>foo</i></b><i>s family</i>
- </p>
- !! end
- !! test
- Italics and bold: other quote tests: (3,2,3,3)
- !! wikitext
- '''this is about ''foo'''s family'''
- !! html/*
- <p>'<i>this is about </i>foo<b>s family</b>
- </p>
- !!end
- !! test
- Italics and bold: other quote tests: (3,(2,2),3)
- !! wikitext
- '''this is about ''foo's'' family'''
- !! html
- <p><b>this is about <i>foo's</i> family</b>
- </p>
- !!end
- !! test
- Italicized possessive
- !! wikitext
- The ''[[Main Page]]'''s talk page.
- !! html/php
- <p>The <i><a href="/wiki/Main_Page" title="Main Page">Main Page</a>'</i>s talk page.
- </p>
- !! html/parsoid
- <p>The <i><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>'</i>s talk page.</p>
- !! end
- !! test
- Quote balancing context should be restricted to td/th cells on the same wikitext line
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- {|
- !''a!!''b
- |''a||''b
- |}
- !! html+tidy
- <table>
- <tbody><tr>
- <th><i>a</i></th>
- <th><i>b</i>
- </th>
- <td><i>a</i></td>
- <td><i>b</i>
- </td></tr></tbody></table>
- !! end
- ###
- ### Non-html5 tags
- ###
- !! test
- Non-html5 tags should be accepted
- !! wikitext
- <center>''foo''</center>
- <big>''foo''</big>
- <font>''foo''</font>
- <strike>''foo''</strike>
- <tt>''foo''</tt>
- !! html
- <center><i>foo</i></center>
- <p><big><i>foo</i></big>
- <font><i>foo</i></font>
- <strike><i>foo</i></strike>
- <tt><i>foo</i></tt>
- </p>
- !! end
- !! test
- <wbr> is valid wikitext (T54468)
- !! wikitext
- <wbr>
- !! html
- <p><wbr />
- </p>
- !! end
- # <strike> is HTML4, <s> is HTML4/5.
- !! test
- <s> or <strike> for strikethrough
- !! wikitext
- <strike>strike</strike>
- <s>s</s>
- !! html
- <p><strike>strike</strike>
- </p><p><s>s</s>
- </p>
- !! end
- ## a not permitted
- ## i,b,br omitted
- !! test
- Text-level semantic html elements in wikitext
- !! wikitext
- <em>text</em>
- <strong>text</strong>
- <small>text</small>
- <s>text</s>
- <cite>text</cite>
- <q>text</q>
- <dfn>text</dfn>
- <abbr>text</abbr>
- <data>text</data>
- <time>text</time>
- <code>text</code>
- <var>text</var>
- <samp>text</samp>
- <kbd>text</kbd>
- <sub>text</sub>
- <u>text</u>
- <mark>text</mark>
- <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
- <bdi>text</bdi>
- <bdo>text</bdo>
- <span>text</span>
- <wbr />
- !! html
- <p><em>text</em>
- <strong>text</strong>
- <small>text</small>
- <s>text</s>
- <cite>text</cite>
- <q>text</q>
- <dfn>text</dfn>
- <abbr>text</abbr>
- <data>text</data>
- <time>text</time>
- <code>text</code>
- <var>text</var>
- <samp>text</samp>
- <kbd>text</kbd>
- <sub>text</sub>
- <u>text</u>
- <mark>text</mark>
- <ruby><rb>明日</rb><rp>(</rp><rt>Ashita</rt><rp> </rp><rtc>あした</rtc><rp>)</rp></ruby>
- <bdi>text</bdi>
- <bdo>text</bdo>
- <span>text</span>
- <wbr />
- </p>
- !! end
- # test cases taken from
- # https://www.w3.org/TR/html5/text-level-semantics.html#the-ruby-element
- !! test
- Ruby markup (W3C-style)
- !! wikitext
- ;Mono-ruby for individual base characters
- :<ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby>
- ;Group ruby
- :<ruby>今日<rt>きょう</rt></ruby>
- ;Jukugo ruby
- :<ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby>
- ;Inline ruby
- :<ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby>
- ;Double-sided ruby
- :<ruby><rb>旧</rb><rb>金</rb><rb>山</rb><rt>jiù</rt><rt>jīn</rt><rt>shān</rt><rtc>San Francisco</rtc></ruby>
- <ruby>
- <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
- <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
- <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
- </ruby>
- !! html
- <dl><dt>Mono-ruby for individual base characters</dt>
- <dd><ruby>日<rt>に</rt>本<rt>ほん</rt>語<rt>ご</rt></ruby></dd>
- <dt>Group ruby</dt>
- <dd><ruby>今日<rt>きょう</rt></ruby></dd>
- <dt>Jukugo ruby</dt>
- <dd><ruby>法<rb>華</rb><rb>経</rb><rt>ほ</rt><rt>け</rt><rt>きょう</rt></ruby></dd>
- <dt>Inline ruby</dt>
- <dd><ruby>東<rb>京</rb><rp>(</rp><rt>とう</rt><rt>きょう</rt><rp>)</rp></ruby></dd>
- <dt>Double-sided ruby</dt>
- <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>
- <p><ruby>
- <rb>♥</rb><rtc><rt>Heart</rt></rtc><rtc lang="fr"><rt>Cœur</rt></rtc>
- <rb>☘</rb><rtc><rt>Shamrock</rt></rtc><rtc lang="fr"><rt>Trèfle</rt></rtc>
- <rb>✶</rb><rtc><rt>Star</rt></rtc><rtc lang="fr"><rt>Étoile</rt></rtc>
- </ruby>
- </p>
- !! end
- # The next two test different paths in the sanitizer.
- !! test
- Non-word characters don't terminate tag names (T19663, T42670, T54022)
- !! wikitext
- <blockquote|>a</blockquote>
- <b→> doesn't terminate </b→>
- <bä> doesn't terminate </bä>
- <boo> doesn't terminate </boo>
- <s.foo> doesn't terminate </s.foo>
- <sub-ID#1>
- !! html
- <p><blockquote|>a</blockquote>
- </p><p><b→> doesn't terminate </b→>
- </p><p><bä> doesn't terminate </bä>
- </p><p><boo> doesn't terminate </boo>
- </p><p><s.foo> doesn't terminate </s.foo>
- </p><p><sub-ID#1>
- </p>
- !! end
- !! test
- Non-word characters don't terminate tag names
- !! wikitext
- <blockquote|>a</blockquote>
- <b→> doesn't terminate </b→>
- <bä> doesn't terminate </bä>
- <boo> doesn't terminate </boo>
- <s.foo> doesn't terminate </s.foo>
- <sub-ID#1>
- !! html+tidy
- <p><blockquote|>a
- </p><p><b→> doesn't terminate </b→>
- </p><p><bä> doesn't terminate </bä>
- </p><p><boo> doesn't terminate </boo>
- </p><p><s.foo> doesn't terminate </s.foo>
- </p><p><sub-ID#1>
- </p>
- !! end
- ###
- ### See tests/parser/parserTestsParserHook.php for the <tåg> extension)
- ### This checks that HTML5 tags (with non-word characters in the tag
- ### name) make it safely through the parser -- the Sanitizer will
- ### munge them later, as it should.
- ###
- !! test
- Non-word characters are valid in extension tags (T19663)
- !! wikitext
- <tåg>tåg</tåg>
- !! html/php
- <pre>
- 'tåg'
- array (
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tåg" data-mw='{"name":"tåg","attrs":{},"body":{"extsrc":"tåg"}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- !! test
- Isolated close tags should be treated as literal text (T54760)
- !! options
- parsoid=wt2html
- !! wikitext
- </b>
- <s.foo>s</s>
- !! html/php+tidy
- <p class="mw-empty-elt">
- </p><p><s.foo>s
- </p>
- !! html/parsoid
- <p><s.foo>s</p>
- !! end
- ###
- ### Special characters
- ###
- !! test
- Bare pipe character (T54363)
- !! wikitext
- |
- !! html
- <p>|
- </p>
- !! end
- !! test
- Bare pipe character from a template (T54363)
- !! wikitext
- {{pipe}}
- !! html
- <p>|
- </p>
- !! end
- ###
- ### <nowiki> test cases
- ###
- !! test
- <nowiki> unordered list
- !! wikitext
- <nowiki>* This is not an unordered list item.</nowiki>
- !! html/php
- <p>* This is not an unordered list item.
- </p>
- !! html/parsoid
- <p><span typeof="mw:Nowiki">* This is not an unordered list item.</span></p>
- !! end
- !! test
- <nowiki> spacing
- !! wikitext
- <nowiki>Lorem ipsum dolor
- sed abit.
- sed nullum.
- :and a colon
- </nowiki>
- !! html/php
- <p>Lorem ipsum dolor
- sed abit.
- sed nullum.
- :and a colon
- </p>
- !! html/parsoid
- <p><span typeof="mw:Nowiki">Lorem ipsum dolor
- sed abit.
- sed nullum.
- :and a colon
- </span></p>
- !! end
- !! test
- Don't parse <nowiki><span class="error"></nowiki> (T149622)
- !! wikitext
- <nowiki><span class="error"></nowiki>
- !! html/php
- <p><span class="error">
- </p>
- !! html/parsoid
- <p><span typeof="mw:Nowiki"><span class="error"></span></p>
- !! end
- !! test
- nowiki 3
- !! wikitext
- :There is not nowiki.
- :There is <nowiki>nowiki</nowiki>.
- #There is not nowiki.
- #There is <nowiki>nowiki</nowiki>.
- *There is not nowiki.
- *There is <nowiki>nowiki</nowiki>.
- !! html/php
- <dl><dd>There is not nowiki.</dd>
- <dd>There is nowiki.</dd></dl>
- <ol><li>There is not nowiki.</li>
- <li>There is nowiki.</li></ol>
- <ul><li>There is not nowiki.</li>
- <li>There is nowiki.</li></ul>
- !! html/parsoid
- <dl><dd data-parsoid='{}'>There is not nowiki.</dd>
- <dd data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</dd></dl>
- <ol><li data-parsoid='{}'>There is not nowiki.</li>
- <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ol>
- <ul><li data-parsoid='{}'>There is not nowiki.</li>
- <li data-parsoid='{}'>There is <span typeof="mw:Nowiki">nowiki</span>.</li></ul>
- !! end
- !! test
- Entities inside <nowiki>
- !! wikitext
- <nowiki><</nowiki>
- !! html/php
- <p><
- </p>
- !! html/parsoid
- <p><span typeof="mw:Nowiki"><span typeof="mw:Entity" data-parsoid='{"src":"&lt;","srcContent":"<"}'><</span></span></p>
- !! end
- !! test
- Entities inside template parameters
- !! wikitext
- {{echo|–}}
- !! html/php+tidy
- <p>–
- </p>
- !! html/parsoid
- <p><span typeof="mw:Transclusion mw:Entity" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"&ndash;"}},"i":0}}]}'>–</span></p>
- !! end
- !! test
- Properly escape nowiki when combined with other wiki markup
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>* </nowiki> tag</p>
- !! wikitext
- <nowiki>*</nowiki> <nowiki></nowiki></nowiki> tag
- !! end
- !! test
- T93824: Put escaped HTML tags inside nowiki
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><h2>foo</h2></p>
- !! wikitext
- <nowiki><h2>foo</h2></nowiki>
- !! end
- !! test
- T71950: 1. Put nowiki as close to cause as possible, even with non-quote escapable chars
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>This text: L'<a rel="mw:WikiLink" href="./Foo">Foo</a>
- This text: L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
- This text: L'''<a rel="mw:WikiLink" href="./Foo">Foo</a>''</p>
- !! wikitext
- This text: L'[[Foo]]
- This text: L<nowiki>''</nowiki>[[Foo]]
- This text: L<nowiki>'''</nowiki>[[Foo]]<nowiki>''</nowiki>
- !! end
- # This test fails because wikitext whitespace is not normalized before comparing.
- !! test
- T71950: 2. Put nowiki as close to cause as possible, after ' :'
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>This text : L''<a rel="mw:WikiLink" href="./Foo">Foo</a>
- </p>
- !! wikitext
- This text : L<nowiki>''</nowiki>[[Foo]]
- !! end
- # This test and the next one are html2wt only as they test that incorrect wikitext
- # passed in template arguments gets escaped or wrapped in nowikis where required.
- !! test
- T71482: Use {{!}} instead of nowiki for single pipe in template argument
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo|bar"}},"i":0}}]}" about="#mwt1"></span>
- <span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo|bar |[["}},"i":0}}]}" about="#mwt2"></p>
- !! wikitext
- {{echo|foo{{!}}bar}}
- {{echo|<nowiki>foo|bar |[[</nowiki>}}
- !! end
- !! test
- T53961: Output correct nowikis in template arguments
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a [ b"}},"i":0}}]}" about="#mwt1"></span>
- <span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a }} b"}},"i":0}}]}" about="#mwt2"></span>
- <span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a [[ b"}},"i":0}}]}" about="#mwt3"></span>
- <span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a | {{ ]]"}},"i":0}}]}" about="#mwt4"></span>
- <span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a }"}},"i":0}}]}" about="#mwt5"></span></p>
- !! wikitext
- {{echo|a [ b}}
- {{echo|<nowiki>a }} b</nowiki>}}
- {{echo|<nowiki>a [[ b</nowiki>}}
- {{echo|<nowiki>a | {{ ]]</nowiki>}}
- {{echo|a <nowiki>}</nowiki>}}
- !! end
- !! test
- Cases where "!!" needs nowiki protection
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table>
- <tr><th>this needs protection !! here</th></tr>
- </table>
- <table>
- <tr><th>this does not need
- protection !! here</th></tr>
- </table>
- !! wikitext
- {|
- !<nowiki>this needs protection !! here</nowiki>
- |}
- {|
- !this does not need
- protection !! here
- |}
- !! end
- ###
- ### Comments
- ###
- !! test
- Comments and Indent-Pre
- !! wikitext
- <!-- comment 1 --> asdf
- <!-- comment 1 --> asdf
- <!-- comment 2 -->
- <!-- comment 1 --> asdf
- <!-- comment 2 -->xyz
- <!-- comment 1 --> asdf
- <!-- comment 2 --> xyz
- !! html
- <pre>asdf
- </pre>
- <pre>asdf
- </pre>
- <pre>asdf
- </pre>
- <p>xyz
- </p>
- <pre>asdf
- xyz
- </pre>
- !! end
- !! test
- Comment test 2a
- !! wikitext
- asdf
- <!-- comment 1 -->
- jkl
- !! html
- <p>asdf
- jkl
- </p>
- !! end
- !! test
- Comment test 2b
- !! wikitext
- asdf
- <!-- comment 1 -->
- jkl
- !! html
- <p>asdf
- </p><p>jkl
- </p>
- !! end
- !! test
- Comment test 3
- !! wikitext
- asdf
- <!-- comment 1 -->
- <!-- comment 2 -->
- jkl
- !! html
- <p>asdf
- jkl
- </p>
- !! end
- !! test
- Comment test 4
- !! wikitext
- asdf<!-- comment 1 -->jkl
- !! html
- <p>asdfjkl
- </p>
- !! end
- !! test
- Comment spacing
- !! wikitext
- a
- <!-- foo --> b <!-- bar -->
- c
- !! html
- <p>a
- </p>
- <pre> b
- </pre>
- <p>c
- </p>
- !! end
- !! test
- Comment whitespace
- !! wikitext
- <!-- returns a single newline, not nothing, since the newline after > is not stripped -->
- !! html
- !! end
- !! test
- Comment semantics and delimiters
- !! wikitext
- <!-- --><!----><!-----><!------>
- !! html/php
- !! html/parsoid
- <!-- --><!----><!-----><!------>
- !! end
- !! test
- Comment semantics and delimiters, redux
- !! wikitext
- <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
- -- foo -- funky huh? ... -->
- !! html/php
- !! html/parsoid
- <!-- In SGML every "foo" here would actually show up in the text -- foo -- bar
- -- foo -- funky huh? ... -->
- !! end
- !! test
- Comment semantics and delimiters: directors cut
- !! wikitext
- <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
- everything starting with < followed by !-- until the first -- and > we see,
- that wouldn't be valid XML however, since in XML -- has to terminate a comment
- -->-->
- !! html/php
- <p>-->
- </p>
- !! html/parsoid
- <!-- ... However we like to keep things simple and somewhat XML-ish so we eat
- everything starting with < followed by !-- until the first -- and > we see,
- that wouldn't be valid XML however, since in XML -- has to terminate a comment
- --><p>--></p>
- !! end
- !! test
- Comment semantics: nesting
- !! wikitext
- <!--<!-- no, we're not going to do anything fancy here -->-->
- !! html/php
- <p>-->
- </p>
- !! html/parsoid
- <!--<!-- no, we're not going to do anything fancy here --><p>--></p>
- !! end
- # Parsoid closes the unclosed comment, even if it means a slight
- # round-trip diff.
- !! test
- Comment semantics: unclosed comment at end
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <!--This comment will run out to the end of the document
- !! html/php
- !! html/parsoid
- <!--This comment will run out to the end of the document-->
- !! end
- !! test
- Comment semantics: normalize comments to play nice with XML and browsers
- !! wikitext
- <!-- Browsers --!> think this is closed -->
- <!--> This would normally be text -->
- <!---> As would this -->
- <!-- XML doesn't like trailing dashes -------->
- <!-- Nor doubled hyphens -- anywhere in the data -->
- But this is not a comment.
- !! html/php
- <p>But this is not a comment.
- </p>
- !! html/parsoid
- <!-- Browsers --!> think this is closed -->
- <!--> This would normally be text -->
- <!---> As would this -->
- <!-- XML doesn't like trailing dashes -------->
- <!-- Nor doubled hyphens -- anywhere in the data -->
- <p>But this is not a comment.</p>
- !! end
- !! test
- Comment semantics: round-trip even text which contains encoded -->
- !! wikitext
- <!-- hello & goodbye - > --> --&gt; --&xx -->
- !! html/parsoid
- <!-- hello & goodbye - > --> --&gt; --&xx -->
- !! end
- !! test
- Comment in template title
- !! wikitext
- {{f<!---->oo}}
- !! html
- <p>FOO
- </p>
- !! end
- !! test
- Comment on its own line post-expand
- !! wikitext
- a
- {{blank}}<!---->
- b
- !! html
- <p>a
- </p><p>b
- </p>
- !! end
- !! test
- Comment on its own line post-expand with non-significant whitespace
- !! wikitext
- a
- {{blank}} <!---->
- b
- !! html
- <p>a
- </p><p>b
- </p>
- !! end
- !! test
- Multiple comments should still parse as SOL-transparent
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- <!--c1-->*a
- <!--c2--><!--c3--><!--c4-->*b
- !! html/php
- <ul><li>a</li>
- <li>b</li></ul>
- !! html/parsoid
- <!--c1--><ul>
- <li>a
- </li>
- <!--c2--><!--c3--><!--c4-->
- <li>b
- </li>
- </ul>
- !! end
- ## Make sure ">" gets escaped in comments to avoid XSS
- !! test
- IE conditional comments
- !! wikitext
- <!--[if lt IE 9]>
- <script>alert('hi');</script>
- <![endif]-->
- !! html/parsoid
- <!--[if lt IE 9]>
- <script>alert('hi');</script>
- <![endif]-->
- !! end
- ###
- ### paragraph wrapping tests
- ###
- !! test
- No block tags
- !! wikitext
- a
- b
- !! html
- <p>a
- </p><p>b
- </p>
- !! end
- !! test
- Block tag on one line (<div>)
- !! wikitext
- a <div>foo</div>
- b
- !! html
- a <div>foo</div>
- <p>b
- </p>
- !! html+tidy
- <p>a </p><div>foo</div>
- <p>b
- </p>
- !! end
- # Remex wraps empty tag runs with p-tags.
- # Parsoid strips them out during p-wrapping.
- !! test
- No p-wrappable content
- !! wikitext
- <span><div>x</div></span>
- <span><s><div>x</div></s></span>
- <small><em></em></small><span><s><div>x</div></s></span>
- !! html/php+tidy
- <span><div>x</div></span>
- <span><s><div>x</div></s></span>
- <p><small><em></em></small></p><span><s><div>x</div></s></span>
- !! html/parsoid
- <span><div>x</div></span>
- <span><s><div>x</div></s></span>
- <small><em></em></small><span><s><div>x</div></s></span>
- !! end
- # T177612: Parsoid-only test
- !! test
- Transclusion meta tags shouldn't trip Parsoid's useless p-wrapper stripping code
- !! wikitext
- {{echo|<span><div>x</div></span>}}
- x
- !! html/parsoid
- <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":"<span><div>x</div></span>"}},"i":0}}]}'><div>x</div></span>
- <p>x</p>
- !! end
- !! test
- Block tag on one line (<blockquote>)
- !! wikitext
- a <blockquote>foo</blockquote>
- b
- !! html
- a <blockquote>foo</blockquote>
- <p>b
- </p>
- !! html+tidy
- <p>a </p><blockquote><p>foo</p></blockquote>
- <p>b
- </p>
- !! end
- !! test
- Block tag on both lines (<div>)
- !! wikitext
- a <div>foo</div>
- b <div>foo</div>
- !! html
- a <div>foo</div>
- b <div>foo</div>
- !! html+tidy
- <p>a </p><div>foo</div><p>
- b </p><div>foo</div>
- !! end
- !! test
- Block tag on both lines (<blockquote>)
- !! wikitext
- a <blockquote>foo</blockquote>
- b <blockquote>foo</blockquote>
- !! html
- a <blockquote>foo</blockquote>
- b <blockquote>foo</blockquote>
- !! html+tidy
- <p>a </p><blockquote><p>foo</p></blockquote><p>
- b </p><blockquote><p>foo</p></blockquote>
- !! end
- !! test
- Multiple lines without block tags
- !! wikitext
- <div>foo</div> a
- b
- c
- d<!--foo--> e
- x <div>foo</div> z
- !! html
- <div>foo</div> a
- <p>b
- c
- d e
- </p>
- x <div>foo</div> z
- !! html+tidy
- <div>foo</div><p> a
- </p><p>b
- c
- d e
- </p><p>
- x </p><div>foo</div><p> z
- </p>
- !! end
- # The difference between Parsoid & Remex here
- # is because of Parsoid's Tidy-emulation code
- # for p-wrapping. We'll start work to remove this
- # emulation code in Parsoid sooner than later.
- # Remex wraps empty tag runs with p-tags.
- # Parsoid strips them out in a separate pass.
- !! test
- Empty lines between lines with block tags
- !! wikitext
- <div></div>
- <div></div>a
- b
- <div>a</div>b
- <div>b</div>d
- <div>e</div>
- !! html
- <div></div>
- <p><br />
- </p>
- <div></div>a
- <p>b
- </p>
- <div>a</div>b
- <div>b</div>d
- <p><br />
- </p>
- <div>e</div>
- !! html+tidy
- <div></div>
- <p><br />
- </p>
- <div></div><p>a
- </p><p>b
- </p>
- <div>a</div><p>b
- </p><div>b</div><p>d
- </p><p><br />
- </p>
- <div>e</div>
- !! html/parsoid
- <div data-parsoid='{"stx":"html"}'></div>
- <p><br /></p>
- <div data-parsoid='{"stx":"html"}'></div><p>a</p>
- <p>b</p>
- <div data-parsoid='{"stx":"html"}'>a</div><p>b</p>
- <div data-parsoid='{"stx":"html"}'>b</div><p>d</p>
- <p><br /></p>
- <div data-parsoid='{"stx":"html"}'>e</div>
- !! end
- !! test
- Unclosed HTML p-tags should be handled properly
- !! wikitext
- <div><p>foo</div>
- a
- b
- !! html/php+tidy
- <div><p>foo</p></div>
- <p>a
- </p><p>b
- </p>
- !! html/parsoid
- <div data-parsoid='{"stx":"html"}'><p data-parsoid='{"stx":"html", "autoInsertedEnd":true}'>foo</p></div>
- <p>a</p>
- <p>b</p>
- !! end
- ## SSS FIXME: I can come up with other scenarios where this doesn't work because
- ## of eager output of buffered tokens in the p-wrapper. But, I'm going to ignore
- ## them for now.
- !! test
- 1. P-wrapping should leave sol-transparent tags outside p-tags where possible
- !! options
- parsoid=wt2html
- !! wikitext
- a [[Category:A1]] [[Category:A2]]
- [[Category:A3]]
- [[Category:A4]]
- !! html/parsoid
- <p>a</p>
- <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"/>
- !! end
- !! test
- 2. P-wrapping should leave sol-transparent tags outside p-tags where possible
- !! options
- parsoid=wt2html
- !! wikitext
- [[Category:A1]]a
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:A1"/><p>a</p>
- !! end
- !! test
- No paragraph necessary for SOL transparent template
- !! wikitext
- <span><div>foo</div></span>
- [[Category:Foo]]
- <span><div>foo</div></span>
- {{echo|[[Category:Foo]]}}
- !! html/php
- <span><div>foo</div></span>
- <span><div>foo</div></span>
- !! html/parsoid
- <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
- <link rel="mw:PageProp/Category" href="./Category:Foo"/>
- <span data-parsoid='{"stx":"html"}'><div data-parsoid='{"stx":"html"}'>foo</div></span>
- <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}}]}'/>
- !! end
- !! test
- Avoid expanding multiline sol transparent template ranges unnecessarily
- !! wikitext
- hi
- {{echo|<br/>
- }}
- [[Category:Ho]]
- !! html/php
- <p>hi
- </p><p><br />
- <br />
- </p>
- !! html/parsoid
- <p>hi</p>
- <p><br />
- <br about="#mwt1" typeof="mw:Transclusion" data-parsoid='{}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<br/>\n"}},"i":0}}]}'/><span about="#mwt1">
- </span></p>
- <link rel="mw:PageProp/Category" href="./Category:Ho" />
- !! end
- ###
- ### Preformatted text
- ###
- !! test
- Preformatted text
- !! wikitext
- This is some
- Preformatted text
- With ''italic''
- And '''bold'''
- And a [[Main Page|link]]
- !! html
- <pre>This is some
- Preformatted text
- With <i>italic</i>
- And <b>bold</b>
- And a <a href="/wiki/Main_Page" title="Main Page">link</a>
- </pre>
- !! end
- !! test
- Tabs don't trigger preformatted text
- !! wikitext
- This is not
- preformatted text.
- This is preformatted text.
- So is this.
- !! html/php
- <p> This is not
- preformatted text.
- </p>
- <pre>This is preformatted text.
- So is this.
- </pre>
- !! html/parsoid
- <p> This is not
- preformatted text.</p>
- <pre>This is preformatted text.
- So is this.</pre>
- !! end
- !! test
- Space before tab needs nowiki pre protection
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p> a</p>
- !! wikitext
- <nowiki> </nowiki> a
- !! end
- !! test
- Ident preformatting with inline content
- !! wikitext
- a
- ''b''
- !! html
- <pre>a
- <i>b</i>
- </pre>
- !! end
- !! test
- <pre> with <nowiki> inside (compatibility with 1.6 and earlier)
- !! wikitext
- <pre><nowiki>
- <b>
- <cite>
- <em>
- </nowiki></pre>
- !! html
- <pre>
- <b>
- <cite>
- <em>
- </pre>
- !! end
- !! test
- Regression with preformatted in <center>
- !! wikitext
- <center>
- Blah
- </center>
- !! html
- <center>
- <pre>Blah
- </pre>
- </center>
- !! end
- !! test
- T54763: Preformatted in <blockquote>
- !! wikitext
- <blockquote>
- Blah
- {|
- |
- indented cell (no pre-wrapping!)
- |}
- </blockquote>
- !! html
- <blockquote>
- <p> Blah
- </p>
- <table>
- <tr>
- <td>
- <p> indented cell (no pre-wrapping!)
- </p>
- </td></tr></table>
- </blockquote>
- !! end
- !! test
- T53086: Double newlines in blockquotes should be turned into paragraphs
- !! wikitext
- <blockquote>
- Foo
- Bar
- </blockquote>
- !! html
- <blockquote>
- <p>Foo
- </p><p>Bar
- </p>
- </blockquote>
- !! end
- !! test
- T17491: <ins>/<del> in blockquote
- !! wikitext
- <blockquote>
- Foo <del>bar</del> <ins>baz</ins> quux
- </blockquote>
- !! html
- <blockquote>
- <p>Foo <del>bar</del> <ins>baz</ins> quux
- </p>
- </blockquote>
- !! end
- !! test
- T17491: <ins>/<del> in blockquote (2)
- !! wikitext
- <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
- </blockquote>
- !! html
- <blockquote>Foo <del>bar</del> <ins>baz</ins> quux
- </blockquote>
- !! html+tidy
- <blockquote><p>Foo </p><del>bar</del> <ins>baz</ins><p> quux
- </p></blockquote>
- !! end
- !! test
- <pre> with attributes (T5202)
- !! wikitext
- <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
- !! html
- <pre style="background: blue; color:white">Bluescreen of WikiDeath</pre>
- !! end
- !! test
- <pre> with width attribute (T5202)
- !! wikitext
- <pre width="8">Narrow screen goodies</pre>
- !! html
- <pre width="8">Narrow screen goodies</pre>
- !! end
- !! test
- <pre> with forbidden attribute (T5202)
- !! wikitext
- <pre width="8" onmouseover="alert(document.cookie)">Narrow screen goodies</pre>
- !! html
- <pre width="8">Narrow screen goodies</pre>
- !! end
- !! test
- Entities inside <pre>
- !! wikitext
- <pre><</pre>
- !! html
- <pre><</pre>
- !! end
- !! test
- <pre> with forbidden attribute values (T5202)
- !! wikitext
- <pre width="8" style="border-width: expression(alert(document.cookie))">Narrow screen goodies</pre>
- !! html
- <pre width="8" style="/* insecure input */">Narrow screen goodies</pre>
- !! end
- !! test
- <nowiki> inside <pre> (T15238)
- !! wikitext
- <pre>
- <nowiki>
- </pre>
- <pre>
- <nowiki></nowiki>
- </pre>
- <pre><nowiki><nowiki></nowiki>Foo<nowiki></nowiki></nowiki></pre>
- !! html
- <pre>
- <nowiki>
- </pre>
- <pre>
- </pre>
- <pre><nowiki>Foo</nowiki></pre>
- !! end
- !! test
- <nowiki> inside of #tag:pre
- !! wikitext
- {{#tag:pre|Foo <nowiki>→bar</nowiki>}}
- !! html/php
- <pre>Foo →bar</pre>
- !! html/parsoid
- <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 <nowiki>&rarr;bar</nowiki>"}},"i":0}}]}'>Foo <span typeof="mw:Entity">→</span>bar</pre>
- !! end
- ## Don't expect this to rt, Parsoid drops the unmatched closing pre tags that
- ## aren't enclosed in nowikis.
- !! test
- <nowiki> and <pre> preference (first one wins)
- !! options
- parsoid=wt2html
- !! wikitext
- <pre>
- <nowiki>
- </pre>
- </nowiki>
- </pre>
- <nowiki>
- <pre>
- <nowiki>
- </pre>
- </nowiki>
- </pre>
- !! html/php
- <pre>
- <nowiki>
- </pre>
- <p></nowiki>
- </pre>
- </p><p>
- <pre>
- <nowiki>
- </pre>
- </pre>
- </p>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n<nowiki>\n"}}'><nowiki>
- </pre>
- <p></nowiki></p>
- <p><span typeof="mw:Nowiki">
- <pre>
- <nowiki>
- </pre>
- </span></p>
- !! end
- !! test
- </pre> inside nowiki
- !! wikitext
- <nowiki></pre></nowiki>
- !! html
- <p></pre>
- </p>
- !! end
- !! test
- Empty pre; pre inside other HTML tags (T56946)
- !! wikitext
- a
- <div><pre>
- foo
- </pre></div>
- <pre></pre>
- !! html/php+tidy
- <p>a
- </p>
- <div><pre>foo
- </pre></div>
- <pre></pre>
- !! html/parsoid
- <p>a</p>
- <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
- </pre></div>
- <pre typeof="mw:Extension/pre" about="#mwt4" data-parsoid='{"stx":"html"}' data-mw='{"name":"pre","attrs":{},"body":{"extsrc":""}}'></pre>
- !! end
- !! test
- HTML pre followed by indent-pre
- !! wikitext
- <pre>foo</pre>
- bar
- !! html
- <pre>foo</pre>
- <pre>bar
- </pre>
- !! end
- !! test
- Block tag pre
- !! wikitext
- <p><pre>foo</pre></p>
- !! html/php+tidy
- <p class="mw-empty-elt"></p><pre>foo</pre><p class="mw-empty-elt"></p>
- !! html/parsoid
- <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>
- !! end
- !!test
- Templates: Indent-Pre: 1a. Templates that break a line should suppress <pre>
- !! wikitext
- {{echo|}}
- !! html
- !!end
- !!test
- Templates: Indent-Pre: 1b. Templates that break a line should suppress <pre>
- !! wikitext
- {{echo|
- foo}}
- !! html
- <p>foo
- </p>
- !!end
- !! test
- Templates: Indent-Pre: 1c: Wrapping should be based on expanded content
- !! wikitext
- {{echo|a
- b}}
- !! html
- <pre>a
- </pre>
- <p>b
- </p>
- !!end
- !! test
- Templates: Indent-Pre: 1d: Wrapping should be based on expanded content
- !! wikitext
- {{echo|a
- b
- c
- d
- e
- }}
- !! html
- <pre>a
- </pre>
- <p>b
- c
- </p>
- <pre>d
- </pre>
- <p>e
- </p>
- !!end
- !!test
- Templates: Indent-Pre: 1e. Wrapping should be based on expanded content
- !! wikitext
- {{echo| foo}}
- {{echo| foo}}{{echo| bar}}
- {{echo| foo}}
- {{echo| bar}}
- {{echo|<!--cmt--> foo}}
- <!--cmt-->{{echo| foo}}
- {{echo|{{echo| }}bar}}
- !! html
- <pre>foo
- </pre>
- <pre>foo bar
- </pre>
- <pre>foo
- bar
- </pre>
- <pre>foo
- </pre>
- <pre>foo
- </pre>
- <pre>bar
- </pre>
- !!end
- !! test
- Templates: Indent-Pre: 1f: Wrapping should be based on expanded content
- !! wikitext
- {{echo| }}a
- {{echo|
- }}a
- {{echo|
- b}}
- {{echo|a
- }}b
- {{echo|a
- }} b
- !! html
- <pre>a
- </pre>
- <p><br />
- </p>
- <pre>a
- </pre>
- <p><br />
- </p>
- <pre>b
- </pre>
- <p>a
- </p>
- <pre>b
- </pre>
- <p>a
- </p>
- <pre>b
- </pre>
- !!end
- ## Hmm, should Parsoid rt this?
- !! test
- Pres with newline attributes
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <pre class="one
- two">hi</pre>
- !! html/php
- <pre class="one two">hi</pre>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" class="one two" data-mw='{"name":"pre","attrs":{"class":"one two"},"body":{"extsrc":"hi"}}'>hi</pre>
- !! end
- !! test
- Things that look like <pre> tags aren't treated as such
- !! wikitext
- Barack Obama <President> of the United States
- <President></President>
- !! html
- <p>Barack Obama <President> of the United States
- <President></President>
- </p>
- !! end
- !! test
- Handle broken pre-like tags (T66025)
- !! options
- parsoid=wt2html
- !! wikitext
- {{echo|<pre <pre>x</pre>}}
- <table><pre </table>
- !! html/php
- <pre>x</pre>
- <table><pre </table>
- !! html/php+tidy
- <pre>x</pre>
- <pre <table></table>
- !! html/parsoid
- <pre about="#mwt1" typeof="mw:Transclusion mw:Extension/pre" data-parsoid='{"a":{"<pre":null},"sa":{"<pre":""},"stx":"html","pi":[[{"k":"1"}]]}' data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre <pre>x</pre>"}},"i":0}}]}'>x</pre>
- <p><pre </p>
- <table></table>
- !! end
- !! test
- Parsoid: handle pre with space after attribute
- !! options
- parsoid=wt2html
- !! wikitext
- <pre style="width:50%;" >{{echo|foo}}</pre>
- !! html/php
- <pre style="width:50%;">{{echo|foo}}</pre>
- !! html/parsoid
- <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>
- !! end
- # TODO / maybe: fix wt2wt for this
- !! test
- Parsoid: Don't paragraph-wrap fosterable content
- !! options
- parsoid=wt2html
- !! wikitext
- {|
- <td></td>
- <td></td>
- |}
- !! html
- <table>
- <tbody>
- <tr>
- <td></td>
- <td></td></tr>
- </tbody></table>
- !! end
- !! test
- Self-closed pre
- !! wikitext
- <pre />
- !! html/php
- <pre></pre>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":null}'></pre>
- !! end
- !! test
- Parsoid: Don't paragraph-wrap fosterable content even if table syntax is unbalanced
- !! options
- parsoid=wt2html
- !! wikitext
- {|
- <td>
- <td>
- </td>
- |}
- !! html
- <table>
- <tbody>
- <tr>
- <td></td>
- <td>
- </td></tr>
- </tbody></table>
- !! end
- #--------------------------------------------------------------------
- # Transclusion parameter whitespace stripping tests
- # Behavior is different for positional and named parameters
- #--------------------------------------------------------------------
- !! test
- Templates: Strip leading and trailing whitespace from named-param values
- !! wikitext
- {{echo|1= a }}
- {{echo|1= {{echo|b}} }}
- {{echo| 1 =
- c }}
- {{echo| 1 =
- * d
- }}
- !! html
- <p>a
- </p><p>b
- </p><p>c
- </p>
- <ul><li>d</li></ul>
- !! end
- !! test
- Templates: Don't strip whitespace from positional-param values
- !! wikitext
- {{echo|a }}
- {{echo|{{echo|b}} }}
- {{echo| c
- }}
- {{echo| {{echo|d}}
- }}
- {{echo|
- e}}
- {{echo|
- *f}}
- {{echo|
- }}g
- !! html
- <p>a
- </p><p>b
- </p>
- <pre>c
- </pre>
- <p><br />
- </p>
- <pre>d
- </pre>
- <p><br />
- </p>
- <pre>e
- </pre>
- <p><br />
- </p>
- <ul><li>f</li></ul>
- <p><br />
- </p>
- <pre>g
- </pre>
- !! end
- !! test
- Templates: Don't recognize targets split by newlines
- !! options
- parsoid=wt2html
- !! wikitext
- {{ech
- o|foo}}
- !! html/php
- <p>{{ech
- o|foo}}
- </p>
- !! html/parsoid
- <p>{{ech
- o|foo}}</p>
- !! end
- !! test
- Templates: Recognize targets when newlines and comments don't split the target
- !! options
- parsoid=wt2html
- !! wikitext
- {{
- <!--X--> ech<!--X-->o<!--X-->
- <!--X--> <!--X-->
- |foo}}
- !! html/php
- <p>foo
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"ech<!--X-->o<!--X--> \n <!--X--> <!--X-->\n\n ","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
- !! end
- !! test
- Templates: Handle empty comment-and-ws-only lines correctly
- !! wikitext
- {{echo|foo
- <!--should be ignored-->
- <!--should be ignored as well-->
- bar}}
- !! html/php
- <p>foo
- bar
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo\n<!--should be ignored-->\n <!--should be ignored as well-->\nbar"}},"i":0}}]}'>foo <!--should be ignored--> <!--should be ignored as well--> bar</p>
- !! end
- !! test
- Templates: Handle comments in the target
- !! wikitext
- {{echo
- <!-- should be ignored -->
- |foo}}
- {{echo
- <!-- should be ignored and spaces on next line should not trip us up (T147742) -->
- |foo}}
- {{echo<!-- should be ignored -->
- |foo}}
- {{echo<!-- should be ignored -->|foo}}
- {{<!-- should be ignored -->echo|foo}}
- !! html/php
- <p>foo
- </p><p>foo
- </p><p>foo
- </p><p>foo
- </p><p>foo
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n<!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n<!-- 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>
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo<!-- should be ignored -->\n","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo<!-- should be ignored -->","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</p>
- !! end
- !! test
- Templates: Handle comments in parameter names (T69657)
- !! wikitext
- {{echo|1
- <!-- should be ignored -->
- =foo}}
- {{echo|
- <!-- should be ignored -->
- 1 = foo}}
- {{echo|1<!-- should be ignored -->=foo}}
- {{echo|<!-- should be ignored -->1=foo}}
- !! html/php
- <p>foo
- </p><p>foo
- </p><p>foo
- </p><p>foo
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1\n<!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"<!-- should be ignored -->\n1"}}},"i":0}}]}'>foo</p>
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"1<!-- should be ignored -->"}}},"i":0}}]}'>foo</p>
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo","key":{"wt":"<!-- should be ignored -->1"}}},"i":0}}]}'>foo</p>
- !! end
- !! test
- Templates: Other wikitext in parameter names (T69657)
- !! wikitext
- {{echo|''1''=foo}}
- !! html/php
- <p>{{{1}}}
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"''1''":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
- !! end
- !! test
- Templates: With colons
- !! wikitext
- {{With: Colon}}
- !! html/php
- <p>Template with colon
- </p>
- !! html/parsoid
- <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>
- !! end
- #--------------------------------------------------------------------
- # Transclusion parameter escaping tests
- #--------------------------------------------------------------------
- !! test
- Templates: Parsoid parameter escaping test 1
- !! wikitext
- {{echo|[foo]|{{echo|[bar]}}}}
- !! html/php+tidy
- <p>[foo]
- </p>
- !! html/parsoid
- <p about="#mwt1" typeof="mw:Transclusion"
- data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[foo]"},"2":{"wt":"{{echo|[bar]}}"}},"i":0}}]}'>[foo]</p>
- !! end
- !! test
- Parsoid: Pipes in external links in template parameter
- !! wikitext
- {{echo|[{{echo|http://example.com}} link]}}
- !! html/php+tidy
- <p><a rel="nofollow" class="external text" href="http://example.com">link</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid: pipe in transclusion parameter
- !! wikitext
- {{echo|http://foo.com/a|b}}
- !! html/php+tidy
- <p><a rel="nofollow" class="external free" href="http://foo.com/a%7Cb">http://foo.com/a%7Cb</a>
- </p>
- !! html/parsoid
- <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&#124;b"}},"i":0}}]}'>http://foo.com/a%7Cb</a></p>
- !! end
- !! test
- Parsoid: Pipe in external link target and content in template parameter
- !! options
- parsoid=html2wt,wt2wt
- !! wikitext
- {{echo|[http://foo.com/a|b a|b]}}
- !! html/php+tidy
- <p><a rel="nofollow" class="external text" href="http://foo.com/a%7Cb">a|b</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" href="http://foo.com/a|b" about="#mwt1"
- typeof="mw:Transclusion"
- data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},
- "params":{"1":{"wt":"[http://foo.com/a|b a|b]"}},"i":0}}]}'>a|b</a></p>
- !! end
- !! test
- Parsoid: Pipe in template with nested template in external link target in template parameter (seriously)
- !! options
- parsoid
- !! wikitext
- {{echo|[{{fullurl:{{FULLPAGENAME}}|action=edit}} bar]}}
- !! html
- <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>
- !! end
- !! test
- Templates: Don't escape already nowiki-escaped text in template parameters
- !! options
- parsoid=html2wt,wt2wt
- !! wikitext
- {{echo|foo<nowiki>|</nowiki>bar}}
- {{echo|<nowiki><div></nowiki>}}
- {{echo|<nowiki></nowiki>}}
- !! html/php+tidy
- <p>foo|bar
- <div>
- </p>
- !! html/parsoid
- <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>
- <span typeof="mw:Transclusion mw:Nowiki" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>&lt;div&gt;</nowiki>"}},"i":0}}]}'><span typeof="mw:Entity"><</span>div<span typeof="mw:Entity">></span></span>
- <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>
- </p>
- !! end
- ## T54824
- !! test
- Templates: '=' char in nested transclusions should not trigger nowiki escapes or conversion to named param
- !! options
- parsoid=html2wt,wt2wt
- !! wikitext
- {{echo|{{echo|1=bar}}}}
- !! html/php+tidy
- <p>bar
- </p>
- !! html/parsoid
- <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>
- !! end
- ## T58733
- !! test
- Templates parameters with special tokenizing behavior dont get modified because of arg escaping
- !! wikitext
- {{echo|a : b}}
- !! html/php+tidy
- <p>a : b
- </p>
- !! html/parsoid
- <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>
- !! end
- ## T73412
- !! test
- Templates: Preserve blank parameter names
- !! wikitext
- {{echo|=foo}}
- !! html/php+tidy
- <p>{{{1}}}
- </p>
- !! html/parsoid
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"":{"wt":"foo"}},"i":0}}]}'>{{{1}}}</p>
- !! end
- !! test
- Templates: Preserve blank parameter names in other positions
- !! wikitext
- {{blank_param|bar|=foo}}
- !! html/php+tidy
- <p>bar
- foo
- </p>
- !! html/parsoid
- <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
- foo</p>
- !! end
- ###
- ### Parsoid-centric tests for testing RT edge cases for pre
- ###
- !!test
- 1a. Indent-Pre and Comments
- !! wikitext
- a
- <!--a-->
- c
- !! html
- <pre>a
- </pre>
- <p>c
- </p>
- !!end
- !!test
- 1b. Indent-Pre and Comments
- !! wikitext
- a
- <!--a-->
- c
- !! html
- <pre>a
- </pre>
- <p>c
- </p>
- !!end
- !!test
- 1c. Indent-Pre and Comments
- !! wikitext
- <!--a--> a
- <!--a--> a
- !! html
- <pre> a
- </pre>
- <pre> a
- </pre>
- !!end
- !!test
- 1d. Indent-Pre and Comments
- (Pre-handler currently cannot distinguish between comment/ws order and normalizes them to [comment,ws] order)
- !! wikitext
- <!--a--> a
- <!--b-->b
- !! html
- <pre>a
- </pre>
- <pre>b
- </pre>
- !!end
- !!test
- 2a. Indent-Pre and tables
- !! wikitext
- {|
- |-
- !h1!!h2
- |foo||bar
- |}
- !! html
- <table>
- <tr>
- <th>h1</th>
- <th>h2
- </th>
- <td>foo</td>
- <td>bar
- </td></tr></table>
- !!end
- !!test
- 2b. Indent-Pre and tables
- !! wikitext
- {|
- |-
- |foo
- |}
- !! html
- <table>
- <tr>
- <td>foo
- </td></tr></table>
- !!end
- !!test
- 2c. Indent-Pre and tables (T44252)
- !! wikitext
- {|
- |+foo
- ! |bar
- |}
- !! html
- <table>
- <caption>foo
- </caption>
- <tr>
- <th>bar
- </th></tr></table>
- !!end
- !!test
- 2d. Indent-Pre and tables
- !! wikitext
- a
- {|
- |b
- |}
- !! html/php
- <pre>a
- </pre>
- <table>
- <tr>
- <td>b
- </td></tr></table>
- !! html/parsoid
- <pre>a</pre>
- <table>
- <tbody><tr><td> b</td></tr>
- </tbody></table>
- !!end
- !!test
- 2e. Indent-Pre and table-line syntax
- !! wikitext
- a
- | b
- | c
- !! html/php
- <pre>a
- | b
- | c
- </pre>
- !!end
- !!test
- 2f. Indent-pre started by table-line syntax
- !! wikitext
- a
- | b
- | c
- !! html/php
- <p>a
- </p>
- <pre>| b
- | c
- </pre>
- !! html/parsoid
- <p>a</p>
- <pre>
- | b
- | c</pre>
- !!end
- !! test
- 2g. Indented table markup mixed with indented pre content (proposed in T8200)
- !! wikitext
- <table>
- <tr>
- <td>
- Text that should be rendered preformatted
- </td>
- </tr>
- </table>
- !! html
- <table>
- <tr>
- <td>
- <pre>Text that should be rendered preformatted
- </pre>
- </td>
- </tr>
- </table>
- !! end
- !!test
- 3a. Indent-Pre and block tags (single-line html)
- !! wikitext
- a <p> foo </p>
- b <div> foo </div>
- c <blockquote> foo </blockquote>
- <span> foo </span>
- !! html
- a <p> foo </p>
- b <div> foo </div>
- c <blockquote> foo </blockquote>
- <pre><span> foo </span>
- </pre>
- !! html/parsoid
- <p>a </p><p data-parsoid='{"stx":"html"}'> foo </p>
- <p>b </p><div data-parsoid='{"stx":"html"}'> foo </div>
- <p>c </p><blockquote data-parsoid='{"stx":"html"}'> foo </blockquote>
- <pre><span> foo </span>
- </pre>
- !! html/php+tidy
- <p> a </p><p> foo </p><p>
- b </p><div> foo </div><p>
- c </p><blockquote><p> foo </p></blockquote>
- <pre><span> foo </span>
- </pre>
- !! end
- !!test
- 3b. Indent-Pre and block tags (multi-line html)
- !! wikitext
- a <span>foo</span>
- b <div> foo </div>
- !! html
- <pre>a <span>foo</span>
- </pre>
- b <div> foo </div>
- !! html/parsoid
- <pre>a <span data-parsoid='{"stx":"html"}'>foo</span></pre>
- b <div data-parsoid='{"stx":"html"}'> foo </div>
- !! html/php+tidy
- <pre>a <span>foo</span>
- </pre><p>
- b </p><div> foo </div>
- !!end
- !!test
- 3c. Indent-Pre and block tags (pre-content on separate line)
- !! wikitext
- <p>
- foo
- </p>
- <div>
- foo
- </div>
- <center>
- foo
- </center>
- <blockquote>
- foo
- </blockquote>
- <blockquote>
- <pre>
- foo
- </pre>
- </blockquote>
- <table><tr><td>
- foo
- </td></tr></table>
- <ul><li>
- foo
- </li></ul>
- !! html
- <p>
- foo
- </p>
- <div>
- <pre>foo
- </pre>
- </div>
- <center>
- <pre>foo
- </pre>
- </center>
- <blockquote>
- <p> foo
- </p>
- </blockquote>
- <blockquote>
- <pre>
- foo
- </pre>
- </blockquote>
- <table><tr><td>
- <pre>foo
- </pre>
- </td></tr></table>
- <ul><li>
- foo
- </li></ul>
- !!end
- !! test
- 4. Indent-Pre and extension tags
- !! wikitext
- a <tag />
- !! html/php
- a <pre>
- NULL
- array (
- )
- </pre>
- !! html/parsoid
- a <pre typeof="mw:Extension/tag" about="#mwt2" data-parsoid='{}' data-mw='{"name":"tag","attrs":{},"body":null}'></pre>
- !! end
- !! test
- 5. Indent-Pre and html pre
- !! wikitext
- <pre class="123">hi</pre>
- !! html/php
- <pre class="123">hi</pre>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" class="123" data-mw='{"name":"pre","attrs":{"class":"123"},"body":{"extsrc":"hi"}}'>hi</pre>
- !! end
- !!test
- Render paragraphs when indent-pre is suppressed in blocklevels
- !! wikitext
- <blockquote>
- foo
- bar
- </blockquote>
- !! html
- <blockquote>
- <p> foo
- </p><p> bar
- </p>
- </blockquote>
- !!end
- !!test
- 4. Multiple spaces at start-of-line
- !! wikitext
- <p> foo </p>
- foo
- {|
- |foo
- |}
- !! html
- <p> foo </p>
- <pre> foo
- </pre>
- <table>
- <tr>
- <td>foo
- </td></tr></table>
- !!end
- ## NOTE: the leading white-space chars on empty line are significant
- !! test
- 5a. White-space in indent-pre
- !! wikitext
- a<br />
-
- b
- !! html
- <pre>a<br />
- b
- </pre>
- !! end
- ## NOTE: the leading white-space chars on empty line are significant
- !! test
- 5b. White-space in indent-pre
- !! wikitext
- a
-
- b
-
-
- c
- !! html
- <pre>a
- b
- c
- </pre>
- !! end
- !! test
- 5c. White-space in indent-pre
- !! wikitext
- ''a''
- ''b''
- ''c''
- !! html
- <pre><i>a</i>
- <i>b</i>
- <i>c</i>
- </pre>
- !! end
- !! test
- 6. Pre-blocks should extend across lines with leading WS even when there is no wrappable content
- !! wikitext
- a
-
- <!-- continue -->
- b
- c
-
- d
- !! html
- <pre>a
- b
- </pre>
- <pre>c
- </pre>
- <p>d
- </p>
- !! end
- !! test
- 7a. Indent-pre and category links
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- [[Category:foo]] <!-- No pre-wrapping -->
- {{echo| [[Category:foo]]}} <!-- No pre-wrapping -->
- !! html/php+tidy
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:Foo"> <!-- No pre-wrapping -->
- <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-wrapping -->
- !! end
- ## We used to, but no longer wt2wt this test since the default serializer
- ## will normalize all categories to serialize on their own line.
- ## This wikitext usage is going to be fairly uncommon in production and
- ## selser will take care of preserving formatting in those scenarios.
- !! test
- 7b. Indent-pre and category links
- !! options
- parsoid=wt2html
- !! wikitext
- [[Category:foo]] a
- [[Category:foo]] {{echo|b}}
- !! html/parsoid
- <pre><link rel="mw:PageProp/Category" href="./Category:Foo"> a
- <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>
- !! end
- !! test
- Indent-Pre: Newlines in comments shouldn't affect sol state
- !! wikitext
- a <!--
- foo
- --> b
- !! html/php+tidy
- <p>a b
- </p>
- !! html/parsoid
- <p>a <!--
- foo
- --> b</p>
- !! end
- ###
- ### HTML-pre (some to spec PHP parser behavior and some Parsoid-RT-centric)
- ###
- !!test
- HTML-pre: 1. embedded newlines
- !! wikitext
- <pre>foo</pre>
- <pre>
- foo
- </pre>
- <pre>
- foo
- </pre>
- <pre>
- foo
- </pre>
- !! html/php+tidy
- <pre>foo</pre>
- <pre>foo
- </pre>
- <pre>
- foo
- </pre>
- <pre>
- foo
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre>
- <pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\nfoo\n"}}'>foo
- </pre>
- <pre typeof="mw:Extension/pre" about="#mwt6" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\nfoo\n"}}'>
- foo
- </pre>
- <pre typeof="mw:Extension/pre" about="#mwt8" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n\n\nfoo\n"}}'>
- foo
- </pre>
- !!end
- !! test
- HTML-pre: big spaces
- !! wikitext
- <pre>
- haha
- haha
- </pre>
- !! html/php+tidy
- <pre>
- haha
- haha
- </pre>
- !! html/parsoid
- <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"}}'>
- haha
- haha
- </pre>
- !! end
- !!test
- HTML-pre: 2: indented text
- !! wikitext
- <pre>
- foo
- </pre>
- !! html
- <pre>
- foo
- </pre>
- !!end
- !!test
- HTML-pre: 3: other wikitext
- !! wikitext
- <pre>
- * foo
- # bar
- = no-h =
- '' no-italic ''
- [[ NoLink ]]
- </pre>
- !! html/php
- <pre>
- * foo
- # bar
- = no-h =
- '' no-italic ''
- [[ NoLink ]]
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"\n* foo\n# bar\n= no-h =\n'' no-italic ''\n[[ NoLink ]]\n"}}'>* foo
- # bar
- = no-h =
- '' no-italic ''
- [[ NoLink ]]
- </pre>
- !!end
- ###
- ### Definition lists
- ###
- !! test
- Simple definition
- !! wikitext
- ;name :Definition
- !! html
- <dl><dt>name </dt>
- <dd>Definition</dd></dl>
- !! end
- !! test
- Definition list for indentation only
- !! wikitext
- :Indented text
- !! html
- <dl><dd>Indented text</dd></dl>
- !! end
- !! test
- Definition list with no space
- !! wikitext
- ;name:Definition
- !! html
- <dl><dt>name</dt>
- <dd>Definition</dd></dl>
- !!end
- !! test
- Definition list with URL link
- !! wikitext
- ;http://example.com/ :definition
- !! html
- <dl><dt><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> </dt>
- <dd>definition</dd></dl>
- !! end
- !! test
- Definition list with bracketed URL link
- !! wikitext
- ;[http://www.example.com/ Example]:Something about it
- !! html
- <dl><dt><a rel="nofollow" class="external text" href="http://www.example.com/">Example</a></dt>
- <dd>Something about it</dd></dl>
- !! end
- !! test
- Definition list with wikilink containing colon
- !! wikitext
- ; [[Help:FAQ]]:The least-read page on Wikipedia
- !! html
- <dl><dt><a href="/index.php?title=Help:FAQ&action=edit&redlink=1" class="new" title="Help:FAQ (page does not exist)">Help:FAQ</a></dt>
- <dd>The least-read page on Wikipedia</dd></dl>
- !! end
- # At Brion's and JeLuF's insistence... :)
- !! test
- Definition list with news link containing colon
- !! wikitext
- ;news:alt.wikipedia.rox: This isn't even a real newsgroup!
- !! html/php
- <dl><dt><a rel="nofollow" class="external free" href="news:alt.wikipedia.rox">news:alt.wikipedia.rox</a></dt>
- <dd>This isn't even a real newsgroup!</dd></dl>
- !! html/parsoid
- <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>
- !! end
- !! test
- Malformed definition list with colon
- !! wikitext
- ; news:alt.wikipedia.rox -- don't crash or enter an infinite loop
- !! html
- <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>
- !! end
- !! test
- Definition lists: colon in external link text
- !! wikitext
- ;[http://www.wikipedia2.org/ Wikipedia :The Next Generation] :OK, I made that up
- !! html
- <dl><dt><a rel="nofollow" class="external text" href="http://www.wikipedia2.org/">Wikipedia :The Next Generation</a> </dt>
- <dd>OK, I made that up</dd></dl>
- !! end
- !! test
- Definition lists: colon in HTML attribute
- !! wikitext
- ;<b style="display: inline">bold</b>
- !! html
- <dl><dt><b style="display: inline">bold</b></dt></dl>
- !! end
- !! test
- Definition lists: self-closed tag
- !! wikitext
- ;one<br/>two :two-line fun
- !! html
- <dl><dt>one<br />two </dt>
- <dd>two-line fun</dd></dl>
- !! end
- !! test
- Definition lists: ignore colons inside tags
- !! wikitext
- ;one <b>two : tag <i>fun:</i>:</b>:def
- !! html
- <dl><dt>one <b>two : tag <i>fun:</i>:</b></dt>
- <dd>def</dd></dl>
- !! end
- !! test
- Definition lists: excess closed tags
- !! wikitext
- ;one</b>two :bad tag fun
- !! html/php+tidy
- <dl><dt>onetwo </dt>
- <dd>bad tag fun</dd></dl>
- !! html/parsoid
- <dl>
- <dt>onetwo</dt>
- <dd>bad tag fun</dd>
- </dl>
- !! end
- !! test
- T13748: Literal closing tags
- !! wikitext
- <dl>
- <dt>test 1</dt>
- <dd>test test test test test</dd>
- <dt>test 2</dt>
- <dd>test test test test test</dd>
- </dl>
- !! html
- <dl>
- <dt>test 1</dt>
- <dd>test test test test test</dd>
- <dt>test 2</dt>
- <dd>test test test test test</dd>
- </dl>
- !! end
- !! test
- Definition and unordered list using wiki syntax nested in unordered list using html tags.
- !! wikitext
- <ul><li>
- ;term :description
- *unordered
- </li></ul>
- !! html
- <ul><li>
- <dl><dt>term </dt>
- <dd>description</dd></dl>
- <ul><li>unordered</li></ul>
- </li></ul>
- !! end
- !! test
- Definition list with empty definition and following paragraph
- !! wikitext
- ;term:
- Paragraph text
- !! html
- <dl><dt>term</dt>
- <dd></dd></dl>
- <p>Paragraph text
- </p>
- !! end
- !! test
- Nested definition lists using html syntax
- !! wikitext
- <dl><dt>x</dt>
- <dd>a</dd>
- <dd>b</dd></dl>
- !! html
- <dl><dt>x</dt>
- <dd>a</dd>
- <dd>b</dd></dl>
- !! end
- !! test
- Definition Lists: No nesting: Multiple dd's
- !! wikitext
- ;x
- :a
- :b
- !! html
- <dl><dt>x</dt>
- <dd>a</dd>
- <dd>b</dd></dl>
- !! end
- !! test
- Definition Lists: Indentation: Regular
- !! wikitext
- :i1
- ::i2
- :::i3
- !! html
- <dl><dd>i1
- <dl><dd>i2
- <dl><dd>i3</dd></dl></dd></dl></dd></dl>
- !! end
- !! test
- Definition Lists: Indentation: Missing 1st level
- !! wikitext
- ::i2
- :::i3
- !! html
- <dl><dd><dl><dd>i2
- <dl><dd>i3</dd></dl></dd></dl></dd></dl>
- !! end
- !! test
- Definition Lists: Indentation: Multi-level indent
- !! wikitext
- :::i3
- !! html
- <dl><dd><dl><dd><dl><dd>i3</dd></dl></dd></dl></dd></dl>
- !! end
- !! test
- Definition Lists: Hacky use to indent tables
- !! wikitext
- ::{|
- |foo
- |bar
- |}
- this text
- should be left alone
- !! html
- <dl><dd><dl><dd><table>
- <tr>
- <td>foo
- </td>
- <td>bar
- </td></tr></table></dd></dl></dd></dl>
- <p>this text
- should be left alone
- </p>
- !! end
- !! test
- Definition Lists: Hacky use to indent tables (with content following table)
- !! wikitext
- :{|
- |foo
- |bar
- |} <!--c1--> this text should be part of the dl
- !! html/php+tidy
- <dl><dd><table>
- <tbody><tr>
- <td>foo
- </td>
- <td>bar
- </td></tr></tbody></table> this text should be part of the dl</dd></dl>
- !! html/parsoid
- <dl><dd><table>
- <tbody><tr>
- <td>foo
- </td>
- <td>bar
- </td></tr></tbody></table> <!--c1--> this text should be part of the dl</dd></dl>
- !! end
- !! test
- Definition Lists: Hacky use to indent tables, with comments (T65979)
- !! wikitext
- <!-- foo -->
- ::{|
- |foo
- |bar
- |}<!-- bar -->
- this text
- should be left alone
- !! html/parsoid
- <!-- foo -->
- <dl><dd><dl><dd><table><tr>
- <td>foo</td>
- <td>bar</td>
- </tr></table><!-- bar --></dd></dl></dd></dl>
- <p>this text
- should be left alone</p>
- !! end
- !! test
- Definition Lists: Hacky use to indent tables, with comment before table
- !! wikitext
- ::<!-- foo -->{|
- |foo
- |}
- !! html/parsoid
- <dl><dd><dl><dd><!-- foo --><table><tr>
- <td>foo</td>
- </tr></table></dd></dl></dd></dl>
- !! end
- # The trailing whitespace in this test is to catch a regression in
- # Parsoid after T54473.
- !! test
- Definition Lists: Hacky use to indent tables (WS-insensitive)
- !! wikitext
- : {|
- |a
- |}
- !! html/php
- <dl><dd><table>
- <tr>
- <td>a
- </td></tr></table></dd></dl>
- !! html/parsoid
- <dl><dd> <table>
- <tbody><tr><td>a</td></tr>
- </tbody></table> </dd></dl>
- !! end
- ## The PHP parser treats : items (dd) without a corresponding ; item (dt)
- ## as an empty dt item. It also ignores all but the last ";" when followed
- ## by ":" later on. So, ";" are not ignored in ";;;t3" but are ignored in
- ## ";;;t3 :d1". So, PHP parser behavior is a little inconsistent wrt multiple
- ## ";"s.
- ##
- ## Ex: ";;t2 ::d2" is transformed into:
- ##
- ## <dl>
- ## <dt>t2 </dt>
- ## <dd>
- ## <dl>
- ## <dt></dt>
- ## <dd>d2</dd>
- ## </dl>
- ## </dd>
- ## </dl>
- ##
- ## But, Parsoid treats "; :" as a tight atomic unit and excess ":" as plain text
- ## So, the same wikitext above (;;t2 ::d2) is transformed into:
- ##
- ## <dl>
- ## <dt>
- ## <dl>
- ## <dt>t2 </dt>
- ## <dd>:d2</dd>
- ## </dl>
- ## </dt>
- ## </dl>
- ##
- ## All Parsoid only definition list tests have this difference.
- ##
- ## See also: https://phabricator.wikimedia.org/T8569
- ## and https://lists.wikimedia.org/pipermail/wikitext-l/2011-November/000483.html
- !! test
- Table / list interaction: indented table with lists in table contents
- !! wikitext
- :{|
- |-
- |a
- *b
- |-
- |c
- *d
- |}
- !! html
- <dl><dd><table>
- <tr>
- <td>a
- <ul><li>b</li></ul>
- </td></tr>
- <tr>
- <td>c
- <ul><li>d</li></ul>
- </td></tr></table></dd></dl>
- !! end
- !!test
- Table / list interaction: lists nested in tables nested in indented lists
- !! wikitext
- :{|
- |
- :a
- :b
- |
- *c
- *d
- |}
- *e
- *f
- !! html
- <dl><dd><table>
- <tr>
- <td>
- <dl><dd>a</dd>
- <dd>b</dd></dl>
- </td>
- <td>
- <ul><li>c</li>
- <li>d</li></ul>
- </td></tr></table></dd></dl>
- <ul><li>e</li>
- <li>f</li></ul>
- !!end
- !! test
- Definition Lists: Nesting: Multi-level (Parsoid only)
- !! wikitext
- ;t1 :d1
- ;;t2 ::d2
- ;;;t3 :::d3
- !! html/parsoid
- <dl>
- <dt>t1 </dt>
- <dd>d1</dd>
- <dt>
- <dl>
- <dt>t2 </dt>
- <dd>:d2</dd>
- <dt>
- <dl>
- <dt>t3 </dt>
- <dd>::d3</dd>
- </dl>
- </dt>
- </dl>
- </dt>
- </dl>
- !! end
- !! test
- Definition Lists: Nesting: Test 2
- !! wikitext
- ;t1
- ::d2
- !! html+tidy
- <dl><dt>t1</dt>
- <dd>
- <dl><dd>d2</dd></dl></dd></dl>
- !! end
- !! test
- Definition Lists: Nesting: Test 3
- !! wikitext
- :;t1
- ::::d2
- !! html+tidy
- <dl><dd><dl><dt>t1</dt>
- <dd>
- <dl><dd><dl><dd>d2</dd></dl></dd></dl></dd></dl></dd></dl>
- !! end
- !! test
- Definition Lists: Nesting: Test 4
- !! wikitext
- ::;t3
- :::d3
- !! html
- <dl><dd><dl><dd><dl><dt>t3</dt>
- <dd>d3</dd></dl></dd></dl></dd></dl>
- !! end
- ## The Parsoid team believes the following three test exposes a
- ## bug in the PHP parser. (Parsoid team thinks the PHP parser is
- ## wrong to close the <dl> after the <dt> containing the <ul>.)
- ## It also exposes a "misfeature" in tidy, which doesn't like
- ## <dl> tags with a single <dt> child; it converts the <dt> into
- ## a <dd> in that case. (Parsoid leaves the <dt> alone!)
- !! test
- Definition Lists: Mixed Lists: Test 1
- !! wikitext
- :;*foo
- ::*bar
- :;baz
- !! html/php
- <dl><dd><dl><dt><ul><li>foo</li>
- <li>bar</li></ul></dt></dl>
- <dl><dt>baz</dt></dl></dd></dl>
- !! html/php+tidy
- <dl><dd><dl><dt><ul><li>foo</li>
- <li>bar</li></ul></dt></dl>
- <dl><dt>baz</dt></dl></dd></dl>
- !! html/parsoid
- <dl>
- <dd><dl>
- <dt><ul>
- <li>foo
- </li>
- </ul></dt>
- <dd><ul>
- <li>bar
- </li>
- </ul></dd>
- <dt>baz</dt>
- </dl></dd>
- </dl>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 2
- !! wikitext
- *:d1
- *:d2
- !! html
- <ul><li><dl><dd>d1</dd>
- <dd>d2</dd></dl></li></ul>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 3
- !! wikitext
- *:::d1
- *:::d2
- !! html
- <ul><li><dl><dd><dl><dd><dl><dd>d1</dd>
- <dd>d2</dd></dl></dd></dl></dd></dl></li></ul>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 4
- !! wikitext
- *;d1 :d2
- *;d3 :d4
- !! html
- <ul><li><dl><dt>d1 </dt>
- <dd>d2</dd>
- <dt>d3 </dt>
- <dd>d4</dd></dl></li></ul>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 5
- !! wikitext
- *:d1
- *::d2
- !! html
- <ul><li><dl><dd>d1
- <dl><dd>d2</dd></dl></dd></dl></li></ul>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 6
- !! wikitext
- #*:d1
- #*:::d3
- !! html
- <ol><li><ul><li><dl><dd>d1
- <dl><dd><dl><dd>d3</dd></dl></dd></dl></dd></dl></li></ul></li></ol>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 7
- !! wikitext
- :*d1
- :*d2
- !! html
- <dl><dd><ul><li>d1</li>
- <li>d2</li></ul></dd></dl>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 8
- !! wikitext
- :*d1
- ::*d2
- !! html
- <dl><dd><ul><li>d1</li></ul>
- <dl><dd><ul><li>d2</li></ul></dd></dl></dd></dl>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 9
- !! wikitext
- *;foo :bar
- !! html
- <ul><li><dl><dt>foo </dt>
- <dd>bar</dd></dl></li></ul>
- !! end
- !! test
- Definition Lists: Mixed Lists: Test 10
- !! wikitext
- *#;foo :bar
- !! html
- <ul><li><ol><li><dl><dt>foo </dt>
- <dd>bar</dd></dl></li></ol></li></ul>
- !! end
- # The Parsoid team disagrees with the PHP parser's seemingly-random
- # rules regarding dd/dt on the next few tests. Parsoid is more
- # consistent, and recognizes the shared nesting and keeps the
- # still-open tags around until the nesting is complete.
- # This is a regression test for T175099
- !! test
- Definition Lists: Mixed Lists: Test 11
- !! wikitext
- ;a
- :*b
- !! html/php
- <dl><dt>a</dt>
- <dd>
- <ul><li>b</li></ul></dd></dl>
- !! html/parsoid
- <dl><dt>a
- <dd><ul><li>b</li></ul></dd></dl>
- !! end
- # FIXME: Maybe get rid of this test?
- !! test
- Definition Lists: Mixed Lists: Test 12
- !! wikitext
- *#*#;*;;foo :bar
- *#*#;boo :baz
- !! html/php
- <ul><li><ol><li><ul><li><ol><li><dl><dt>foo </dt>
- <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dd></dl></li></ul></dd></dl>
- <dl><dt>boo </dt>
- <dd>baz</dd></dl></li></ol></li></ul></li></ol></li></ul>
- !! html/php+tidy
- <ul><li><ol><li><ul><li><ol><li><dl><dt>foo </dt>
- <dd><ul><li><dl><dt><dl><dt>bar</dt></dl></dt></dl></li></ul></dd></dl></li></ol></li></ul>
- <dl><dt>boo </dt>
- <dd>baz</dd></dl></li></ol></li></ul>
- !! html/parsoid
- <ul>
- <li>
- <ol>
- <li>
- <ul>
- <li>
- <ol>
- <li>
- <dl>
- <dt>
- <ul>
- <li>
- <dl>
- <dt>
- <dl>
- <dt>foo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'> </span></dt>
- <dd data-parsoid='{"stx":"row"}'>bar</dd>
- </dl></dt>
- </dl></li>
- </ul></dt>
- <dt>boo<span typeof="mw:Placeholder" data-parsoid='{"src":" "}'> </span></dt>
- <dd data-parsoid='{"stx":"row"}'>baz</dd>
- </dl></li>
- </ol></li>
- </ul></li>
- </ol></li>
- </ul>
- !! end
- # FIXME: Maybe get rid of this test?
- # From whitelist:
- # * The test is wrong, there are two colons where there should be :;
- # * The PHP parser is wrong to close the <dl> after the <dt> containing the <ul>.
- !! test
- Definition Lists: Weird Ones: Test 1
- !! wikitext
- *#;*::;;foo :bar (who uses this?)
- !! html/php+tidy
- <ul><li><ol><li><dl><dt>foo </dt>
- <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>
- !! html/parsoid
- <ul>
- <li>
- <ol>
- <li>
- <dl>
- <dt>
- <ul>
- <li>
- <dl>
- <dd>
- <dl>
- <dd>
- <dl>
- <dt>
- <dl>
- <dt>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span></dt>
- <dd data-parsoid='{"stx":"row"}'>bar (who uses this?)</dd>
- </dl></dt>
- </dl></dd>
- </dl></dd>
- </dl></li>
- </ul></dt>
- </dl></li>
- </ol></li>
- </ul>
- !! end
- !! test
- Definition Lists: colons occurring in tags
- !! wikitext
- ;a:b
- ;'''a:b'''
- ;<i>a:b</i>
- ;<span>a:b</span>
- ;<div>a:b</div>
- ;<div>a
- :b</div>
- ;{{echo|a:b}}
- ;{{echo|''a:b''}}
- ;;;''a:b''
- !! html+tidy
- <dl><dt>a</dt>
- <dd>b</dd>
- <dt><b>a:b</b></dt>
- <dt><i>a:b</i></dt>
- <dt><span>a:b</span></dt>
- <dt><div>a:b</div></dt>
- <dt><div>a</div></dt>
- <dd>b</dd>
- <dt>a</dt>
- <dd>b</dd>
- <dt><i>a:b</i></dt></dl>
- <dl><dt><dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
- !! html/parsoid
- <dl><dt>a</dt><dd data-parsoid='{"stx":"row"}'>b</dd>
- <dt><b>a:b</b></dt>
- <dt><i data-parsoid='{"stx":"html"}'>a:b</i></dt>
- <dt><span data-parsoid='{"stx":"html"}'>a:b</span></dt>
- <dt><div data-parsoid='{"stx":"html"}'>a:b</div></dt>
- <dt><div data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</div></dt>
- <dd>b</dd>
- <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>
- <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":"''a:b''"}},"i":0}}]}'>a:b</i>
- <dl><dt><dl><dt><i>a:b</i></dt></dl></dt></dl></dt></dl>
- !! end
- # Parsoid's output differs here again because it shares
- # nesting between the two lists unlike the PHP parser.
- # Unsure which is more desirable.
- !! test
- Definition Lists: colons and tables 1
- !! wikitext
- :{|
- |x
- |}
- :{|
- |y
- |}
- !! html/php
- <dl><dd><table>
- <tr>
- <td>x
- </td></tr></table></dd></dl>
- <dl><dd><table>
- <tr>
- <td>y
- </td></tr></table></dd></dl>
- !! html/parsoid
- <dl><dd><table>
- <tr>
- <td>x
- </td></tr></table></dd>
- <dd><table>
- <tr>
- <td>y
- </td></tr></table></dd></dl>
- !! end
- # FIXME: Does this need a html/php section?
- !! test
- Definition Lists: template interaction
- !! wikitext
- ::{{definition_list}}
- :one
- ::{{definition_list}}
- :::two
- :::three
- ::four
- !! html/parsoid
- <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">
- </span><dd about="#mwt1">two</dd></dl></dd></dl>
- <dl><dd data-parsoid='{}'>one
- <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">
- </span><dd about="#mwt2">two
- <dl><dd>two</dd>
- <dd>three</dd></dl></dd>
- <dd data-parsoid='{}'>four</dd></dl></dd></dl>
- !! end
- ###
- ### External links
- ###
- !! test
- External links: non-bracketed
- !! wikitext
- Non-bracketed: http://example.com
- !! html
- <p>Non-bracketed: <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
- </p>
- !! end
- # parsoid doesn't explicitly mark autonumbered links, see T55505
- !! test
- External links: numbered
- !! wikitext
- Numbered: [http://example.com]
- Numbered: [http://example.net]
- Numbered: [http://example.com]
- !! html/php
- <p>Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>
- Numbered: <a rel="nofollow" class="external autonumber" href="http://example.net">[2]</a>
- Numbered: <a rel="nofollow" class="external autonumber" href="http://example.com">[3]</a>
- </p>
- !! html/parsoid
- <p>Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>
- Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.net"></a>
- Numbered: <a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a></p>
- !!end
- !! test
- External links: specified text
- !! wikitext
- Specified text: [http://example.com link]
- !! html
- <p>Specified text: <a rel="nofollow" class="external text" href="http://example.com">link</a>
- </p>
- !!end
- !! test
- External links: trail
- !! wikitext
- Linktrails should not work for external links: [http://example.com link]s
- !! html
- <p>Linktrails should not work for external links: <a rel="nofollow" class="external text" href="http://example.com">link</a>s
- </p>
- !! end
- !! test
- External links: dollar sign in URL
- !! wikitext
- http://example.com/1$2345
- !! html
- <p><a rel="nofollow" class="external free" href="http://example.com/1$2345">http://example.com/1$2345</a>
- </p>
- !! end
- # parsoid doesn't explicitly mark autonumbered links, see T55505
- !! test
- External links: dollar sign in URL (autonumber)
- !! wikitext
- [http://example.com/1$2345]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://example.com/1$2345">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/1$2345"></a></p>
- !!end
- !! test
- External links: open square bracket forbidden in URL (T6377)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- http://example.com/1[2345
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com/1">http://example.com/1</a>[2345
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/1">http://example.com/1</a>[2345</p>
- !! end
- !! test
- External links: open square bracket forbidden in URL (named) (T6377)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- [http://example.com/1[2345]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://example.com/1">[2345</a></p>
- !!end
- # parsoid adds a space before the link name
- !! test
- External links: open square bracket forbidden in URL (named) (T6377)
- Parsoid variant.
- !! wikitext
- [http://example.com/1 [2345]
- !! html
- <p><a rel="nofollow" class="external text" href="http://example.com/1">[2345</a>
- </p>
- !!end
- !! test
- External links: nowiki in URL link text (T8230)
- !! wikitext
- [http://example.com/ <nowiki>''example site''</nowiki>]
- !! html
- <p><a rel="nofollow" class="external text" href="http://example.com/">''example site''</a>
- </p>
- !! end
- !! test
- External links: newline forbidden in text (T8230 regression check)
- !! wikitext
- [http://example.com/ first
- second]
- !! html
- <p>[<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a> first
- second]
- </p>
- !!end
- !! test
- External links: Pipe char between url and text
- !! wikitext
- [http://example.com | link]
- !! html
- <p><a rel="nofollow" class="external text" href="http://example.com">| link</a>
- </p>
- !!end
- !! test
- External links: protocol-relative URL in brackets
- !! wikitext
- [//example.com/ Test]
- !! html
- <p><a rel="nofollow" class="external text" href="//example.com/">Test</a>
- </p>
- !! end
- # parsoid doesn't explicitly mark autonumbered links, see T55505
- !! test
- External links: protocol-relative URL in brackets without text
- !! wikitext
- [//example.com]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="//example.com">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="//example.com"></a></p>
- !! end
- !! test
- External links: protocol-relative URL in free text is left alone
- !! wikitext
- //example.com/Foo
- !! html
- <p>//example.com/Foo
- </p>
- !!end
- !! test
- External links: protocol-relative URL in the middle of a word is left alone (T32269)
- !! wikitext
- foo//example.com/Foo
- !! html
- <p>foo//example.com/Foo
- </p>
- !! end
- ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
- !! test
- External links: with no contents
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- [http://en.wikipedia.org/wiki/Foo]
- [[wikipedia:Foo|Bar]]
- [[wikipedia:Foo|<span>Bar</span>]]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo">[1]</a>
- </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
- </p><p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo"><span>Bar</span></a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/wiki/Foo"></a></p>
- <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo">Bar</a></p>
- <p><a rel="mw:WikiLink/Interwiki" href="http://en.wikipedia.org/wiki/Foo" title="wikipedia:Foo"><span>Bar</span></a></p>
- !! end
- !! test
- External links: Free with trailing punctuation
- !! wikitext
- http://example.com,
- http://example.com;
- http://example.com\
- http://example.com.
- http://example.com:
- http://example.com!
- http://example.com?
- http://example.com)
- http://example.com/url_with_(brackets)
- (http://example.com/url_without_brackets)
- http://example.com/url_with_entity&
- http://example.com/url_with_entity&
- http://example.com/url_with_entity&
- http://example.com/url_with_entity
- http://example.com/url_with_entity 
- http://example.com/url_with_entity 
- http://example.com/url_with_entity<
- http://example.com/url_with_entity<
- http://example.com/url_with_entity<
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>;
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>\
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>!
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>?
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
- <a rel="nofollow" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
- (<a rel="nofollow" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&">http://example.com/url_with_entity&</a>
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&">http://example.com/url_with_entity&</a>
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity&">http://example.com/url_with_entity&</a>
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a> 
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a> 
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a> 
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><
- <a rel="nofollow" class="external free" href="http://example.com/url_with_entity">http://example.com/url_with_entity</a><
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>,
- <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>;
- <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>\
- <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>.
- <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>:
- <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>!
- <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>?
- <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)
- <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_(brackets)">http://example.com/url_with_(brackets)</a>
- (<a rel="mw:ExtLink" class="external free" href="http://example.com/url_without_brackets">http://example.com/url_without_brackets</a>)
- <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&">http://example.com/url_with_entity&</a>
- <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&">http://example.com/url_with_entity&</a>
- <a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&">http://example.com/url_with_entity&</a>
- <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":"&nbsp;","srcContent":" "}'> </span>
- <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":"&#xA0;","srcContent":" "}'> </span>
- <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":"&#160;","srcContent":" "}'> </span>
- <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":"&lt;","srcContent":"<"}'><</span>
- <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":"&#x3C;","srcContent":"<"}'><</span>
- <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":"&#60;","srcContent":"<"}'><</span></p>
- !! end
- !! test
- External links: tricky Parsoid html2html case
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- http://example.com/url_with_entity&amp;
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com/url_with_entity&amp">http://example.com/url_with_entity&amp</a>;
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/url_with_entity&amp">http://example.com/url_with_entity&amp</a>;</p>
- !! end
- !! test
- External links: Free with trailing quotes (T113666)
- !! wikitext
- '''News:''' Stuff here
- news:'a'b''c''d e
- !! html/php
- <p><b>News:</b> Stuff here
- </p><p><a rel="nofollow" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e
- </p>
- !! html/parsoid
- <p><b>News:</b> Stuff here</p>
- <p><a rel="mw:ExtLink" class="external free" href="news:'a'b">news:'a'b</a><i>c</i>d e</p>
- !! end
- !! test
- External links: with entity
- !! wikitext
- [http:// www.librarieswithoutborders.org Libraries without borders]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://+www.librarieswithoutborders.org">Libraries without borders</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://+www.librarieswithoutborders.org" data-parsoid='{"a":{"href":"http://+www.librarieswithoutborders.org"},"sa":{"href":"http://&#x20;www.librarieswithoutborders.org"}}'>Libraries without borders</a></p>
- !! end
- !! test
- External links: Lone protocols are never linked (T105697)
- !! wikitext
- http://
- http://;
- (http://)
- bitcoin:
- bitcoin:;
- (bitcoin:)
- !! html
- <p>http://
- http://;
- (http://)
- bitcoin:
- bitcoin:;
- (bitcoin:)
- </p>
- !! end
- !! test
- External links: No preceding word characters allowed (T67278)
- !! wikitext
- NOPEhttp://example.com
- N0http://example.com
- ok:http://example.com
- ok-http://example.com
- !! html
- <p>NOPEhttp://example.com
- N0http://example.com
- ok:<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
- ok-<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
- </p>
- !! end
- !! test
- External links: nofollow domain exception
- !! wikitext
- A [https://no-nofollow.org/foobar link], and another [https://example.org link].
- !! html
- <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>.
- </p>
- !!end
- !! test
- External image
- !! wikitext
- External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
- !! html
- <p>External image: <img src="http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
- </p>
- !! end
- !! test
- External image from https
- !! wikitext
- External image from https: https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
- !! html
- <p>External image from https: <img src="https://meta.wikimedia.org/upload/f/f1/Ncwikicol.png" alt="Ncwikicol.png"/>
- </p>
- !! end
- !! test
- External image (when not allowed)
- !! options
- wgAllowExternalImages=0
- !! wikitext
- External image: http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png
- !! html
- <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>
- </p>
- !! end
- !! test
- Link to non-http image, no img tag
- !! wikitext
- Link to non-http image, no img tag: ftp://example.com/test.jpg
- !! html
- <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>
- </p>
- !! end
- !! test
- External links: terminating separator
- !! wikitext
- Terminating separator: http://example.com/thing,
- !! html
- <p>Terminating separator: <a rel="nofollow" class="external free" href="http://example.com/thing">http://example.com/thing</a>,
- </p>
- !! end
- !! test
- External links: intervening separator
- !! wikitext
- Intervening separator: http://example.com/1,2,3
- !! html
- <p>Intervening separator: <a rel="nofollow" class="external free" href="http://example.com/1,2,3">http://example.com/1,2,3</a>
- </p>
- !! end
- !! test
- External links: old bug with URL in query
- !! wikitext
- Old bug with URL in query: [http://example.com/thing?url=http://example.com link]
- !! html
- <p>Old bug with URL in query: <a rel="nofollow" class="external text" href="http://example.com/thing?url=http://example.com">link</a>
- </p>
- !! end
- !! test
- External links: old URL-in-URL bug, mixed protocols
- !! wikitext
- And again with mixed protocols: [ftp://example.com?url=http://example.com link]
- !! html
- <p>And again with mixed protocols: <a rel="nofollow" class="external text" href="ftp://example.com?url=http://example.com">link</a>
- </p>
- !!end
- # Since Parsoid is starting to emit canonical wikitext for links,
- # [http://example.com http://example.com] will not RT back to that
- # form anymore.
- !! test
- External links: URL in text
- !! options
- parsoid=wt2html
- !! wikitext
- URL in text: [http://example.com http://example.com]
- !! html/php
- <p>URL in text: <a rel="nofollow" class="external text" href="http://example.com">http://example.com</a>
- </p>
- !! html/parsoid
- <p>URL in text: <a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
- !! end
- !! test
- External links: Clickable images
- !! wikitext
- ja-style clickable images: [http://example.com http://meta.wikimedia.org/upload/f/f1/Ncwikicol.png]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- External links: raw ampersand
- !! wikitext
- Old & use: http://x&y
- !! html
- <p>Old & use: <a rel="nofollow" class="external free" href="http://x&y">http://x&y</a>
- </p>
- !! end
- !! test
- External links: encoded ampersand
- !! wikitext
- Old & use: http://x&y
- !! html/php
- <p>Old & use: <a rel="nofollow" class="external free" href="http://x&y">http://x&y</a>
- </p>
- !! html/parsoid
- <p>Old <span typeof="mw:Entity">&</span> use: <a rel="mw:ExtLink" class="external free" href="http://x&y">http://x&y</a></p>
- !! end
- !! test
- External links: encoded equals (T8102)
- !! wikitext
- http://example.com/?foo=bar
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/?foo=bar">http://example.com/?foo=bar</a></p>
- !! end
- ##
- ## Note that parsoid doesn't explicit mark autonumbered links, nor
- ## does it number them. As discussed in T55505, we can identify
- ## autonumbered links via CSS.
- ##
- !! test
- External links: [raw ampersand]
- !! wikitext
- Old & use: [http://x&y]
- !! html/php
- <p>Old & use: <a rel="nofollow" class="external autonumber" href="http://x&y">[1]</a>
- </p>
- !! html/parsoid
- <p>Old <span typeof="mw:Entity">&</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&y"></a></p>
- !! end
- # note that parsoid html is identical to [raw ampersand] case; so html2wt
- # mode will return the [raw ampersand] wikitext
- !! test
- External links: [encoded ampersand]
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Old & use: [http://x&y]
- !! html/php
- <p>Old & use: <a rel="nofollow" class="external autonumber" href="http://x&y">[1]</a>
- </p>
- !! html/parsoid
- <p>Old <span typeof="mw:Entity">&</span> use: <a rel="mw:ExtLink" class="external autonumber" href="http://x&y"></a></p>
- !! end
- !! test
- External links: [raw equals]
- !! wikitext
- [http://example.com/?foo=bar]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
- !! end
- # note that parsoid html is identical to [raw equals] case; so html2wt
- # mode will return the [raw equals] wikitext
- !! test
- External links: [encoded equals] (T8102)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [http://example.com/?foo=bar]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://example.com/?foo=bar">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/?foo=bar"></a></p>
- !! end
- # xxx parsoid strips the IDN character, so the round-trip tests will
- # obviously fail and are disabled. --cscott
- !! test
- External links: [IDN ignored character reference in hostname; strip it right off]
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [http://e‌xample.com/]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://example.com/">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://example.com/"></a></p>
- !! end
- # FIXME: This test (the IDN characters in the text of a link) is an inconsistency.
- # Where an external link could easily circumvent the sanitization of the text of
- # a link like this (where an IDN-ignore character is in the URL somewhere), this
- # test demands a higher standard. That's a bit strange.
- #
- # Example:
- #
- # http://example.com -> [http://example.com|http://example.com]
- # [http://example.com|http://example.com] -> [http://example.com|http://example.com]
- #
- # The first example is sanitized, but the second is not. Any security benefits
- # from this production are trivial to circumvent. Either remove this test and
- # let the parser(s) do their thing unaccosted, or fix the inconsistency and change
- # the test accordingly.
- #
- # All our love,
- # The Parsoid team.
- # xxx parsoid strips the IDN character, so the round-trip tests will
- # obviously fail and are disabled. --cscott
- !! test
- External links: IDN ignored character reference in hostname; strip it right off
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- http://e‌xample.com/
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/">http://example.com/</a></p>
- !! end
- !! test
- External links: www.jpeg.org (T2554)
- !! wikitext
- http://www.jpeg.org
- !! html
- <p><a rel="nofollow" class="external free" href="http://www.jpeg.org">http://www.jpeg.org</a>
- </p>
- !! end
- # parsoid doesn't explicitly mark autonumbered links, see T55505
- !! test
- External links: URL within URL (T2002)
- !! wikitext
- [http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://www.unausa.org/newindex.asp?place=http://www.unausa.org/programs/mun.asp">[1]</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- T2361: URL inside bracketed URL
- !! wikitext
- [http://www.example.com/foo http://www.example.com/bar]
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.com/foo">http://www.example.com/bar</a>
- </p>
- !! end
- !! test
- T2361: URL within URL, not bracketed
- !! wikitext
- http://www.example.com/foo?=http://www.example.com/bar
- !! html
- <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>
- </p>
- !! end
- !! test
- T2289: ">"-token in URL-tail
- !! wikitext
- http://www.example.com/<hello>
- !! html
- <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><hello>
- </p>
- !!end
- !! test
- T2289: literal ">"-token in URL-tail
- !! wikitext
- http://www.example.com/<b>html</b>
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a><b>html</b>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- T2289: ">"-token in bracketed URL
- !! wikitext
- [http://www.example.com/<hello> stuff]
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.com/"><hello> stuff</a>
- </p>
- !!end
- !! test
- T2289: literal ">"-token in bracketed URL
- !! wikitext
- [http://www.example.com/<b>html</b> stuff]
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.com/"><b>html</b> stuff</a>
- </p>
- !!end
- !! test
- T2289: literal double quote at end of URL
- !! wikitext
- http://www.example.com/"hello"
- !! html
- <p><a rel="nofollow" class="external free" href="http://www.example.com/">http://www.example.com/</a>"hello"
- </p>
- !!end
- !! test
- T2289: literal double quote in bracketed URL
- !! wikitext
- [http://www.example.com/"hello" stuff]
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.com/">"hello" stuff</a>
- </p>
- !!end
- !! test
- External links: multiple legal whitespace is fine, Magnus. Don't break it please. (T7081)
- !! wikitext
- [http://www.example.com test]
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.com">test</a>
- </p>
- !! end
- !! test
- External links: link text with spaces
- !! wikitext
- [http://www.example.com a b c]
- [http://www.example.com ''a'' ''b'']
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.com">a b c</a>
- <a rel="nofollow" class="external text" href="http://www.example.com"><i>a</i> <i>b</i></a>
- </p>
- !! end
- # Note edge case difference between PHP and Parsoid here.
- !! test
- External links: wiki links within external link (T5695)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- [http://example.com [[wikilink]] embedded in ext link]
- [http://example.com test [[wikilink]] embedded in ext link]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://example.com"></a><a href="/index.php?title=Wikilink&action=edit&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>
- </p><p><a rel="nofollow" class="external text" href="http://example.com">test </a><a href="/index.php?title=Wikilink&action=edit&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>
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- T2787: Links with one slash after the url protocol are invalid
- !! wikitext
- http:/example.com
- [http:/example.com title]
- !! html
- <p>http:/example.com
- </p><p>[http:/example.com title]
- </p>
- !! end
- !! test
- Bracketed external links with template-generated invalid target
- !! wikitext
- [{{echo|http:/example.com}} title]
- !! html
- <p>[http:/example.com title]
- </p>
- !! end
- # wt2html only because Parsoid would want to add <nowiki>s coming from html
- !! test
- Broken wikilinks (but not external links) prevent templates from closing
- !! options
- parsoid=wt2html
- !! wikitext
- [http://example.com x
- {{echo|[http://example.com x}}
- [[Foo
- {{echo|[[Foo}}
- !! html/php
- <p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
- </p><p>[<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> x
- </p><p>[[Foo
- </p><p>{{echo|[[Foo}}
- </p>
- !! html/parsoid
- <p>[<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a> x</p>
- <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>
- <p>[[Foo</p>
- <p>{{echo|[[Foo}}</p>
- !! end
- !! test
- Wikilinks with embedded newlines are not broken
- !! wikitext
- {{echo|[[ Foo
- B
- C]]}}
- !! html/php
- <p>[[ Foo
- B
- C]]
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Broken templates
- !! options
- parsoid=wt2html
- !! wikitext
- {{echo|[[Foo|}}]]
- [[Foo|{{echo|]]}}
- !! html/php
- <p>{{echo|<a href="/wiki/Foo" title="Foo">}}</a>
- </p><p>[[Foo|]]
- </p>
- !! html/parsoid
- <p>{{echo|<a rel="mw:WikiLink" href="./Foo" title="Foo">}}</a></p>
- <p>[[Foo|<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"]]"}},"i":0}}]}'>]]</span></p>
- !! end
- !! test
- T4702: Mismatched <i>, <b> and <a> tags are invalid
- !! wikitext
- ''[http://example.com text'']
- [http://example.com '''text]'''
- ''Something [http://example.com in italic'']
- ''Something [http://example.com mixed''''', even bold]'''
- '''''Now [http://example.com both''''']
- !! html
- <p><a rel="nofollow" class="external text" href="http://example.com"><i>text</i></a>
- <a rel="nofollow" class="external text" href="http://example.com"><b>text</b></a>
- <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>in italic</i></a>
- <i>Something </i><a rel="nofollow" class="external text" href="http://example.com"><i>mixed</i><b>, even bold</b></a>
- <i><b>Now </b></i><a rel="nofollow" class="external text" href="http://example.com"><i><b>both</b></i></a>
- </p>
- !! end
- !! test
- T6781: %26 in URL
- !! wikitext
- http://www.example.com/?title=AT%26T
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://www.example.com/?title=AT%26T">http://www.example.com/?title=AT%26T</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- # According to https://www.w3.org/TR/2011/WD-html5-20110525/Overview.html#parsing-urls a plain
- # % is actually legal in HTML5. Any change in output would need testing though.
- !! test
- T6781, T7267: %25 in URL
- !! wikitext
- http://www.example.com/?title=100%25_Bran
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- T6781, T7267: %28, %29 in URL
- !! wikitext
- http://www.example.com/?title=Ben-Hur_%281959_film%29
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- T6781: %26 in autonumber URL
- !! wikitext
- [http://www.example.com/?title=AT%26T]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=AT%26T">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=AT%26T"></a></p>
- !! end
- !! test
- T6781, T7267: %26 in autonumber URL
- !! wikitext
- [http://www.example.com/?title=100%25_Bran]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=100%25_Bran">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=100%25_Bran"></a></p>
- !! end
- !! test
- T6781, T7267: %28, %29 in autonumber URL
- !! wikitext
- [http://www.example.com/?title=Ben-Hur_%281959_film%29]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com/?title=Ben-Hur_%281959_film%29"></a></p>
- !! end
- !! test
- T6781: %26 in bracketed URL
- !! wikitext
- [http://www.example.com/?title=AT%26T link]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=AT%26T">link</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=AT%26T">link</a></p>
- !! end
- !! test
- T6781, T7267: %25 in bracketed URL
- !! wikitext
- [http://www.example.com/?title=100%25_Bran link]
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=100%25_Bran">link</a>
- </p>
- !! end
- !! test
- T6781, T7267: %28, %29 in bracketed URL
- !! wikitext
- [http://www.example.com/?title=Ben-Hur_%281959_film%29 link]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://www.example.com/?title=Ben-Hur_%281959_film%29">link</a></p>
- !! end
- !! test
- External link containing a period in the anchor. (T65947)
- !! wikitext
- [//foo.org/bar#baz. bang]
- [//foo.org/bar. bang]
- !! html/php
- <p><a rel="nofollow" class="external text" href="//foo.org/bar#baz.">bang</a>
- </p><p><a rel="nofollow" class="external text" href="//foo.org/bar.">bang</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar#baz.">bang</a></p>
- <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar.">bang</a></p>
- !! end
- !! test
- External link containing a single quote. (T65947)
- !! wikitext
- [//foo.org/bar'baz]
- [//foo.org/bar'baz bang]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="//foo.org/bar'baz">[1]</a>
- </p><p><a rel="nofollow" class="external text" href="//foo.org/bar'baz">bang</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="//foo.org/bar'baz"></a></p>
- <p><a rel="mw:ExtLink" class="external text" href="//foo.org/bar'baz">bang</a></p>
- !! end
- !! test
- External link containing double-single-quotes in text '' (T6598 sanity check)
- !! wikitext
- Some [http://example.com/ pretty ''italics'' and stuff]!
- !! html
- <p>Some <a rel="nofollow" class="external text" href="http://example.com/">pretty <i>italics</i> and stuff</a>!
- </p>
- !! end
- !! test
- External link containing double-single-quotes in text embedded in italics (T6598 sanity check)
- !! wikitext
- ''Some [http://example.com/ pretty ''italics'' and stuff]!''
- !! html
- <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>
- </p>
- !! end
- # Don't add the html/php section since the output is broken and there isn't any reason to spec it
- !! test
- External link containing double-single-quotes with no space separating the url from text in italics
- !! wikitext
- [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]].]
- !! html/php+tidy
- <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)&action=edit&redlink=1" class="new" title="Museo Picasso (París) (page does not exist)">Museo Picasso</a>.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- External link with comments in link text
- !! wikitext
- [http://www.google.com Google <!-- comment -->]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://www.google.com">Google </a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://www.google.com">Google <!-- comment --></a></p>
- !! end
- !! test
- External link to bare IPv4 address
- !! wikitext
- [http://192.168.0.1 Link]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://192.168.0.1">Link</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://192.168.0.1">Link</a></p>
- !! end
- !! test
- URL-encoding in URL functions (single parameter)
- !! wikitext
- {{localurl:Some page|amp=&}}
- !! html
- <p>/index.php?title=Some_page&amp=&
- </p>
- !! end
- !! test
- URL-encoding in URL functions (multiple parameters)
- !! wikitext
- {{localurl:Some page|q=?&=&}}
- !! html
- <p>/index.php?title=Some_page&q=?&amp=&
- </p>
- !! end
- !! test
- Brackets in urls
- !! wikitext
- http://example.com/index.php?foozoid%5B%5D=bar
- http://example.com/index.php?foozoid[]=bar
- !! html/php
- <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>
- </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>
- </p>
- !! html/parsoid
- <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>
- <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&#x5B;&#x5D;=bar"}}'>http://example.com/index.php?foozoid%5B%5D=bar</a></p>
- !! end
- !! test
- IPv6 urls, autolink format (T23261)
- !! wikitext
- http://[2404:130:0:1000::187:2]/index.php
- Examples from RFC 2373, section 2.2:
- *http://[1080::8:800:200C:417A]/unicast
- *http://[FF01::101]/multicast
- *http://[::1]/loopback
- *http://[::]/unspecified
- *http://[::13.1.68.3]/ipv4compat
- *http://[::FFFF:129.144.52.38]/ipv4compat
- Examples from RFC 2732, section 2:
- *http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html
- *http://[1080:0:0:0:8:800:200C:417A]/index.html
- *http://[3ffe:2a00:100:7031::1]
- *http://[1080::8:800:200C:417A]/foo
- *http://[::192.9.5.5]/ipng
- *http://[::FFFF:129.144.52.38]:80/index.html
- *http://[2010:836B:4179::836B:4179]
- !! html/php
- <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>
- </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:
- </p>
- <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>
- <li><a rel="nofollow" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
- <li><a rel="nofollow" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
- <li><a rel="nofollow" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
- <li><a rel="nofollow" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
- <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>
- <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
- </p>
- <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>
- <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>
- <li><a rel="nofollow" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
- <li><a rel="nofollow" class="external free" href="http://[1080::8:800:200C:417A]/foo">http://[1080::8:800:200C:417A]/foo</a></li>
- <li><a rel="nofollow" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
- <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>
- <li><a rel="nofollow" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
- !! html/parsoid
- <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>
- <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
- <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>
- <li><a rel="mw:ExtLink" class="external free" href="http://[FF01::101]/multicast">http://[FF01::101]/multicast</a></li>
- <li><a rel="mw:ExtLink" class="external free" href="http://[::1]/loopback">http://[::1]/loopback</a></li>
- <li><a rel="mw:ExtLink" class="external free" href="http://[::]/unspecified">http://[::]/unspecified</a></li>
- <li><a rel="mw:ExtLink" class="external free" href="http://[::13.1.68.3]/ipv4compat">http://[::13.1.68.3]/ipv4compat</a></li>
- <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>
- <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
- <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>
- <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>
- <li><a rel="mw:ExtLink" class="external free" href="http://[3ffe:2a00:100:7031::1]">http://[3ffe:2a00:100:7031::1]</a></li>
- <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>
- <li><a rel="mw:ExtLink" class="external free" href="http://[::192.9.5.5]/ipng">http://[::192.9.5.5]/ipng</a></li>
- <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>
- <li><a rel="mw:ExtLink" class="external free" href="http://[2010:836B:4179::836B:4179]">http://[2010:836B:4179::836B:4179]</a></li></ul>
- !! end
- !! test
- IPv6 urls, bracketed format (T23261)
- !! wikitext
- [http://[2404:130:0:1000::187:2]/index.php test]
- Examples from RFC 2373, section 2.2:
- *[http://[1080::8:800:200C:417A] unicast]
- *[http://[FF01::101] multicast]
- *[http://[::1]/ loopback]
- *[http://[::] unspecified]
- *[http://[::13.1.68.3] ipv4compat]
- *[http://[::FFFF:129.144.52.38] ipv4compat]
- Examples from RFC 2732, section 2:
- *[http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html 1]
- *[http://[1080:0:0:0:8:800:200C:417A]/index.html 2]
- *[http://[3ffe:2a00:100:7031::1] 3]
- *[http://[1080::8:800:200C:417A]/foo 4]
- *[http://[::192.9.5.5]/ipng 5]
- *[http://[::FFFF:129.144.52.38]:80/index.html 6]
- *[http://[2010:836B:4179::836B:4179] 7]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a>
- </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:
- </p>
- <ul><li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
- <li><a rel="nofollow" class="external text" href="http://[FF01::101]">multicast</a></li>
- <li><a rel="nofollow" class="external text" href="http://[::1]/">loopback</a></li>
- <li><a rel="nofollow" class="external text" href="http://[::]">unspecified</a></li>
- <li><a rel="nofollow" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
- <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
- <p>Examples from <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc2732">RFC 2732</a>, section 2:
- </p>
- <ul><li><a rel="nofollow" class="external text" href="http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html">1</a></li>
- <li><a rel="nofollow" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
- <li><a rel="nofollow" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
- <li><a rel="nofollow" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
- <li><a rel="nofollow" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
- <li><a rel="nofollow" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
- <li><a rel="nofollow" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://[2404:130:0:1000::187:2]/index.php">test</a></p>
- <p>Examples from <a href="https://tools.ietf.org/html/rfc2373" rel="mw:ExtLink" class="external text">RFC 2373</a>, section 2.2:</p>
- <ul><li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]">unicast</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[FF01::101]">multicast</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[::1]/">loopback</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[::]">unspecified</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[::13.1.68.3]">ipv4compat</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]">ipv4compat</a></li></ul>
- <p>Examples from <a href="https://tools.ietf.org/html/rfc2732" rel="mw:ExtLink" class="external text">RFC 2732</a>, section 2:</p>
- <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>
- <li><a rel="mw:ExtLink" class="external text" href="http://[1080:0:0:0:8:800:200C:417A]/index.html">2</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[3ffe:2a00:100:7031::1]">3</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[1080::8:800:200C:417A]/foo">4</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[::192.9.5.5]/ipng">5</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[::FFFF:129.144.52.38]:80/index.html">6</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://[2010:836B:4179::836B:4179]">7</a></li></ul>
- !! end
- !! test
- Non-extlinks in brackets
- !! wikitext
- [foo]
- [foo bar]
- [foo ''bar'']
- [fool's] errand
- [fool's errand]
- [{{echo|foo}}]
- [{{echo|foo}} bar]
- [{{echo|foo}} ''bar'']
- [{{echo|foo}}l's] errand
- [{{echo|foo}}l's errand]
- [url={{echo|foo}}]
- [url=http://example.com]
- [http:// bare protocols don't count]
- !! html/php
- <p>[foo]
- [foo bar]
- [foo <i>bar</i>]
- [fool's] errand
- [fool's errand]
- [foo]
- [foo bar]
- [foo <i>bar</i>]
- [fool's] errand
- [fool's errand]
- [url=foo]
- [url=<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>]
- [http:// bare protocols don't count]
- </p>
- !! html/parsoid
- <p>[foo]
- [foo bar]
- [foo <i>bar</i>]
- [fool's] errand
- [fool's errand]
- [<span about="#mwt19" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}}]}'>foo</span>]
- [<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]
- [<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>]
- [<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
- [<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]
- [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>]
- [url=<a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>]
- [http:// bare protocols don't count]</p>
- !! end
- !! test
- Percent encoding in external links
- !! wikitext
- [https://github.com/search?l=&q=ResourceLoader+%40wikimedia Search]
- !! html/php
- <p><a rel="nofollow" class="external text" href="https://github.com/search?l=&q=ResourceLoader+%40wikimedia">Search</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="https://github.com/search?l=&q=ResourceLoader+%40wikimedia">Search</a></p>
- !! end
- !! test
- Use url link syntax for links where the content is equal the link target
- !! wikitext
- http://example.com
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a></p>
- !! end
- !! test
- Parenthesis in external links, especially URL links
- !! wikitext
- http://example.com)
- http://example.com/test)
- http://example.com/(test)
- http://example.com/((test)
- (http://example.com/(test))
- (http://example.com/(test)))))
- http://example.com/a)b
- [http://example.com) foo]
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
- </p><p><a rel="nofollow" class="external free" href="http://example.com/test">http://example.com/test</a>)
- </p><p><a rel="nofollow" class="external free" href="http://example.com/(test)">http://example.com/(test)</a>
- </p><p><a rel="nofollow" class="external free" href="http://example.com/((test)">http://example.com/((test)</a>
- </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test))">http://example.com/(test))</a>
- </p><p>(<a rel="nofollow" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a>
- </p><p><a rel="nofollow" class="external free" href="http://example.com/a)b">http://example.com/a)b</a>
- </p><p><a rel="nofollow" class="external text" href="http://example.com)">foo</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com">http://example.com</a>)</p>
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/test">http://example.com/test</a>)</p>
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/(test)">http://example.com/(test)</a></p>
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/((test)">http://example.com/((test)</a></p>
- <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test))">http://example.com/(test))</a></p>
- <p>(<a rel="mw:ExtLink" class="external free" href="http://example.com/(test)))))">http://example.com/(test)))))</a></p>
- <p><a rel="mw:ExtLink" class="external free" href="http://example.com/a)b">http://example.com/a)b</a></p>
- <p><a rel="mw:ExtLink" class="external text" href="http://example.com)">foo</a></p>
- !! end
- !! test
- Parenthesis in external links, w/ transclusion or comment
- !! wikitext
- (http://example.com/{{echo|hi}})
- (http://example.com<!-- hi -->)
- !! html/php
- <p>(<a rel="nofollow" class="external free" href="http://example.com/hi">http://example.com/hi</a>)
- </p><p>(<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
- </p>
- !! html/parsoid
- <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/<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[20,31,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}'>hi</span>"}]]}'>http://example.com/hi</a>)</p>
- <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<!-- hi -->"}}'>http://example.com</a>)</p>
- !! end
- !! test
- Serialize <a> tags with invalid link targets as plain text
- !! options
- parsoid={ "modes": ["html2wt"], "suppressErrors": true }
- !! html/parsoid
- <a rel="mw:WikiLink" href="[[foo]]">text</a>
- <a rel="mw:WikiLink" href="[[foo]]">*text</a>
- <a rel="mw:WikiLink" href="[[foo]]">[[foo]]</a>
- <a rel="mw:WikiLink" href="[[foo]]">*a [[foo]]</a>
- !! wikitext
- text
- <nowiki>*</nowiki>text
- <nowiki>[[foo]]</nowiki>
- <nowiki>*</nowiki>a <nowiki>[[foo]]</nowiki>
- !! end
- !! test
- mw:ExtLink -vs- mw:WikiLink (T94723)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"piped","a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>Bar</a>
- <a rel="mw:WikiLink" href="./Foo" title="Foo">Bar</a>
- <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
- <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/Foo" title="Foo">Bar</a>
- <p>
- <a rel="mw:ExtLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
- <a rel="mw:WikiLink" href="http://en.wikipedia.org/wiki/European_Robin">European Robin</a>
- </p>
- !! wikitext
- [[Foo|Bar]]
- [[Foo|Bar]]
- [[:en:Foo|Bar]]
- [[:en:Foo|Bar]]
- [[:en:European_Robin|European Robin]]
- [[:en:European_Robin|European Robin]]
- !! end
- !! test
- mw:ExtLink linking to a interwiki URL can be round-tripped losslessly (T94723)
- !! options
- parsoid=wt2wt
- !! wikitext
- [http://en.wikipedia.org/wiki/European_Robin European Robin]
- !! html/parsoid
- THIS SECTION IS NOT USED (but Parsoid won't run the test without it)
- !! end
- ###
- ### Quotes
- ###
- !! test
- Quotes
- !! wikitext
- Normal text. '''Bold text.''' Normal text. ''Italic text.''
- Normal text. '''''Bold italic text.''''' Normal text.
- !! html
- <p>Normal text. <b>Bold text.</b> Normal text. <i>Italic text.</i>
- </p><p>Normal text. <i><b>Bold italic text.</b></i> Normal text.
- </p>
- !! end
- # Parsoid inserts an empty bold tag pair at the end of the line, that the PHP
- # parser strips. The wikitext contains just the first half of the bold
- # quote pair.
- !! test
- Unclosed and unmatched quotes
- !! wikitext
- '''''Bold italic text '''with bold deactivated''' in between.'''''
- '''''Bold italic text ''with italic deactivated'' in between.'''''
- '''Bold text..
- ..spanning two paragraphs (should not work).'''
- '''Bold tag left open
- ''Italic tag left open
- Normal text.
- <!-- Unmatching number of opening, closing tags: -->
- '''This year''''s election ''should'' beat '''last year''''s.
- ''Tom'''s car is bigger than ''Susan'''s.
- Plain ''italic'''s plain
- !! html/php
- <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
- </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
- </p><p><b>Bold text..</b>
- </p><p>..spanning two paragraphs (should not work).
- </p><p><b>Bold tag left open</b>
- </p><p><i>Italic tag left open</i>
- </p><p>Normal text.
- </p><p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
- </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
- </p><p>Plain <i>italic'</i>s plain
- </p>
- !! html/parsoid
- <p><i><b>Bold italic text </b>with bold deactivated<b> in between.</b></i>
- </p><p><b><i>Bold italic text </i>with italic deactivated<i> in between.</i></b>
- </p><p><b>Bold text..</b>
- </p><p>..spanning two paragraphs (should not work).<b></b>
- </p><p><b>Bold tag left open</b>
- </p><p><i>Italic tag left open</i>
- </p><p>Normal text.
- </p>
- <!-- Unmatching number of opening, closing tags: -->
- <p><b>This year'</b>s election <i>should</i> beat <b>last year'</b>s.
- </p><p><i>Tom<b>s car is bigger than </b></i><b>Susan</b>s.
- </p><p>Plain <i>italic'</i>s plain
- </p>
- !! end
- ###
- ### Tables
- ###
- ### some content taken from http://meta.wikimedia.org/wiki/MediaWiki_User%27s_Guide:_Using_tables
- ###
- # This should not produce <table></table> as <table><tr><td></td></tr></table>
- # is the bare minimum required by the spec, see:
- # https://www.w3.org/TR/xhtml-modularization/dtd_module_defs.html#a_module_Basic_Tables
- # Parsoid team replies: empty table tags are legal in HTML5
- !! test
- A table with no data.
- !! options
- parsoid=wt2html
- !! wikitext
- {||}
- !! html/php
- !! html/parsoid
- <table></table>
- !! end
- !! test
- A table with stray table end tags on start tag line (wt2html)
- !! options
- parsoid=wt2html
- !! wikitext
- {|style="color: red;"|}
- {|style="color: red;" |}
- |foo
- |}
- {|style="color: red;"|} id="foo"
- |foo
- |}
- {|style="color: red;" |} id="foo"
- |foo
- |}
- !! html
- <table style="color: red;"></table>
- <table style="color: red;">
- <tbody><tr>
- <td>foo</td>
- </tr></tbody>
- </table>
- <table style="color: red;" id="foo">
- <tbody><tr>
- <td>foo</td>
- </tr></tbody>
- </table>
- <table style="color: red;" id="foo">
- <tbody><tr>
- <td>foo</td>
- </tr></tbody>
- </table>
- !! end
- !! test
- A table with no data (take 2)
- !! wikitext
- {|
- |}
- !! html/parsoid
- <table></table>
- !! end
- # A table with nothing but a caption is invalid XHTML, we might want to render
- # this as <p>caption</p>
- # Parsoid team replies: table with only a caption is legal in HTML5
- !! test
- A table with nothing but a caption
- !! wikitext
- {|
- |+caption
- |}
- !! html/php
- <table>
- <caption>caption
- </caption><tr><td></td></tr></table>
- !! html/parsoid
- <table><caption>caption</caption></table>
- !! end
- !! test
- A table with caption with default-spaced attributes and a table row
- !! wikitext
- {|
- |+ style="color: red;" | caption1
- |-
- |foo
- |}
- !! html
- <table>
- <caption style="color: red;">caption1
- </caption>
- <tr>
- <td>foo
- </td></tr></table>
- !! end
- !! test
- A table with captions with non-default spaced attributes and a table row
- !! wikitext
- {|
- |+style="color: red;"|caption2
- |+ style="color: red;"|caption3
- |-
- |foo
- |}
- !! html
- <table>
- <caption style="color: red;">caption2
- </caption>
- <caption style="color: red;">caption3
- </caption>
- <tr>
- <td>foo
- </td></tr></table>
- !! end
- !! test
- Table td-cell syntax variations
- !! wikitext
- {|
- |foo bar foo|baz
- |foo bar foo||baz
- |style='color:red;'|baz
- |style='color:red;'||baz
- |}
- !! html
- <table>
- <tr>
- <td>baz
- </td>
- <td>foo bar foo</td>
- <td>baz
- </td>
- <td style="color:red;">baz
- </td>
- <td>style='color:red;'</td>
- <td>baz
- </td></tr></table>
- !! end
- !! test
- Simple table
- !! wikitext
- {|
- |1||2
- |-
- |3||4
- |}
- !! html
- <table>
- <tr>
- <td>1</td>
- <td>2
- </td></tr>
- <tr>
- <td>3</td>
- <td>4
- </td></tr></table>
- !! end
- !! test
- Simple table but with multiple dashes for row wikitext
- !! wikitext
- {|
- |foo
- |-----
- |bar
- |}
- !! html
- <table>
- <tr>
- <td>foo
- </td></tr>
- <tr>
- <td>bar
- </td></tr></table>
- !! end
- !! test
- Multiplication table
- !! wikitext
- {| border="1" cellpadding="2"
- |+Multiplication table
- |-
- !×!!1!!2!!3
- |-
- !1
- |1||2||3
- |-
- !2
- |2||4||6
- |-
- !3
- |3||6||9
- |-
- !4
- |4||8||12
- |-
- !5
- |5||10||15
- |}
- !! html
- <table border="1" cellpadding="2">
- <caption>Multiplication table
- </caption>
- <tr>
- <th>×</th>
- <th>1</th>
- <th>2</th>
- <th>3
- </th></tr>
- <tr>
- <th>1
- </th>
- <td>1</td>
- <td>2</td>
- <td>3
- </td></tr>
- <tr>
- <th>2
- </th>
- <td>2</td>
- <td>4</td>
- <td>6
- </td></tr>
- <tr>
- <th>3
- </th>
- <td>3</td>
- <td>6</td>
- <td>9
- </td></tr>
- <tr>
- <th>4
- </th>
- <td>4</td>
- <td>8</td>
- <td>12
- </td></tr>
- <tr>
- <th>5
- </th>
- <td>5</td>
- <td>10</td>
- <td>15
- </td></tr></table>
- !! end
- !! test
- Accept "||" in table headings
- !! wikitext
- {|
- !h1||h2
- |}
- !! html
- <table>
- <tr>
- <th>h1</th>
- <th>h2
- </th></tr></table>
- !! end
- !! test
- Accept "!!" in table data
- !! wikitext
- {|
- |Foo!!||
- |}
- !! html
- <table>
- <tr>
- <td>Foo!!</td>
- <td>
- </td></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'> Foo!! </td><td data-parsoid='{"stx":"row","autoInsertedEnd":true}'></td></tr>
- </tbody></table>
- !! end
- !! test
- Accept "||" in indented table headings
- !! wikitext
- :{|
- !h1||h2
- |}
- !! html
- <dl><dd><table>
- <tr>
- <th>h1</th>
- <th>h2
- </th></tr></table></dd></dl>
- !! end
- !! test
- Accept "!!" in templates
- !! wikitext
- {|
- !a {{echo|b!!c}}
- |}
- !! html/php
- <table>
- <tr>
- <th>a b</th>
- <th>c
- </th></tr></table>
- !! html/parsoid
- <table>
- <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>
- !! end
- !! test
- Accept "!!" in table headings after newline
- !! wikitext
- {|
- !a
- b!!c
- |}
- !! html/php
- <table>
- <tr>
- <th>a
- <p>b!!c
- </p>
- </th></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr><th>a
- <p>b!!c</p></th></tr>
- </tbody></table>
- !! end
- !! test
- Accept "!!" in table data of mixed wikitext / html syntax
- !! wikitext
- {|
- !a
- <tr><td>b!!c</td></tr>
- |}
- !! html/php+tidy
- <table>
- <tbody><tr>
- <th>a
- </th></tr><tr><td>b!!c</td></tr>
- </tbody></table>
- !! html/parsoid
- <table>
- <tbody><tr><th>a</th></tr>
- <tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>b!!c</td></tr>
- </tbody></table>
- !! end
- !! test
- Accept empty attributes in td/th cells (td/th cells starting with leading ||)
- !! wikitext
- {|
- !| h1
- || a
- |}
- !! html
- <table>
- <tr>
- <th>h1
- </th>
- <td>a
- </td></tr></table>
- !! end
- !!test
- Accept "| !" at start of line in tables (ignore !-attribute)
- !! wikitext
- {|
- |-
- |!style="color:red"|bar
- |}
- !! html
- <table>
- <tr>
- <td>bar
- </td></tr></table>
- !!end
- !!test
- 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 +/-
- !! wikitext
- {|
- |-
- |style='color:red;'|+1
- |style='color:blue;'|-1
- |-
- |1||2||3
- |1||+2||-3
- |-
- | +1
- | -1
- |}
- !! html
- <table>
- <tr>
- <td style="color:red;">+1
- </td>
- <td style="color:blue;">-1
- </td></tr>
- <tr>
- <td>1</td>
- <td>2</td>
- <td>3
- </td>
- <td>1</td>
- <td>+2</td>
- <td>-3
- </td></tr>
- <tr>
- <td>+1
- </td>
- <td>-1
- </td></tr></table>
- !!end
- !! test
- Table rowspan
- !! wikitext
- {| border=1
- |Cell 1, row 1
- |rowspan=2|Cell 2, row 1 (and 2)
- |Cell 3, row 1
- |-
- |Cell 1, row 2
- |Cell 3, row 2
- |}
- !! html
- <table border="1">
- <tr>
- <td>Cell 1, row 1
- </td>
- <td rowspan="2">Cell 2, row 1 (and 2)
- </td>
- <td>Cell 3, row 1
- </td></tr>
- <tr>
- <td>Cell 1, row 2
- </td>
- <td>Cell 3, row 2
- </td></tr></table>
- !! end
- !! test
- Nested table
- !! wikitext
- {| border=1
- | α
- |
- {| bgcolor=#ABCDEF border=2
- |nested
- |-
- |table
- |}
- |the original table again
- |}
- !! html
- <table border="1">
- <tr>
- <td>α
- </td>
- <td>
- <table bgcolor="#ABCDEF" border="2">
- <tr>
- <td>nested
- </td></tr>
- <tr>
- <td>table
- </td></tr></table>
- </td>
- <td>the original table again
- </td></tr></table>
- !! end
- !! test
- Invalid attributes in table cell (T3830)
- !! wikitext
- {|
- |Cell:|broken
- |}
- !! html
- <table>
- <tr>
- <td>broken
- </td></tr></table>
- !! end
- !! test
- Table cell attributes: Pipes protected by nowikis should be treated as a plain character
- !! wikitext
- {|
- | title="foo" |bar
- | title="foo<nowiki>|</nowiki>" |bar
- | title="foo<nowiki>|</nowiki>" bar
- |}
- !! html/php
- <table>
- <tr>
- <td title="foo">bar
- </td>
- <td title="foo|">bar
- </td>
- <td>title="foo|" bar
- </td></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr><td title="foo">bar</td>
- <td title="foo|" data-parsoid='{"a":{"title":"foo|"},"sa":{"title":"foo<nowiki>|</nowiki>"},"autoInsertedEnd":true}'>bar</td>
- <td> title="foo<span typeof="mw:Nowiki">|</span>" bar</td></tr>
- </tbody></table>
- !! end
- # See: http://lists.wikimedia.org/mailman/htdig/wikitech-l/2006-April/022293.html
- # N.B. The "|}" to close the table is missing from the input, so parsoid's
- # *2wt modes will fail.
- !! test
- Table security: embedded pipes
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- | |[ftp://|x||]" onmouseover="alert(document.cookie)">test
- !! html/php
- <table>
- <tr>
- <td>[<a rel="nofollow" class="external free" href="ftp://%7Cx">ftp://%7Cx</a></td>
- <td>]" onmouseover="alert(document.cookie)">test
- </td>
- </tr>
- </table>
- !! html/parsoid
- <table><tbody>
- <tr>
- <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>
- !! end
- !! test
- Element attributes with double ! should not be broken up by <th>
- !! wikitext
- {|
- !hi <div class="!!">ha</div> ho
- |}
- !! html/php
- <table>
- <tr>
- <th>hi <div class="!!">ha</div> ho
- </th></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr><th>hi <div class="!!" data-parsoid='{"stx":"html"}'>ha</div> ho</th></tr>
- </tbody></table>
- !! end
- !! test
- ! and || in element attributes should not be parsed as <th>/<td>
- !! wikitext
- {|
- |<div style="color: red !important;" data-contrived="put this here ||">hi</div>
- |}
- !! html/php
- <table>
- <tr>
- <td><div style="color: red !important;" data-contrived="put this here ||">hi</div>
- </td></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr><td><div style="color: red !important;" data-contrived="put this here ||" data-parsoid='{"stx":"html"}'>hi</div></td></tr>
- </tbody></table>
- !! end
- # FIXME: The output seems broken. Filed as T110268.
- !! test
- ! and || in td attributes should not be parsed as <th>/<td>
- !! options
- parsoid=wt2html
- !! wikitext
- {|
- |style="color: red !important;" data-contrived="put this here ||"|foo
- |}
- !! html/php
- <table>
- <tr>
- <td>style="color: red !important;" data-contrived="put this here</td>
- <td>foo
- </td></tr></table>
- !! html/parsoid
- <table>
- <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>
- </tbody></table>
- !! end
- !! test
- Break on | in element attribute in template
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {{echo|1=<div class="hi|ho">ha</div>}}
- !! html/php
- <p>ho">ha</div>
- </p>
- !! html/parsoid
- <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"ho\">ha</div>"}},"i":0}}]}'>ho">ha</span>
- !! end
- !! test
- Break on | in element attribute name in template
- !! wikitext
- {{echo|<div cla|ss="hiho">ha</div>}}
- !! html/parsoid
- <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":"<div cla"},"ss":{"wt":"\"hiho\">ha</div>"}},"i":0}}]}'><div cla</p>
- !! end
- !! test
- Don't break on | in extension attribute in template
- !! wikitext
- {{echo|<ref name="hi|ho">ha</ref>}}
- <references />
- !! html/parsoid
- <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":"<ref name=\"hi|ho\">ha</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>
- <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>
- !! end
- ## We don't support roundtripping of these attributes in Parsoid.
- ## Selective serialization takes care of preventing dirty diffs.
- ## But, on edits, we dirty-diff the invalid attribute text.
- !! test
- Invalid text in table attributes should be discarded
- !! options
- parsoid=wt2html
- !! wikitext
- {| <span>boo</span> style='border:1px solid black'
- | <span>boo</span> style='color:blue' |1
- |<span>boo</span> style='color:blue'|2
- |}
- !! html/php
- <table style="border:1px solid black">
- <tr>
- <td style="color:blue">1
- </td>
- <td style="color:blue">2
- </td></tr></table>
- !! html/parsoid
- <table style="border:1px solid black">
- <tr>
- <td style="color:blue">1</td>
- <td style="color:blue">2</td>
- </tr>
- </table>
- !! end
- !! test
- Invalid text in table attributes should be preserved by selective serializer
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- ["td:first-child", "text", "abc"],
- ["td + td", "text", "xyz"]
- ]
- }
- !! wikitext
- {| <span>boo</span> style='border:1px solid black'
- | <span>boo</span> style='color:blue' | 1
- |<span>boo</span> style='color:blue'| 2
- |}
- !! wikitext/edited
- {| <span>boo</span> style='border:1px solid black'
- | <span>boo</span> style='color:blue' |abc
- |<span>boo</span> style='color:blue'|xyz
- |}
- !! end
- !! test
- 1. Template-generated table cell attributes and cell content
- !! wikitext
- {|
- |{{table_attribs}}
- | {{table_attribs}}
- || {{table_attribs_5}}
- | <!--foo--> <!--bar--> <!--baz--> {{table_attribs}}
- |align=center {{table_attribs}}
- | <!--foo--> align=center <!--bar--> {{table_attribs}}
- |}
- !! html
- <table>
- <tr>
- <td style="color:red;">Foo
- </td>
- <td style="color:red;">Foo
- </td>
- <td>style="color:red;"</td>
- <td>Bar
- </td>
- <td style="color:red;">Foo
- </td>
- <td align="center" style="color:red;">Foo
- </td>
- <td align="center" style="color:red;">Foo
- </td></tr></table>
- !! end
- !! test
- 2. Template-generated table cell attributes and cell content
- !! wikitext
- {|
- |{{table_attribs_2}}
- |}
- !! html/php
- <table>
- <tr>
- <td style="color:red;">Foo
- </td>
- <td>Bar</td>
- <td>Baz
- </td></tr></table>
- !! html/parsoid
- <table>
- <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>
- <td about="#mwt1">Bar</td><td about="#mwt1">Baz</td></tr>
- </tbody></table>
- !! end
- !! test
- 3. Template-generated table cell attributes and cell content
- !! wikitext
- {|
- !align=center {{table_header_cells}}
- |-
- |align=center {{table_cells}}
- |}
- !! html/php
- <table>
- <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>
- <tr>
- <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></table>
- !! html/parsoid
- <table>
- <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>
- <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>
- </tbody></table>
- !! end
- !! test
- 4. Template-generated table cell attributes and cell content inside a templated table
- !! wikitext
- {{tbl-start}}
- !align=center {{table_header_cells}}
- |-
- |align=center {{table_cells}}
- {{tbl-end}}
- !! html/php
- <table>
- <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>
- <tr>
- <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></table>
- !! html/parsoid
- <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}}]}'>
- <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>
- <tr>
- <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>
- </tbody></table>
- !! end
- ## Edge case fix to prevent future regressions
- !! test
- T107652: <ref>s in templates that also generate table cell attributes should be rendered properly
- !! wikitext
- {|
- |{{table_attribs_7}}
- |}
- <references />
- !! html/parsoid
- <table>
- <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>
- </tbody></table>
- <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>
- !! end
- !! test
- Table with row followed by newlines and table heading
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- |-
- !foo
- |}
- !! html/*
- <table>
- <tr>
- <th>foo
- </th></tr></table>
- !! end
- !! test
- Table with empty line following the start tag
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- |-
- |foo
- |}
- !! html/*
- <table>
- <tr>
- <td>foo
- </td></tr></table>
- !! end
- !! test
- Table attributes with empty value
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- | style=|hello
- |}
- !! html/php
- <table>
- <tr>
- <td style="">hello
- </td></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr><td style="">hello</td></tr>
- </tbody></table>
- !! end
- !! test
- Wikitext table with a lot of comments
- !! wikitext
- {|
- <!-- c0 -->
- |foo
- <!-- c1 -->
- |-<!-- c2 -->
- <!-- c3 -->
- |<!-- c4 -->
- <!-- c5 -->
- |}
- !! html
- <table>
- <tr>
- <td>foo
- </td></tr>
- <tr>
- <td>
- </td></tr></table>
- !! end
- !! test
- Wikitext table comments represented in parsoid dom
- !! wikitext
- {|<!--c1--><!--c2-->
- |-<!--c3-->
- |x
- |}
- !! html/php+tidy
- <table>
- <tbody><tr>
- <td>x
- </td></tr></tbody></table>
- !! html/parsoid
- <table><!--c1--><!--c2-->
- <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'><!--c3-->
- <td data-parsoid='{"autoInsertedEnd":true}'>x</td></tr>
- </tbody></table>
- !! end
- !! test
- Wikitext table with double-line table cell
- !! wikitext
- {|
- |a
- b
- |}
- !! html
- <table>
- <tr>
- <td>a
- <p>b
- </p>
- </td></tr></table>
- !! end
- !! test
- Table cell with a single comment
- !! wikitext
- {|
- | <!-- c1 -->
- |a
- |}
- !! html
- <table>
- <tr>
- <td>
- </td>
- <td>a
- </td></tr></table>
- !! end
- !! test
- Table-cell after a comment-only-empty-line
- !! wikitext
- {|
- |a
- <!--c1-->
- <!--c2-->|b
- |}
- !! html
- <table>
- <tr>
- <td>a
- </td>
- <td>b
- </td></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>a</td>
- <!--c1-->
- <!--c2--><td data-parsoid='{"autoInsertedEnd":true}'>b</td></tr>
- </tbody></table>
- !! end
- !! test
- Build table with {{!}}
- !! wikitext
- {{{!}} class="wikitable"
- !header
- !second header
- {{!}}- style="color:red;"
- {{!}}data{{!}}{{!}} style="color:red;" {{!}}second data
- {{!}}}
- !! html
- <table class="wikitable">
- <tr>
- <th>header
- </th>
- <th>second header
- </th></tr>
- <tr style="color:red;">
- <td>data</td>
- <td style="color:red;">second data
- </td></tr></table>
- !! end
- !! test
- Build table with pipe as data
- !! wikitext
- {| class="wikitable"
- !header
- !second header
- |- style="color:red;"
- |data|| style="color:red;" |second data
- |-
- | style="color:red;" |data with | || style="color:red;" | second data with |
- |-
- ||data with | |||second data with |
- |}
- !! html
- <table class="wikitable">
- <tr>
- <th>header
- </th>
- <th>second header
- </th></tr>
- <tr style="color:red;">
- <td>data</td>
- <td style="color:red;">second data
- </td></tr>
- <tr>
- <td style="color:red;">data with |</td>
- <td style="color:red;">second data with |
- </td></tr>
- <tr>
- <td>data with |</td>
- <td>second data with |
- </td></tr></table>
- !! end
- !! test
- Build table with wikilink
- !! wikitext
- {| class="wikitable"
- !header||second header
- |- style="color:red;"
- |data [[Main Page|linktext]]||second data [[Main Page|linktext]]
- |-
- |data||second data [[Main Page|link|text with pipe]]
- |}
- !! html
- <table class="wikitable">
- <tr>
- <th>header</th>
- <th>second header
- </th></tr>
- <tr style="color:red;">
- <td>data <a href="/wiki/Main_Page" title="Main Page">linktext</a></td>
- <td>second data <a href="/wiki/Main_Page" title="Main Page">linktext</a>
- </td></tr>
- <tr>
- <td>data</td>
- <td>second data <a href="/wiki/Main_Page" title="Main Page">link|text with pipe</a>
- </td></tr></table>
- !! end
- # The expected HTML structure in this test is debatable. The PHP parser does
- # not parse this kind of table at all. The main focus for Parsoid is on
- # round-tripping, so this output is ok for now. TODO: revisit!
- !! test
- Wikitext table with html-syntax row
- !! wikitext
- {|
- |-
- <td>foo</td>
- |}
- !! html/parsoid
- <table>
- <tbody>
- <tr>
- <td>foo</td></tr></tbody></table>
- !! end
- !! test
- Fostered content in tables: Plain text
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- |-
- a
- |}
- !! html/php
- <table>
- a
- </table>
- !! html/php+tidy
- a
- <table></table>
- !! html/parsoid
- <p data-parsoid='{"fostered":true,"autoInsertedEnd":true}'>a</p><table>
- <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
- </tr></tbody></table>
- !! end
- !! test
- Fostered content in tables: Lists
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- |-
- *a
- |}
- !! html/php
- <table>
- <ul><li>a</li></ul>
- </table>
- !! html/php+tidy
- <ul><li>a</li></ul><table>
- </table>
- !! html/parsoid
- <ul data-parsoid='{"fostered":true,"autoInsertedEnd":true}'><li>a</li></ul><table>
- <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
- </tr></tbody></table>
- !! end
- !! test
- Template generated table cell with attributes
- !! wikitext
- {|
- |-
- {{table_attribs_4}} ||a||b
- |}
- !! html/php+tidy
- <table>
- <tbody><tr>
- <td style="background-color:#DC241f;" width="10px"></td>
- <td>a</td>
- <td>b
- </td></tr></tbody></table>
- !! html/parsoid
- <table>
- <tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
- <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>
- !! end
- !! test
- Parsoid: Round-trip tables directly followed by content (T53219)
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- {|
- |foo
- |} bar
- {|
- |baz
- |}<b>quux</b>
- !! html+tidy
- <table>
- <tbody><tr>
- <td>foo
- </td></tr></tbody></table><p> bar
- </p><table>
- <tbody><tr>
- <td>baz
- </td></tr></tbody></table><p><b>quux</b>
- </p>
- !! end
- !! test
- Parsoid: Default to a newline after tables in new content (T53219)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><tbody>
- <tr><td>foo</td></tr></tbody></table> bar
- <table><tbody>
- <tr><td>baz</td></tr></tbody></table><b>quux</b>
- !! wikitext
- {|
- |foo
- |}
- <nowiki> </nowiki>bar
- {|
- |baz
- |}
- '''quux'''
- !! end
- !! test
- Parsoid: newline inducing block nodes don't suppress <nowiki>
- !! options
- parsoid=html2wt
- !! html/parsoid
- a<h1>foo</h1>
- !! wikitext
- <nowiki> </nowiki>a
- = foo =
- !! end
- !! test
- Parsoid: Row-syntax table headings followed by comment & table cells
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- {|
- !foo||bar
- <!-- foo --> ||baz||quux
- |}
- !! html/php
- <table>
- <tr>
- <th>foo</th>
- <th>bar
- </th>
- <td>baz</td>
- <td>quux
- </td></tr></table>
- !! html/parsoid
- <table>
- <tbody><tr><th> foo </th><th> bar
- <!-- foo --> </th><td> baz </td><td> quux</td></tr>
- </tbody></table>
- !! end
- !!test
- Parsoid: Recover better from broken table attributes
- !!options
- parsoid=wt2html
- !!wikitext
- {| class="foo
- | class="bar" |
- foo
- |}
- !!html/php+tidy
- <table class="foo">
- <tbody><tr>
- <td class="bar">
- <p>foo
- </p>
- </td></tr></tbody></table>
- !!html/parsoid
- <table class="foo">
- <tr>
- <td class="bar">
- <p>foo</p></td></tr>
- </tbody></table>
- !!end
- !! test
- Tables: Digest broken attributes on table and tr tag
- !! options
- parsoid=wt2html
- !! wikitext
- {| || |} ++
- |- || || ++ --
- |- > [
- |}
- !! html
- <table>
- <tbody>
- <tr class='mw-empty-elt'></tr>
- <tr class='mw-empty-elt'></tr>
- </tbody></table>
- !! end
- # T137406: Whitespace in the HTML
- !! test
- 1. Generate correct wikitext for tables with thead/tbody/tfoot
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table>
- <caption>Test</caption>
- <thead>
- <tr>
- <th>Month</th>
- <th>Savings</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>January</td>
- <td>$100</td>
- </tr>
- <tr>
- <td>February</td>
- <td>$80</td>
- </tr>
- </tbody>
- <tfoot>
- <tr>
- <td>Sum</td>
- <td>$180</td>
- </tr>
- </tfoot>
- </table>
- !! wikitext
- {|
- |+Test
- !Month
- !Savings
- |-
- |January
- |$100
- |-
- |February
- |$80
- |-
- |Sum
- |$180
- |}
- !! html/php+tidy
- <table>
- <caption>Test
- </caption>
- <tbody><tr>
- <th>Month
- </th>
- <th>Savings
- </th></tr>
- <tr>
- <td>January
- </td>
- <td>$100
- </td></tr>
- <tr>
- <td>February
- </td>
- <td>$80
- </td></tr>
- <tr>
- <td>Sum
- </td>
- <td>$180
- </td></tr></tbody></table>
- !! end
- # T137406: No whitespace in the HTML
- !! test
- 2. Generate correct wikitext for tables with thead/tbody/tfoot
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><thead><tr><th>heading</th></tr></thead><tbody><tr><td>foo</td></tr></tbody></table>
- !! wikitext
- {|
- !heading
- |-
- |foo
- |}
- !! end
- !! test
- Testing serialization after deletion in references
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["#x", "remove"]
- ]
- }
- !! wikitext
- hi <ref><div id="x">ho</div></ref>
- <references />
- !! wikitext/edited
- hi <ref></ref>
- <references />
- !! end
- !!test
- Testing serialization after deletion of table cells
- !!options
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- ["#x", "remove"]
- ]
- }
- !!wikitext
- {|
- !h1 !!h2 !!h3
- | id="x" |c1 {{!}}{{!}}{{!}}c2 |||c3
- |}
- !! wikitext/edited
- {|
- !h1 !!h2 !!h3
- |c2 |||c3
- |}
- !!end
- !! test
- Testing selser after addition of new row before first row (T125419)
- !! options
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- [ "tr", "before", "<tr><td>X</td></tr>" ]
- ]
- }
- !! wikitext
- {|
- |a
- |}
- !! wikitext/edited
- {|
- |X
- |-
- |a
- |}
- !! end
- !! test
- Serialize new table rows in a HTML table using HTML tags
- !! options
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- [ "tr", "before", "<tr><td>X</td></tr>" ]
- ]
- }
- !! wikitext
- <table><tr><td>a</td></tr></table>
- !! wikitext/edited
- <table><tr><td>X</td></tr><tr><td>a</td></tr></table>
- !! end
- !! test
- Serialize new table cells in a HTML row using HTML tags
- !! options
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- [ "td", "before", "<td>X</td>" ]
- ]
- }
- !! wikitext
- <table><tr><td>a</td></tr></table>
- !! wikitext/edited
- <table><tr><td>X</td><td>a</td></tr></table>
- !! end
- !! test
- Wikitext tables can be nested inside HTML tables
- !! options
- parsoid=html2wt
- !! html
- <table data-parsoid='{"stx":"html"}'>
- <tr><td>
- <table>
- <tr><td>foo</td></tr>
- </table>
- </td></tr>
- </table>
- !! wikitext
- <table>
- <tr><td>
- {|
- |foo
- |}
- </td></tr>
- </table>
- !! end
- !! test
- Serialize wikitext list items as HTML list items when embedded in a HTML list
- !! options
- parsoid=html2wt
- !! html
- <ul data-parsoid='{"stx": "html"}'>
- <li data-parsoid='{}'>a</li>
- <li>b</li>
- </ul>
- !! wikitext
- <ul>
- <li>a</li>
- <li>b</li>
- </ul>
- !! end
- # SSS FIXME: Is this actually a good thing given the
- # odd nested list output that is generated by MW?
- # <ul><li>foo<ul>..</ul></li></ul> instead of
- # <ul><li>foo</li><ul>..</ul></ul>
- !! test
- Wikitext lists can be nested inside HTML lists
- !! options
- parsoid=html2wt
- !! html
- <ul data-parsoid='{"stx": "html"}'>
- <li data-parsoid='{"stx": "html"}'>a
- <ul><li>b</li></ul>
- </li>
- </ul>
- <ul data-parsoid='{"stx": "html"}'>
- <li>x
- <ul><li>y</li></ul>
- </li>
- </ul>
- !! wikitext
- <ul>
- <li>a
- * b
- </li>
- </ul>
- <ul>
- <li>x
- * y
- </li>
- </ul>
- !! end
- ###
- ### Internal links
- ###
- !! test
- Plain link, capitalized
- !! wikitext
- [[Main Page]]
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- </p>
- !! end
- !! test
- Plain link, uncapitalized
- !! wikitext
- [[main Page]]
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">main Page</a>
- </p>
- !! end
- !! test
- Piped link
- !! wikitext
- [[Main Page|The Main Page]]
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
- </p>
- !! end
- !! test
- Piped link with comment in link text
- !! wikitext
- [[Main Page|The Main<!--front--> Page]]
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">The Main Page</a>
- </p>
- !! end
- !! test
- Piped link with multiple pipe characters in link text
- !! wikitext
- [[Main Page||The|Main|Page|]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">|The|Main|Page|</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">|The|Main|Page|</a></p>
- !! end
- !! test
- Piped link with no link text
- !! wikitext
- [[Thomas Bek (bishop of St David's)|]]
- !! html/php
- <p>[[Thomas Bek (bishop of St David's)|]]
- </p>
- !! html/parsoid
- <p>[[Thomas Bek (bishop of St David's)|]]</p>
- !! end
- !! test
- Piped link with empty link text
- !! wikitext
- [[Main Page|<nowiki/>]] - empty nowiki
- [[Main Page| ]] - empty space
- [[Main Page| ]] - empty non breaking space
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page"></a> - empty nowiki
- <a href="/wiki/Main_Page" title="Main Page"> </a> - empty space
- <a href="/wiki/Main_Page" title="Main Page"> </a> - empty non breaking space
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Nowiki"></span></a> - empty nowiki
- <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"> </a> - empty space
- <a rel="mw:WikiLink" href="./Main_Page" title="Main Page"><span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span></a> - empty non breaking space</p>
- !! end
- !! test
- Broken link
- !! wikitext
- [[Zigzagzogzagzig]]
- !! html
- <p><a href="/index.php?title=Zigzagzogzagzig&action=edit&redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig</a>
- </p>
- !! end
- !! test
- Broken link with fragment
- !! wikitext
- [[Zigzagzogzagzig#zug]]
- !! html
- <p><a href="/index.php?title=Zigzagzogzagzig&action=edit&redlink=1" class="new" title="Zigzagzogzagzig (page does not exist)">Zigzagzogzagzig#zug</a>
- </p>
- !! end
- !! test
- Special page link with fragment
- !! wikitext
- [[Special:Version#anchor]]
- !! html
- <p><a href="/wiki/Special:Version#anchor" title="Special:Version">Special:Version#anchor</a>
- </p>
- !! end
- !! test
- Nonexistent special page link with fragment
- !! wikitext
- [[Special:ThisNameWillHopefullyNeverBeUsed#anchor]]
- !! html
- <p><a href="/wiki/Special:ThisNameWillHopefullyNeverBeUsed" class="new" title="Special:ThisNameWillHopefullyNeverBeUsed (page does not exist)">Special:ThisNameWillHopefullyNeverBeUsed#anchor</a>
- </p>
- !! end
- !! test
- Link with prefix
- !! wikitext
- xxx[[main Page]], xxx[[Main Page]], Xxx[[main Page]] XXX[[main Page]], XXX[[Main Page]]
- !! html
- <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>
- </p>
- !! end
- !! test
- Link with suffix
- !! wikitext
- [[Main Page]]xxx, [[Main Page]]XXX, [[Main Page]]!!!
- !! html
- <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>!!!
- </p>
- !! end
- !! article
- prefixed article
- !! text
- Some text
- !! endarticle
- !! test
- T45661: Piped links with identical prefixes
- !! wikitext
- [[prefixed article|prefixed articles with spaces]]
- [[prefixed article|prefixed articlesaoeu]]
- [[Main Page|Main Page test]]
- !! html
- <p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articles with spaces</a>
- </p><p><a href="/wiki/Prefixed_article" title="Prefixed article">prefixed articlesaoeu</a>
- </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page test</a>
- </p>
- !! end
- !! test
- Link with HTML entity in suffix / tail
- !! wikitext
- [[Main Page]]", [[Main Page]]a
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>", <a href="/wiki/Main_Page" title="Main Page">Main Page</a>a
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&quot;","srcContent":"\""}'>"</span>, <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a><span typeof="mw:Entity" data-parsoid='{"src":"&#97;","srcContent":"a"}'>a</span></p>
- !! end
- !! test
- Link with 3 brackets
- !! wikitext
- [[[Main Page]]]
- Foo [[[Main Page]]]
- !! html
- <p>[[[Main Page]]]
- Foo [[[Main Page]]]
- </p>
- !! end
- !! test
- Link with 4 brackets
- !! wikitext
- [[[[Main Page]]]]
- !! html
- <p>[[<a href="/wiki/Main_Page" title="Main Page">Main Page</a>]]
- </p>
- !! end
- !! test
- Piped link with 3 brackets
- !! wikitext
- [[[main page|the main page]]]
- !! html
- <p>[[[main page|the main page]]]
- </p>
- !! end
- !! test
- Piped link with extlink-like text
- !! wikitext
- [[Main Page|[bar]]]
- [[Main Page|This is a [bar]]]
- [[Main Page|[bar]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">[bar]</a>
- <a href="/wiki/Main_Page" title="Main Page">This is a [bar]</a>
- <a href="/wiki/Main_Page" title="Main Page">[bar</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar]</a>
- <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>This is a [bar]</a>
- <a rel="mw:WikiLink" href="./Main_Page" title="Main Page" data-parsoid='{"stx":"piped"}'>[bar</a></p>
- !! end
- !! test
- Link with multiple pipes
- !! wikitext
- [[Main Page|The|Main|Page]]
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">The|Main|Page</a>
- </p>
- !! end
- !! test
- Anchor containing a #. (T65430)
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- [[Main Page#And#Link]]
- !! html/php
- <p><a href="/wiki/Main_Page#And#Link" title="Main Page">Main Page#And#Link</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Link to namespaces
- !! wikitext
- [[Talk:Parser testing]], [[Meta:Disclaimers]]
- !! html
- <p><a href="/index.php?title=Talk:Parser_testing&action=edit&redlink=1" class="new" title="Talk:Parser testing (page does not exist)">Talk:Parser testing</a>, <a href="/index.php?title=Meta:Disclaimers&action=edit&redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">Meta:Disclaimers</a>
- </p>
- !! end
- !! test
- Link with space in namespace
- !! wikitext
- [[User talk:Foo bar]]
- !! html
- <p><a href="/index.php?title=User_talk:Foo_bar&action=edit&redlink=1" class="new" title="User talk:Foo bar (page does not exist)">User talk:Foo bar</a>
- </p>
- !! end
- !! article
- MemoryAlpha:AlphaTest
- !! text
- This is an article in the MemoryAlpha namespace
- (which shadows the memoryalpha interwiki link).
- !! endarticle
- !! test
- Namespace takes precedence over interwiki link (T53680)
- !! wikitext
- [[MemoryAlpha:AlphaTest]]
- !! html
- <p><a href="/wiki/MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a>
- </p>
- !! end
- # The previous test doesn't work correctly in html2*, due to not recognizing the
- # link as an internal one. This one checks for the correct behavior.
- !! test
- Link to namespace preferred over interwiki with correct rel attribute
- !! options
- parsoid=html2wt,html2html
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./MemoryAlpha:AlphaTest" title="MemoryAlpha:AlphaTest">MemoryAlpha:AlphaTest</a></p>
- !! wikitext
- [[MemoryAlpha:AlphaTest]]
- !! end
- !! test
- Piped link to namespace
- !! wikitext
- [[Meta:Disclaimers|The disclaimers]]
- !! html
- <p><a href="/index.php?title=Meta:Disclaimers&action=edit&redlink=1" class="new" title="Meta:Disclaimers (page does not exist)">The disclaimers</a>
- </p>
- !! end
- !! test
- Link containing }
- !! wikitext
- [[Usually caused by a typo (oops}]]
- !! html
- <p>[[Usually caused by a typo (oops}]]
- </p>
- !! end
- !! article
- 7% Solution
- !! text
- Just a test of an article title containing a percent.
- !! endarticle
- !! test
- Link containing % (not as a hex sequence)
- !! wikitext
- [[7% Solution]]
- [[7% Solution|7%25 Solution]]
- !! html/php
- <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
- <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
- <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
- !! end
- # note that the parsoid HTML is identical to the previous test output,
- # so the previous test ensures that the html2wt mode will generate the
- # "not as a hex sequence" wikitext.
- !! test
- Link containing % as a single hex sequence interpreted to char
- !! options
- parsoid=wt2wt,wt2html,html2html
- !! wikitext
- [[7%25 Solution]]
- [[7%25 Solution|7%25 Solution]]
- !! html/php
- <p><a href="/wiki/7%25_Solution" title="7% Solution">7% Solution</a>
- <a href="/wiki/7%25_Solution" title="7% Solution">7%25 Solution</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7% Solution</a>
- <a rel="mw:WikiLink" href="./7%25_Solution" title="7% Solution">7%25 Solution</a></p>
- !!end
- !! test
- Link containing % as a double hex sequence interpreted to hex sequence
- !! wikitext
- [[7%2525 Solution]]
- !! html
- <p>[[7%2525 Solution]]
- </p>
- !!end
- ## Example for such a section: == < ==
- !! test
- Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- [[%23%3c]][[%23%3e]]
- !! html/php
- <p><a href="#<">#<</a><a href="#>">#></a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page#<" title="Main Page" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#<"},"sa":{"href":"%23%3c"}}'>#<</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>
- !! end
- ## Example for such a section: == < ==
- !! test
- Link containing "#<" and "#>" % as a hex sequences- these are valid section anchors (legacy)
- !! config
- wgFragmentMode=[ 'legacy' ]
- !! wikitext
- [[%23%3c]][[%23%3e]]
- !! html/php
- <p><a href="#.3C">#<</a><a href="#.3E">#></a>
- </p>
- !! end
- !! test
- Link containing "<#" and ">#" as a hex sequences
- !! wikitext
- [[%3c%23]][[%3e%23]]
- !! html
- <p>[[%3c%23]][[%3e%23]]
- </p>
- !! end
- !! test
- Link containing an equals sign
- !! wikitext
- [[Special:BookSources/isbn=4-00-026157-6]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! article
- Foo~bar
- !! text
- Just a test of an article title containing a tilde.
- !! endarticle
- # note that links containing signatures, like [[Foo~~~~]], are
- # massaged by the pre-save transform (PST) and so the tildes are never
- # seen by the parser.
- !! test
- Link containing a tilde
- !! wikitext
- [[Foo~bar]]
- !! html/php
- <p><a href="/wiki/Foo~bar" title="Foo~bar">Foo~bar</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo~bar" title="Foo~bar">Foo~bar</a></p>
- !! end
- !! test
- Link containing double-single-quotes '' (T6598)
- !! wikitext
- [[Lista d''e paise d''o munno]]
- !! html/php
- <p><a href="/index.php?title=Lista_d%27%27e_paise_d%27%27o_munno&action=edit&redlink=1" class="new" title="Lista d''e paise d''o munno (page does not exist)">Lista d''e paise d''o munno</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Link containing double quotes and spaces
- !! wikitext
- [[Cool "Gator"]]
- !! html/php
- <p><a href="/index.php?title=Cool_%22Gator%22&action=edit&redlink=1" class="new" title="Cool "Gator" (page does not exist)">Cool "Gator"</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href='./Cool_"Gator"' title='Cool "Gator"'>Cool "Gator"</a></p>
- !! end
- !! test
- File containing double quotes and spaces
- !! wikitext
- [[File:Cool "Gator".png]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Redirect containing double quotes and spaces
- !! wikitext
- #REDIRECT [[Cool "Gator"]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Cool_%22Gator%22" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Cool_%22Gator%22"},"sa":{"href":"Cool \"Gator\""}}'/>
- !! end
- !! test
- Link containing double-single-quotes '' in text (T6598 sanity check)
- !! wikitext
- Some [[Link|pretty ''italics'' and stuff]]!
- !! html/php
- <p>Some <a href="/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!
- </p>
- !! html/parsoid
- <p>Some <a rel="mw:WikiLink" href="./Link" title="Link">pretty <i>italics</i> and stuff</a>!</p>
- !! end
- !! test
- Link containing double-single-quotes '' in text embedded in italics (T6598 sanity check)
- !! wikitext
- ''Some [[Link|pretty ''italics'' and stuff]]!''
- !! html
- <p><i>Some <a href="/index.php?title=Link&action=edit&redlink=1" class="new" title="Link (page does not exist)">pretty <i>italics</i> and stuff</a>!</i>
- </p>
- !! end
- !! test
- Link with double quotes in title part (literal) and alternate part (interpreted)
- !! wikitext
- [[File:Denys_Savchenko_''Pentecoste''.jpg]]
- [[''Pentecoste'']]
- [[''Pentecoste''|Pentecoste]]
- [[''Pentecoste''|''Pentecoste'']]
- !! html/php
- <p><a href="/index.php?title=Special:Upload&wpDestFile=Denys_Savchenko_%27%27Pentecoste%27%27.jpg" class="new" title="File:Denys Savchenko ''Pentecoste''.jpg">File:Denys Savchenko <i>Pentecoste</i>.jpg</a>
- </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">''Pentecoste''</a>
- </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)">Pentecoste</a>
- </p><p><a href="/index.php?title=%27%27Pentecoste%27%27&action=edit&redlink=1" class="new" title="''Pentecoste'' (page does not exist)"><i>Pentecoste</i></a>
- </p>
- !! html/parsoid
- <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>
- <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">''Pentecoste''</a></p>
- <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''">Pentecoste</a></p>
- <p><a rel="mw:WikiLink" href="./''Pentecoste''" title="''Pentecoste''"><i>Pentecoste</i></a></p>
- !! end
- !! test
- Broken image links with HTML captions (T41700)
- !! wikitext
- [[File:Nonexistent|<script></script>]]
- [[File:Nonexistent|100x100px|<script></script>]]
- [[File:Nonexistent|<]]
- [[File:Nonexistent|a<i>b</i>c]]
- !! html/php
- <p><a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent"><script></script></a>
- <a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent"><script></script></a>
- <a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent"><</a>
- <a href="/index.php?title=Special:Upload&wpDestFile=Nonexistent" class="new" title="File:Nonexistent">abc</a>
- </p>
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"<script></script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;script>&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>
- <figure-inline typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"width","ak":"100x100px"},{"ck":"caption","ak":"<script></script>"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"&lt;script>&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>
- <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&lt;"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"<span typeof=\"mw:Entity\" data-parsoid='{\"src\":\"&amp;lt;\",\"srcContent\":\"&lt;\",\"dsr\":[107,111,null,null]}'>&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>
- <figure-inline class="mw-default-size" typeof="mw:Error mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"a<i>b</i>c"}]}' data-mw='{"errors":[{"key":"apierror-filedoesnotexist","message":"This image does not exist."}],"caption":"a<i data-parsoid='{\"stx\":\"html\",\"dsr\":[134,142,3,4]}'>b</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>
- !! end
- !! test
- Plain link to URL
- !! wikitext
- [[http://www.example.com]]
- !! html/php
- <p>[<a rel="nofollow" class="external autonumber" href="http://www.example.com">[1]</a>]
- </p>
- !! html/parsoid
- <p>[<a rel="mw:ExtLink" class="external autonumber" href="http://www.example.com"></a>]</p>
- !! end
- !! test
- Plain link to URL with link text
- !! wikitext
- [[http://www.example.com Link text]]
- !! html
- <p>[<a rel="nofollow" class="external text" href="http://www.example.com">Link text</a>]
- </p>
- !! end
- !! test
- Plain link to protocol-relative URL
- !! wikitext
- [[//www.example.com]]
- !! html/php
- <p>[<a rel="nofollow" class="external autonumber" href="//www.example.com">[1]</a>]
- </p>
- !! html/parsoid
- <p>[<a rel="mw:ExtLink" class="external autonumber" href="//www.example.com"></a>]</p>
- !! end
- !! test
- Plain link to protocol-relative URL with link text
- !! wikitext
- [[//www.example.com Link text]]
- !! html
- <p>[<a rel="nofollow" class="external text" href="//www.example.com">Link text</a>]
- </p>
- !! end
- !! test
- Plain link to page with question mark in title
- !! wikitext
- [[A?b]]
- [[A?b|Baz]]
- !! html
- <p><a href="/wiki/A%3Fb" title="A?b">A?b</a>
- </p><p><a href="/wiki/A%3Fb" title="A?b">Baz</a>
- </p>
- !! end
- # I'm fairly sure the expected result here is wrong.
- # We want these to be URL links, not pseudo-pages with URLs for titles....
- # However the current output is also pretty screwy.
- #
- # ----
- # I'm changing it to match the current output--it arguably makes more
- # sense in the light of the test above. Old expected result was:
- #<p>Piped link to URL: <a href="/index.php?title=Http://www.example.com&action=edit" class="new">an example URL</a>
- #</p>
- # But I think this test is bordering on "garbage in, garbage out" anyway.
- # -- wtm
- !! test
- Piped link to URL
- !! wikitext
- Piped link to URL: [[http://www.example.com|an example URL]]
- !! html/php
- <p>Piped link to URL: [<a rel="nofollow" class="external text" href="http://www.example.com%7Can">example URL</a>]
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Plain link in template argument
- !! options
- parsoid=wt2html
- !! wikitext
- {{echo|[http://www.example.com |123]}}
- {{echo|[[http://www.example.com |123]]}}
- {{echo|[[http://www.example.com |123]}}
- {{echo|[http://www.example.com |123]]}}
- !! html/php
- <p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
- </p><p>[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>]
- </p><p>{{echo|[<a rel="nofollow" class="external text" href="http://www.example.com">|123</a>}}
- </p><p>[<a rel="nofollow" class="external free" href="http://www.example.com">http://www.example.com</a>
- </p>
- !! html/parsoid
- <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>
- <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>
- <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>
- <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>
- !! end
- !! test
- T2002: [[page|http://url/]] should link to page, not http://url/
- !! wikitext
- [[Main Page|http://url/]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">http://url/</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">http://url/</a></p>
- !! end
- # Parsoid does not mark self-links, by design.
- !! test
- T2337: Escaped self-links should be bold
- !! options
- title=[[Bug462]]
- !! wikitext
- [[Bug462]] [[Bug462]]
- !! html/php+tidy
- <p><a class="mw-selflink selflink">Bug462</a> <a class="mw-selflink selflink">Bug462</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a> <a rel="mw:WikiLink" href="./Bug462" title="Bug462">Bug462</a></p>
- !! end
- !! test
- Self-link to section should not be bold
- !! options
- title=[[Main Page]]
- !! wikitext
- [[Main Page#section]]
- !! html
- <p><a href="/wiki/Main_Page#section" title="Main Page">Main Page#section</a>
- </p>
- !! end
- !! article
- 00
- !! text
- This is 00.
- !! endarticle
- !!test
- Self-link to numeric title
- !!options
- title=[[0]]
- !! wikitext
- [[0]]
- !! html
- <p><a class="mw-selflink selflink">0</a>
- </p>
- !!end
- !!test
- Link to numeric-equivalent title
- !!options
- title=[[0]]
- !! wikitext
- [[00]]
- !! html
- <p><a href="/wiki/00" title="00">00</a>
- </p>
- !!end
- !! test
- <nowiki> inside a link
- !! wikitext
- [[Main<nowiki> Page</nowiki>]] [[Main Page|the main page <nowiki>[it's not very good]</nowiki>]]
- !! html
- <p>[[Main Page]] <a href="/wiki/Main_Page" title="Main Page">the main page [it's not very good]</a>
- </p>
- !! end
- !! test
- Non-breaking spaces in title
- !! wikitext
- [[ Main Page ]]
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">  Main   Page  </a>
- </p>
- !!end
- # Add new article for the test below so that it doesn't red-link
- !! article
- Foo bar baz
- !! text
- boo
- !! endarticle
- !! test
- Multiple spaces in titles should normalize to a single underscore
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- [[Foo bar baz|x]]
- [[Foo bar baz|x]]
- [[Foo bar baz|x]]
- !! html/php
- <p><a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
- <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
- <a href="/wiki/Foo_bar_baz" title="Foo bar baz">x</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
- <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
- <a rel="mw:WikiLink" href="./Foo_bar_baz" title="Foo bar baz">x</a>
- </p>
- !! end
- !! test
- Internal link with ca linktrail, surrounded by bold apostrophes (T29473 primary issue)
- !! options
- language=ca
- !! wikitext
- '''[[Main Page]]'''
- !! html
- <p><b><a href="/wiki/Main_Page" title="Main Page">Main Page</a></b>
- </p>
- !! end
- !! test
- Internal link with ca linktrail, surrounded by italic apostrophes (T29473 primary issue)
- !! options
- language=ca
- !! wikitext
- ''[[Main Page]]''
- !! html
- <p><i><a href="/wiki/Main_Page" title="Main Page">Main Page</a></i>
- </p>
- !! end
- !! test
- Internal link with en linktrail: no apostrophes (T29473)
- !! options
- language=en
- !! wikitext
- [[Something]]'nice
- !! html
- <p><a href="/index.php?title=Something&action=edit&redlink=1" class="new" title="Something (page does not exist)">Something</a>'nice
- </p>
- !! end
- !! test
- Internal link with ca linktrail with apostrophes (T29473)
- !! options
- language=ca
- !! wikitext
- [[Something]]'nice
- !! html
- <p><a href="/index.php?title=Something&action=edit&redlink=1" class="new" title="Something (encara no existeix)">Something'nice</a>
- </p>
- !! end
- !! test
- Internal link with kaa linktrail with apostrophes (T29473)
- !! options
- language=kaa
- !! wikitext
- [[Something]]'nice
- !! html
- <p><a href="/index.php?title=Something&action=edit&redlink=1" class="new" title="Something (bet ele jaratılmag'an)">Something'nice</a>
- </p>
- !! end
- !! test
- Link with multiple ":" in a subpage-supporting namespace (T65636)
- !! wikitext
- [[User:Foo/Test/63636:Bar|Test]]
- !! html/php
- <p><a href="/index.php?title=User:Foo/Test/63636:Bar&action=edit&redlink=1" class="new" title="User:Foo/Test/63636:Bar (page does not exist)">Test</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./User:Foo/Test/63636:Bar" title="User:Foo/Test/63636:Bar">Test</a></p>
- !! end
- ## Mainly a sanity check for Parsoid
- !! test
- Handle title parsing for subpages
- !! options
- title=[[/123123]]
- subpage
- !! wikitext
- 123
- !! html/php
- <p>123
- </p>
- !! html/parsoid
- <p>123</p>
- !! end
- !! article
- User:Test/123
- !! text
- test 123
- !! endarticle
- !! test
- Link to a subpage from a namespace other than main
- !! options
- title=[[User:Test]]
- subpage
- !! wikitext
- [[/123]]
- !! html/php
- <p><a href="/wiki/User:Test/123" title="User:Test/123">/123</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Ensure that transclusion titles are not url-decoded
- !! options
- subpage title=[[Test]]
- parsoid=wt2html
- !! wikitext
- {{Bar%C3%A9}} {{/Bar%C3%A9}}
- !! html/php
- <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}
- </p>
- !! html/parsoid
- <p>{{Bar%C3%A9}} {{/Bar%C3%A9}}</p>
- !! end
- !! test
- Purely hash wikilink
- !! options
- title=[[User:Test/123]]
- subpage
- !! wikitext
- [[#a|b]]
- !! html/php
- <p><a href="#a">b</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Serialization of purely hash wikilink
- !! options
- title=[[User:Test/123]]
- subpage
- parsoid=html2wt
- !! html/parsoid
- <p><a href="#a">[[</a></p>
- !! wikitext
- [[#a|<nowiki>[[</nowiki>]]
- !! html/php
- <p><a href="#a">[[</a>
- </p>
- !! end
- !! test
- 1. Interaction of linktrail and template encapsulation
- !! wikitext
- {{echo|[[Foo]]}}l
- !! html/parsoid
- <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>
- !! end
- !! test
- 2. Interaction of linktrail and template encapsulation
- !! options
- parsoid
- !! wikitext
- {{echo|Some [[Fool]]}}s
- !! html
- <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>
- !! end
- !! test
- 3. Interaction of linktrail and template encapsulation
- !! options
- parsoid
- !! wikitext
- {{echo|Some [[Fool]]s are '''bold and foolish'''}}
- !! html
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Some [[Fool]]s are '''bold and foolish'''"}},"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>
- !! end
- !! article
- Söfnuður
- !! text
- Test.
- !! endarticle
- !! test
- Internal link with is link prefix
- !! options
- language=is
- !! wikitext
- Aðrir mótmælenda[[söfnuður|söfnuðir]] og
- !! html
- <p>Aðrir <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a> og
- </p>
- !! end
- !! article
- Mótmælendatrú
- !! text
- Test.
- !! endarticle
- !! test
- Internal link with is link trail and link prefix
- !! options
- language=is
- !! wikitext
- [[mótmælendatrú|xxx]]ar
- [[mótmælendatrú]]ar
- mótmælenda[[söfnuður]]
- mótmælenda[[söfnuður|söfnuðir]]
- mótmælenda[[söfnuður|söfnuðir]]xxx
- !! html
- <p><a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">xxxar</a>
- <a href="/wiki/M%C3%B3tm%C3%A6lendatr%C3%BA" title="Mótmælendatrú">mótmælendatrúar</a>
- <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuður</a>
- <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðir</a>
- <a href="/wiki/S%C3%B6fnu%C3%B0ur" title="Söfnuður">mótmælendasöfnuðirxxx</a>
- </p>
- !! end
- !! test
- Parsoid link trail escaping
- !! options
- parsoid=html2wt,html2html
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Apple" title="Apple">apple</a>s</p>
- !! wikitext
- [[apple]]<nowiki/>s
- !! end
- !! test
- Parsoid link prefix escaping
- !! options
- language=is
- parsoid=html2wt,html2html
- !! html/parsoid
- <p>Aðrir mótmælenda<a rel="mw:WikiLink" href="./Söfnuður" title="Söfnuður">söfnuður</a></p>
- !! wikitext
- Aðrir mótmælenda<nowiki/>[[söfnuður]]
- !! end
- !! test
- Parsoid link bracket escaping
- !! options
- parsoid=html2wt,html2html
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Test" title="Test">Test</a></p>
- <p>[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]</p>
- <p>[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]</p>
- <p>[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]</p>
- <p>[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]</p>
- <p>[[[[[<a rel="mw:WikiLink" href="./Test" title="Test">Test</a>]]]]]</p>
- !! wikitext
- [[Test]]
- [<nowiki/>[[Test]]]
- [[[[Test]]]]
- [[[<nowiki/>[[Test]]]]]
- [[[[[[Test]]]]]]
- [[[[[<nowiki/>[[Test]]]]]]]
- !! end
- !! test
- Parsoid-centric test: Whitespace in ext- and wiki-links should be preserved
- !! wikitext
- [[Foo| bar]]
- [[Foo| ''bar'']]
- [http://wp.org foo]
- [http://wp.org ''foo'']
- !! html
- <p><a href="/wiki/Foo" title="Foo"> bar</a>
- </p><p><a href="/wiki/Foo" title="Foo"> <i>bar</i></a>
- </p><p><a rel="nofollow" class="external text" href="http://wp.org">foo</a>
- </p><p><a rel="nofollow" class="external text" href="http://wp.org"><i>foo</i></a>
- </p>
- !! end
- !! test
- Parsoid: Scoped parsing should handle mixed transclusions and plain text
- !! wikitext
- [[Foo|{{echo|a}} b {{echo|c}}]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Link with angle bracket after anchor
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- [[Foo#<bar>]]
- !! html/php
- <p><a href="/wiki/Foo#<bar>" title="Foo">Foo#<bar></a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo#<bar>" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo#<bar>"},"sa":{"href":"Foo#<bar>"}}'>Foo#<bar></a></p>
- !! end
- !! test
- Link with angle bracket after anchor (legacy)
- !! config
- wgFragmentMode=[ 'legacy' ]
- !! wikitext
- [[Foo#<bar>]]
- !! html/php
- <p><a href="/wiki/Foo#.3Cbar.3E" title="Foo">Foo#<bar></a>
- </p>
- !! end
- ###
- ### Interwiki links (see maintenance/interwiki.sql)
- ###
- !! test
- Inline interwiki link
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[MeatBall:SoftSecurity]]
- !! html/php
- <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity" title="meatball:SoftSecurity">MeatBall:SoftSecurity</a></p>
- !! end
- !! test
- Inline interwiki link with empty title (T4372)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[MeatBall:]]
- !! html/php
- <p><a href="http://www.usemod.com/cgi-bin/mb.pl" class="extiw" title="meatball:">MeatBall:</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?" title="meatball:">MeatBall:</a></p>
- !! end
- ## html2wt and html2html will fail because we will prefer the :en: interwiki prefix over wikipedia:
- !! test
- Interwiki link encoding conversion (T3636)
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- *[[Wikipedia:ro:Olteniţa]]
- *[[Wikipedia:ro:Olteniţa]]
- !! html
- <ul><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>
- <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></ul>
- !! html/php+tidy
- <ul>
- <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>
- <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>
- </ul>
- !! html/parsoid
- <ul>
- <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>
- <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>
- </ul>
- !! end
- !! test
- Interwiki link with fragment (T4130)
- !! wikitext
- [[MeatBall:SoftSecurity#foo]]
- !! html
- <p><a href="http://www.usemod.com/cgi-bin/mb.pl?SoftSecurity#foo" class="extiw" title="meatball:SoftSecurity">MeatBall:SoftSecurity#foo</a>
- </p>
- !! end
- !! test
- Link scenarios with escaped fragments
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- [[#Is this great?]]
- [[Foo#Is this great?]]
- [[meatball:Foo#Is this great?]]
- !! html/php
- <p><a href="#Is_this_great?">#Is this great?</a>
- <a href="/wiki/Foo#Is_this_great?" title="Foo">Foo#Is this great?</a>
- <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>
- </p>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- !! test
- Link scenarios with escaped fragments (legacy)
- !! config
- wgFragmentMode=[ 'legacy' ]
- !! wikitext
- [[#Is this great?]]
- [[Foo#Is this great?]]
- [[meatball:Foo#Is this great?]]
- !! html/php
- <p><a href="#Is_this_great.3F">#Is this great?</a>
- <a href="/wiki/Foo#Is_this_great.3F" title="Foo">Foo#Is this great?</a>
- <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>
- </p>
- !! end
- # Ideally the wikipedia: prefix here should be proto-relative too
- # [CSA]: this is kind of a bogus test, as the PHP parser test doesn't
- # define the 'en' prefix, and originally the test used 'wikipedia',
- # which isn't a localinterwiki prefix hence the links to the 'en:Foo'
- # article.
- !! test
- Different interwiki prefixes mapping to the same URL
- !! wikitext
- [[:en:Foo]]
- [[:en:Foo|Foo]]
- [[wikipedia:Foo]]
- [[:wikipedia:Foo|Foo]]
- [[wikipedia:en:Foo]]
- [[:wikipedia:en:Foo]]
- [[ wikiPEdia :Foo]]
- !! html/parsoid
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- !! end
- !! test
- Interwiki links that cannot be represented in wiki syntax
- !! wikitext
- [[meatball:ok]]
- [[meatball:ok#foo|ok with fragment]]
- [[meatball:ok_as_well?|ok ending with ? mark]]
- [http://de.wikipedia.org/wiki/Foo?action=history has query]
- [http://de.wikipedia.org/wiki/#foo is just fragment]
- !! html/php
- <p><a href="http://www.usemod.com/cgi-bin/mb.pl?ok" class="extiw" title="meatball:ok">meatball:ok</a>
- <a href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" class="extiw" title="meatball:ok">ok with fragment</a>
- <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>
- <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
- <a rel="nofollow" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok" title="meatball:ok">meatball:ok</a>
- <a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?ok#foo" title="meatball:ok">ok with fragment</a>
- <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>
- <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/Foo?action=history">has query</a>
- <a rel="mw:ExtLink" class="external text" href="http://de.wikipedia.org/wiki/#foo">is just fragment</a></p>
- !! end
- !! test
- Interwiki links: trail
- !! wikitext
- [[wikipedia:Foo|Ba]]r
- !! html/php
- <p><a href="http://en.wikipedia.org/wiki/Foo" class="extiw" title="wikipedia:Foo">Bar</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Local interwiki link
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[local:Template:Foo]]
- !! html/php
- <p><a href="/wiki/Template:Foo" title="Template:Foo">local:Template:Foo</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">local:Template:Foo</a></p>
- !! end
- # Parsoid does not mark self-links, by design.
- !! test
- Local interwiki link: self-link to current page
- !! options
- title=[[Main Page]]
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[local:Main Page]]
- !! html/php
- <p><a class="mw-selflink selflink">local:Main Page</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:Main Page</a></p>
- !! end
- !! test
- Local interwiki link: prefix only (T66167)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[local:]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">local:</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">local:</a></p>
- !! end
- !! test
- Local interwiki link: with additional interwiki prefix (T63357)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[local:meatball:Hello]]
- !! html/php
- <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Hello" class="extiw" title="meatball:Hello">local:meatball:Hello</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink/Interwiki" href="http://www.usemod.com/cgi-bin/mb.pl?Hello" title="meatball:Hello">local:meatball:Hello</a></p>
- !! end
- !! test
- Multiple local interwiki link prefixes
- !! wikitext
- [[local:local:local:local:mi:local:Foo]]
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! html/php
- <p><a href="/wiki/Foo" title="Foo">local:local:local:local:mi:local:Foo</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo">local:local:local:local:mi:local:Foo</a></p>
- !! end
- ###
- ### Interlanguage links
- ### Language links (so that searching for '### language' matches..)
- ###
- !! test
- Interlanguage link
- !! wikitext
- Blah blah blah
- [[zh:Chinese]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
- !! end
- ## parsoid html2wt will lose the space variations
- !! test
- Interlanguage link with spacing
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Blah blah blah
- [[ zh : Chinese ]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
- !! end
- !! test
- Double interlanguage link
- !! wikitext
- Blah blah blah
- [[es:Spanish]]
- [[zh:Chinese]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
- <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
- !! end
- ## parsoid html2wt will lose the space variations
- !! test
- Interlanguage link variations
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Blah blah blah
- [[ es :Spanish]]
- [[ ZH :Chinese]]
- [[es:Foo_bar]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish" />
- <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese" />
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar" />
- !! end
- !! test
- Escaping of interlanguage links (T129218, T156308)
- !! wikitext
- Blah blah blah
- [[:es:Spanish]]
- [[ : zh : Chinese ]]
- !! html/php
- <p>Blah blah blah
- <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
- <a href="http://zh.wikipedia.org/wiki/Chinese" class="extiw" title="zh:Chinese"> zh : Chinese </a>
- </p>
- !! html/parsoid
- <p>Blah blah blah
- <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
- <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese"> zh : Chinese </a></p>
- !! end
- !! test
- Multiple colons escaping interlanguage links
- !! options
- parsoid=wt2html
- !! wikitext
- [[:es:Spanish]]
- [[::es:Spanish]]
- [[:::es:Spanish]]
- !! html/php
- <p><a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">es:Spanish</a>
- [[::es:Spanish]]
- [[:::es:Spanish]]
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">es:Spanish</a>
- [[::es:Spanish]]
- [[:::es:Spanish]]</p>
- !! end
- ## parsoid html2wt will normalize the space to _
- !! test
- Space and question mark encoding in interlanguage links (T95473)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Blah blah blah
- [[es:Foo bar?]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo_bar%3F" />
- !! end
- !! test
- Interlanguage link, with prefix links
- !! options
- language=ln
- !! wikitext
- Blah blah blah
- [[zh:Chinese]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
- !! end
- !! test
- Double interlanguage link, with prefix links (T10897)
- !! options
- language=ln
- !! wikitext
- Blah blah blah
- [[es:Spanish]]
- [[zh:Chinese]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Spanish"/>
- <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/Chinese"/>
- !! end
- !! test
- "Extra" interlanguage links (T34189 / gerrit 111390)
- !! wikitext
- Blah blah blah
- [[mul:Article]]
- !! html/php
- <p>Blah blah blah
- </p>
- !! html/parsoid
- <p>Blah blah blah</p>
- <link rel="mw:PageProp/Language" title="Multilingual" href="http://wikisource.org/wiki/Article"/>
- !! end
- ## PHP parser tests script needs an update
- ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
- !! test
- Language links render as inline links if $wgInterwikiMagic=false
- !! options
- wgInterwikiMagic=false
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Blah blah blah
- [[zh:Chinese]]
- !! html/parsoid
- <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
- !! end
- ## PHP parser tests script needs an update
- ## Parsoid html2wt will normalize output to [[:zh:Chinese]]
- !! test
- Language links render as inline links in the Talk namespace
- !! options
- title=Talk:Foo
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Blah blah blah
- [[zh:Chinese]]
- !! html/parsoid
- <p>Blah blah blah <a rel="mw:WikiLink/Interwiki" href="http://zh.wikipedia.org/wiki/Chinese" title="zh:Chinese">zh:Chinese</a></p>
- !! end
- !! test
- Parsoid-specific test: Wikilinks with should RT properly
- !! options
- language=ln
- !! wikitext
- [[WW II]]
- !! html
- <p><a href="/index.php?title=WW_II&action=edit&redlink=1" class="new" title="WW II (lonkásá ezalí tɛ̂)">WW II</a>
- </p>
- !! end
- !! test
- Parsoid T55221: Wikilinks should be properly entity-escaped
- !! options
- parsoid={ "modes": ["html2wt"], "suppressErrors": true }
- !! html/parsoid
- <p>He&nbsp;llo <a href="./Foo" rel="mw:WikiLink">He&nbsp;llo</a></p>
- <p>He&nbsp;llo <a href="./He&nbsp;llo" rel="mw:WikiLink">He&nbsp;llo</a></p>
- !! wikitext
- He&nbsp;llo [[Foo|He&nbsp;llo]]
- He&nbsp;llo He&nbsp;llo
- !! html/php
- <p>He&nbsp;llo <a href="/wiki/Foo" title="Foo">He&nbsp;llo</a>
- </p><p>He&nbsp;llo He&nbsp;llo
- </p>
- !! end
- # html2wt will fail because of title normalization without data-parsoid
- !! test
- Parsoid: handle constructor well
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- [[constructor]]
- [[constructor:foo]]
- !! html/php
- <p><a href="/index.php?title=Constructor&action=edit&redlink=1" class="new" title="Constructor (page does not exist)">constructor</a>
- </p><p><a href="/index.php?title=Constructor:foo&action=edit&redlink=1" class="new" title="Constructor:foo (page does not exist)">constructor:foo</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Constructor" title="Constructor" data-parsoid='{"stx":"simple","a":{"href":"./Constructor"},"sa":{"href":"constructor"}}'>constructor</a></p>
- <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>
- !! end
- !! article
- ko:
- !! text
- Test.
- !! endarticle
- # Note that `ko` isn't a known interlanguage prefix
- !! test
- Parsoid: recognize interlanguage links without a target page
- !! options
- ill
- !! wikitext
- [[es:]]
- [[ko:]]
- !! html/php
- es:
- !! html/parsoid
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/"/>
- <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
- !! end
- # Note that `ko` isn't a known interwiki prefix
- !! test
- Parsoid: recognize interwiki links without a target page
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[:es:]]
- [[:ko:]]
- !! html/php
- <p><a href="http://es.wikipedia.org/wiki/" class="extiw" title="es:">es:</a>
- </p><p><a href="/wiki/Ko:" title="Ko:">ko:</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/" title="es:">es:</a></p>
- <p><a rel="mw:WikiLink" href="./Ko:" title="Ko:">ko:</a></p>
- !! end
- !! test
- Handle interwiki links pointing to the current wiki as plain wiki links (T47209)
- !! wikitext
- [[mi:Foo]]
- !! html/php
- <p><a href="/wiki/Foo" title="Foo">mi:Foo</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"simple","a":{"href":"./Foo"},"sa":{"href":"mi:Foo"}}'>mi:Foo</a></p>
- !! end
- !! test
- Interlanguage link with preceding local interwiki link (T70085)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Blah blah blah
- [[local:es:Spanish]]
- !! html/php
- <p>Blah blah blah
- <a href="http://es.wikipedia.org/wiki/Spanish" class="extiw" title="es:Spanish">local:es:Spanish</a>
- </p>
- !! html/parsoid
- <p>Blah blah blah
- <a rel="mw:WikiLink/Interwiki" href="http://es.wikipedia.org/wiki/Spanish" title="es:Spanish">local:es:Spanish</a></p>
- !! end
- !! test
- Looks like an interlanguage link, but is actually a local interwiki
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- Blah blah blah
- [[mi:Template:Foo]]
- !! html/php
- <p>Blah blah blah
- <a href="/wiki/Template:Foo" title="Template:Foo">mi:Template:Foo</a>
- </p>
- !! html/parsoid
- <p>Blah blah blah
- <a rel="mw:WikiLink" href="./Template:Foo" title="Template:Foo">mi:Template:Foo</a></p>
- !! end
- ###
- ### Redirects, Parsoid-only
- ###
- !! test
- 1. Simple redirect to page
- !! wikitext
- #REDIRECT [[Main Page]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page"/>
- !! end
- !! test
- 2. Other redirect variants
- !! wikitext
- #REDIRECT [[Main_Page]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./Main_Page"},"sa":{"href":"Main_Page"}}'/>
- !! end
- # Not a valid redirect in PHP (although perhaps it was, once upon a time)
- # This tests the Parsoid bail-out code.
- !! test
- 3. Other redirect variants
- !! options
- parsoid=wt2html
- !! wikitext
- #REDIRECT [[<nowiki>[[Bar]]</nowiki>]]
- !! html/parsoid
- <ol><li>REDIRECT [[<span typeof="mw:Nowiki">[[Bar]]</span>]]</li></ol>
- !! end
- !! test
- 4. Redirect to a templated destination
- !! wikitext
- #REDIRECT [[{{echo|Foo}}bar]]
- !! html/parsoid
- <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":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[12,24,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"Foo\"}},\"i\":0}}]}'>Foo</span>bar"}]]}'/>
- !! end
- !! test
- Empty redirect
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- #REDIRECT [[]]
- !! html/parsoid
- <ol>
- <li>REDIRECT [[]]</li></ol>
- !! end
- !! test
- Optional colon in #REDIRECT
- !! options
- # the colon is archaic syntax. we support it for wt2html, but we
- # don't care that it roundtrips back to the modern syntax.
- parsoid=wt2html,html2html
- !! wikitext
- #REDIRECT:[[Main Page]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page"/>
- !! end
- !! test
- Whitespace in #REDIRECT with optional colon
- !! options
- # the colon and gratuitous whitespace is archaic syntax. we support
- # it for wt2html, but we don't care that it roundtrips back to the
- # modern syntax (without extra whitespace)
- parsoid=wt2html,html2html
- !! wikitext
-
- #REDIRECT
- :
- [[Main Page]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page"/>
- !! end
- !! test
- Piped link in #REDIRECT
- !! options
- # content after piped link is ignored. we support this syntax,
- # but don't care that the piped link is lost when we roundtrip this.
- parsoid=wt2html
- !! wikitext
- #REDIRECT [[Main Page|bar]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page"/>
- !! end
- !! test
- Redirect to category (T104502)
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- #REDIRECT [[Category:Foo]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
- !! end
- !! test
- Redirect to category with URL encoding (T104502)
- !! options
- parsoid=wt2html
- !! wikitext
- #REDIRECT [[Category%3AFoo]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
- !! end
- !! test
- Redirect to category page
- !! wikitext
- #REDIRECT [[:Category:Foo]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Category:Foo"/>
- !! end
- !! test
- Redirect to image page (1)
- !! wikitext
- #REDIRECT [[File:Wiki.png]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./File:Wiki.png"/>
- !! end
- !! test
- Redirect to image page (2)
- !! wikitext
- #REDIRECT [[Image:Wiki.png]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./File:Wiki.png" data-parsoid='{"src":"#REDIRECT ","a":{"href":"./File:Wiki.png"},"sa":{"href":"Image:Wiki.png"}}'/>
- !! end
- # html2wt disabled because wts serializes as "#REDIRECT [[:en:File:Wiki.png]]"
- # Next test confirms this.
- !! test
- Redirect to language (1) (T104918)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- #REDIRECT [[en:File:Wiki.png]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
- !! end
- !! test
- Redirect to language (2) (T104918)
- !! wikitext
- #REDIRECT [[:en:File:Wiki.png]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="//en.wikipedia.org/wiki/File:Wiki.png"/>
- !! end
- !! test
- Redirect to interwiki (T104918)
- !! wikitext
- #REDIRECT [[meatball:File:Wiki.png]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="http://www.usemod.com/cgi-bin/mb.pl?File:Wiki.png"/>
- !! end
- !! test
- Non-English #REDIRECT
- !! options
- language=is
- !! wikitext
- #TILVÍSUN [[Main Page]]
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page" data-parsoid='{"src":"#TILVÍSUN ","a":{"href":"./Main_Page"},"sa":{"href":"Main Page"}}'/>
- !! end
- !! test
- Redirect syntax under text isn't considered a redirect
- !! wikitext
- some text
- #redirect [[Main Page]]
- !! html/parsoid
- <p>some text</p>
- <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>
- !! end
- !! test
- New redirect
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>Foo<link rel="mw:PageProp/redirect" href="./Foo"/></p>
- !! wikitext
- #REDIRECT [[Foo]]
- Foo
- !! end
- !! test
- Redirect followed by block on the same line
- !! options
- parsoid=wt2html
- !! wikitext
- #REDIRECT [[Main Page]]<!-- haha -->==hi==
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page"/><!-- haha --><h2 id="hi">hi</h2>
- !! end
- !! test
- Redirect followed by a newline
- !! wikitext
- #REDIRECT [[Main Page]]
- A newline
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page"/>
- <p>A newline</p>
- !! end
- !! test
- Redirect followed by multiple newlines
- !! wikitext
- #REDIRECT [[Main Page]]
- A newline
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page"/>
- <p><br/>
- A newline</p>
- !! end
- !! test
- Drop duplicate redirects
- !! options
- parsoid=html2wt
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Foo"/>
- <link rel="mw:PageProp/redirect" href="./Bar"/>
- <link rel="mw:PageProp/redirect" href="./Baz"/>
- !! wikitext
- #REDIRECT [[Foo]]
- !! end
- ##
- ## XHTML tidiness
- ###
- !! test
- <br> to <br />
- !! wikitext
- 1<br>2<br />3
- !! html
- <p>1<br />2<br />3
- </p>
- !! end
- !! test
- Broken br tag sanitization
- !! wikitext
- </br>
- !! html/php
- <p></br>
- </p>
- !! end
- # TODO: Fix html2html mode (T53055)!
- !! test
- Parsoid: Broken br tag recognition
- !! options
- parsoid=wt2html
- !! wikitext
- </br>
- <br/ >
- !! html+tidy
- <p><br />
- </p><p><br />
- </p>
- !! end
- !! test
- Incorrecly removing closing slashes from correctly formed XHTML
- !! wikitext
- <br style="clear:both;" />
- !! html
- <p><br style="clear:both;" />
- </p>
- !! end
- !! test
- Failing to transform badly formed HTML into correct XHTML
- !! wikitext
- <br style="clear: left;">
- <br style="clear: right;">
- <br style="clear: both;">
- !! html
- <p><br style="clear: left;" />
- <br style="clear: right;" />
- <br style="clear: both;" />
- </p>
- !!end
- ## FIXME: Is Parsoid's acceptance of self-closing html-tags
- ## a feature or a bug? See https://phabricator.wikimedia.org/T76962
- !! test
- Handling html with a div self-closing tag
- !! wikitext
- <div title />
- <div title/>
- <div title/ >
- <div title=bar />
- <div title=bar/>
- <div title=bar/ >
- !! html/php
- <p><div title />
- <div title/>
- </p>
- <div>
- <p><div title=bar />
- <div title=bar/>
- </p>
- <div title="bar/"></div>
- </div>
- !! html/parsoid
- <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
- <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
- <div title="" data-parsoid='{"stx":"html","selfClose":true}'></div>
- <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
- <div title="bar" data-parsoid='{"stx":"html","selfClose":true}'></div>
- <div title="bar/" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></div>
- !! end
- !! test
- Handling html with a br self-closing tag
- !! wikitext
- <br title />
- <br title/>
- <br title/ >
- <br title=bar />
- <br title=bar/>
- <br title=bar/ >
- !! html/php
- <p><br title="" />
- <br title="" />
- <br />
- <br title="bar" />
- <br title="bar" />
- <br title="bar/" />
- </p>
- !! html/parsoid
- <p><br title="" />
- <br title="" />
- <br title="" />
- <br title="bar" />
- <br title="bar" />
- <br title="bar/" />
- </p>
- !! end
- !! test
- Horizontal ruler (should it add that extra space?)
- !! wikitext
- <hr>
- <hr >
- foo <hr
- > bar
- !! html+tidy
- <hr />
- <hr /><p>
- foo </p><hr /><p> bar
- </p>
- !! end
- !! test
- Horizontal ruler -- 4+ dashes render hr
- !! wikitext
- ----
- !! html
- <hr />
- !! end
- !! test
- Horizontal ruler -- eats additional dashes on the same line
- !! wikitext
- ---------
- !! html
- <hr />
- !! end
- !! test
- Horizontal ruler -- does not collapse dashes on consecutive lines
- !! wikitext
- ----
- ----
- !! html
- <hr />
- <hr />
- !! end
- !! test
- Horizontal ruler -- <4 dashes render as plain text
- !! wikitext
- ---
- !! html
- <p>---
- </p>
- !! end
- !! test
- Horizontal ruler -- Supports content following dashes on same line
- !! wikitext
- ---- Foo
- !! html
- <hr /> Foo
- !! html+tidy
- <hr /><p> Foo
- </p>
- !! end
- ###
- ### Block-level elements
- ###
- !! test
- Common list
- !! wikitext
- *Common list
- *item 2
- *item 3
- !! html
- <ul><li>Common list</li>
- <li>item 2</li>
- <li>item 3</li></ul>
- !! end
- !! test
- Numbered list
- !! wikitext
- #Numbered list
- #item 2
- #item 3
- !! html
- <ol><li>Numbered list</li>
- <li>item 2</li>
- <li>item 3</li></ol>
- !! end
- # the switch from level 3 to ordered should not introduce a newline between
- !! test
- Mixed list
- !! wikitext
- *Mixed list
- *#with numbers
- **and bullets
- *#and numbers
- *bullets again
- **bullet level 2
- ***bullet level 3
- ***#Number on level 4
- **bullet level 2
- **#Number on level 3
- **#Number on level 3
- *#number level 2
- *Level 1
- ***Level 3
- #**Level 3, but ordered
- !! html
- <ul><li>Mixed list
- <ol><li>with numbers</li></ol>
- <ul><li>and bullets</li></ul>
- <ol><li>and numbers</li></ol></li>
- <li>bullets again
- <ul><li>bullet level 2
- <ul><li>bullet level 3
- <ol><li>Number on level 4</li></ol></li></ul></li>
- <li>bullet level 2
- <ol><li>Number on level 3</li>
- <li>Number on level 3</li></ol></li></ul>
- <ol><li>number level 2</li></ol></li>
- <li>Level 1
- <ul><li><ul><li>Level 3</li></ul></li></ul></li></ul>
- <ol><li><ul><li><ul><li>Level 3, but ordered</li></ul></li></ul></li></ol>
- !! end
- !! test
- 1. Nested mixed wikitext and html list
- !! wikitext
- *hi
- *<ul><li>ho</li></ul>
- *hi
- **ho
- !! html/php
- <ul><li>hi</li>
- <li><ul><li>ho</li></ul></li>
- <li>hi
- <ul><li>ho</li></ul></li></ul>
- !! html/parsoid
- <ul><li>hi</li>
- <li><ul data-parsoid='{"stx":"html"}'><li data-parsoid='{"stx":"html"}'>ho</li></ul></li>
- <li>hi
- <ul><li>ho</li></ul></li></ul>
- !! end
- !! test
- 2. Nested mixed wikitext and html list (incompatible)
- !! wikitext
- ;hi
- :{{echo|<li>ho</li>}}
- !! html/php
- <dl><dt>hi</dt>
- <dd><li>ho</li></dd></dl>
- !! html/parsoid
- <dl><dt>hi</dt>
- <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":"<li>ho</li>"}},"i":0}}]}'>ho</li></dd></dl>
- !! end
- !! test
- Nested lists 1
- !! wikitext
- *foo
- **bar
- !! html
- <ul><li>foo
- <ul><li>bar</li></ul></li></ul>
- !! end
- !! test
- Nested lists 2
- !! wikitext
- **foo
- *bar
- !! html
- <ul><li><ul><li>foo</li></ul></li>
- <li>bar</li></ul>
- !! end
- !! test
- Nested lists 3 (first element empty)
- !! wikitext
- *
- **bar
- !! html
- <ul><li>
- <ul><li>bar</li></ul></li></ul>
- !! end
- !! test
- Nested lists 4 (first element empty)
- !! wikitext
- **
- *bar
- !! html
- <ul><li><ul><li></li></ul></li>
- <li>bar</li></ul>
- !! end
- !! test
- Nested lists 5 (both elements empty)
- !! wikitext
- **
- *
- !! html
- <ul><li><ul><li></li></ul></li>
- <li></li></ul>
- !! end
- !! test
- Nested lists 6 (both elements empty)
- !! wikitext
- *
- **
- !! html
- <ul><li>
- <ul><li></li></ul></li></ul>
- !! end
- !! test
- Nested lists 7 (skip initial nesting levels)
- !! wikitext
- ***foo
- !! html
- <ul><li><ul><li><ul><li>foo</li></ul></li></ul></li></ul>
- !! end
- !! test
- Nested lists 8 (multiple nesting transitions)
- !! wikitext
- *foo
- ***bar
- **baz
- *boo
- !! html
- <ul><li>foo
- <ul><li><ul><li>bar</li></ul></li>
- <li>baz</li></ul></li>
- <li>boo</li></ul>
- !! end
- !! test
- Nested lists 9 (extension interaction)
- !! options
- parsoid
- !! wikitext
- *<references />
- !! html/parsoid
- <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>
- !! end
- !! test
- 1. Lists with start-of-line-transparent tokens before bullets: Comments
- !! wikitext
- *foo
- *<!--cmt-->bar
- <!--cmt-->*baz
- !! html
- <ul><li>foo</li>
- <li>bar</li>
- <li>baz</li></ul>
- !! end
- !! test
- 2. Lists with start-of-line-transparent tokens before bullets: Template close
- !! wikitext
- *foo {{echo|bar
- }}*baz
- !! html
- <ul><li>foo bar</li>
- <li>baz</li></ul>
- !! end
- !! test
- List items are not parsed correctly following a <pre> block (T2785)
- !! wikitext
- *<pre>foo</pre>
- *<pre>bar</pre>
- *zar
- !! html/php
- <ul><li><pre>foo</pre></li>
- <li><pre>bar</pre></li>
- <li>zar</li></ul>
- !! html/parsoid
- <ul><li><pre typeof="mw:Extension/pre" about="#mwt2" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo"}}'>foo</pre></li>
- <li><pre typeof="mw:Extension/pre" about="#mwt4" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"bar"}}'>bar</pre></li>
- <li>zar</li></ul>
- !! end
- # FIXME: Might benefit from a html/parsoid since this has a template
- !! test
- List items from template
- !! wikitext
- {{inner list}}
- *item 2
- *item 0
- {{inner list}}
- *item 2
- *item 0
- *notSOL{{inner list}}
- *item 2
- !! html
- <ul><li>item 1</li>
- <li>item 2</li></ul>
- <ul><li>item 0</li>
- <li>item 1</li>
- <li>item 2</li></ul>
- <ul><li>item 0</li>
- <li>notSOL</li>
- <li>item 1</li>
- <li>item 2</li></ul>
- !! end
- !! test
- List interrupted by empty line or heading
- !! wikitext
- *foo
- **bar
- ==A heading==
- *Another list item
- !! html
- <ul><li>foo</li></ul>
- <ul><li><ul><li>bar</li></ul></li></ul>
- <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&action=edit&section=1" title="Edit section: A heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <ul><li>Another list item</li></ul>
- !!end
- !!test
- Multiple list tags generated by templates
- !! wikitext
- {{echo|<li>}}a
- {{echo|<li>}}b
- {{echo|<li>}}c
- !! html
- <li>a
- <li>b
- <li>c</li>
- </li>
- </li>
- !! html+tidy
- <li>a
- </li><li>b
- </li><li>c
- </li>
- !! html/parsoid
- <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":"<li>"}},"i":0}},"a\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":1}},"b\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<li>"}},"i":2}},"c"]}'>a
- </li><li about="#mwt1">b
- </li><li about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true,"dsr":[null,44,null,0]}'>c</li>
- !!end
- !!test
- Single-comment whitespace lines dont break lists, and neither do multi-comment whitespace lines
- !! wikitext
- *a
- <!--This line will NOT split the list-->
- *b
- <!--This line will NOT split the list either-->
- *c
- <!--foo--> <!----> <!--This line NOT split the list either-->
- *d
- !! html
- <ul><li>a</li>
- <li>b</li>
- <li>c</li>
- <li>d</li></ul>
- !!end
- !!test
- Replacing whitespace with tabs still doesn't break the list (gerrit 78327)
- !! wikitext
- *a
- <!--This line will NOT split the list-->
- *b
- <!--This line will NOT split the list either-->
- *c
- <!--foo--> <!----> <!--This line NOT split the list
- either-->
- *d
- !! html
- <ul><li>a</li>
- <li>b</li>
- <li>c</li>
- <li>d</li></ul>
- !!end
- # FIXME: Parsoid has a dedicated DOM pass to mimic this Tidy-specific li-hack
- # That pass could possibly be removed.
- !!test
- Test the li-hack (a hack from Tidy days, but doesn't work as advertised with Remex)
- !!options
- parsoid=wt2html,wt2wt
- !! wikitext
- *foo
- *<li>li-hack
- *{{echo|<li>templated li-hack}}
- *<!--foo--><li> unsupported li-hack with preceding comments
- <ul>
- <li><li>not a li-hack
- </li>
- </ul>
- !! html+tidy
- <ul><li>foo</li>
- <li class="mw-empty-elt"></li><li>li-hack</li>
- <li class="mw-empty-elt"></li><li>templated li-hack</li>
- <li class="mw-empty-elt"></li><li> unsupported li-hack with preceding comments</li></ul>
- <ul>
- <li class="mw-empty-elt"></li><li>not a li-hack
- </li>
- </ul>
- !! html/parsoid
- <ul><li> foo</li>
- <li data-parsoid='{"stx":"html","autoInsertedEnd":true,"liHackSrc":"*"}'>li-hack</li>
- <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":"<li>templated li-hack"}},"i":0}}]}'>templated li-hack</li>
- <li data-parsoid='{"autoInsertedEnd":true}'><!--foo--></li><li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>unsupported li-hack with preceding comments</li></ul>
- <ul data-parsoid='{"stx":"html"}'>
- <li class="mw-empty-elt" data-parsoid='{"stx":"html","autoInsertedEnd":true}'></li><li data-parsoid='{"stx":"html"}'>not a li-hack
- </li>
- </ul>
- !!end
- !! test
- Parsoid: Make sure nested lists are serialized on their own line even if HTML contains no newlines
- !! options
- parsoid
- !! wikitext
- #foo
- ##bar
- *foo
- **bar
- :foo
- ::bar
- !! html
- <ol>
- <li>foo<ol>
- <li>bar</li>
- </ol></li>
- </ol><ul>
- <li>foo<ul>
- <li>bar</li>
- </ul></li>
- </ul><dl>
- <dd>foo<dl>
- <dd>bar</dd>
- </dl></dd>
- </dl>
- !! end
- !! test
- Parsoid: Test of whitespace serialization with Templated bullets
- !! options
- parsoid
- !! wikitext
- * {{bullet}}
- !! html/parsoid
- <ul>
- <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>
- </ul>
- !! end
- # ------------------------------------------------------------------------
- # The next set of tests are about Parsoid's ability to handle badly nested
- # tags (parse, minimize scope of fixup, and roundtrip back)
- # ------------------------------------------------------------------------
- # Remex and Parsoid output stems from list handling diffs because Parsoid & PHP parser.
- # Parsoid's list handling is more aware of block structure.
- !! test
- Unbalanced closing block tags break a list
- !! wikitext
- <div>
- *a</div><div>
- *b</div>
- !! html+tidy
- <div>
- <ul><li>a</li></ul></div><div>
- <li>b</li></div>
- !! html/parsoid
- <div><ul>
- <li>a</li>
- </ul></div>
- <div><ul>
- <li>b</li>
- </ul></div>
- !! end
- !! test
- Unbalanced closing non-block tags don't break a list
- !! wikitext
- <span>
- *a</span><span>
- *b</span>
- !! html/php+tidy
- <p><span>
- </span></p>
- <ul><li>a<span></span></li>
- <li>b</li></ul>
- !! html/parsoid
- <span>
- <ul>
- <li>a<span></span></li>
- <li>b</li>
- </ul>
- </span>
- !! end
- # Parsoid does some post-dom-building cleanup
- # which is why its output differs from Remex.
- !! test
- Unclosed formatting tags that straddle lists are closed and reopened
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- #<s> a
- #b </s>
- !! html/php+tidy
- <ol><li><s> a</s></li><s>
- </s><li><s>b </s></li></ol>
- !! html/parsoid
- <ol><li><s> a</s></li>
- <li><s>b </s></li></ol>
- !! end
- # Output is ugly because of all the misnested tag fixups.
- # Remex is wrapping p-tags around empty elements.
- # Parsoid has special-case handling of this pattern of
- # wrapping lists in formatting tags.
- # FIXME: Should we remove this code from Parsoid? Or add
- # special support in Remex? If the latter, maybe just wait
- # for Parsoid to become the default parser.
- # See T70395.
- !!test
- 1. List embedded in a formatting tag
- !! wikitext
- <small>
- *foo
- </small>
- !! html/php+tidy
- <p><small>
- </small></p><small><ul><li>foo</li></ul></small><small></small><p><small></small>
- </p>
- !! html/parsoid
- <small>
- <ul>
- <li>foo</li>
- </ul>
- </small>
- !!end
- # Output is ugly because of all the misnested tag fixups
- # Remex is wrapping p-tags around empty elements.
- # Parsoid has code that strips useless p-tags.
- !!test
- 2. List embedded in a formatting tag in a misnested way
- !! wikitext
- <small>
- *a
- *b</small>
- !! html/php+tidy
- <p><small>
- </small></p><small></small><ul><small><li>a</li>
- </small><li><small>b</small></li></ul>
- !! html/parsoid
- <small></small>
- <ul><small>
- <li>a</li>
- </small>
- <li><small>b</small></li>
- </ul>
- !!end
- !! test
- Table with missing opening <tr> tag
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- <table>
- <td>foo</td>
- </tr>
- </table>
- !! html+tidy
- <table>
- <tbody><tr><td>foo</td>
- </tr>
- </tbody></table>
- !! end
- ###
- ### Magic Words
- ###
- # Note that the current date is hard-coded as
- # 1970-01-01T00:02:03Z (a Thursday)
- # when running parser tests. The timezone is also fixed to GMT, so
- # local date will be identical to current date.
- !! test
- Magic Word: {{CURRENTDAY}}
- !! wikitext
- {{CURRENTDAY}}
- !! html
- <p>1
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTDAY2}}
- !! wikitext
- {{CURRENTDAY2}}
- !! html
- <p>01
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTDAYNAME}}
- !! wikitext
- {{CURRENTDAYNAME}}
- !! html
- <p>Thursday
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTDOW}}
- !! wikitext
- {{CURRENTDOW}}
- !! html
- <p>4
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTMONTH}}
- !! wikitext
- {{CURRENTMONTH}}
- !! html
- <p>01
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTMONTH1}}
- !! wikitext
- {{CURRENTMONTH1}}
- !! html
- <p>1
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTMONTHABBREV}}
- !! wikitext
- {{CURRENTMONTHABBREV}}
- !! html
- <p>Jan
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTMONTHNAME}}
- !! wikitext
- {{CURRENTMONTHNAME}}
- !! html
- <p>January
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTMONTHNAMEGEN}}
- !! wikitext
- {{CURRENTMONTHNAMEGEN}}
- !! html
- <p>January
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTTIME}}
- !! wikitext
- {{CURRENTTIME}}
- !! html
- <p>00:02
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTHOUR}}
- !! wikitext
- {{CURRENTHOUR}}
- !! html
- <p>00
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTWEEK}} (T6594)
- !! wikitext
- {{CURRENTWEEK}}
- !! html
- <p>1
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTYEAR}}
- !! wikitext
- {{CURRENTYEAR}}
- !! html
- <p>1970
- </p>
- !! end
- !! test
- Magic Word: {{CURRENTTIMESTAMP}}
- !! wikitext
- {{CURRENTTIMESTAMP}}
- !! html
- <p>19700101000203
- </p>
- !! end
- !! test
- Magic Words LOCAL (UTC)
- !! wikitext
- *{{LOCALMONTH}}
- *{{LOCALMONTH1}}
- *{{LOCALMONTHNAME}}
- *{{LOCALMONTHNAMEGEN}}
- *{{LOCALMONTHABBREV}}
- *{{LOCALDAY}}
- *{{LOCALDAY2}}
- *{{LOCALDAYNAME}}
- *{{LOCALYEAR}}
- *{{LOCALTIME}}
- *{{LOCALHOUR}}
- *{{LOCALWEEK}}
- *{{LOCALDOW}}
- *{{LOCALTIMESTAMP}}
- !! html
- <ul><li>01</li>
- <li>1</li>
- <li>January</li>
- <li>January</li>
- <li>Jan</li>
- <li>1</li>
- <li>01</li>
- <li>Thursday</li>
- <li>1970</li>
- <li>00:02</li>
- <li>00</li>
- <li>1</li>
- <li>4</li>
- <li>19700101000203</li></ul>
- !! end
- !! test
- Magic Word: {{FULLPAGENAME}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{FULLPAGENAME}}
- !! html/*
- <p>User:Ævar Arnfjörð Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{FULLPAGENAMEE}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{FULLPAGENAMEE}}
- !! html/*
- <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{TALKSPACE}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{TALKSPACE}}
- !! html/*
- <p>User talk
- </p>
- !! end
- !! test
- Magic Word: {{TALKSPACE}}, same namespace
- !! options
- title=[[User talk:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{TALKSPACE}}
- !! html/*
- <p>User talk
- </p>
- !! end
- !! test
- Magic Word: {{TALKSPACE}}, main namespace
- !! options
- title=[[Parser Test]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{TALKSPACE}}
- !! html/*
- <p>Talk
- </p>
- !! end
- !! test
- Magic Word: {{TALKSPACEE}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{TALKSPACEE}}
- !! html/*
- <p>User_talk
- </p>
- !! end
- !! test
- Magic Word: {{SUBJECTSPACE}}
- !! options
- title=[[User talk:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBJECTSPACE}}
- !! html/*
- <p>User
- </p>
- !! end
- !! test
- Magic Word: {{SUBJECTSPACE}}, same namespace
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBJECTSPACE}}
- !! html/*
- <p>User
- </p>
- !! end
- !! test
- Magic Word: {{SUBJECTSPACE}}, main namespace
- !! options
- title=[[Parser Test]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBJECTSPACE}}
- !! html/*
- !! end
- !! test
- Magic Word: {{SUBJECTSPACEE}}
- !! options
- title=[[User talk:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBJECTSPACEE}}
- !! html/*
- <p>User
- </p>
- !! end
- !! test
- Magic Word: {{NAMESPACE}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{NAMESPACE}}
- !! html/*
- <p>User
- </p>
- !! end
- !! test
- Magic Word: {{NAMESPACEE}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{NAMESPACEE}}
- !! html/*
- <p>User
- </p>
- !! end
- !! test
- Magic Word: {{NAMESPACENUMBER}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{NAMESPACENUMBER}}
- !! html/*
- <p>2
- </p>
- !! end
- !! test
- Magic Word: {{SUBPAGENAME}}
- !! options
- title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBPAGENAME}}
- !! html/*
- <p>sub ö
- </p>
- !! end
- !! test
- Magic Word: {{SUBPAGENAMEE}}
- !! options
- title=[[Ævar Arnfjörð Bjarmason/sub ö]] subpage
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBPAGENAMEE}}
- !! html/*
- <p>sub_%C3%B6
- </p>
- !! end
- !! test
- Magic Word: {{ROOTPAGENAME}}
- !! options
- title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{ROOTPAGENAME}}
- !! html/*
- <p>Ævar Arnfjörð Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{ROOTPAGENAMEE}}
- !! options
- title=[[Ævar Arnfjörð Bjarmason/sub/sub2]] subpage
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{ROOTPAGENAMEE}}
- !! html/*
- <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{BASEPAGENAME}}
- !! options
- title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{BASEPAGENAME}}
- !! html/*
- <p>Ævar Arnfjörð Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{BASEPAGENAMEE}}
- !! options
- title=[[Ævar Arnfjörð Bjarmason/sub]] subpage
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{BASEPAGENAMEE}}
- !! html/*
- <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{TALKPAGENAME}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{TALKPAGENAME}}
- !! html/*
- <p>User talk:Ævar Arnfjörð Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{TALKPAGENAMEE}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{TALKPAGENAMEE}}
- !! html/*
- <p>User_talk:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{SUBJECTPAGENAME}}
- !! options
- title=[[User talk:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBJECTPAGENAME}}
- !! html/*
- <p>User:Ævar Arnfjörð Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{SUBJECTPAGENAMEE}}
- !! options
- title=[[User talk:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SUBJECTPAGENAMEE}}
- !! html/*
- <p>User:%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{NUMBEROFFILES}}
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{NUMBEROFFILES}}
- !! html/*
- <p>7
- </p>
- !! end
- !! test
- Magic Word: {{PAGENAME}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{PAGENAME}}
- !! html/*
- <p>Ævar Arnfjörð Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{PAGENAME}} with metacharacters
- !! options
- title=[['foo & bar = baz']]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- ''{{PAGENAME}}''
- !! html+tidy
- <p><i>'foo & bar = baz'</i>
- </p>
- !! end
- !! test
- Magic Word: {{PAGENAME}} with metacharacters (T28781)
- !! options
- title=[[*RFC 1234 http://example.com/]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{PAGENAME}}
- !! html+tidy
- <p>*RFC 1234 http://example.com/
- </p>
- !! end
- !! test
- Magic Word: {{PAGENAMEE}}
- !! options
- title=[[User:Ævar Arnfjörð Bjarmason]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{PAGENAMEE}}
- !! html/*
- <p>%C3%86var_Arnfj%C3%B6r%C3%B0_Bjarmason
- </p>
- !! end
- !! test
- Magic Word: {{PAGENAMEE}} with metacharacters (T28781)
- !! options
- title=[[*RFC 1234 http://example.com/]]
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{PAGENAMEE}}
- !! html+tidy
- <p>*RFC_1234_http://example.com/
- </p>
- !! end
- !! test
- Magic Word: {{REVISIONID}}
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- showflags
- !! wikitext
- {{REVISIONID}}
- !! html/*
- <p>1337
- </p>
- flags=vary-revision-id
- !! end
- !! test
- Magic Word: {{SCRIPTPATH}}
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SCRIPTPATH}}
- !! html/*
- !! end
- !! test
- Magic Word: {{STYLEPATH}}
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{STYLEPATH}}
- !! html/*
- <p>/skins
- </p>
- !! end
- !! test
- Magic Word: {{SERVER}}
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SERVER}}
- !! html/*
- <p><a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
- </p>
- !! end
- !! test
- Magic Word: {{SERVERNAME}}
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SERVERNAME}}
- !! html/*
- <p>example.org
- </p>
- !! end
- !! test
- Magic Word: {{SITENAME}}
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{SITENAME}}
- !! html/*
- <p>MediaWiki
- </p>
- !! end
- !! test
- Magic Word: {{PAGELANGUAGE}}
- !! options
- language=fr
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{PAGELANGUAGE}}
- !! html/*
- <p>fr
- </p>
- !! end
- !! test
- Magic Word: {{PAGELANGUAGE}} on a page with no explicitly set language
- !! options
- parsoid={ "modes": ["wt2html","wt2wt"], "normalizePhp": true }
- !! wikitext
- {{PAGELANGUAGE}}
- !! html/*
- <p>en
- </p>
- !! end
- !! test
- Case-sensitive magic words, when cased differently, should just be template transclusions
- !! wikitext
- {{CurrentMonth}}
- {{currentday}}
- {{cURreNTweEK}}
- {{currentHour}}
- !! html
- <p><a href="/index.php?title=Template:CurrentMonth&action=edit&redlink=1" class="new" title="Template:CurrentMonth (page does not exist)">Template:CurrentMonth</a>
- <a href="/index.php?title=Template:Currentday&action=edit&redlink=1" class="new" title="Template:Currentday (page does not exist)">Template:Currentday</a>
- <a href="/index.php?title=Template:CURreNTweEK&action=edit&redlink=1" class="new" title="Template:CURreNTweEK (page does not exist)">Template:CURreNTweEK</a>
- <a href="/index.php?title=Template:CurrentHour&action=edit&redlink=1" class="new" title="Template:CurrentHour (page does not exist)">Template:CurrentHour</a>
- </p>
- !! end
- !! test
- Case-insensitive magic words should still work with weird casing.
- !! wikitext
- {{sErVeRNaMe}}
- {{LCFirst:AOEU}}
- {{ucFIRST:aoeu}}
- {{SERver}}
- !! html
- <p>example.org
- aOEU
- Aoeu
- <a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>
- </p>
- !! end
- # From plwiki:PLOS_ONE
- !! test
- Parsoid: Page property magic word with magic word contents
- !! wikitext
- {{DISPLAYTITLE:''{{PAGENAME}}''}}
- !! html/parsoid
- <meta property="mw:PageProp/displaytitle" content="Main Page" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"src":"{{DISPLAYTITLE:''{{PAGENAME}}''}}"}' data-mw='{"attribs":[[{"txt":"content"},{"html":"DISPLAYTITLE:<i data-parsoid='{\"dsr\":[15,31,2,2]}'><span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[]],\"dsr\":[17,29,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"PAGENAME\",\"function\":\"pagename\"},\"params\":{},\"i\":0}}]}'>Main Page</span></i>"}]]}'/>
- !! end
- # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
- # But, this is a limitation of our representation and is documented in
- # TemplateHandler.js in processSpecialMagicWord
- !! test
- Parsoid: Template-generated DISPLAYTITLE
- !! wikitext
- {{{{echo|DISPLAYTITLE}}:Foo}}
- !! options
- showtitle
- !! config
- wgAllowDisplayTitle=true
- wgRestrictDisplayTitle=false
- !! html/php
- Foo
- !! html/parsoid
- <meta property="mw:PageProp/displaytitle" content="Foo" about="#mwt1" typeof="mw:ExpandedAttrs" data-parsoid='{"pi":[[]]}' data-mw='{"attribs":[[{"txt":"content"},{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,23,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DISPLAYTITLE\"}},\"i\":0}}]}'>DISPLAYTITLE</span>:Foo"}]]}'/>
- !! end
- !! test
- Namespace 1 {{ns:1}}
- !! wikitext
- {{ns:1}}
- !! html
- <p>Talk
- </p>
- !! end
- !! test
- Namespace 1 {{ns:01}}
- !! wikitext
- {{ns:01}}
- !! html
- <p>Talk
- </p>
- !! end
- !! test
- Namespace 0 {{ns:0}} (T6783)
- !! wikitext
- {{ns:0}}
- !! html
- !! end
- !! test
- Namespace 0 {{ns:00}} (T6783)
- !! wikitext
- {{ns:00}}
- !! html
- !! end
- !! test
- Namespace -1 {{ns:-1}}
- !! wikitext
- {{ns:-1}}
- !! html
- <p>Special
- </p>
- !! end
- !! test
- Namespace User {{ns:User}}
- !! wikitext
- {{ns:User}}
- !! html
- <p>User
- </p>
- !! end
- !! test
- Namespace User talk {{ns:User_talk}}
- !! wikitext
- {{ns:User_talk}}
- !! html
- <p>User talk
- </p>
- !! end
- !! test
- Namespace User talk {{ns:uSeR tAlK}}
- !! wikitext
- {{ns:uSeR tAlK}}
- !! html
- <p>User talk
- </p>
- !! end
- !! test
- Namespace File {{ns:File}}
- !! wikitext
- {{ns:File}}
- !! html
- <p>File
- </p>
- !! end
- !! test
- Namespace File {{ns:Image}}
- !! wikitext
- {{ns:Image}}
- !! html
- <p>File
- </p>
- !! end
- !! test
- Namespace (lang=de) Benutzer {{ns:User}}
- !! options
- language=de
- !! wikitext
- {{ns:User}}
- !! html
- <p>Benutzer
- </p>
- !! end
- !! test
- Namespace (lang=de) Benutzer Diskussion {{ns:3}}
- !! options
- language=de
- !! wikitext
- {{ns:3}}
- !! html
- <p>Benutzer Diskussion
- </p>
- !! end
- !! test
- Urlencode
- !! wikitext
- {{urlencode:hi world?!}}
- {{urlencode:hi world?!|WIKI}}
- {{urlencode:hi world?!|PATH}}
- {{urlencode:hi world?!|QUERY}}
- !! html/php
- <p>hi+world%3F%21
- hi_world%3F!
- hi%20world%3F%21
- hi+world%3F%21
- </p>
- !! end
- !! test
- Magic Word: prioritize type info over data-parsoid
- !! options
- parsoid=html2wt
- !! html/parsoid
- <meta property="mw:PageProp/forcetoc" data-parsoid='{"magicSrc":"__NOTOC__"}'/>
- !! wikitext
- __FORCETOC__
- !! end
- !! test
- Magic Word: serialize on separate line (parsoid)
- !! options
- parsoid=wt2wt,html2wt
- !! wikitext
- foo
- __NOTOC__
- bar
- !! html/parsoid
- foo<meta property="mw:PageProp/notoc"/>bar
- !! end
- !! test
- Magic Word: rt non-english wikis
- !! options
- parsoid=wt2wt
- language=de
- !! wikitext
- __NOEDITSECTION__
- !! html/parsoid
- <meta property="mw:PageProp/noeditsection" data-parsoid='{"magicSrc":"__NOEDITSECTION__"}'/>
- !! end
- !!test
- __proto__ is treated as normal wikitext (T105997)
- !!wikitext
- __proto__
- !!html
- <p>__proto__
- </p>
- !!end
- ###
- ### Magic links
- ###
- !! test
- Magic links: internal link to RFC (T2479)
- !! wikitext
- [[RFC 123]]
- !! html/php
- <p><a href="/index.php?title=RFC_123&action=edit&redlink=1" class="new" title="RFC 123 (page does not exist)">RFC 123</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./RFC_123" title="RFC 123">RFC 123</a></p>
- !! end
- !! test
- Magic links: RFC (T2479)
- !! wikitext
- RFC 822
- !! html/php
- <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
- </p>
- !! html/parsoid
- <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC 822</a></p>
- !! end
- !! test
- Magic links: RFC (T67278)
- !! wikitext
- This is RFC 822 but thisRFC 822 is not RFC 822linked.
- !! html/php
- <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.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Magic links: RFC (w/ non-newline whitespace, T30950/T31025)
- !! wikitext
- RFC      822
- RFC
- 822
- !! html/php
- <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc822">RFC 822</a>
- RFC
- 822
- </p>
- !! html/parsoid
- <p><a href="https://tools.ietf.org/html/rfc822" rel="mw:ExtLink" class="external text">RFC <span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#Xa0;","srcContent":" "}'> </span> 822</a>
- RFC
- 822</p>
- !! end
- !! test
- Magic links: ISBN (T3937)
- !! wikitext
- ISBN 0-306-40615-2
- !! html/php
- <p><a href="/wiki/Special:BookSources/0306406152" class="internal mw-magiclink-isbn">ISBN 0-306-40615-2</a>
- </p>
- !! html/parsoid
- <p><a href="./Special:BookSources/0306406152" rel="mw:WikiLink">ISBN 0-306-40615-2</a></p>
- !! end
- !! test
- Magic links: ISBN (T67278)
- !! wikitext
- This is ISBN 978-0-316-09811-3 but thisISBN 978-0-316-09811-3 is not ISBN 978-0-316-09811-3linked.
- !! html/php
- <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.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Magic links: ISBN (w/ non-newline whitespace, T30950/T31025)
- !! wikitext
- ISBN      978 0 316 09811 3
- ISBN
- 9780316098113
- ISBN 978
- 0316098113
- !! html/php
- <p><a href="/wiki/Special:BookSources/9780316098113" class="internal mw-magiclink-isbn">ISBN 978 0 316 09811 3</a>
- ISBN
- 9780316098113
- ISBN 978
- 0316098113
- </p>
- !! html/parsoid
- <p><a href="./Special:BookSources/9780316098113" rel="mw:WikiLink">ISBN <span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#Xa0;","srcContent":" "}'> </span> 978<span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span>0<span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span>316<span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span>09811<span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span>3</a>
- ISBN
- 9780316098113
- ISBN 978
- 0316098113</p>
- !! end
- !! test
- Magic links: PMID incorrectly converts space to underscore
- !! wikitext
- PMID 1234
- !! html/php
- <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
- </p>
- !! html/parsoid
- <p><a href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract" rel="mw:ExtLink" class="external text">PMID 1234</a></p>
- !! end
- !! test
- Magic links: PMID (T67278)
- !! wikitext
- This is PMID 1234 but thisPMID 1234 is not PMID 1234linked.
- !! html/php
- <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.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Magic links: PMID (w/ non-newline whitespace, T30950/T31025)
- !! wikitext
- PMID      1234
- PMID
- 1234
- !! html/php
- <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/1234?dopt=Abstract">PMID 1234</a>
- PMID
- 1234
- </p>
- !! html/parsoid
- <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":"&nbsp;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#0160;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#xA0;","srcContent":" "}'> </span><span typeof="mw:Entity" data-parsoid='{"src":"&#Xa0;","srcContent":" "}'> </span> 1234</a>
- PMID
- 1234</p>
- !! end
- # <nowiki> nodes shouldn't be inserted during html2wt by Parsoid,
- # since these are ExtLinkText, not MagicLinkText
- !! test
- Magic links: use appropriate serialization for "almost" magic links.
- !! wikitext
- X[[Special:BookSources/0978739256|foo]]
- X[https://tools.ietf.org/html/rfc1234 foo]
- !! html/php
- <p>X<a href="/wiki/Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a>
- </p><p>X<a rel="nofollow" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a>
- </p>
- !! html/parsoid
- <p>X<a rel="mw:WikiLink" href="./Special:BookSources/0978739256" title="Special:BookSources/0978739256">foo</a></p>
- <p>X<a rel="mw:ExtLink" class="external text" href="https://tools.ietf.org/html/rfc1234">foo</a></p>
- !! end
- !! test
- Magic links: All disabled (T47942)
- !! options
- wgEnableMagicLinks={"ISBN":false, "PMID":false, "RFC":false}
- !! wikitext
- ISBN 0-306-40615-2
- PMID 1234
- RFC 4321
- !! html/php
- <p>ISBN 0-306-40615-2
- PMID 1234
- RFC 4321
- </p>
- !! end
- ###
- ### Templates
- ####
- !! test
- Nonexistent template
- !! wikitext
- {{thistemplatedoesnotexist}}
- !! html
- <p><a href="/index.php?title=Template:Thistemplatedoesnotexist&action=edit&redlink=1" class="new" title="Template:Thistemplatedoesnotexist (page does not exist)">Template:Thistemplatedoesnotexist</a>
- </p>
- !! end
- !! test
- Template with invalid target containing tags
- !! wikitext
- {{a<b>b</b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
- !! html
- <p>{{a<b>b</b>|foo|a=b|a = b}}
- </p>
- !! end
- !! test
- Template with invalid target containing unclosed tag
- !! wikitext
- {{a<b>|{{echo|foo}}|{{echo|a}}={{echo|b}}|a = b}}
- !! html
- <p>{{a<b>|foo|a=b|a = b}}</b>
- </p>
- !! end
- !! test
- Template with invalid target containing wikilink
- !! wikitext
- {{[[Main Page]]}}
- !! html/php
- <p>{{<a href="/wiki/Main_Page" title="Main Page">Main Page</a>}}
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Template with just whitespace in it, T70421
- !! wikitext
- {{echo|{{ }}}}
- !! html/parsoid
- <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>
- !! end
- !! article
- Template:test
- !! text
- This is a test template
- !! endarticle
- !! test
- Simple template
- !! wikitext
- {{test}}
- !! html
- <p>This is a test template
- </p>
- !! end
- !! test
- Template with explicit namespace
- !! wikitext
- {{Template:test}}
- !! html
- <p>This is a test template
- </p>
- !! end
- !! article
- Template:paramtest
- !! text
- This is a test template with parameter {{{param}}}
- !! endarticle
- !! test
- Template parameter
- !! wikitext
- {{paramtest|param=foo}}
- !! html
- <p>This is a test template with parameter foo
- </p>
- !! end
- !! article
- Template:paramtestnum
- !! text
- [[{{{1}}}|{{{2}}}]]
- !! endarticle
- !! test
- Template unnamed parameter
- !! wikitext
- {{paramtestnum|Main Page|the main page}}
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">the main page</a>
- </p>
- !! end
- !! article
- Template:templatesimple
- !! text
- (test)
- !! endarticle
- !! article
- Template:templateredirect
- !! text
- #redirect [[Template:templatesimple]]
- !! endarticle
- !! article
- Template:templateasargtestnum
- !! text
- {{{{{1}}}}}
- !! endarticle
- !! article
- Template:templateasargtest
- !! text
- {{template{{{templ}}}}}
- !! endarticle
- !! article
- Template:templateasargtest2
- !! text
- {{{{{templ}}}}}
- !! endarticle
- !! test
- Template with template name as unnamed argument
- !! wikitext
- {{templateasargtestnum|templatesimple}}
- !! html
- <p>(test)
- </p>
- !! end
- !! test
- Template with template name as argument
- !! wikitext
- {{templateasargtest|templ=simple}}
- !! html
- <p>(test)
- </p>
- !! end
- !! test
- Template with template name as argument (2)
- !! wikitext
- {{templateasargtest2|templ=templatesimple}}
- !! html
- <p>(test)
- </p>
- !! end
- !! article
- Template:templateasargtestdefault
- !! text
- {{{{{templ|templatesimple}}}}}
- !! endarticle
- !! article
- Template:templa
- !! text
- '''templ'''
- !! endarticle
- !! test
- Template with default value
- !! wikitext
- {{templateasargtestdefault}}
- !! html
- <p>(test)
- </p>
- !! end
- !! test
- Template with default value (value set)
- !! wikitext
- {{templateasargtestdefault|templ=templa}}
- !! html
- <p><b>templ</b>
- </p>
- !! end
- !! test
- Template redirect
- !! wikitext
- {{templateredirect}}
- !! html/php
- <p>(test)
- </p>
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Template:Templatesimple" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"templateredirect","href":"./Template:Templateredirect"},"params":{},"i":0}}]}'/>
- !! end
- !! test
- Template with argument in separate line
- !! wikitext
- {{ templateasargtest |
- templ = simple }}
- !! html
- <p>(test)
- </p>
- !! end
- !! test
- Template with complex template as argument
- !! wikitext
- {{paramtest|
- param ={{ templateasargtest |
- templ = simple }}}}
- !! html
- <p>This is a test template with parameter (test)
- </p>
- !! end
- !! test
- Templates with templated name
- !! wikitext
- {{{{echo|echo}}|foo}}
- {{{{echo|inner list}} }}
- !! html
- <p>foo
- </p>
- <ul><li>item 1</li></ul>
- !! html/parsoid
- <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>
- <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>
- !! end
- ## Regression test; the output here isn't really that interesting.
- !! test
- Templates with templated name and top level template args
- !! wikitext
- {{1{{2{{{3}}}|4=5}}}}
- !! html/parsoid
- <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>
- !! end
- # Parsoid markup is deliberate "broken". This is an edge case.
- # See long comment in TemplateHandler.js:convertAttribsToString.
- !! test
- Templates with invalid templated targets
- !! wikitext
- {{echo
- {{echo|foo}}
- }}
- !! html/php
- <p>{{echo
- foo
- }}
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo\n{{echo|foo}}\n"},"params":{},"i":0}}]}'>{{echo
- foo }}</p>
- !! end
- !! test
- Template with thumb image (with link in description)
- !! wikitext
- {{paramtest|param=[[Image:noimage.png|thumb|[[no link|link]] [[no link|caption]]]]}}
- !! html/php
- This is a test template with parameter <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=Special:Upload&wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
- !! html+tidy
- <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&wpDestFile=Noimage.png" class="new" title="File:Noimage.png">File:Noimage.png</a> <div class="thumbcaption"><a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">link</a> <a href="/index.php?title=No_link&action=edit&redlink=1" class="new" title="No link (page does not exist)">caption</a></div></div></div>
- !! html/parsoid
- <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>
- !! end
- !! article
- Template:complextemplate
- !! text
- {{{1}}} {{paramtest|
- param ={{{param}}}}}
- !! endarticle
- !! test
- Template with complex arguments
- !! wikitext
- {{complextemplate|
- param ={{ templateasargtest |
- templ = simple }}|[[Template:complextemplate|link]]}}
- !! html
- <p><a href="/wiki/Template:Complextemplate" title="Template:Complextemplate">link</a> This is a test template with parameter (test)
- </p>
- !! end
- !! test
- T2553: link with two variables in a piped link
- !! wikitext
- {|
- |[[{{{1}}}|{{{2}}}]]
- |}
- !! html/php
- <table>
- <tr>
- <td>[[{{{1}}}|{{{2}}}]]
- </td></tr></table>
- !! html/parsoid
- <table>
- <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>
- </tbody></table>
- !! end
- # See: T2553
- !! test
- Abort table cell attribute parsing on wikilink
- !! wikitext
- {|
- |testing [[one|two]] |three||four
- |testing one two |three||four
- |testing="[[one|two]]" |three||four
- |}
- !! html/php
- <table>
- <tr>
- <td>testing <a href="/index.php?title=One&action=edit&redlink=1" class="new" title="One (page does not exist)">two</a> |three</td>
- <td>four
- </td>
- <td>three</td>
- <td>four
- </td>
- <td>testing="<a href="/index.php?title=One&action=edit&redlink=1" class="new" title="One (page does not exist)">two</a>" |three</td>
- <td>four
- </td></tr></table>
- !! html/parsoid
- <table>
- <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>
- <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>
- <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>
- </tbody></table>
- !! end
- !! test
- Don't abort table cell attribute parsing if wikilink is found in template arg
- !! wikitext
- {|
- |Test {{#tag:ref|One two "[[three]]" four}}
- |}
- !! html/parsoid
- <table>
- <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>
- </tbody></table>
- !! end
- !! test
- Magic variable as template parameter
- !! wikitext
- {{paramtest|param={{SITENAME}}}}
- !! html
- <p>This is a test template with parameter MediaWiki
- </p>
- !! end
- !! article
- Template:linktest
- !! text
- [[{{{param}}}|link]]
- !! endarticle
- !! test
- Template parameter as link source
- !! wikitext
- {{linktest|param=Main Page}}
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">link</a>
- </p>
- !! end
- !!article
- Template:paramtest2
- !! text
- including another template, {{paramtest|param={{{arg}}}}}
- !! endarticle
- !! test
- Template passing argument to another template
- !! wikitext
- {{paramtest2|arg='hmm'}}
- !! html
- <p>including another template, This is a test template with parameter 'hmm'
- </p>
- !! end
- !! article
- Template:Linktest2
- !! text
- Main Page
- !! endarticle
- !! test
- Template as link source
- !! wikitext
- [[{{linktest2}}]]
- [[{{linktest2}}|Main Page]]
- [[{{linktest2}}]]Page
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- </p><p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>Page
- </p>
- !! end
- !! article
- Template:loop1
- !! text
- {{loop2}}
- !! endarticle
- !! article
- Template:loop2
- !! text
- {{loop1}}
- !! endarticle
- !! test
- Template infinite loop
- !! wikitext
- {{loop1}}
- !! html
- <p><span class="error">Template loop detected: <a href="/wiki/Template:Loop1" title="Template:Loop1">Template:Loop1</a></span>
- </p>
- !! end
- !! test
- Template from main namespace
- !! wikitext
- {{:Main Page}}
- !! html
- <p>blah blah
- </p>
- !! end
- !! article
- Template:table
- !! text
- {|
- | 1 || 2
- |-
- | 3 || 4
- |}
- !! endarticle
- !! test
- T2529: Template with table, not included at beginning of line
- !! wikitext
- foo {{table}}
- !! html
- <p>foo
- </p>
- <table>
- <tr>
- <td>1</td>
- <td>2
- </td></tr>
- <tr>
- <td>3</td>
- <td>4
- </td></tr></table>
- !! end
- !! test
- T2523: Template shouldn't eat newline (or add an extra one before table)
- !! wikitext
- foo
- {{table}}
- !! html
- <p>foo
- </p>
- <table>
- <tr>
- <td>1</td>
- <td>2
- </td></tr>
- <tr>
- <td>3</td>
- <td>4
- </td></tr></table>
- !! end
- !! test
- T2041: Template parameters shown as broken links
- !! wikitext
- {{{parameter}}}
- !! html
- <p>{{{parameter}}}
- </p>
- !! end
- !! test
- Template with targets containing wikilinks
- !! options
- parsoid=wt2html
- !! wikitext
- {{[[foo]]}}
- {{[[{{echo|foo}}]]}}
- {{{{echo|[[foo}}]]}}
- !! html/php
- <p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
- </p><p>{{<a href="/wiki/Foo" title="Foo">foo</a>}}
- </p><p>{{[[foo}}]]
- </p>
- !! html/parsoid
- <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">foo</a>}}</p>
- <p>{{<a typeof="mw:ExpandedAttrs" rel="mw:WikiLink" href="./Foo" title="Foo" data-mw='{"attribs":[[{"txt":"href"},{"html":"<span about=\"#mwt3\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[17,29,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</span>"}]]}'>foo</a>}}</p>
- <p>{{<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"[[foo}}]]"}},"i":0}}]}'>[[foo}}]]</span></p>
- !! end
- !! article
- Template:''
- !! text
- bar
- !! endarticle
- !! test
- Templates: Double quotes as template target
- !! wikitext
- foo {{''}} baz
- !! html/php
- <p>foo bar baz
- </p>
- !! html/parsoid
- <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"''","href":"./Template:''"},"params":{},"i":0}}]}'>bar</span> baz
- </p>
- !! end
- ## This test is about making sure Parsoid's data-mw is well formed in the
- ## face of multiple templates with intersecting and overlapping ranges. The
- ## wikitext itself is wretched.
- !! test
- Templates with intersecting and overlapping ranges
- !! wikitext
- {|{{echo|
- <p>ha</p>}}
- {|{{echo|
- <p>ho</p>}}
- {{echo|{{!}}hi}}
- |}
- !! html/php+tidy
- <p>ha</p><table>
- </table><p>ho</p><table>
- <tbody><tr>
- <td>hi
- </td></tr></tbody></table>
- !! html/parsoid
- <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<p>ha</p>"}},"i":0}},"\n","{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n<p>ho</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":""}]]}'>
- </table><p about="#mwt1">ho</p><table about="#mwt1" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"","html":""},{"html":""}]]}'>
- <tbody><tr><td>hi</td></tr>
- </tbody></table>
- !! end
- !! article
- Template:MSGNW test
- !! text
- ''None'' of '''this''' should be
- * interpreted
- but rather passed unmodified
- {{test}}
- <gallery>
- File:Foobar.jpg
- </gallery>
- <!-- comment -->
- !! endarticle
- # hmm, fix this or just deprecate msgnw and document its behavior?
- !! test
- msgnw keyword
- !! wikitext
- {{msgnw:MSGNW test}}
- !! html/php
- <p>''None'' of '''this''' should be
- * interpreted
-  but rather passed unmodified
- {{test}}
- <gallery>
- File:Foobar.jpg
- </gallery>
- <!-- comment -->
- </p>
- !! end
- !! test
- int keyword
- !! wikitext
- {{int:youhavenewmessages|lots of money|not!}}
- !! html
- <p>You have lots of money (not!).
- </p>
- !! end
- !! test
- int keyword - non-existing message
- !! wikitext
- {{int:var}}
- !! html
- <p>⧼var⧽
- </p>
- !! end
- !! article
- Template:Includes
- !! text
- Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
- !! endarticle
- !! test
- <includeonly> and <noinclude> being included
- !! wikitext
- {{Includes}}
- !! html
- <p>Foobar
- </p>
- !! end
- !! article
- Template:Includes2
- !! text
- <onlyinclude>Foo</onlyinclude>bar
- !! endarticle
- !! test
- <onlyinclude> being included
- !! wikitext
- {{Includes2}}
- !! html
- <p>Foo
- </p>
- !! end
- !! article
- Template:Includes3
- !! text
- <onlyinclude>Foo</onlyinclude>bar<includeonly>zar</includeonly>
- !! endarticle
- !! test
- <onlyinclude> and <includeonly> being included
- !! wikitext
- {{Includes3}}
- !! html
- <p>Foo
- </p>
- !! end
- !! test
- <includeonly> and <noinclude> on a page
- !! wikitext
- Foo<noinclude>zar</noinclude><includeonly>bar</includeonly>
- !! html
- <p>Foozar
- </p>
- !! end
- !! test
- Un-closed <noinclude>
- !! wikitext
- <noinclude>
- !! html
- !! end
- !! test
- <onlyinclude> on a page
- !! wikitext
- <onlyinclude>Foo</onlyinclude>bar
- !! html
- <p>Foobar
- </p>
- !! end
- !! test
- Un-closed <onlyinclude>
- !! wikitext
- <onlyinclude>
- !! html
- !! end
- !!test
- Self-closed noinclude, includeonly, onlyinclude tags
- !! wikitext
- <noinclude />
- <includeonly />
- <onlyinclude />
- !! html
- <p><br />
- </p>
- !!end
- !!test
- Unbalanced includeonly and noinclude tags
- !! wikitext
- {|
- |a</noinclude>
- |b</noinclude></noinclude>
- |c</noinclude></includeonly>
- |d</includeonly></includeonly>
- |}
- !! html
- <table>
- <tr>
- <td>a
- </td>
- <td>b
- </td>
- <td>c</includeonly>
- </td>
- <td>d</includeonly></includeonly>
- </td></tr></table>
- !!end
- !! article
- Template:Includeonly section
- !! text
- <includeonly>
- ==Includeonly section==
- </includeonly>
- ==Section T-1==
- !!endarticle
- !! test
- T8563: Edit link generation for section shown by <includeonly>
- !! wikitext
- {{includeonly section}}
- !! html
- <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&action=edit&section=T-1" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=T-2" title="Template:Includeonly section">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- # Uses same input as the contents of [[Template:Includeonly section]]
- !! test
- T8563: Section extraction for section shown by <includeonly>
- !! options
- section=T-2
- !! wikitext
- <includeonly>
- ==Includeonly section==
- </includeonly>
- ==Section T-2==
- !! html
- ==Section T-2==
- !! end
- !! test
- T8563: Edit link generation for section suppressed by <includeonly>
- !! wikitext
- <includeonly>
- ==Includeonly section==
- </includeonly>
- ==Section 1==
- !! html
- <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&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- T8563: Section extraction for section suppressed by <includeonly>
- !! options
- section=1
- !! wikitext
- <includeonly>
- ==Includeonly section==
- </includeonly>
- ==Section 1==
- !! html
- ==Section 1==
- !! end
- !! test
- Un-closed <includeonly>
- !! wikitext
- <includeonly>
- !! html/php
- !! html/parsoid
- <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>"}'/>
- !! end
- ## We used to, but no longer wt2wt this test since the default serializer
- ## will normalize the include directives to serialize on their own line.
- ## Selser will take care of preserving formatting in scenarios where they
- ## intermingled with other wikitext.
- !! test
- Includes and comments at SOL
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <!-- comment --><noinclude><!-- comment --></noinclude><!-- comment -->==hu==
- <noinclude>
- some
- </noinclude>*stuff
- *here
- <includeonly>can have stuff</includeonly>===here===
- !! html/php
- <h2><span class="mw-headline" id="hu">hu</span></h2>
- <p>some
- </p>
- <ul><li>stuff</li>
- <li>here</li></ul>
- <h3><span class="mw-headline" id="here">here</span></h3>
- !! html/parsoid
- <!-- comment --><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"<noinclude>"}'/><!-- comment --><meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"</noinclude>"}'/><!-- comment --><h2 id="hu">hu</h2>
- <meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"<noinclude>"}'/>
- <p>some</p>
- <meta typeof="mw:Includes/NoInclude/End" data-parsoid='{"src":"</noinclude>"}'/><ul><li>stuff</li>
- <li>here</li></ul>
- <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>can have stuff</includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><h3 id="here">here</h3>
- !! end
- # TODO: test with DOM fragment reuse!
- !! test
- Parsoid: DOM fragment reuse
- !! options
- parsoid=wt2wt,wt2html
- !! wikitext
- a{{echo|b<table></table>c}}d
- a{{echo|b
- <table></table>
- c}}d
- {{echo|a
- <table></table>
- b}}
- !! html
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b<table></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>
- <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["a",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"b\n<table></table>\nc"}},"i":0}},"d"]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>ab</p><span about="#mwt2">
- </span><table about="#mwt2" data-parsoid='{"stx":"html"}'></table><span about="#mwt2">
- </span><p about="#mwt2">cd</p>
- <p about="#mwt3" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n\n<table></table>\n\nb"}},"i":0}}]}' data-parsoid='{"pi":[[{"k":"1"}]]}'>a</p><span about="#mwt3">
- </span><table about="#mwt3" data-parsoid='{"stx":"html"}'></table><span about="#mwt3">
- </span><p about="#mwt3">b</p>
- !! end
- !! test
- Parsoid: Merge double tds (T52603)
- !! options
- parsoid
- !! wikitext
- {|
- |{{echo|{{!}} foo}}
- |}
- !! html
- <table><tbody>
- <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>
- </tbody></table>
- !! end
- !! test
- Parsoid: Merge double tds in nested transclusion content (T52603)
- !! options
- parsoid
- !! wikitext
- {{echo|<div>}}
- {|
- |{{echo|{{!}} foo}}
- |}
- {{echo|</div>}}
- !! html
- <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}}]}'>
- <table><tbody>
- <tr><td data-mw='{"parts":["|"]}'> foo</td></tr>
- </tbody></table>
- </div>
- !! end
- ###
- ### <includeonly> and <noinclude> in attributes
- ###
- !!test
- 0. includeonly around the entire attribute
- !! wikitext
- <span <includeonly>id="v1"</includeonly><noinclude>id="v2"</noinclude>>bar</span>
- !! html
- <p><span id="v2">bar</span>
- </p>
- !!end
- !!test
- 1. includeonly in html attr key
- !! wikitext
- <span <noinclude>id</noinclude><includeonly>about</includeonly>="foo">bar</span>
- !! html
- <p><span id="foo">bar</span>
- </p>
- !!end
- !!test
- 2. includeonly in html attr value
- !! wikitext
- <span id="<noinclude>v1</noinclude><includeonly>v2</includeonly>">bar</span>
- <span id=<noinclude>"v1"</noinclude><includeonly>"v2"</includeonly>>bar</span>
- !! html
- <p><span id="v1">bar</span>
- <span id="v1">bar</span>
- </p>
- !!end
- !!test
- 3. includeonly in part of an attr value
- !! wikitext
- <span style="color:<noinclude>red</noinclude><includeonly>blue</includeonly>;">bar</span>
- !! html
- <p><span style="color:red;">bar</span>
- </p>
- !!end
- !!test
- 4. includeonly in table attributes
- !! wikitext
- {|
- |- <noinclude>
- |-
- |a
- </noinclude>
- |- <includeonly>
- |-
- |b
- </includeonly>
- |}
- !! html
- <table>
- <tr>
- <td>a
- </td></tr>
- </table>
- !!end
- ###
- ### Preprocessor precedence tests
- ### See: https://www.mediawiki.org/wiki/Preprocessor_ABNF
- ###
- ##{{[[-{{{{{{[[Foo|bar}}]]}-}}}}}]]
- !! test
- Preprocessor precedence 1: link is rightmost opening
- !! options
- parsoid=wt2html
- !! wikitext
- {{[[Foo|bar}}]]
- But close-brace is not a valid character in a link title:
- {{[[Foo}}|bar]]
- However, we can still tell this was handled as a link in the preprocessor:
- {{echo|[[Foo}}|bar]]|bat}}
- !! html/php
- <p>{{<a href="/wiki/Foo" title="Foo">bar}}</a>
- </p><p>But close-brace is not a valid character in a link title:
- {{[[Foo}}|bar]]
- </p><p>However, we can still tell this was handled as a link in the preprocessor:
- [[Foo}}|bar]]
- </p>
- !! html/parsoid
- <p>{{<a rel="mw:WikiLink" href="./Foo" title="Foo">bar}}</a></p>
- <p>But close-brace is not a valid character in a link title: {{[[Foo}}|bar]]</p>
- <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>
- !! end
- !! test
- Preprocessor precedence 2: template is rightmost opening
- !! options
- language=zh
- !! wikitext
- -{{echo|foo}-}}-
- !! html/php
- <p>-foo}--
- </p>
- !! html/parsoid
- <p>-<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}-"}},"i":0}}]}'>foo}-</span>-</p>
- !! end
- !! test
- Preprocessor precedence 3: language converter is rightmost opening
- !! options
- language=zh
- parsoid=wt2html
- !! wikitext
- {{echo|hi}}
- {{-{R|echo|hi}}}-
- [[-{R|raw]]}-
- !! html/php
- <p>hi
- </p><p>{{echo|hi}}
- </p><p>[[raw]]
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi"}},"i":0}}]}'>hi</p>
- <p>{{<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"echo|hi}}"}}'></span></p>
- <p>[[<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw]]"}}'></span></p>
- !! end
- !! test
- Preprocessor precedence 4: left-most angle bracket
- !! options
- language=zh
- !! wikitext
- <!--{raw}-->
- !! html/php
- !! html/parsoid
- <!--{raw}-->
- !! end
- !! article
- Template:Precedence5
- !! text
- {{{{{1}}}}}
- !! endarticle
- !! test
- Preprocessor precedence 5: tplarg takes precedence over template
- !! wikitext
- {{Precedence5|Bullet}}
- !! html/php
- <ul><li>Bar</li></ul>
- !! html/parsoid
- <ul typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"Precedence5","href":"./Template:Precedence5"},"params":{"1":{"wt":"Bullet"}},"i":0}}]}'><li>Bar</li></ul>
- !! end
- !! test
- Preprocessor precedence 6: broken link is rightmost opening
- !! options
- parsoid=wt2html
- !! wikitext
- {{echo|[[Foo}}
- {{echo|[[Foo|bar|bat=baz}}
- !! html/php
- <p>{{echo|[[Foo}}
- </p><p>{{echo|[[Foo|bar|bat=baz}}
- </p>
- !! html/parsoid
- <p>{{echo|[[Foo}}</p>
- <p>{{echo|[[Foo|bar|bat=baz}}</p>
- !! end
- # This next test exposes a difference between PHP and Parsoid:
- # Given [[Foo|{{echo|Bar]]x}}y]]z:
- # 1) Both PHP and Parsoid ignore the `]]` inside the `echo` in the
- # "preprocessor" stage. The `{{echo` extends until the `x}}`, and the
- # outer `[[Foo` extends until the `y]]`
- # 2a) But then the PHP preprocessor emits `[[Foo|Bar]]xy]]z` as an
- # intermediate result (after template expansion), and link processing
- # happens on this intermediate result, which moves the wikilink
- # boundary leftward to `[[Foo|Bar]]`
- # 2b) Parsoid works in a single step, so it's going to keep the
- # wikilink as extending to the `y]]`
- # 3a) Then PHP does linktrail processing which slurps up the trailing
- # `xy` inside the link.
- # 3b) Parsoid will do linktrail processing to slurp up the trailing
- # `z` inside the link.
- # This is "correct" behavior. Parsoid's basic worldview is that the
- # `]]` inside the template shouldn't be allowed to leak out to affect
- # the surrounding wikilink. PHP may match Parsoid (in the future)
- # if you use {{#balance}} (T114445).
- !! test
- Preprocessor precedence 7: broken template is rightmost opening
- !! options
- parsoid=wt2html
- !! wikitext
- [[Foo|{{echo|Bar]]
- [[Foo|{{echo|Bar]]-x}}-y]]-z
- Careful: linktrails can move the end of the wikilink:
- [[Foo|{{echo|y']]a}}l]]l
- !! html/php
- <p><a href="/wiki/Foo" title="Foo">{{echo|Bar</a>
- </p><p><a href="/wiki/Foo" title="Foo">Bar</a>-x-y]]-z
- </p><p>Careful: linktrails can move the end of the wikilink:
- <a href="/wiki/Foo" title="Foo">y'al</a>]]l
- </p>
- !! html/parsoid
- <p>[[Foo|{{echo|Bar]]</p>
- <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>
- <p>Careful: linktrails can move the end of the wikilink:
- <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']]a"}},"i":0}}]}'>y']]a</span>ll</a></p>
- !! end
- !! test
- Preprocessor precedence 8: broken language converter is rightmost opening
- !! options
- language=zh
- !! wikitext
- [[Foo-{R|raw]]
- !! html
- <p>[[Foo-{R|raw]]
- </p>
- !! end
- !! article
- Template:Preprocessor_precedence_9
- !! text
- ;4: {{{{1}}}}
- ;5: {{{{{2}}}}}
- ;6: {{{{{{3}}}}}}
- ;7: {{{{{{{4}}}}}}}
- !! endarticle
- !! test
- Preprocessor precedence 9: groups of braces
- !! wikitext
- {{Preprocessor precedence 9|Four|Bullet|1|2}}
- !! html/php
- <dl><dt>4</dt>
- <dd>{Four}</dd>
- <dt>5</dt>
- <dd></dd></dl>
- <ul><li>Bar</li></ul>
- <dl><dt>6</dt>
- <dd>Four</dd>
- <dt>7</dt>
- <dd>{Bullet}</dd></dl>
- !! html/parsoid
- <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}}]}'>
- <dt>4</dt>
- <dd>{Four}</dd>
- <dt>5</dt>
- <dd></dd>
- </dl><ul about="#mwt1">
- <li>Bar</li>
- </ul><span about="#mwt1"> </span><dl about="#mwt1">
- <dt>6</dt>
- <dd>Four</dd>
- <dt>7</dt>
- <dd>{Bullet}</dd>
- </dl>
- !! end
- !! article
- Template:Preprocessor_precedence_10
- !! text
- ;1: -{R|raw}-
- ;2: -{{Bullet}}-
- ;3: -{{{1}}}-
- ;4: -{{{{2}}}}-
- ;5: -{{{{{3}}}}}-
- ;6: -{{{{{{4}}}}}}-
- ;7: -{{{{{{{5}}}}}}}-
- !! endarticle
- !! test
- Preprocessor precedence 10: groups of braces with leading dash
- !! options
- language=zh
- !! wikitext
- {{Preprocessor precedence 10|Three|raw2|Bullet|1|2}}
- !! html/php
- <dl><dt>1</dt>
- <dd>raw</dd>
- <dt>2</dt>
- <dd>-</dd></dl>
- <ul><li>Bar-</li></ul>
- <dl><dt>3</dt>
- <dd>-Three-</dd>
- <dt>4</dt>
- <dd>raw2</dd>
- <dt>5</dt>
- <dd>-</dd></dl>
- <ul><li>Bar-</li></ul>
- <dl><dt>6</dt>
- <dd>-Three-</dd>
- <dt>7</dt>
- <dd>raw2</dd></dl>
- !! html/parsoid
- <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}}]}'>
- <dt>1</dt>
- <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw"}}'></span></dd>
- <dt>2</dt>
- <dd>-</dd>
- </dl><ul about="#mwt1">
- <li>Bar-</li>
- </ul><span about="#mwt1"> </span><dl about="#mwt1">
- <dt>3</dt>
- <dd>-Three-</dd>
- <dt>4</dt>
- <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
- <dt>5</dt>
- <dd>-</dd>
- </dl><ul about="#mwt1">
- <li>Bar-</li>
- </ul><span about="#mwt1"> </span><dl about="#mwt1">
- <dt>6</dt>
- <dd>-Three-</dd>
- <dt>7</dt>
- <dd><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"raw2"}}'></span></dd>
- </dl>
- !! end
- !! test
- Preprocessor precedence 11: found during visual diff testing
- !! wikitext
- {{#tag:span|-{{#tag:span|-{{echo|x}}}}}}
- {{echo|-{{echo|-{{echo|x}}}}}}
- {{echo|-{{echo|x}}}}
- !! html/php
- <p><span>-<span>-x</span></span>
- </p><p>--x
- </p><p>-x
- </p>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- !! test
- Preprocessor precedence 12: broken language converter closed by brace.
- !! options
- parsoid=wt2html
- !! wikitext
- This form breaks the template, which is unfortunate:
- *{{echo|foo-{bar}bat}}
- But if the broken language converter markup is inside an extension
- tag, nothing bad happens:
- *<nowiki>foo-{bar}bat</nowiki>
- *{{echo|<nowiki>foo-{bar}bat</nowiki>}}
- *<pre>foo-{bar}bat</pre>
- *{{echo|<pre>foo-{bar}bat</pre>}}
- <tag>foo-{bar}bat</tag>
- {{echo|<tag>foo-{bar}bat</tag>}}
- !! html/php+tidy
- <p>This form breaks the template, which is unfortunate:
- </p>
- <ul><li>{{echo|foo-{bar}bat}}</li></ul>
- <p>But if the broken language converter markup is inside an extension
- tag, nothing bad happens:
- </p>
- <ul><li>foo-{bar}bat</li>
- <li>foo-{bar}bat</li>
- <li><pre>foo-{bar}bat</pre></li>
- <li><pre>foo-{bar}bat</pre></li></ul>
- <pre>'foo-{bar}bat'
- array (
- )
- </pre>
- <pre>'foo-{bar}bat'
- array (
- )
- </pre>
- !! html/parsoid
- <p>This form breaks the template, which is unfortunate:</p>
- <ul>
- <li>{{echo|foo-{bar}bat}}</li>
- </ul>
- <p>But if the broken language converter markup is inside an extension tag, nothing bad happens:</p>
- <ul>
- <li><span typeof="mw:Nowiki">foo-{bar}bat</span></li>
- <li><span typeof="mw:Transclusion mw:Nowiki" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<nowiki>foo-{bar}bat</nowiki>"}},"i":0}}]}'>foo-{bar}bat</span></li>
- <li><pre typeof="mw:Extension/pre" data-mw='{"name":"pre","attrs":{},"body":{"extsrc":"foo-{bar}bat"}}'>foo-{bar}bat</pre></li>
- <li><pre typeof="mw:Transclusion mw:Extension/pre" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<pre>foo-{bar}bat</pre>"}},"i":0}}]}'>foo-{bar}bat</pre></li>
- </ul>
- <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":"<tag>foo-{bar}bat</tag>"}},"i":0}}]}'></pre>
- !! end
- !! test
- Preprocessor precedence 13: broken language converter in external link
- !! options
- parsoid=wt2html
- !! wikitext
- *[http://example.com/-{foo Example in URL]
- *[http://example.com Example in -{link} description]
- *{{echo|[http://example.com/-{foo Breaks template, however]}}
- !! html/php+tidy
- <ul><li><a rel="nofollow" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
- <li><a rel="nofollow" class="external text" href="http://example.com">Example in -{link} description</a></li>
- <li>{{echo|<a rel="nofollow" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li></ul>
- !! html/parsoid
- <ul>
- <li><a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Example in URL</a></li>
- <li><a rel="mw:ExtLink" class="external text" href="http://example.com">Example in -{link} description</a></li>
- <li>{{echo|<a rel="mw:ExtLink" class="external text" href="http://example.com/-{foo">Breaks template, however</a>}}</li>
- </ul>
- !! end
- !! test
- Preprocessor precedence 14: broken language converter in comment
- !! wikitext
- *<!--{{foo}}-->...should be ok
- *<!---{{foo}}-->...extra dashes
- *{{echo|foo<!-- -{bar} -->bat}}...should be ok
- !! html/php+tidy
- <ul><li>...should be ok</li>
- <li>...extra dashes</li>
- <li>foobat...should be ok</li></ul>
- !! html/parsoid
- <ul>
- <li><!--{{foo}}-->...should be ok</li>
- <li><!---{{foo}}-->...extra dashes</li>
- <li><span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<!-- -{bar} -->bat"}},"i":0}}]}'>foo</span><span about="#mwt1"><!-- -{bar} --></span><span about="#mwt1">bat</span>...should be ok</li>
- </ul>
- !! end
- !! test
- Preprocessor precedence 15: broken brace markup in headings
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! options
- parsoid=wt2html
- !! wikitext
- __NOTOC__ __NOEDITSECTION__
- ===1 foo[bar 1===
- 1
- ===2 foo[[bar 2===
- 2
- ===3 foo{bar 3===
- 3
- ===4 foo{{bar 4===
- 4
- ===5 foo{{{bar 5===
- 5
- ===6 foo-{bar 6===
- 6
- !! html/php+tidy
- <h3><span id="1_foo.5Bbar_1"></span><span class="mw-headline" id="1_foo[bar_1">1 foo[bar 1</span></h3>
- <p>1
- </p>
- <h3><span id="2_foo.5B.5Bbar_2"></span><span class="mw-headline" id="2_foo[[bar_2">2 foo[[bar 2</span></h3>
- <p>2
- </p>
- <h3><span id="3_foo.7Bbar_3"></span><span class="mw-headline" id="3_foo{bar_3">3 foo{bar 3</span></h3>
- <p>3
- </p>
- <h3><span id="4_foo.7B.7Bbar_4"></span><span class="mw-headline" id="4_foo{{bar_4">4 foo{{bar 4</span></h3>
- <p>4
- </p>
- <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>
- <p>5
- </p>
- <h3><span id="6_foo-.7Bbar_6"></span><span class="mw-headline" id="6_foo-{bar_6">6 foo-{bar 6</span></h3>
- <p>6
- </p>
- !! html/parsoid
- <meta property="mw:PageProp/notoc"/> <meta property="mw:PageProp/noeditsection"/>
- <h3 id="1_foo[bar_1"><span id="1_foo.5Bbar_1" typeof="mw:FallbackId"></span>1 foo[bar 1</h3>
- <p>1</p>
- <h3 id="2_foo[[bar_2"><span id="2_foo.5B.5Bbar_2" typeof="mw:FallbackId"></span>2 foo[[bar 2</h3>
- <p>2</p>
- <h3 id="3_foo{bar_3"><span id="3_foo.7Bbar_3" typeof="mw:FallbackId"></span>3 foo{bar 3</h3>
- <p>3</p>
- <h3 id="4_foo{{bar_4"><span id="4_foo.7B.7Bbar_4" typeof="mw:FallbackId"></span>4 foo{{bar 4</h3>
- <p>4</p>
- <h3 id="5_foo{{{bar_5"><span id="5_foo.7B.7B.7Bbar_5" typeof="mw:FallbackId"></span>5 foo{{{bar 5</h3>
- <p>5</p>
- <h3 id="6_foo-{bar_6"><span id="6_foo-.7Bbar_6" typeof="mw:FallbackId"></span>6 foo-{bar 6</h3>
- <p>6</p>
- !! end
- !! test
- Preprocessor precedence 16: matching closing braces to opening braces
- !! options
- language=zh
- parsoid=wt2html
- !! wikitext
- -{{{echo|foo}}bar}-
- !! html/php
- <p>foobar
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"foo\"}},\"i\":0}}]}'>foo</span>bar"}}'></span></p>
- !! end
- !! test
- Preprocessor precedence 17: template w/o target shouldn't prevent closing
- !! options
- parsoid=wt2html
- !! wikitext
- {{echo|hi {{}}}}
- !! html/php
- <p>hi {{}}
- </p>
- !! html/parsoid
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi {{}}"}},"i":0}}]}'>hi {{}}</p>
- !! end
- !! test
- Preprocessor precedence 18: another rightmost wins scenario
- !! options
- parsoid=wt2html
- !! wikitext
- {{ -{{{{1|tplarg}}} }} }-
- !! html/php
- <p>{{ -{tplarg }} }-
- </p>
- !! html/parsoid
- <p>{{ -{<span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"1"},"params":{"1":{"wt":"tplarg"}},"i":0}}]}'>tplarg</span> }} }-</p>
- !! end
- !! test
- Preprocessor precedence 19: break syntax
- !! options
- parsoid=wt2html
- !! wikitext
- -{{
- !! html/php
- <p>-{{
- </p>
- !! html/parsoid
- <p>-{{</p>
- !! end
- ###
- ### Token Stream Patcher tests
- ###
- ### These tests won't always pass wt2wt and other modes because
- ### on serialization, the table will be output on a new line.
- ### For now, we are blacklisting them, and using this to test selser.
- ###
- !!test
- 1. Table tag in SOL posn. should get reparsed correctly with valid TSR
- !!options
- parsoid=wt2html,wt2wt
- !!wikitext
- {{echo|}}{| width = '100%'
- |foo
- |}
- !!html/parsoid
- <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":""}},"i":0}}]}'></span><table width="100%">
- <tbody><tr><td>foo</td></tr>
- </tbody></table>
- !!end
- ## We used to, but no longer wt2wt this test since the default serializer
- ## will normalize the include directives to serialize on their own line.
- ## Selser will take care of preserving formatting in scenarios where they
- ## intermingled with other wikitext.
- !!test
- 2. Table tag in SOL posn. should get reparsed correctly with valid TSR
- !!options
- parsoid=wt2html
- !!wikitext
- <includeonly>a</includeonly>{| {{{b}}}
- |c
- |}
- !!html/parsoid
- <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>a</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":"<span about=\"#mwt1\" typeof=\"mw:Param\" data-parsoid='{\"pi\":[[]],\"dsr\":[31,38,null,null]}' data-mw='{\"parts\":[{\"templatearg\":{\"target\":{\"wt\":\"b\"},\"params\":{},\"i\":0}}]}'>{{{b}}}</span>"},{"html":""}]]}'>
- <tbody><tr><td>c</td></tr>
- </tbody></table>
- !!end
- !! test
- Table wikitext syntax outside wiki-tables
- !! wikitext
- a
- |+ not a caption
- ! not a table heading
- |- not a table row
- | not a table cell
- | class="foo bar" | baz
- b
- |}
- |-
- c
- !! html
- <p>a
- |+ not a caption
- ! not a table heading
- |- not a table row
- | not a table cell
- | class="foo bar" | baz
- b
- |}
- |-
- c
- </p>
- !! end
- ###
- ### Testing parsing of templates where a template arg
- ### has the same name as the template itself.
- ###
- !! article
- Template:quote
- !! text
- {{{quote|{{{1}}}}}}
- !! endarticle
- !!test
- Templates: Template Name/Arg clash: 1. Use of positional param
- !! wikitext
- {{quote|foo}}
- !! html
- <p>foo
- </p>
- !!end
- !!test
- Templates: Template Name/Arg clash: 2. Use of named param
- !! wikitext
- {{quote|quote=foo}}
- !! html
- <p>foo
- </p>
- !!end
- !!test
- Templates: Template Name/Arg clash: 3. Use of named param with empty input
- !! wikitext
- {{quote|quote}}
- !! html
- <p>quote
- </p>
- !!end
- ###
- ### Parsoid-centric tests to stress Parsoid's ability to RT them unchanged
- ###
- !!test
- Templates: 1. Simple use
- !! wikitext
- {{echo|Foo}}
- !! html
- <p>Foo
- </p>
- !!end
- !!test
- Templates: 2. Inside a block tag
- !! wikitext
- <div>{{echo|Foo}}</div>
- <blockquote>{{echo|Foo}}</blockquote>
- !! html
- <div>Foo</div>
- <blockquote>Foo</blockquote>
- !! html+tidy
- <div>Foo</div>
- <blockquote><p>Foo</p></blockquote>
- !!end
- !!test
- Templates: P-wrapping: 1a. Templates on consecutive lines
- !! wikitext
- {{echo|Foo}}
- {{echo|bar}}
- !! html
- <p>Foo
- bar
- </p>
- !!end
- !!test
- Templates: P-wrapping: 1b. Templates on consecutive lines
- !! wikitext
- Foo
- {{echo|bar}}
- {{echo|baz}}
- !! html
- <p>Foo
- </p><p>bar
- baz
- </p>
- !!end
- !!test
- Templates: P-wrapping: 1c. Templates on consecutive lines
- !! wikitext
- {{echo|Foo}}
- {{echo|bar}} <div>baz</div>
- !! html
- <p>Foo
- </p>
- bar <div>baz</div>
- !! html+tidy
- <p>Foo
- </p><p>
- bar </p><div>baz</div>
- !! end
- !!test
- Templates: P-wrapping: 1d. Template preceded by comment-only line
- !!options
- parsoid
- !! wikitext
- <!-- foo -->
- {{echo|Bar}}
- !! html
- <!-- foo -->
- <p about="#mwt223" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Bar"}},"i":0}}]}'>Bar</p>
- !!end
- !!test
- Templates: Inline Text: 1. Multiple template uses
- !! wikitext
- {{echo|Foo}}bar{{echo|baz}}
- !! html
- <p>Foobarbaz
- </p>
- !!end
- !!test
- Templates: Inline Text: 2. Back-to-back template uses
- !! wikitext
- {{echo|Foo}}{{echo|bar}}
- !! html
- <p>Foobar
- </p>
- !!end
- !!test
- Templates: Block Tags: 1. Multiple template uses
- !! wikitext
- {{echo|<div>Foo</div>}}<div>bar</div>{{echo|<div>baz</div>}}
- !! html
- <div>Foo</div><div>bar</div><div>baz</div>
- !!end
- !!test
- Templates: Block Tags: 2. Back-to-back template uses
- !! wikitext
- {{echo|<div>Foo</div>}}{{echo|<div>bar</div>}}
- !! html
- <div>Foo</div><div>bar</div>
- !!end
- # This is an edge case relating to paragraph wrapping.
- !!test
- Templates: Correctly encapsulate templates producing </p> tag without a corresponding <p> tag
- !! wikitext
- {{echo|a
- b</p>}}
- !! html/parsoid
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\nb</p>"}},"i":0}}]}'>a
- b</p>
- !!end
- !!test
- Templates: Links: 1. Simple example
- !! wikitext
- {{echo|[[Foo|bar]]}}
- !! html
- <p><a href="/wiki/Foo" title="Foo">bar</a>
- </p>
- !!end
- !!test
- Templates: Links: 2. Generation of link href
- !! wikitext
- [[{{echo|Foo}}|bar]]
- !! html
- <p><a href="/wiki/Foo" title="Foo">bar</a>
- </p>
- !!end
- !!test
- Templates: Links: 3. Generation of part of a link href
- !! wikitext
- [[Fo{{echo|o}}|bar]]
- [[Foo{{echo|bar}}]]
- [[Foo{{echo|bar}}baz]]
- [[Foo{{echo|bar}}|bar]]
- [[:Foo{{echo|bar}}]]
- [[:Foo{{echo|bar}}|bar]]
- !! html
- <p><a href="/wiki/Foo" title="Foo">bar</a>
- </p><p><a href="/index.php?title=Foobar&action=edit&redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
- </p><p><a href="/index.php?title=Foobarbaz&action=edit&redlink=1" class="new" title="Foobarbaz (page does not exist)">Foobarbaz</a>
- </p><p><a href="/index.php?title=Foobar&action=edit&redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
- </p><p><a href="/index.php?title=Foobar&action=edit&redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
- </p><p><a href="/index.php?title=Foobar&action=edit&redlink=1" class="new" title="Foobar (page does not exist)">bar</a>
- </p>
- !!end
- !!test
- Templates: Links: 4. Multiple templates generating link href
- !! wikitext
- [[{{echo|F}}{{echo|o}}ob{{echo|ar}}]]
- !! html
- <p><a href="/index.php?title=Foobar&action=edit&redlink=1" class="new" title="Foobar (page does not exist)">Foobar</a>
- </p>
- !!end
- !!test
- Templates: Links: 5. Generation of link text
- !! wikitext
- [[Foo|{{echo|bar}}]]
- !! html
- <p><a href="/wiki/Foo" title="Foo">bar</a>
- </p>
- !!end
- !!test
- Templates: Links: 5. Nested templates (only outermost template should be marked)
- !! wikitext
- {{echo|[[{{echo|Foo}}|bar]]}}
- !! html
- <p><a href="/wiki/Foo" title="Foo">bar</a>
- </p>
- !!end
- !!test
- Templates: HTML Tag: 1. Generation of HTML attr. key
- !! wikitext
- <div {{echo|style}}="color:red;">foo</div>
- !! html
- <div style="color:red;">foo</div>
- !!end
- !!test
- Templates: HTML Tag: 2. Generation of HTML attr. value
- !! wikitext
- <div style={{echo|'color:red;'}}>foo</div>
- !! html
- <div style="color:red;">foo</div>
- !!end
- !!test
- Templates: HTML Tag: 3. Generation of HTML attr key and value
- !! wikitext
- <div {{echo|style}}={{echo|'color:red;'}}>foo</div>
- !! html
- <div style="color:red;">foo</div>
- !!end
- !!test
- Templates: HTML Tag: 4. Generation of starting piece of HTML attr value
- !! wikitext
- <div title="{{echo|This is a long title}} with just one piece templated">foo</div>
- !! html
- <div title="This is a long title with just one piece templated">foo</div>
- !!end
- !!test
- Templates: HTML Tag: 5. Generation of middle piece of HTML attr value
- !! wikitext
- <div title="This is a long title with just {{echo|one piece}} templated">foo</div>
- !! html
- <div title="This is a long title with just one piece templated">foo</div>
- !!end
- !!test
- Templates: HTML Tag: 6. Generation of end piece of HTML attr value
- !! wikitext
- <div title="This is a long title with just one piece {{echo|templated}}">foo</div>
- !! html
- <div title="This is a long title with just one piece templated">foo</div>
- !!end
- # SSS FIXME: While it is great we added support for all this,
- # do we want to make this part of the spec? Maybe we want to
- # deprecate this kind of usage in the future?
- !!test
- Templates: HTML Tag: 7. Generation of partial attribute key string
- !! wikitext
- <div st{{echo|yle}}="color:red;">foo</div>
- !! html
- <div style="color:red;">foo</div>
- !!end
- !! test
- Templates: HTML Tag: 8. Template-generated attribute (k=v)
- !! wikitext
- <div {{echo|1=id="v1"}}>bar</div>
- !! html
- <div id="v1">bar</div>
- !!end
- !! test
- Templates: HTML Tag: 9. Multiple template-generated attributes
- !! wikitext
- <div {{echo|1=id="v1" title="foo"}}>bar</div>
- !! html
- <div id="v1" title="foo">bar</div>
- !!end
- !! test
- Templates: Support for templates generating attributes and content
- !! wikitext
- {| {{mixed_attr_content_template}}
- |-
- |bar
- |}
- !! html/php
- <table style="color:red;" title="T48811">
- <tr>
- <td>foo
- </td></tr>
- <tr>
- <td>bar
- </td></tr></table>
- !! html/parsoid
- <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|}"]}'>
- <tbody><tr>
- <td>foo</td></tr>
- <tr>
- <td>bar</td></tr>
- </tbody></table>
- !!end
- !! test
- 1. Entities and nowikis inside templated attributes should be handled correctly
- !! wikitext
- <div {{echo|style{{=}}"background:#f9f9f9;"}}>foo</div>
- !! html/php
- <div style="background:#f9f9f9;">foo</div>
- !! html/parsoid
- <div style="background:#f9f9f9;" about="#mwt3" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html"}' data-mw='{"attribs":[[{"txt":"style","html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[5,49,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"style{{=}}\\\"background:&amp;#35;f9f9f9;\\\"\"}},\"i\":0}}]}'>style</span><span typeof=\"mw:Nowiki\" about=\"#mwt1\" data-parsoid=\"{}\">=</span><span about=\"#mwt1\" data-parsoid=\"{}\">\"background:</span><span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid='{\"src\":\"&amp;#35;\",\"srcContent\":\"#\"}'>#</span><span about=\"#mwt1\" data-parsoid=\"{}\">f9f9f9;\"</span>"},{"html":""}]]}'>foo</div>
- !! end
- !! test
- 2. Entities and nowikis inside templated attributes should be handled correctly
- !! wikitext
- {|
- |{{table_attribs_3}}
- |}
- !! html/php
- <table>
- <tr>
- <td style="background:#f9f9f9;">Foo
- </td></tr></table>
- !! html/parsoid
- <table>
- <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>
- </tbody></table>
- !! end
- !! test
- 3. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
- !! wikitext
- {{tbl-start}}
- |{{table_attribs_3}}
- {{tbl-end}}
- !! html/php
- <table>
- <tr>
- <td style="background:#f9f9f9;">Foo
- </td></tr></table>
- !! html/parsoid
- <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}}]}'>
- <tbody><tr><td style="background:#f9f9f9;">Foo</td></tr>
- </tbody></table>
- !! end
- # T107622
- !! test
- 4. Entities and nowikis inside templated attributes should be handled correctly inside templated tables
- !! wikitext
- {|
- |{{table_attribs_6}} hi
- |}
- !! html/php
- <table>
- <tr>
- <td style="background: red;">hi
- </td></tr></table>
- !! html/parsoid
- <table>
- <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>
- </tbody></table>
- !! end
- !!test
- Templates: HTML Tables: 1. Generating start of a HTML table
- !! wikitext
- {{echo|<table><tr><td>foo</td>}}</tr></table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 2a. Generating middle of a HTML table
- !! wikitext
- <table><tr>{{echo|<td>foo</td>}}</tr></table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 2b. Generating middle of a HTML table
- !! wikitext
- <table>{{echo|<tr><td>foo</td></tr>}}</table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 3. Generating end of a HTML table
- !! wikitext
- <table><tr>{{echo|<td>foo</td></tr></table>}}
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 4a. Generating a single tag of a HTML table
- !! wikitext
- {{echo|<table>}}<tr><td>foo</td></tr></table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 4b. Generating a single tag of a HTML table
- !! wikitext
- <table>{{echo|<tr>}}<td>foo</td></tr></table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 4c. Generating a single tag of a HTML table
- !! wikitext
- <table><tr>{{echo|<td>}}foo</td></tr></table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 4d. Generating a single tag of a HTML table
- !! wikitext
- <table><tr><td>foo{{echo|</td>}}</tr></table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 4e. Generating a single tag of a HTML table
- !! wikitext
- <table><tr><td>foo</td>{{echo|</tr>}}</table>
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 4f. Generating a single tag of a HTML table
- !! wikitext
- <table><tr><td>foo</td></tr>{{echo|</table>}}
- !! html
- <table><tr><td>foo</td></tr></table>
- !!end
- !!test
- Templates: HTML Tables: 5. Proper fostering of categories from inside
- !!options
- parsoid=wt2html,wt2wt
- !! wikitext
- <table>[[Category:foo1]]<tr><td>foo</td></tr></table>
- <!--Two categories (T52330)-->
- <table>[[Category:bar1]][[Category:bar2]]<tr><td>foo</td></tr></table>
- !! html
- <link rel="mw:PageProp/Category" href="./Category:Foo1"><table><tbody><tr><td>foo</td></tr></tbody></table>
- <!--Two categories (T52330)-->
- <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>
- !!end
- !!test
- Templates: Wiki Tables: 1a. Fostering of entire template content
- !! wikitext
- {|
- {{echo|a}}
- |}
- !! html
- <table>
- a
- <tr><td></td></tr></table>
- !! html/php+tidy
- a
- <table><tbody><tr><td></td></tr></tbody></table>
- !! html/parsoid
- <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">
- </table>
- !! end
- !!test
- Templates: Wiki Tables: 1b. Fostering of entire template content
- !! wikitext
- {|
- {{echo|<div>}}
- foo
- {{echo|</div>}}
- |}
- !! html
- <table>
- <div>
- <p>foo
- </p>
- </div>
- <tr><td></td></tr></table>
- !! html/php+tidy
- <div>
- <p>foo
- </p>
- </div><table>
- <tbody><tr><td></td></tr></tbody></table>
- !! html/parsoid
- <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":"<div>"}},"i":0}},"\nfoo\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</div>"}},"i":1}},"\n|}"]}'>
- <p>foo</p>
- </div><table about="#mwt3">
- </table>
- !! end
- !!test
- Templates: Wiki Tables: 2. Fostering of partial template content
- !! wikitext
- {|
- {{echo|a
- <div>b</div>}}
- |}
- !! html
- <table>
- a
- <div>b</div>
- <tr><td></td></tr></table>
- !! html/php+tidy
- a
- <div>b</div><table>
- <tbody><tr><td></td></tr></tbody></table>
- !! html/parsoid
- <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<div>b</div>"}},"i":0}},"\n|}"]}'>a</p><div about="#mwt2">b</div><table about="#mwt2">
- </table>
- !! end
- !!test
- Templates: Wiki Tables: 3. td-content via multiple templates
- !! wikitext
- {|
- {{echo|{{pipe}}a}}{{echo|b}}
- |}
- !! html
- <table>
- <tr>
- <td>ab
- </td></tr></table>
- !!end
- !!test
- Templates: Wiki Tables: 4. Templated tags, no content
- !! wikitext
- {{tbl-start}}
- {{tbl-end}}
- !! html
- <table>
- <tr><td></td></tr></table>
- !!end
- !!test
- Templates: Wiki Tables: 5. Templated tags, regular td-tags
- !! wikitext
- {{tbl-start}}
- |foo
- {{tbl-end}}
- !! html
- <table>
- <tr>
- <td>foo
- </td></tr></table>
- !!end
- !!test
- Templates: Wiki Tables: 6. Templated tags, templated td-tags
- !! wikitext
- {{tbl-start}}
- {{!}}foo
- {{tbl-end}}
- !! html
- <table>
- <tr>
- <td>foo
- </td></tr></table>
- !!end
- ## This test case is very specific to Parsoid's internals
- ## and is hence only tested for Parsoid's code. Parsoid uses
- ## a <meta> marker tag for <ref> tags and they are expanded
- ## much later. We are verifying that this <meta> tag usage
- ## doesn't prevent foster parenting.
- !!test
- Templates: Wiki Tables: 7. Fosterable <ref>s should get fostered
- !!wikitext
- {{PartialTable}}<ref>foo</ref>
- |}
- <references />
- !!html/parsoid
- <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}},"<ref>foo</ref>\n|}"]}'><a href="./Main_Page#cite_note-1"><span class="mw-reflink-text">[1]</span></a></sup><table about="#mwt2">
- <tbody>
- </tbody></table>
- <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>
- !!end
- !! test
- Templates: Wiki Tables: 8. Fosterable meta-tags should get fostered
- !! wikitext
- {{echo|
- {{{!}}
- {{!}}-}}
- <onlyinclude>
- |foo
- </onlyinclude>
- {{!}}}
- !! html/parsoid
- <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"\n{{{!}}\n{{!}}-"}},"i":0}},"\n<onlyinclude>\n|foo\n</onlyinclude>\n{{!}}}"]}'>
- </span><meta typeof="mw:Includes/OnlyInclude" about="#mwt1"/><table about="#mwt1">
- <tbody><tr>
- <td>foo
- <meta typeof="mw:Includes/OnlyInclude/End"/></td></tr>
- </tbody></table>
- !! end
- !!test
- Templates: Lists: Multi-line list-items via templates
- !! wikitext
- *{{echo|a {{nonexistent|
- unused}}}}
- *{{echo|b {{nonexistent|
- unused}}}}
- !! html
- <ul><li>a <a href="/index.php?title=Template:Nonexistent&action=edit&redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li>
- <li>b <a href="/index.php?title=Template:Nonexistent&action=edit&redlink=1" class="new" title="Template:Nonexistent (page does not exist)">Template:Nonexistent</a></li></ul>
- !!end
- !!test
- Templates: Ugly nesting: 1. Quotes opened/closed across templates (echo)
- !! wikitext
- {{echo|''a}}{{echo|b''c''d}}{{echo|''e}}
- !! html
- <p><i>ab</i>c<i>d</i>e
- </p>
- !!end
- !!test
- Templates: Ugly nesting: 2. Quotes opened/closed across templates (echo_with_span)
- (PHP parser generates misnested html)
- !! wikitext
- {{echo_with_span|''a}}{{echo_with_span|b''c''d}}{{echo_with_span|''e}}
- !! html/parsoid
- <p><span about="#mwt1" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo_with_span","href":"./Template:Echo_with_span"},"params":{"1":{"wt":"''a"}},"i":0}}]}"><i>a</i></span><i about="#mwt2" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo_with_span","href":"./Template:Echo_with_span"},"params":{"1":{"wt":"b''c''d"}},"i":0}},{"template":{"target":{"wt":"echo_with_span","href":"./Template:Echo_with_span"},"params":{"1":{"wt":"''e"}},"i":1}}]}"><span>b</span></i><span about="#mwt2">c</span><i about="#mwt2">d<span></span></i><span about="#mwt2">e</span></p>
- !!end
- !!test
- Templates: Ugly nesting: 3. Quotes opened/closed across templates (echo_with_div)
- (PHP parser generates misnested html; Parsoid html2wt mode adds newlines between {{echo}}s)
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- {{echo_with_div|''a}}{{echo_with_div|b''c''d}}{{echo_with_div|''e}}
- !! html
- <div about="#mwt1" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo_with_div","href":"./Template:Echo_with_div"},"params":{"1":{"wt":"''a"}},"i":0}}]}"><i>a</i></div>
- <div about="#mwt2" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo_with_div","href":"./Template:Echo_with_div"},"params":{"1":{"wt":"b''c''d"}},"i":0}}]}"><i>b</i>c<i>d</i></div>
- <div about="#mwt3" typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo_with_div","href":"./Template:Echo_with_div"},"params":{"1":{"wt":"''e"}},"i":0}}]}">e</div>
- !!end
- !!test
- Templates: Ugly nesting: 4. Divs opened/closed across templates
- !! wikitext
- a<div>b{{echo|c</div>d}}e
- !! html
- a<div>bc</div>de
- !! html+tidy
- <p>a</p><div>bc</div><p>de
- </p>
- !! end
- !! test
- Templates: Ugly templates: 3. newline-only template parameter
- !! wikitext
- foo {{echo|
- }}
- !! html
- <p>foo
- </p>
- !! end
- # This looks like a bug: a single newline triggers p/br for some reason.
- !! test
- Templates: Ugly templates: 4. newline-only template parameter inconsistency
- !! wikitext
- {{echo|
- }}
- !! html
- <p><br />
- </p>
- !! end
- # T66017 -- ugly wikitext with fostered content generates two template ranges that
- # have a true overlap (T1-start - T2-start - T1-end - T2-end).
- !! test
- Templates: Ugly templates: 5. Template encapsulation test: Non-trivial overlap of template ranges is properly handled
- !! wikitext
- {{echo|<table>}}
- {{echo|<div>foo}}
- {{echo|</table>}}
- !! html/parsoid
- <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>foo"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</table>"}},"i":2}}]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[{"k":"1"}],[{"k":"1"}],[{"k":"1"}]]}'>foo
- </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
- </table>
- !! end
- # T66017 -- ugly wikitext with fostered content generates two template ranges
- # that are "identical" and generate nesting cycles in the algorithm
- !! test
- Templates: Ugly templates: 6. Template encapsulation test: Cyclical nesting of template ranges is properly handled
- !! wikitext
- {{echo|<table><tr><td><table>}}
- {{echo|<div>}}
- {{echo|</div>}}
- !! html/parsoid
- <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<table><tr><td><table>"}},"i":0}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<div>"}},"i":1}},"\n",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"</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"}'>
- </div><table about="#mwt1" data-parsoid='{"stx":"html"}'>
- </table></td></tr></tbody></table>
- !! end
- !! test
- Templates: Parameters substituted at the top-level
- !! wikitext
- {{{foo|''who'' {{echo|me}}? '''never!'''}}}
- {{{foo|bar|baz}}}
- !! html/php
- <p><i>who</i> me? <b>never!</b>
- </p><p>bar
- </p>
- !! html/parsoid
- <p about="#mwt2" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"''who'' {{echo|me}}? '''never!'''"}},"i":0}}]}'><i>who</i> me? <b>never!</b></p>
- <p about="#mwt3" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"foo"},"params":{"1":{"wt":"bar"},"2":{"wt":"baz"}},"i":0}}]}'>bar</p>
- !! end
- !! test
- Templates: Param with empty arg in the final position
- !! wikitext
- {{{hi|}}}
- !! html/parsoid
- <span about="#mwt1" typeof="mw:Param" data-mw='{"parts":[{"templatearg":{"target":{"wt":"hi"},"params":{"1":{"wt":""}},"i":0}}]}'></span>
- !! end
- !!test
- Parser Functions: 1. Simple example
- !! wikitext
- {{uc:foo}}
- !! html
- <p>FOO
- </p>
- !!end
- !!test
- Parser Functions: 2. Nested use (only outermost should be marked up)
- !! wikitext
- {{uc:{{lc:FOO}}}}
- !! html
- <p>FOO
- </p>
- !!end
- ###
- ### Pre-save transform tests
- ###
- !! test
- pre-save transform: subst:
- !! options
- pst
- !! wikitext
- {{subst:test}}
- !! html/php
- This is a test template
- !! end
- !! test
- pre-save transform: normal template
- !! options
- pst
- !! wikitext
- {{test}}
- !! html/php
- {{test}}
- !! end
- !! test
- pre-save transform: nonexistent template
- !! options
- pst
- !! wikitext
- {{thistemplatedoesnotexist}}
- !! html/php
- {{thistemplatedoesnotexist}}
- !! end
- !! test
- pre-save transform: subst magic variables
- !! options
- pst
- !! wikitext
- {{subst:SITENAME}}
- !! html/php
- MediaWiki
- !! end
- # This is T2089, which I fixed. -- wtm
- !! test
- pre-save transform: subst: templates with parameters
- !! options
- pst
- !! wikitext
- {{subst:paramtest|param="something else"}}
- !! html/php
- This is a test template with parameter "something else"
- !! end
- !! article
- Template:nowikitest
- !! text
- <nowiki>'''not wiki'''</nowiki>
- !! endarticle
- !! test
- pre-save transform: nowiki in subst (T3188)
- !! options
- pst
- !! wikitext
- {{subst:nowikitest}}
- !! html/php
- <nowiki>'''not wiki'''</nowiki>
- !! end
- !! article
- Template:commenttest
- !! text
- This template has <!-- a comment --> in it.
- !! endarticle
- !! test
- pre-save transform: comment in subst (T3936)
- !! options
- pst
- !! wikitext
- {{subst:commenttest}}
- !! html/php
- This template has <!-- a comment --> in it.
- !! end
- !! test
- pre-save transform: unclosed tag
- !! options
- pst
- !! wikitext
- <nowiki>'''not wiki'''
- !! html/php
- <nowiki>'''not wiki'''
- !! end
- !! test
- pre-save transform: mixed tag case
- !! options
- pst
- !! wikitext
- <NOwiki>'''not wiki'''</noWIKI>
- !! html/php
- <NOwiki>'''not wiki'''</noWIKI>
- !! end
- !! test
- pre-save transform: unclosed comment in <nowiki>
- !! options
- pst
- !! wikitext
- wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
- !! html/php
- wiki<nowiki>nowiki<!--nowiki</nowiki>wiki
- !!end
- # Leading @ in this template definition works around a limitation
- # in parsoid's parserTests which otherwise strips the <span> from the
- # result (confusing it for a template wrapper)
- !! article
- Template:dangerous
- !!text
- @<span onmouseover="alert('crap')">Oh no</span>
- !!endarticle
- !!test
- (confirming safety of fix for subst T3936)
- !! wikitext
- {{Template:dangerous}}
- !! html
- <p>@<span>Oh no</span>
- </p>
- !! end
- !! test
- pre-save transform: comment containing gallery (T7024)
- !! options
- pst
- !! wikitext
- <!-- <gallery>data</gallery> -->
- !! html/php
- <!-- <gallery>data</gallery> -->
- !!end
- !! test
- pre-save transform: comment containing extension
- !! options
- pst
- !! wikitext
- <!-- <tag>data</tag> -->
- !! html/php
- <!-- <tag>data</tag> -->
- !!end
- !! test
- pre-save transform: comment containing nowiki
- !! options
- pst
- !! wikitext
- <!-- <nowiki>data</nowiki> -->
- !! html/php
- <!-- <nowiki>data</nowiki> -->
- !!end
- !! test
- pre-save transform: <noinclude> in subst (T5298)
- !! options
- pst
- !! wikitext
- {{subst:Includes}}
- !! html/php
- Foobar
- !! end
- !! test
- pre-save transform: <onlyinclude> in subst (T5298)
- !! options
- pst
- !! wikitext
- {{subst:Includes2}}
- !! html/php
- Foo
- !! end
- !! article
- Template:SubstTest
- !!text
- {{<includeonly>subst:</includeonly>Includes}}
- !! endarticle
- !! article
- Template:SafeSubstTest
- !! text
- {{<includeonly>safesubst:</includeonly>Includes}}
- !! endarticle
- !! test
- T24297: safesubst: works during PST
- !! options
- pst
- !! wikitext
- {{subst:SafeSubstTest}}{{safesubst:SubstTest}}
- !! html/php
- FoobarFoobar
- !! end
- !! test
- T24297: safesubst: works during normal parse
- !! wikitext
- {{SafeSubstTest}}
- !! html
- <p>Foobar
- </p>
- !! end
- !! test
- subst: does not work during normal parse
- !! wikitext
- {{SubstTest}}
- !! html
- <p>{{subst:Includes}}
- </p>
- !! end
- !! test
- pre-save transform: context links ("pipe trick")
- !! options
- pst
- !! wikitext
- [[Article (context)|]]
- [[Bar:Article|]]
- [[:Bar:Article|]]
- [[Bar:Article (context)|]]
- [[:Bar:Article (context)|]]
- [[|Article]]
- [[|Article (context)]]
- [[Bar:X (Y) Z|]]
- [[:Bar:X (Y) Z|]]
- !! html/php
- [[Article (context)|Article]]
- [[Bar:Article|Article]]
- [[:Bar:Article|Article]]
- [[Bar:Article (context)|Article]]
- [[:Bar:Article (context)|Article]]
- [[Article]]
- [[Article (context)]]
- [[Bar:X (Y) Z|X (Y) Z]]
- [[:Bar:X (Y) Z|X (Y) Z]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with interwiki prefix
- !! options
- pst
- !! wikitext
- [[interwiki:Article|]]
- [[:interwiki:Article|]]
- [[interwiki:Bar:Article|]]
- [[:interwiki:Bar:Article|]]
- !! html/php
- [[interwiki:Article|Article]]
- [[:interwiki:Article|Article]]
- [[interwiki:Bar:Article|Bar:Article]]
- [[:interwiki:Bar:Article|Bar:Article]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with parens in title
- !! options
- pst title=[[Somearticle (context)]]
- !! wikitext
- [[|Article]]
- !! html/php
- [[Article (context)|Article]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with comma in title
- !! options
- pst title=[[Someplace, Somewhere]]
- !! wikitext
- [[|Otherplace]]
- [[Otherplace, Elsewhere|]]
- [[Otherplace, Elsewhere, Anywhere|]]
- !! html/php
- [[Otherplace, Somewhere|Otherplace]]
- [[Otherplace, Elsewhere|Otherplace]]
- [[Otherplace, Elsewhere, Anywhere|Otherplace]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with parens and comma
- !! options
- pst title=[[Someplace (IGNORED), Somewhere]]
- !! wikitext
- [[|Otherplace]]
- [[Otherplace (place), Elsewhere|]]
- !! html/php
- [[Otherplace, Somewhere|Otherplace]]
- [[Otherplace (place), Elsewhere|Otherplace]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with comma and parens
- !! options
- pst title=[[Who, me? (context)]]
- !! wikitext
- [[|Yes, you.]]
- [[Me, Myself, and I (1937 song)|]]
- !! html/php
- [[Yes, you. (context)|Yes, you.]]
- [[Me, Myself, and I (1937 song)|Me, Myself, and I]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with namespace
- !! options
- pst title=[[Ns:Somearticle]]
- !! wikitext
- [[|Article]]
- !! html/php
- [[Ns:Article|Article]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with namespace and parens
- !! options
- pst title=[[Ns:Somearticle (context)]]
- !! wikitext
- [[|Article]]
- !! html/php
- [[Ns:Article (context)|Article]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with namespace and comma
- !! options
- pst title=[[Ns:Somearticle, Context, Whatever]]
- !! wikitext
- [[|Article]]
- !! html/php
- [[Ns:Article, Context, Whatever|Article]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with namespace, comma and parens
- !! options
- pst title=[[Ns:Somearticle, Context (context)]]
- !! wikitext
- [[|Article]]
- !! html/php
- [[Ns:Article (context)|Article]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with namespace, parens and comma
- !! options
- pst title=[[Ns:Somearticle (IGNORED), Context]]
- !! wikitext
- [[|Article]]
- !! html/php
- [[Ns:Article, Context|Article]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with full-width parens and no space (Japanese and Chinese style, T32149)
- !! options
- pst
- !! wikitext
- [[Article(context)|]]
- [[Bar:Article(context)|]]
- [[:Bar:Article(context)|]]
- [[|Article(context)]]
- [[Bar:X(Y)Z|]]
- [[:Bar:X(Y)Z|]]
- !! html/php
- [[Article(context)|Article]]
- [[Bar:Article(context)|Article]]
- [[:Bar:Article(context)|Article]]
- [[Article(context)]]
- [[Bar:X(Y)Z|X(Y)Z]]
- [[:Bar:X(Y)Z|X(Y)Z]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with full-width parens and space (Japanese and Chinese style, T32149)
- !! options
- pst
- !! wikitext
- [[Article (context)|]]
- [[Bar:Article (context)|]]
- [[:Bar:Article (context)|]]
- [[|Article (context)]]
- [[Bar:X (Y) Z|]]
- [[:Bar:X (Y) Z|]]
- !! html/php
- [[Article (context)|Article]]
- [[Bar:Article (context)|Article]]
- [[:Bar:Article (context)|Article]]
- [[Article (context)]]
- [[Bar:X (Y) Z|X (Y) Z]]
- [[:Bar:X (Y) Z|X (Y) Z]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with parens and no space (Korean style, T32149)
- !! options
- pst
- !! wikitext
- [[Article(context)|]]
- [[Bar:Article(context)|]]
- [[:Bar:Article(context)|]]
- [[|Article(context)]]
- [[Bar:X(Y)Z|]]
- [[:Bar:X(Y)Z|]]
- !! html/php
- [[Article(context)|Article]]
- [[Bar:Article(context)|Article]]
- [[:Bar:Article(context)|Article]]
- [[Article(context)]]
- [[Bar:X(Y)Z|X(Y)Z]]
- [[:Bar:X(Y)Z|X(Y)Z]]
- !! end
- !! test
- pre-save transform: context links ("pipe trick") with commas (T23660)
- !! options
- pst
- !! wikitext
- [[Article (context), context|]]
- [[Article (context),context|]]
- [[Bar:Article (context), context|]]
- [[Bar:Article (context),context|]]
- [[:Bar:Article (context), context|]]
- [[:Bar:Article (context),context|]]
- !! html/php
- [[Article (context), context|Article]]
- [[Article (context),context|Article]]
- [[Bar:Article (context), context|Article]]
- [[Bar:Article (context),context|Article]]
- [[:Bar:Article (context), context|Article]]
- [[:Bar:Article (context),context|Article]]
- !! end
- !! test
- Parsoid: backwards pipe trick
- !! wikitext
- [[|'''bar''']]
- !! html/php
- <p>[[|<b>bar</b>]]
- </p>
- !! html/parsoid
- <p>[[|<b>bar</b>]]</p>
- !! end
- !! test
- pre-save transform: trim trailing empty lines
- !! options
- pst
- !! wikitext
- Empty lines are trimmed
- !! html/php
- Empty lines are trimmed
- !! end
- !! test
- pre-save transform: Signature expansion
- !! options
- pst
- !! wikitext
- * ~~~
- * ~~~~
- * ~~~~~
- * <noinclude>~~~</noinclude>
- * <includeonly>~~~</includeonly>
- * <onlyinclude>~~~</onlyinclude>
- !! html/php
- * [[Special:Contributions/127.0.0.1|127.0.0.1]]
- * [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
- * 00:02, 1 January 1970 (UTC)
- * <noinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</noinclude>
- * <includeonly>[[Special:Contributions/127.0.0.1|127.0.0.1]]</includeonly>
- * <onlyinclude>[[Special:Contributions/127.0.0.1|127.0.0.1]]</onlyinclude>
- !! end
- !! test
- ParserOutput flags from signature expansion (T84843)
- !! options
- pst
- showflags
- !! wikitext
- ~~~~
- !! html/php
- [[Special:Contributions/127.0.0.1|127.0.0.1]] 00:02, 1 January 1970 (UTC)
- flags=user-signature
- !! end
- !! test
- pre-save transform: Signature expansion in nowiki tags (T2093)
- !! options
- pst disabled
- !! wikitext
- Shall not expand:
- <nowiki>~~~~</nowiki>
- <includeonly><nowiki>~~~~</nowiki></includeonly>
- <noinclude><nowiki>~~~~</nowiki></noinclude>
- <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
- {{subst:Foo}} shall be converted to FOO
- As well as inside noinclude/onlyinclude
- <noinclude>{{subst:Foo}}</noinclude>
- <onlyinclude>{{subst:Foo}}</onlyinclude>
- But not inside includeonly
- <includeonly>{{subst:Foo}}</includeonly>
- !! html/php
- Shall not expand:
- <nowiki>~~~~</nowiki>
- <includeonly><nowiki>~~~~</nowiki></includeonly>
- <noinclude><nowiki>~~~~</nowiki></noinclude>
- <onlyinclude><nowiki>~~~~</nowiki></onlyinclude>
- FOO shall be converted to FOO
- As well as inside noinclude/onlyinclude
- <noinclude>FOO</noinclude>
- <onlyinclude>FOO</onlyinclude>
- But not inside includeonly
- <includeonly>{{subst:Foo}}</includeonly>
- !! end
- !! test
- Parsoid: Recognize nowiki with trailing space in tags
- !! options
- parsoid=wt2html
- !! wikitext
- <nowiki ><div>[[foo]]</nowiki >
- a<nowiki / >b
- c<nowiki />d
- e<nowiki/ >f
- !! html
- <p><span typeof="mw:Nowiki"><div>[[foo]]</span></p>
- <p>ab</p>
- <p>cd</p>
- <p>ef</p>
- !! end
- !! test
- Parsoid: Recognize nowiki with odd capitalization
- !! options
- parsoid=wt2html
- !! wikitext
- <noWikI ><div>[[foo]]</Nowiki >
- !! html
- <p><span typeof="mw:Nowiki"><div>[[foo]]</span></p>
- !! end
- !! test
- Parsoid: Escape nowiki with trailing space in tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><nowiki > foo </nowiki ></p>
- <p>a<nowiki />b</p>
- <p>c<nowiki/ >d</p>
- !! wikitext
- <nowiki > foo </nowiki >
- a<nowiki />b
- c<nowiki/ >d
- !! end
- !! test
- Parsoid: Escape weird noWikI capitalizations
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><noWikI > foo </NoWikI ></p>
- !! wikitext
- <noWikI > foo </NoWikI >
- !! end
- ###
- ### Message transform tests
- ###
- !! test
- message transform: magic variables
- !! options
- msg
- !! wikitext
- {{SITENAME}}
- !! html
- MediaWiki
- !! end
- !! test
- message transform: should not transform wiki markup
- !! options
- msg
- !! wikitext
- ''test''
- !! html
- ''test''
- !! end
- !! test
- message transform: <noinclude> in transcluded template (T6926)
- !! options
- msg
- !! wikitext
- {{Includes}}
- !! html
- Foobar
- !! end
- !! test
- message transform: <onlyinclude> in transcluded template (T6926)
- !! options
- msg
- !! wikitext
- {{Includes2}}
- !! html
- Foo
- !! end
- !! test
- {{#special:}} page name, known
- !! options
- msg
- !! wikitext
- {{#special:Recentchanges}}
- !! html
- Special:RecentChanges
- !! end
- !! test
- {{#special:}} page name with subpage, known
- !! options
- msg
- !! wikitext
- {{#special:Recentchanges/param}}
- !! html
- Special:RecentChanges/param
- !! end
- !! test
- {{#special:}} page name, unknown
- !! options
- msg
- !! wikitext
- {{#special:foobar nonexistent}}
- !! html
- Special:Foobar nonexistent
- !! end
- !! test
- {{#speciale:}} page name, known
- !! options
- msg
- !! wikitext
- {{#speciale:Recentchanges}}
- !! html
- Special:RecentChanges
- !! end
- !! test
- {{#speciale:}} page name with subpage, known
- !! options
- msg
- !! wikitext
- {{#speciale:Recentchanges/param}}
- !! html
- Special:RecentChanges/param
- !! end
- !! test
- {{#speciale:}} page name, unknown
- !! options
- msg
- !! wikitext
- {{#speciale:foobar nonexistent}}
- !! html
- Special:Foobar_nonexistent
- !! end
- ###
- ### Images
- ###
- ### For Parsoid-specific tests, see
- #### https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
- !! test
- Simple image
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[Image:foobar.jpg]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Serialize simple image with span wrapper
- !! options
- parsoid=html2wt
- !! html/parsoid
- <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>
- !! wikitext
- [[File:Foobar.jpg]]
- !! end
- !! test
- Simple image (using File: namespace, now canonical)
- !! wikitext
- [[File:Foobar.jpg]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Right-aligned image
- !! wikitext
- [[File:Foobar.jpg|right]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with caption
- !! wikitext
- [[File:Foobar.jpg|right|Caption text]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with caption, T55312 #1
- !! wikitext
- [[File:Foobar.jpg|right|Caption page stuff]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with caption, T55312 #2
- !! wikitext
- [[File:Foobar.jpg|right|Caption page=]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with caption, T55312 #3
- !! wikitext
- [[File:Foobar.jpg|right|Caption page=stuff]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image caption with pipe entity
- !! wikitext
- [[File:Foobar.jpg|thumb|one | two]]
- [[File:Foobar.jpg|thumb|one ''two'' | three]]
- !! html/php
- <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 | two</div></div></div>
- <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> | three</div></div></div>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Allow empty links in image captions (T62753)
- !! options
- thumbsize=220
- !! wikitext
- [[File:Foobar.jpg|thumb|Caption [[Link1]]
- [[]]
- [[Link2]]
- ]]
- !! html/php
- <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&action=edit&redlink=1" class="new" title="Link1 (page does not exist)">Link1</a> [[]] <a href="/index.php?title=Link2&action=edit&redlink=1" class="new" title="Link2 (page does not exist)">Link2</a></div></div></div>
- !! html/parsoid
- <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>
- [[]]
- <a rel="mw:WikiLink" href="./Link2" title="Link2" data-parsoid='{"stx":"simple","a":{"href":"./Link2"},"sa":{"href":"Link2"}}'>Link2</a>
- </figcaption></figure>
- !! end
- !! test
- Titles in unlinked images (T23454)
- !! wikitext
- [[File:Foobar.jpg|link=|stuff]]
- !! html/php
- <p><img alt="stuff" src="http://example.com/images/3/3a/Foobar.jpg" title="stuff" width="1941" height="220" />
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Link with empty target
- !! wikitext
- [[]]
- !! html
- <p>[[]]
- </p>
- !! end
- !! test
- Image with link trail
- !! wikitext
- Linktrails should not work for images: [[File:Foobar.jpg]]s
- !! html/php
- <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
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with empty attribute
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|right||Caption text]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- 1. Block image with individual attributes from templates
- !! wikitext
- [[File:Foobar.jpg|thumb|{{echo|137px}}|This is a caption]]
- !! html/php
- <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>
- !! html/parsoid
- <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":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[24,38,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}'>137px</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>
- !! end
- !! test
- 2. Block Image with individual attributes from templates
- !! wikitext
- [[File:Foobar.jpg|{{echo|thumb}}|{{echo|137px}}|This is a caption]]
- !! html/php
- <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>
- !! html/parsoid
- <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":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,32,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"thumb\"}},\"i\":0}}]}'>thumb</span>"}],["width",{"html":"<span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[33,47,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"137px\"}},\"i\":0}}]}'>137px</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>
- !! end
- !! test
- 3. Inline image with individual attributes from templates
- !! wikitext
- [[File:Foobar.jpg|{{echo|50px}}]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <p><figure-inline typeof="mw:Image mw:ExpandedAttrs" about="#mwt2" data-parsoid='{"optList":[{"ck":"width","ak":"{{echo|50px}}"}]}' data-mw='{"attribs":[["width",{"html":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[18,31,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"50px\"}},\"i\":0}}]}'>50px</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>
- !! end
- ## Parsoid does not provide editing support for images where templates produce multiple image attributes.
- ## To signal this, we add a 'mw:Placeholder' type to such images. This could change in the future.
- !! test
- Image with multiple attributes from the same template
- !! wikitext
- [[File:Foobar.jpg|{{image_attribs}}]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with link tails
- !! options
- thumbsize=220
- !! wikitext
- 123[[File:Foobar.jpg]]456
- 123[[File:Foobar.jpg|right]]456
- 123[[File:Foobar.jpg|thumb]]456
- !! html/php
- <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
- </p>
- 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
- 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
- !! html/php+tidy
- <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
- </p><p>
- 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
- 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
- </p>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- !! test
- Image with multiple captions -- only last one is accepted
- !! wikitext
- [[File:Foobar.jpg|right|Caption1 - ignored|[[Caption2]] - ignored|Caption3 - accepted]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with multiple widths -- use last
- !! wikitext
- [[File:Foobar.jpg|200px|300px|caption]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with multiple alignments -- use first (T50664)
- !! options
- thumbsize=220
- !! wikitext
- [[File:Foobar.jpg|thumb|left|right|center|caption]]
- [[File:Foobar.jpg|middle|text-top|caption]]
- !! html/php
- <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>
- <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>
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Image with width attribute at different positions
- !! wikitext
- [[File:Foobar.jpg|200px|right|Caption]]
- [[File:Foobar.jpg|right|200px|Caption]]
- [[File:Foobar.jpg|right|Caption|200px]]
- !! html/php
- <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>
- <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>
- <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>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- # a sad bit of backward-compatibility
- !! test
- Image with size specified with pxpx (T15500, T53628)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|20pxpx]]
- [[File:Foobar.jpg|200x20pxpx]]
- !! html/php
- <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>
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with link parameter, wiki target
- !! wikitext
- [[File:Foobar.jpg|link=Main Page]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- # parsoid T51293 (part 1)
- !! test
- Image with link parameter, URL target
- !! wikitext
- [[File:Foobar.jpg|link=http://example.com/]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- # parsoid T51293 (part 2)
- !! test
- Image with link parameter, protocol-less URL target
- !! wikitext
- [[File:Foobar.jpg|link=//example.com/]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Escaping non-block captions (T107435)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["[typeof~='mw:Image']", "attr", "data-mw", "{\"caption\": \"|\"}"]
- ]
- }
- !! wikitext
- [[Image:Foobar.jpg|caption]]
- !! wikitext/edited
- [[Image:Foobar.jpg|<nowiki>|</nowiki>]]
- !! end
- # wgExternalLinkTarget not supported by Parsoid
- !! test
- Image with link parameter, wgExternalLinkTarget
- !! wikitext
- [[Image:foobar.jpg|link=http://example.com/]]
- !! config
- wgExternalLinkTarget='foobar'
- !! html/php
- <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>
- </p>
- !! end
- !! test
- Image with link parameter, wgNoFollowLinks set to false
- !! wikitext
- [[Image:foobar.jpg|link=http://example.com/]]
- !! config
- wgNoFollowLinks=false
- !! html/php
- <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
- </p>
- !! end
- !! test
- Image with link parameter, wgNoFollowDomainExceptions
- !! wikitext
- [[Image:foobar.jpg|link=http://example.com/]]
- !! config
- wgNoFollowDomainExceptions='example.com'
- !! html/php
- <p><a href="http://example.com/"><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
- </p>
- !! end
- # wgExternalLinkTarget not supported by Parsoid
- !! test
- Image with link parameter, wgExternalLinkTarget, unnamed parameter
- !! wikitext
- [[Image:foobar.jpg|link=http://example.com/|Title]]
- !! config
- wgExternalLinkTarget='foobar'
- !! html/php
- <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>
- </p>
- !! end
- !! test
- Image with empty link parameter
- !! wikitext
- [[File:Foobar.jpg|link=]]
- !! html/php
- <p><img alt="Foobar.jpg" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" />
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with link parameter (wiki target) and unnamed parameter
- !! wikitext
- [[File:Foobar.jpg|link=Main_Page|Title]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with link parameter (URL target) and unnamed parameter
- !! wikitext
- [[File:Foobar.jpg|link=http://example.com/|Title]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Thumbnail image with link parameter
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb|link=http://example.com/|Title]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Manually-specified thumbnail image
- !! options
- thumbsize=220
- !! wikitext
- [[File:Foobar.jpg|thumbnail=Thumb.png|Title]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Manually-specified thumbnail image with explicit link to wiki page
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|Title]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Manually-specified thumbnail image with explicit link to url
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb=Thumb.png|link=http://example.com|Title]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Manually-specified thumbnail image with explicit no link
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb=Thumb.png|link=|Title]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Manually-specified thumbnail image with explicit link and alt text
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb=Thumb.png|link=Main_Page|alt=alttext|Title]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with frame and link
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frame|left|This is a test image [[Main Page]]]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with frame and link and explicit alt
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[Image:Foobar.jpg|frame|left|This is a test image [[Main Page]]|alt=Altitude]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with wiki markup in implicit alt
- !! wikitext
- [[Image:Foobar.jpg|testing '''bold''' in alt]]
- [[Image:Foobar.jpg|alt=testing '''bold''' in alt]]
- !! html/php
- <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>
- </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>
- </p>
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"testing '''bold''' in alt"}]}' data-mw='{"caption":"testing <b data-parsoid='{\"dsr\":[27,37,3,3]}'>bold</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>
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"alt","ak":"alt=testing '''bold''' 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 '''bold''' in alt","resource":"Image:Foobar.jpg"}}'/></a></figure-inline></p>
- !! end
- !! test
- Alt image option should handle most kinds of wikitext without barfing
- !! wikitext
- [[Image:Foobar.jpg|thumb|This is the image caption|alt=This is a [[link]] and a {{echo|''bold template''}}.]]
- !! html/php
- <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>
- !! html/parsoid
- <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|''bold template''}}."}]}' data-mw='{"attribs":[["thumbnail",{"html":"thumb"}],["alt",{"html":"alt=This is a <a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[65,73,2,2]}'>link</a> and a <i about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"dsr\":[80,106,null,null],\"pi\":[[{\"k\":\"1\"}]]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&apos;&apos;bold template&apos;&apos;\"}},\"i\":0}}]}'>bold template</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|''bold template''}}.","resource":"Image:Foobar.jpg"}}'/></a><figcaption>This is the image caption</figcaption></figure>
- !! end
- !! test
- Image with table with attributes in caption
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb|
- {| class="123" |
- |- class="456" |
- | ha
- |}
- ]]
- !! html/parsoid
- <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>
- <table class="123">
- <tbody><tr class="456" data-parsoid='{"startTagSrc":"|-"}'>
- <td> ha</td></tr>
- </tbody></table>
- </figcaption></figure>
- !! end
- !! test
- Image with table with rows from templates in caption
- !! wikitext
- [[File:Foobar.jpg|thumb|
- {|
- {{echo|{{!}} hi}}
- |}
- ]]
- !! html/parsoid
- <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>
- <table>
- <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>
- </tbody></table>
- </figcaption></figure>
- !! end
- !! test
- Image with nested tables in caption
- !! wikitext
- [[File:Foobar.jpg|thumb|Foo<br />
- {|
- |
- {|
- |z
- |}
- |}
- ]]
- !! html/parsoid
- <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Foo<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}'/>
- <table>
- <tbody><tr><td>
- <table>
- <tbody><tr><td>z</td></tr>
- </tbody></table></td></tr>
- </tbody></table>
- </figcaption></figure>
- !! end
- ###################
- # Conflicting image format options.
- # First option specified should 'win'.
- # All three cases in each test should be identical.
- !! test
- Image with 'frameless' first.
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frameless|caption]]
- [[File:Foobar.jpg|frameless|frame|caption]]
- [[File:Foobar.jpg|frameless|thumb|caption]]
- !! html/php
- <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>
- </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>
- </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>
- </p>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- !! test
- Image with 'frame' first.
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frame|caption]]
- [[File:Foobar.jpg|frame|frameless|caption]]
- [[File:Foobar.jpg|frame|thumb|caption]]
- !! html/php
- <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>
- <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>
- <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>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- !! test
- Image with 'thumb' first.
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb|caption]]
- [[File:Foobar.jpg|thumb|frameless|caption]]
- [[File:Foobar.jpg|thumb|frame|caption]]
- !! html/php
- <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>
- <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>
- <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>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- ###################
- # Image sizing.
- # See https://www.mediawiki.org/wiki/Help:Images#Size_and_frame
- # and https://phabricator.wikimedia.org/T64258
- # Foobar has actual size of 1941x220
- # 1. Thumbs & frameless always reduce, can't be enlarged unless it's
- # a scalable format.
- # 2. Framed images always ignore size options; always render at default size.
- # 3. "Unspecified format" and border are the only types which can be
- # enlarged.
- !! test
- Image: unspecified format and border enlarge
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|2000px]]
- [[File:Foobar.jpg|border|2000px]]
- !! html/php
- <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>
- </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>
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Image: "unspecified format" and border reduce
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|1000px]]
- [[File:Foobar.jpg|border|1000px]]
- !! html/php
- <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>
- </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>
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Image: thumbs reduce
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb|50px]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image: bitmap thumbs can't be enlarged past original size, but vector can.
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb|2000px]]
- [[File:Foobar.svg|thumb|2000px]]
- !! html/php
- <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>
- <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>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Image: frameless can reduce in size
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frameless|50px]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image: bitmap frameless can't be enlarged past original size, but vector can
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frameless|2000px]]
- [[File:Foobar.svg|frameless|2000px]]
- !! html/php
- <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>
- </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>
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Image: framed images are always unscaled.
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frame]]
- [[File:Foobar.jpg|frame|50px]]
- [[File:Foobar.jpg|frame|50x50px]]
- [[File:Foobar.jpg|frame|2000px]]
- !! html/php
- <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>
- <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>
- <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>
- <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>
- !! html/parsoid
- <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>
- <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>
- <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>
- <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>
- !! end
- ###################
- !! test
- Link to image page- image page normally doesn't exists, hence edit link
- Add test with existing image page
- #<p><a href="/wiki/File:Test" title="Image:Test">Image:test</a>
- !! wikitext
- [[:Image:test]]
- !! html
- <p><a href="/index.php?title=File:Test&action=edit&redlink=1" class="new" title="File:Test (page does not exist)">Image:test</a>
- </p>
- !! end
- !! test
- T20784 Link to non-existent image page with caption should use caption as link text
- !! wikitext
- [[:Image:test|caption]]
- !! html
- <p><a href="/index.php?title=File:Test&action=edit&redlink=1" class="new" title="File:Test (page does not exist)">caption</a>
- </p>
- !! end
- !! test
- Frameless image caption with a free URL
- !! wikitext
- [[File:Foobar.jpg|http://example.com]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"http://example.com"}]}' data-mw='{"caption":"<a rel=\"mw:ExtLink\" href=\"http://example.com\" data-parsoid='{\"stx\":\"url\",\"dsr\":[18,36,0,0]}'>http://example.com</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>
- !! end
- !! test
- Thumbnail image caption with a free URL
- !! options
- thumbsize=220
- !! wikitext
- [[File:Foobar.jpg|thumb|http://example.com]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Thumbnail image caption with a free URL and explicit alt
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb|http://example.com|alt=Alteration]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- SVG thumbnails with no language set
- !! options
- !! wikitext
- [[File:Foobar.svg|thumb|caption]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- SVG thumbnails with language de
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.svg|thumb|caption|lang=de]]
- !! html/php
- <div class="thumb tright"><div class="thumbinner" style="width:182px;"><a href="/index.php?title=File:Foobar.svg&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>
- !! html/parsoid
- <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>
- !! end
- !! test
- SVG thumbnails with invalid language code
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.svg|thumb|caption|lang=invalid:language:code]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- T3887: A ISBN with a thumbnail
- !! wikitext
- [[File:Foobar.jpg|thumb|ISBN 1235467890]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- T3887: A RFC with a thumbnail
- !! wikitext
- [[File:Foobar.jpg|thumb|This is RFC 12354]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- T3887: A mailto link with a thumbnail
- !! wikitext
- [[File:Foobar.jpg|thumb|Please mailto:nobody@example.com]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- # Pending resolution to T2368
- !! test
- T2648: Frameless image caption with a link
- !! wikitext
- [[File:Foobar.jpg|text with a [[link]] in it]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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 <a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,38,2,2]}'>link</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>
- !! end
- !! test
- T2648: Frameless image caption with a link (suffix)
- !! wikitext
- [[File:Foobar.jpg|text with a [[link]]foo in it]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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 <a rel=\"mw:WikiLink\" href=\"./Link\" title=\"Link\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Link\"},\"sa\":{\"href\":\"link\"},\"dsr\":[30,41,2,5],\"tail\":\"foo\"}'>linkfoo</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>
- !! end
- !! test
- T2648: Frameless image caption with an interwiki link
- !! wikitext
- [[File:Foobar.jpg|text with a [[MeatBall:Link]] in it]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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 <a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,47,2,2]}'>MeatBall:Link</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>
- !! end
- !! test
- T2648: Frameless image caption with a piped interwiki link
- !! wikitext
- [[File:Foobar.jpg|text with a [[MeatBall:Link|link]] in it]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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 <a rel=\"mw:WikiLink/Interwiki\" href=\"http://www.usemod.com/cgi-bin/mb.pl?Link\" title=\"meatball:Link\" data-parsoid='{\"stx\":\"piped\",\"a\":{\"href\":\"http://www.usemod.com/cgi-bin/mb.pl?Link\"},\"sa\":{\"href\":\"MeatBall:Link\"},\"isIW\":true,\"dsr\":[30,52,16,2]}'>link</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>
- !! end
- !! test
- T107474: Frameless image caption with <nowiki>
- !! wikitext
- [[File:Foobar.jpg|<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>]]
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"<nowiki>text with a [[MeatBall:Link|link]] in it</nowiki>"}]}' data-mw='{"caption":"<span typeof=\"mw:Nowiki\" data-parsoid='{\"dsr\":[18,75,8,9]}'>text with a [[MeatBall:Link|link]] in it</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>
- !! end
- !! test
- Escape HTML special chars in image alt text
- !! wikitext
- [[File:Foobar.jpg|& < > "]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"& < > \""}]}' data-mw='{"caption":"&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>
- !! end
- !! test
- Escape HTML special chars in image alt text with LanguageConverter
- !! options
- language=zh
- !! wikitext
- [[File:Foobar.jpg|& < > "]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"& < > \""}]}' data-mw='{"caption":"&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>
- !! end
- !! test
- Entities in file name and attributes
- !! wikitext
- [[File:7%25 solution.gif|manualthumb=7%25 solution.gif|link=7%25 solution|[[7%25 solution]]]]
- !! html/php
- <p><a href="/index.php?title=Special:Upload&wpDestFile=7%25_solution.gif" class="new" title="File:7% solution.gif">7% solution</a>
- </p>
- !! html/parsoid
- <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":"<a rel=\"mw:WikiLink\" href=\"./7%25_solution\" title=\"7% solution\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./7%25_solution\"},\"sa\":{\"href\":\"7%25 solution\"},\"dsr\":[74,91,2,2]}'>7% solution</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>
- !! end
- !! test
- T2499: Alt text should have Ӓ, not &1234;
- !! wikitext
- [[File:Foobar.jpg|♀]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"&#9792;"}]}' data-mw='{"caption":"<span typeof=\"mw:Entity\" data-parsoid='{\"src\":\"&amp;#9792;\",\"srcContent\":\"♀\",\"dsr\":[18,25,null,null]}'>♀</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>
- !! end
- !! test
- Broken image caption with link
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[Image:Foobar.jpg|thumb|This is a broken caption. But [[Main Page|this]] is just an ordinary link.
- !! html/php
- <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.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image caption containing another image
- !! wikitext
- [[File:Foobar.jpg|thumb|This is a caption with another [[File:Thumb.png|image]] inside it!]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image: caption containing a newline
- !! wikitext
- [[File:Foobar.jpg|This
- *is some text]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !!end
- !!test
- Image: caption containing leading space
- (The leading space should not trigger nowiki escaping in wt2wt mode)
- !! wikitext
- [[File:Foobar.jpg|thumb| bar]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !!end
- # html/php output not have newlines after table, td, th, etc. because
- # Linker::makeThumbLink2() replaces the newlines with spaces since
- # the table is inside a caption.
- # FIXME: Verify if that circa 2004 fix is still required.
- !! test
- Image: caption containing a table
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[Image:Foobar.jpg|thumb|200px|This is an example image thumbnail caption with a table
- {|
- !Foo!!Bar
- |-
- |Foo1||Bar1
- |}
- and some more text.]]
- !! html/php
- <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>
- !! html/parsoid
- <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
- <table>
- <tbody>
- <tr><th>Foo</th><th>Bar</th></tr>
- <tr>
- <td>Foo1</td>
- <td>Bar1</td></tr></tbody></table>and some more text.</figcaption></figure>
- !! end
- !! test
- T5090: External links other than http: in image captions
- !! wikitext
- [[File:Foobar.jpg|thumb|200x200px|This caption has [irc://example.net irc] and [https://example.com Secure] ext links in it.]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Custom class
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[Image:foobar.jpg|a|class=b]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Localized image handling (1).
- !! options
- parsoid=wt2html,wt2wt,html2html
- language=es
- !! wikitext
- [[Archivo:Foobar.jpg|izquierda|enlace=foo|caption]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Localized image handling (2).
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- language=es
- !! wikitext
- [[Archivo:Foobar.jpg|miniatura|izquierda|enlace=foo|caption]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Localized image handling (3).
- !! options
- language=fa
- parsoid=html2wt
- !! html/parsoid
- <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>
- !! wikitext
- [[File:Foobar.jpg|بندانگشتی]]
- !! end
- !! test
- "border", "frameless" and "class" attributes on an image.
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frameless|border|class=extra|caption]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- # Note that 'right' is the default alignment, despite the misspelled 'righ' below
- !! test
- Invalid image attributes (T64500)
- !! options
- thumbsize=220
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|thumb|float|left|caption]]
- [[File:Foobar.jpg|thumb|righ|caption]]
- [[File:Foobar.jpg|bogus1|thumb|bogus2|left|bogus3|caption]]
- !! html/php
- <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>
- <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>
- <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>
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- !! article
- File:Barfoo.jpg
- !! text
- #REDIRECT [[File:Barfoo.jpg]]
- !! endarticle
- # FIXME: Parsoid should run this test -- but we'd need to teach the
- # mockAPI about the redirected Barfoo.jpg image.
- !! test
- Redirected image
- !! wikitext
- [[Image:Barfoo.jpg]]
- !! html/php
- <p><a href="/wiki/File:Barfoo.jpg" class="mw-redirect" title="File:Barfoo.jpg">File:Barfoo.jpg</a>
- </p>
- !! end
- !! test
- Missing image with uploads disabled
- !! options
- wgEnableUploads=0
- !! wikitext
- [[File:Foobaz.jpg]]
- !! html/php
- <p><a href="/wiki/File:Foobaz.jpg" title="File:Foobaz.jpg">File:Foobaz.jpg</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- # Parsoid-specific testing for images
- # https://www.mediawiki.org/wiki/Parsoid/MediaWiki_DOM_spec#Images
- # Currently imperfect due to a flaw in the Parsoid testrunner
- # Work in progress
- # THESE TESTS SHOULD BE MOVED UP and merged with the php-specific
- # image tests.
- !! test
- Parsoid-specific image handling - simple image with size and middle alignment
- !! wikitext
- [[File:Foobar.jpg|middle|50px]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - simple image with size, middle alignment,
- non-standard namespace alias
- !! options
- parsoid=wt2wt,wt2html,html2html
- !! wikitext
- [[Image:Foobar.jpg|middle|50px]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - simple image with size and middle alignment
- (existing content)
- !! wikitext
- [[File:Foobar.jpg|50px|middle]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - simple image with size and middle alignment
- and non-standard namespace name
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[Image:Foobar.jpg|50px|middle]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - simple image with both sizes, a baseline alignment, and a caption
- !! wikitext
- [[File:Foobar.jpg|500x10px|baseline|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - simple image with border and size spec
- !! wikitext
- [[File:Foobar.jpg|50px|border|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - thumbnail with halign, valign, and caption
- !! wikitext
- [[File:Foobar.jpg|left|baseline|thumb|caption content]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - thumbnail with halign, valign, and caption
- (existing content)
- !! wikitext
- [[File:Foobar.jpg|thumb|left|baseline|caption content]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - thumbnail with specific size, halign, valign, and caption
- !! wikitext
- [[Image:Foobar.jpg|right|middle|thumb|50x50px|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - thumbnail with specific size, halign,
- valign, and caption (existing content)
- !! wikitext
- [[File:Foobar.jpg|thumb|50x50px|right|middle|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - framed image with specific size and caption
- (size is ignored)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|frame|500x50px|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - framed image with specific size, halign, valign, and caption
- (size is ignored)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- [[File:Foobar.jpg|left|baseline|frame|500x50px|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - frameless image with specific size, border, and caption
- !! wikitext
- [[File:Foobar.jpg|frameless|442x50px|border|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - simple image with a formatted caption
- !! wikitext
- [[File:Foobar.jpg|<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>]]
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"<table><tr><td>a</td><td>b</td></tr><tr><td>c</td></tr></table>"}]}' data-mw='{"caption":"<table data-parsoid='{\"stx\":\"html\",\"dsr\":[18,81,7,8]}'><tbody data-parsoid='{\"dsr\":[25,73,0,0]}'><tr data-parsoid='{\"stx\":\"html\",\"dsr\":[25,54,4,5]}'><td data-parsoid='{\"stx\":\"html\",\"dsr\":[29,39,4,5]}'>a</td><td data-parsoid='{\"stx\":\"html\",\"dsr\":[39,49,4,5]}'>b</td></tr><tr data-parsoid='{\"stx\":\"html\",\"dsr\":[54,73,4,5]}'><td data-parsoid='{\"stx\":\"html\",\"dsr\":[58,68,4,5]}'>c</td></tr></tbody></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>
- !! end
- !! test
- Parsoid-specific image handling - caption with a template in it
- !! wikitext
- [[File:Foobar.jpg|thumb|200x23px|This caption has a {{echo|transclusion}} in it.]]
- !! html/parsoid
- <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="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"transclusion"}},"i":0}}]}">transclusion</span> in it.</figcaption></figure>
- !! end
- !! test
- Parsoid-specific image handling - caption with unbalanced tags in it
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- foo
- [[File:Foobar.jpg|thumb|200x200px|This caption has a <center>unbalanced tag in it.]]
- bar
- !! html/parsoid
- <p>foo</p>
- <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>
- <p>bar</p>
- !! end
- !! test
- Parsoid-specific image handling - empty caption (1)
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- [[File:Foobar.jpg|thumb|]]
- !! html/parsoid
- <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>
- !! end
- # empty captions don't get serialized unless we're in the "round trip" case
- !! test
- Parsoid-specific image handling - empty caption (2)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <figure class="mw-default-size" 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="25" width="220"/>
- </a>
- <figcaption></figcaption>
- </figure>
- !! wikitext
- [[File:Foobar.jpg|thumb]]
- !! end
- !! test
- Parsoid-specific image handling - whitespace caption
- !! wikitext
- [[File:Foobar.jpg|thumb| ]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Parsoid-specific image handling - lang option
- !! wikitext
- foo
- [[File:Foobar.svg|lang=de|caption]]
- bar
- !! html/parsoid
- <p>foo
- <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>
- bar</p>
- !! end
- ## Edge case bugs in Parsoid from T93580
- !! test
- T93580: 1. Templated <ref> inside block images
- !! wikitext
- [[File:Foobar.jpg|thumb|Caption with templated ref: {{echo|<ref>foo</ref>}}]]
- <references />
- !! html/parsoid
- <figure class="mw-default-size" typeof="mw:Image/Thumb" data-parsoid='{"optList":[{"ck":"thumbnail","ak":"thumb"},{"ck":"caption","ak":"Caption with templated ref: {{echo|<ref>foo</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":"<ref>foo</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>
- <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>
- !! end
- !! test
- T93580: 2. <ref> inside inline images
- !! wikitext
- [[File:Foobar.jpg|Undisplayed caption in inline image with ref: <ref>foo</ref>]]
- <references />
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: <ref>foo</ref>"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: <sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Extension/ref\" data-parsoid='{\"dsr\":[64,78,5,6]}' 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;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></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>
- <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>
- !! end
- !! test
- T93580: 3. Templated <ref> inside inline images
- !! wikitext
- [[File:Foobar.jpg|Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}]]
- <references />
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"caption","ak":"Undisplayed caption in inline image with ref: {{echo|<ref>{{echo|foo}}</ref>}}"}]}' data-mw='{"caption":"Undisplayed caption in inline image with ref: <sup about=\"#mwt2\" class=\"mw-ref\" id=\"cite_ref-1\" rel=\"dc:references\" typeof=\"mw:Transclusion mw:Extension/ref\" data-parsoid='{\"dsr\":[64,96,null,null],\"pi\":[[{\"k\":\"1\"}]]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"&lt;ref>{{echo|foo}}&lt;/ref>\"}},\"i\":0}}]}'><a href=\"./Main_Page#cite_note-1\" style=\"counter-reset: mw-Ref 1;\" data-parsoid=\"{}\"><span class=\"mw-reflink-text\" data-parsoid=\"{}\">[1]</span></a></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>
- <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>
- !! end
- ###
- ### Subpages
- ###
- !! article
- Subpage test/subpage
- !! text
- foo
- !! endarticle
- !! test
- Subpage link
- !! options
- subpage title=[[Subpage test]]
- !! wikitext
- [[/subpage]]
- !! html
- <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a>
- </p>
- !! end
- !! test
- Subpage noslash link
- !! options
- subpage title=[[Subpage test]]
- !! wikitext
- [[/subpage/]]
- !! html
- <p><a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">subpage</a>
- </p>
- !! end
- !! article
- Subpage test/1/2/subpage
- !! text
- blah
- !! endarticle
- !! test
- Relative subpage noslash link
- !! options
- parsoid=wt2wt,wt2html,html2html
- subpage title=[[Subpage test/1/2/3/4]]
- !! wikitext
- [[../../subpage/]]
- [[../../subpage]]
- !! html/php
- <p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a>
- </p><p><a href="/wiki/Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage test/1/2/subpage</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">subpage</a></p>
- <p><a rel="mw:WikiLink" href="./Subpage_test/1/2/subpage" title="Subpage test/1/2/subpage">Subpage_test/1/2/subpage</a></p>
- !! end
- !! test
- Parsoid: dot-slash prefixed wikilinks
- !! wikitext
- [[./foo]]
- [[././bar]]
- [[././baz/]]
- !! html/php
- <p>[[./foo]]
- </p><p>[[././bar]]
- </p><p>[[././baz/]]
- </p>
- !! html/parsoid
- <p>[[./foo]]
- </p><p>[[././bar]]
- </p><p>[[././baz/]]
- </p>
- !! end
- !! test
- Render invalid page names as plain text (T53090)
- !! wikitext
- [[./../foo|bar]]
- [[foo�|bar]]
- [[foo/.|bar]]
- [[foo/..|bar]]
- [[foo~~~bar]]
- [[foo>bar]]
- [[foo[bar]]
- [[.]]
- [[..]]
- [[foo././bar]]
- [[foo[http://example.com]xyz]]
- [[{{echo|./../foo}}|bar]]
- [[{{echo|foo/.}}|bar]]
- [[{{echo|foo/..}}|bar]]
- [[{{echo|foo~~~~bar}}]]
- [[{{echo|foo>bar}}]]
- [[{{echo|foo././bar}}]]
- [[{{echo|foo{bar}}]]
- [[{{echo|foo}bar}}]]
- [[{{echo|foo[bar}}]]
- [[{{echo|foo]bar}}]]
- [[{{echo|foo<bar}}]]
- !!html/php
- <p>[[./../foo|bar]]
- [[foo�|bar]]
- [[foo/.|bar]]
- [[foo/..|bar]]
- [[foo~~~bar]]
- [[foo>bar]]
- [[foo[bar]]
- [[.]]
- [[..]]
- [[foo././bar]]
- [[foo<a rel="nofollow" class="external autonumber" href="http://example.com">[1]</a>xyz]]
- </p><p>[[./../foo|bar]]
- [[foo/.|bar]]
- [[foo/..|bar]]
- [[foo~~~~bar]]
- [[foo>bar]]
- [[foo././bar]]
- [[foo{bar]]
- [[foo}bar]]
- [[foo[bar]]
- [[foo]bar]]
- [[foo<bar]]
- </p>
- !!html/parsoid
- <p>[[./../foo|bar]]
- [[foo�|bar]]
- [[foo/.|bar]]
- [[foo/..|bar]]
- [[foo~~~bar]]
- [[foo>bar]]
- [[foo[bar]]
- [[.]]
- [[..]]
- [[foo././bar]]
- [[foo<a rel="mw:ExtLink" class="external autonumber" href="http://example.com"></a>xyz]]</p>
- <p>[[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"./../foo"}},"i":0}}]}'>./../foo</span>|bar]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/."}},"i":0}}]}'>foo/.</span>|bar]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo/.."}},"i":0}}]}'>foo/..</span>|bar]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo~~~~bar"}},"i":0}}]}'>foo~~~~bar</span>]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo>bar"}},"i":0}}]}'>foo>bar</span>]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo././bar"}},"i":0}}]}'>foo././bar</span>]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo{bar"}},"i":0}}]}'>foo{bar</span>]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo}bar"}},"i":0}}]}'>foo}bar</span>]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo[bar"}},"i":0}}]}'>foo[bar</span>]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo]bar"}},"i":0}}]}'>foo]bar</span>]]
- [[<span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<bar"}},"i":0}}]}'>foo<bar</span>]]</p>
- !!end
- !! test
- Disabled subpages
- !! wikitext
- [[/subpage]]
- !! html
- <p><a href="/index.php?title=/subpage&action=edit&redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a>
- </p>
- !! end
- !! test
- T2561: {{/Subpage}}
- !! options
- subpage title=[[Page]]
- !! wikitext
- {{/Subpage}}
- !! html
- <p><a href="/index.php?title=Page/Subpage&action=edit&redlink=1" class="new" title="Page/Subpage (page does not exist)">Page/Subpage</a>
- </p>
- !! end
- ###
- ### Categories
- ###
- !! article
- Category:MediaWiki User's Guide
- !! text
- blah
- !! endarticle
- !! test
- Link to category
- !! wikitext
- [[:Category:MediaWiki User's Guide]]
- !! html
- <p><a href="/wiki/Category:MediaWiki_User%27s_Guide" title="Category:MediaWiki User's Guide">Category:MediaWiki User's Guide</a>
- </p>
- !! end
- !! test
- Simple category
- !! options
- cat
- !! wikitext
- [[Category:MediaWiki User's Guide]]
- !! html/php
- cat=MediaWiki_User's_Guide sort=
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide" data-parsoid='{"stx":"simple","a":{"href":"./Category:MediaWiki_User's_Guide"},"sa":{"href":"Category:MediaWiki User's Guide"}}'/>
- !! end
- !! test
- PAGESINCATEGORY invalid title fatal (r33546 fix)
- !! wikitext
- {{PAGESINCATEGORY:<bogus>}}
- !! html
- <p>0
- </p>
- !! end
- !! test
- Category with different sort key
- !! options
- cat
- !! wikitext
- [[Category:MediaWiki User's Guide|Foo]]
- !! html/php
- cat=MediaWiki_User's_Guide sort=Foo
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#Foo" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User's_Guide"},"sa":{"href":"Category:MediaWiki User's Guide"}}'/>
- !! end
- !! test
- Category with identical sort key
- !! options
- cat
- !! wikitext
- [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
- !! html/php
- cat=MediaWiki_User's_Guide sort=MediaWiki User's Guide
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:MediaWiki_User's_Guide#MediaWiki%20User's%20Guide" data-parsoid='{"stx":"piped","a":{"href":"./Category:MediaWiki_User's_Guide"},"sa":{"href":"Category:MediaWiki User's Guide"}}'/>
- !! end
- !! test
- Category with empty sort key
- !! options
- cat
- pst
- !! wikitext
- [[Category:MediaWiki User's Guide|]]
- !! html/php
- [[Category:MediaWiki User's Guide|MediaWiki User's Guide]]
- !! end
- !! test
- Category with empty sort key and parentheses
- !! options
- cat
- pst
- !! wikitext
- [[Category:Foo (bar)|]]
- !! html/php
- [[Category:Foo (bar)|Foo]]
- !! end
- !! test
- Category with link tail
- !! options
- cat
- pst
- !! wikitext
- 123[[Category:Foo]]456
- !! html/php
- 123[[Category:Foo]]456
- !! end
- !! test
- Category with template
- !! options
- cat
- pst
- !! wikitext
- [[Category:{{echo|Foo}}]]
- !! html/php
- [[Category:{{echo|Foo}}]]
- !! end
- !! test
- Category with template in sort key
- !! options
- cat
- pst
- !! wikitext
- [[Category:Foo|{{echo|Bar}}]]
- !! html/php
- [[Category:Foo|{{echo|Bar}}]]
- !! end
- !! test
- Category with template in sort key and title
- !! options
- cat
- pst
- !! wikitext
- [[Category:{{echo|Foo}}|{{echo|Bar}}]]
- !! html/php
- [[Category:{{echo|Foo}}|{{echo|Bar}}]]
- !! end
- ## We used to, but no longer wt2wt this test since the default serializer
- ## will normalize all categories to serialize on their own line.
- ## This wikitext usage is going to be fairly uncommon in production and
- ## selser will take care of preserving formatting in those scenarios.
- !! test
- Category / paragraph interactions
- !! options
- parsoid=wt2html
- !! wikitext
- Foo [[Category:Baz]] Bar
- Foo [[Category:Baz]]
- Bar
- Foo
- [[Category:Baz]]
- Bar
- Foo
- [[Category:Baz]] Bar
- Foo
- [[Category:Baz]]
- [[Category:Baz]]
- [[Category:Baz]]
- Bar
- [[Category:Baz]]
- [[Category:Baz]]
- [[Category:Baz]]
- [[Category:Baz]]
- {{echo|[[Category:Baz]]}}
- [[Category:Baz]]
- !! html/php
- <p>Foo Bar
- </p><p>Foo
- Bar
- </p><p>Foo
- Bar
- </p><p>Foo Bar
- </p><p>Foo
- Bar
- </p>
- !! html/parsoid
- <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
- <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
- <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
- <p>Foo <link rel="mw:PageProp/Category" href="./Category:Baz"/> Bar</p>
- <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>
- <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}}]}'/>
- <link rel="mw:PageProp/Category" href="./Category:Baz"/>
- !! end
- ## We used to, but no longer wt2wt this test since the default serializer
- ## will normalize all categories to serialize on their own line.
- ## This wikitext usage is going to be fairly uncommon in production and
- ## selser will take care of preserving formatting in those scenarios.
- ##
- ## The whitespace on the empty line is part of the test. Please do not delete
- !! test
- 1. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
- !! options
- parsoid=wt2html
- !! wikitext
- This
-
- [[Category:Foo]] and this should be part of same paragraph (not an indent-pre)
-
- {{echo|[[Category:Foo]] and so should this!}}
- !! html/php
- <p>This and this should be part of same paragraph (not an indent-pre) and so should this!
- </p>
- !! html/parsoid
- <p>This
-
- <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of same paragraph (not an indent-pre)
-
- <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>
- !! end
- ## Parsoid will not try to wt2wt this while preserving newlines because
- ## it suppresses excess newlines within list items -- and we don't want to
- ## introduce a special case just for categories, which is, in reality somewhat
- ## odd behavior -- categories are unlikely to be used in list items like this
- ## in top-level pages and are only likely to show up in template-generated
- ## list items where this RT-ing is a non-issue.
- ##
- ## The whitespace on the empty line is part of the test. Please do not delete
- !! test
- 2. Categories and newlines: All preceding newlines should be suppressed (courtesy T2087)
- !! options
- parsoid=wt2html
- !! wikitext
- * This
-
- [[Category:Foo]] and this should be part of the same list item
- * So should this
- {{echo|[[Category:Foo]] and this should be part of the same list item}}
- !! html
- <ul><li>This and this should be part of the same list item</li>
- <li>So should this and this should be part of the same list item</li></ul>
- !! html/parsoid
- <ul>
- <li>This <link rel="mw:PageProp/Category" href="./Category:Foo"/> and this should be part of the same list item</li>
- <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>
- </ul>
- !! end
- ## Newlines and categories that follow the last item of a list
- ## are treated differently because this (list followed by categories)
- ## is an extremely common pattern on wikis.
- !! test
- 3. Categories and newlines: newline suppression for last list item should RT properly
- !! wikitext
- * a
- * b
-
- [[Category:Foo]]
-
- [[Category:Bar]]
- [[Category:Baz]]
- !! html/parsoid
- <ul><li> a</li>
- <li> b</li></ul>
-
- <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
-
- <link rel="mw:PageProp/Category" href="./Category:Bar" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
- <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
- !! end
- !! test
- 4. Categories and newlines: newline suppression for last list item should RT properly
- !! wikitext
- * a
- **** b
- [[Category:Foo]]
- !! html/parsoid
- <ul><li> a
- <ul><li><ul><li><ul><li> b</li></ul></li></ul></li></ul></li></ul>
- <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
- !! end
- ## only wt2html for this to make sure the algo only applies to the rightmost path
- !! test
- 5. Categories and newlines: migrateTrailingCategories dom pass should only run on the rightmost path of nested lists
- !! options
- parsoid=wt2html
- !! wikitext
- * a
- ** b
- [[Category:Foo]]
- * c
- ** d
- [[Category:Foo]]
- !! html/parsoid
- <ul><li> a
- <ul><li> b
- <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/></li></ul></li>
- <li> c
- <ul><li> d</li></ul></li></ul>
- <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{"stx":"simple","a":{"href":"./Category:Foo"},"sa":{"href":"Category:Foo"}}'/>
- !! end
- ## We used to, but no longer wt2wt this test since the default serializer
- ## will normalize all categories to serialize on their own line.
- ## This wikitext usage is going to be fairly uncommon in production and
- ## selser will take care of preserving formatting in those scenarios.
- !! test
- 6. Categories and newlines: migrateTrailingCategories dom pass should not migrate categories not preceded by newlines
- !! options
- parsoid=wt2html
- !! wikitext
- * a [[Category:Foo]]
- !! html/parsoid
- <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>
- !! end
- # This test also demonstrates because of newline+category tunneling
- # through the list hander, template wrapping doesn't expand to the
- # containing list when the list item swallows the category.
- !! test
- 7. Categories and newlines: migrateTrailingCategories dom pass should leave template content alone
- !! wikitext
- * {{echo|a
- [[Category:Foo]]}}
- !! html/parsoid
- <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
- </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>
- !! end
- !! test
- 8. Categories and newlines: migrateTrailingCategories dom pass should not get tripped by intervening templates
- !! wikitext
- * a
- {{echo|[[Category:Foo]]
- [[Category:Bar]]}}
- [[Category:Baz]]
- !! html/parsoid
- <ul><li> a</li></ul>
- <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">
- </span><link rel="mw:PageProp/Category" href="./Category:Bar" about="#mwt1" data-parsoid='{"stx":"simple","a":{"href":"./Category:Bar"},"sa":{"href":"Category:Bar"}}'/>
- <link rel="mw:PageProp/Category" href="./Category:Baz" data-parsoid='{"stx":"simple","a":{"href":"./Category:Baz"},"sa":{"href":"Category:Baz"}}'/>
- !! end
- !! test
- 9. Categories and newlines: should behave properly with linkprefix (T87753)
- !! options
- language=ar
- !! wikitext
- foo bar
- foo bar
- [[تصنيف:Foo]]
- [[تصنيف:Bar]]
- !! html/php
- <p>foo bar
- foo bar
- </p>
- !! html/parsoid
- <p>foo bar
- foo bar</p>
- <link rel="mw:PageProp/Category" href="./تصنيف:Foo"/>
- <link rel="mw:PageProp/Category" href="./تصنيف:Bar"/>
- !! end
- !! test
- 10. No regressions on internal links following category (T174639)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- [[Category:Foo]]<div>a
- [[Foo]]</div>
- !! html/php
- <div>a
- <a href="/wiki/Foo" title="Foo">Foo</a></div>
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:Foo"/><div>a
- <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></div>
- !! end
- # Note that Parsoid differs slightly from PHP due to T175421
- !! test
- 11. Special case where only newlines separate links (T175416)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- [[Category:Foo]]
- [[Foo]][[es:Alimento]]
- [[Foo]]
- !! html/php
- <p><br />
- <a href="/wiki/Foo" title="Foo">Foo</a>
- </p><p><a href="/wiki/Foo" title="Foo">Foo</a>
- </p>
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:Foo"/>
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p><link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a></p>
- !! end
- !! test
- Category links with multiple namespaces
- !! wikitext
- [[Category:Project:Foo]]
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:Project:Foo" />
- !! end
- !! test
- Parsoid: Serialize link to category page with colon escape
- !! options
- parsoid
- !! wikitext
- [[:Category:Foo]]
- [[:Category:Foo|Bar]]
- !! html
- <p>
- <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Category:Foo</a>
- <a rel="mw:WikiLink" href="./Category:Foo" title="Category:Foo">Bar</a>
- </p>
- !! end
- # We used to, but no longer wt2wt this test since the default serializer
- # will normalize all categories to serialize on their own line.
- # This wikitext usage is going to be fairly uncommon in production and
- # selser will take care of preventing whitespace insertion if this
- # occurs in an article.
- #
- # html2html disabled for the same reason (whitespace insertion between
- # x and y).
- #
- # html2wt disabled because it localizes the "Category" namespace.
- !! test
- Link prefix/suffixes aren't applied to category links
- !! options
- parsoid=wt2html
- language=is
- !! wikitext
- x[[Category:Foo]]y
- !! html/php
- <p>xy
- </p>
- !! html/parsoid
- <p>x<link rel="mw:PageProp/Category" href="./Flokkur:Foo" data-parsoid=""/>y</p>
- !! end
- !! test
- Link prefix/suffixes aren't applied to language links
- !! options
- parsoid=wt2html
- language=is
- !! wikitext
- x[[es:Foo]]y
- !! html/php
- <p>xy
- </p>
- !! html/parsoid
- <p>x<link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Foo" data-parsoid=""/>y</p>
- !! end
- !! test
- Parsoid: Serialize link to file page with colon escape
- !! options
- parsoid
- !! wikitext
- [[:File:Foo.png]]
- [[:File:Foo.png|Bar]]
- !! html
- <p>
- <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">File:Foo.png</a>
- <a rel="mw:WikiLink" href="./File:Foo.png" title="File:Foo.png">Bar</a>
- </p>
- !! end
- !! test
- Parsoid: Serialize a genuine category link without colon escape
- !! options
- parsoid
- !! wikitext
- [[Category:Foo]]
- [[Category:Foo|Bar]]
- !! html
- <link rel="mw:PageProp/Category" href="./Category:Foo">
- <link rel="mw:PageProp/Category" href="./Category:Foo#Bar">
- !! end
- !! test
- Normalize hrefs properly before testing for invalid link targets (T72894)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne"/>
- !! wikitext
- [[Category:Toxine bactérienne]]
- !! end
- !! test
- Parsoid: Defaultsort
- !! wikitext
- {{DEFAULTSORT:Foo}}
- !! html/parsoid
- <meta property="mw:PageProp/categorydefaultsort" content="Foo"/>
- !! end
- # NOTE: mw:ExpandedAttrs is not the best typeof here. mw:Transclusion is better.
- # But, this is a limitation of our representation and is documented in
- # TemplateHandler.js in processSpecialMagicWord
- !! test
- Parsoid: Defaultsort (template-generated)
- !! wikitext
- {{{{echo|DEFAULTSORT}}:Foo}}
- !! html/parsoid
- <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":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,22,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"DEFAULTSORT\"}},\"i\":0}}]}'>DEFAULTSORT</span>:Foo"}]]}'/>
- !! end
- ###
- ### Inter-language links
- ###
- !! test
- Interlanguage links
- !! options
- ill
- !! wikitext
- [[es:Alimento]]
- [[fr:Nourriture]]
- [[zh:食品]]
- !! html/php
- es:Alimento fr:Nourriture zh:食品
- !! html/parsoid
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Alimento"/>
- <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/Nourriture"/>
- <link rel="mw:PageProp/Language" href="http://zh.wikipedia.org/wiki/食品"/>
- !! end
- !! test
- Duplicate interlanguage links (T26502)
- !! options
- ill
- !! wikitext
- [[es:1]]
- [[es:2]]
- [[fr:1]]
- [[fr:2]]
- !! html/php
- es:1 fr:1
- !! html/parsoid
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/1"/>
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/2"/>
- <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/1"/>
- <link rel="mw:PageProp/Language" href="http://fr.wikipedia.org/wiki/2"/>
- !! end
- ###
- ### Sections
- ###
- !! test
- Basic section headings
- !! wikitext
- ==Headline 1==
- Some text
- ==Headline 2==
- More
- ===Smaller headline===
- Blah blah
- !! html
- <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&action=edit&section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>Some text
- </p>
- <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&action=edit&section=2" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>More
- </p>
- <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&action=edit&section=3" title="Edit section: Smaller headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <p>Blah blah
- </p>
- !! end
- !! test
- Section headings with TOC
- !! wikitext
- ==Headline 1==
- ===Subheadline 1===
- =====Skipping a level=====
- ======Skipping a level======
- ==Headline 2==
- Some text
- ===Another headline===
- !! html
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Headline_1"><span class="tocnumber">1</span> <span class="toctext">Headline 1</span></a>
- <ul>
- <li class="toclevel-2 tocsection-2"><a href="#Subheadline_1"><span class="tocnumber">1.1</span> <span class="toctext">Subheadline 1</span></a>
- <ul>
- <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>
- <ul>
- <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>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- <li class="toclevel-1 tocsection-5"><a href="#Headline_2"><span class="tocnumber">2</span> <span class="toctext">Headline 2</span></a>
- <ul>
- <li class="toclevel-2 tocsection-6"><a href="#Another_headline"><span class="tocnumber">2.1</span> <span class="toctext">Another headline</span></a></li>
- </ul>
- </li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Headline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Subheadline 1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=3" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
- <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&action=edit&section=4" title="Edit section: Skipping a level">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- <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&action=edit&section=5" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>Some text
- </p>
- <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&action=edit&section=6" title="Edit section: Another headline">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- !! end
- !! test
- TOC anchors don't collide
- !! wikitext
- __FORCETOC__
- ==Headline 2==
- ==Headline==
- ==Headline 2==
- ==Headline==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Headline_2"><span class="tocnumber">1</span> <span class="toctext">Headline 2</span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#Headline"><span class="tocnumber">2</span> <span class="toctext">Headline</span></a></li>
- <li class="toclevel-1 tocsection-3"><a href="#Headline_2_2"><span class="tocnumber">3</span> <span class="toctext">Headline 2</span></a></li>
- <li class="toclevel-1 tocsection-4"><a href="#Headline_3"><span class="tocnumber">4</span> <span class="toctext">Headline</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=3" title="Edit section: Headline 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=4" title="Edit section: Headline">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- # perl -e 'print "="x$_," Level $_ heading","="x$_,"\n" for 1..10'
- # Parsoid html2wt direction adds <nowiki> for level 7 and up.
- !! test
- Handling of sections up to level 6 and beyond
- !! options
- parsoid=wt2html
- !! wikitext
- =Level 1 Heading=
- ==Level 2 Heading==
- ===Level 3 Heading===
- ====Level 4 Heading====
- =====Level 5 Heading=====
- ======Level 6 Heading======
- =======Level 7 Heading=======
- ========Level 8 Heading========
- =========Level 9 Heading=========
- ==========Level 10 Heading==========
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Level_1_Heading"><span class="tocnumber">1</span> <span class="toctext">Level 1 Heading</span></a>
- <ul>
- <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>
- <ul>
- <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>
- <ul>
- <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>
- <ul>
- <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>
- <ul>
- <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>
- <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>
- <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>
- <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>
- <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>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Level 1 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <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&action=edit&section=2" title="Edit section: Level 2 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=3" title="Edit section: Level 3 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=4" title="Edit section: Level 4 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
- <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&action=edit&section=5" title="Edit section: Level 5 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
- <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&action=edit&section=6" title="Edit section: Level 6 Heading">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- <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&action=edit&section=7" title="Edit section: =Level 7 Heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- <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&action=edit&section=8" title="Edit section: ==Level 8 Heading==">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- <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&action=edit&section=9" title="Edit section: ===Level 9 Heading===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- <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&action=edit&section=10" title="Edit section: ====Level 10 Heading====">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- !! html/parsoid
- <h1 id="Level_1_Heading" data-parsoid='{}'>Level 1 Heading</h1>
- <h2 id="Level_2_Heading" data-parsoid='{}'>Level 2 Heading</h2>
- <h3 id="Level_3_Heading" data-parsoid='{}'>Level 3 Heading</h3>
- <h4 id="Level_4_Heading" data-parsoid='{}'>Level 4 Heading</h4>
- <h5 id="Level_5_Heading" data-parsoid='{}'>Level 5 Heading</h5>
- <h6 id="Level_6_Heading" data-parsoid='{}'>Level 6 Heading</h6>
- <h6 id="=Level_7_Heading=" data-parsoid='{}'><span id=".3DLevel_7_Heading.3D" typeof="mw:FallbackId"></span>=Level 7 Heading=</h6>
- <h6 id="==Level_8_Heading==" data-parsoid='{}'><span id=".3D.3DLevel_8_Heading.3D.3D" typeof="mw:FallbackId"></span>==Level 8 Heading==</h6>
- <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>
- <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>
- !! end
- !! test
- TOC regression (T11764)
- !! wikitext
- ==title 1==
- ===title 1.1===
- ====title 1.1.1====
- ===title 1.2===
- ==title 2==
- ===title 2.1===
- !! html
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
- <ul>
- <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>
- <ul>
- <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>
- </ul>
- </li>
- <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>
- </ul>
- </li>
- <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
- <ul>
- <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>
- </ul>
- </li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
- <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&action=edit&section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- !! end
- !! test
- TOC for heading containing <span id="..."></span> (T96153)
- !! wikitext
- __FORCETOC__
- ==<span id="old-anchor"></span>New title==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#New_title"><span class="tocnumber">1</span> <span class="toctext">New title</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: New title">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- TOC with wgMaxTocLevel=3 (T8204)
- !! options
- wgMaxTocLevel=3
- !! wikitext
- ==title 1==
- ===title 1.1===
- ====title 1.1.1====
- ===title 1.2===
- ==title 2==
- ===title 2.1===
- !! html
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
- <ul>
- <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>
- <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>
- </ul>
- </li>
- <li class="toclevel-1 tocsection-5"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a>
- <ul>
- <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>
- </ul>
- </li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=3" title="Edit section: title 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
- <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&action=edit&section=4" title="Edit section: title 1.2">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=5" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=6" title="Edit section: title 2.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- !! end
- !! test
- TOC with wgMaxTocLevel=3 and two level four headings (T8204)
- !! options
- wgMaxTocLevel=3
- !! wikitext
- ==Section 1==
- ===Section 1.1===
- ====Section 1.1.1====
- ====Section 1.1.1.1====
- ==Section 2==
- !! html
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Section_1"><span class="tocnumber">1</span> <span class="toctext">Section 1</span></a>
- <ul>
- <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>
- </ul>
- </li>
- <li class="toclevel-1 tocsection-5"><a href="#Section_2"><span class="tocnumber">2</span> <span class="toctext">Section 2</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Section 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=3" title="Edit section: Section 1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
- <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&action=edit&section=4" title="Edit section: Section 1.1.1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h4>
- <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&action=edit&section=5" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- Resolving duplicate section names
- !! wikitext
- ==Foo bar==
- ==Foo bar==
- !! html
- <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&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- Resolving duplicate section names with differing case (T12721)
- !! wikitext
- ==Foo bar==
- ==Foo Bar==
- !! html
- <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&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! article
- Template:sections
- !! text
- ===Section 1===
- ==Section 2==
- !! endarticle
- !! test
- Template with sections, __NOTOC__
- !! wikitext
- __NOTOC__
- ==Section 0==
- {{sections}}
- ==Section 4==
- !! html
- <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&action=edit&section=1" title="Edit section: Section 0">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=T-1" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=T-2" title="Template:Sections">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- __NOEDITSECTION__ keyword
- !! wikitext
- __NOEDITSECTION__
- ==Section 1==
- ==Section 2==
- !! html
- <h2><span class="mw-headline" id="Section_1">Section 1</span></h2>
- <h2><span class="mw-headline" id="Section_2">Section 2</span></h2>
- !! end
- !! test
- Link inside a section heading
- !! wikitext
- ==Section with a [[Main Page|link]] in it==
- !! html
- <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&action=edit&section=1" title="Edit section: Section with a link in it">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- TOC regression (T14077)
- !! wikitext
- __TOC__
- ==title 1==
- ===title 1.1===
- ==title 2==
- !! html
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#title_1"><span class="tocnumber">1</span> <span class="toctext">title 1</span></a>
- <ul>
- <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>
- </ul>
- </li>
- <li class="toclevel-1 tocsection-3"><a href="#title_2"><span class="tocnumber">2</span> <span class="toctext">title 2</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: title 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: title 1.1">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=3" title="Edit section: title 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- T3219 URL next to image (good)
- !! wikitext
- http://example.com [[File:Foobar.jpg]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !!end
- # Parsoid doesn't wt2wt this cleanly because it adds <nowiki>s.
- !! test
- Short headings with trailing space should match behavior of Parser::doHeadings (T21910)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- ===
- The line above must have a trailing space!
- === <!--
- --> <!-- -->
- But just in case it doesn't...
- !! html/php
- <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&action=edit&section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <p>The line above must have a trailing space!
- </p>
- <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&action=edit&section=2" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <p>But just in case it doesn't...
- </p>
- !! html/parsoid
- <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
- <p>The line above must have a trailing space!</p>
- <h1 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h1> <!--
- --> <!-- -->
- <p>But just in case it doesn't...</p>
- !! end
- !! test
- Header with special characters (T27462)
- !! wikitext
- The tooltips shall not show entities to the user (ie. be double escaped)
- ==text > text==
- section 1
- ==text < text==
- section 2
- ==text & text==
- section 3
- ==text ' text==
- section 4
- ==text " text==
- section 5
- !! html/php
- <p>The tooltips shall not show entities to the user (ie. be double escaped)
- </p>
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#text_.3E_text"><span class="tocnumber">1</span> <span class="toctext">text > text</span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#text_.3C_text"><span class="tocnumber">2</span> <span class="toctext">text < text</span></a></li>
- <li class="toclevel-1 tocsection-3"><a href="#text_.26_text"><span class="tocnumber">3</span> <span class="toctext">text & text</span></a></li>
- <li class="toclevel-1 tocsection-4"><a href="#text_.27_text"><span class="tocnumber">4</span> <span class="toctext">text ' text</span></a></li>
- <li class="toclevel-1 tocsection-5"><a href="#text_.22_text"><span class="tocnumber">5</span> <span class="toctext">text " text</span></a></li>
- </ul>
- </div>
- <h2><span class="mw-headline" id="text_.3E_text">text > text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: text > text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 1
- </p>
- <h2><span class="mw-headline" id="text_.3C_text">text < text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: text < text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 2
- </p>
- <h2><span class="mw-headline" id="text_.26_text">text & text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: text & text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 3
- </p>
- <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&action=edit&section=4" title="Edit section: text ' text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 4
- </p>
- <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&action=edit&section=5" title="Edit section: text " text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 5
- </p>
- !! html/parsoid
- <p>The tooltips shall not show entities to the user (ie. be double escaped)</p>
- <h2 id="text_>_text"><span id="text_.3E_text" typeof="mw:FallbackId"></span>text > text</h2>
- <p>section 1</p>
- <h2 id="text_<_text"><span id="text_.3C_text" typeof="mw:FallbackId"></span>text < text</h2>
- <p>section 2</p>
- <h2 id="text_&_text"><span id="text_.26_text" typeof="mw:FallbackId"></span>text & text</h2>
- <p>section 3</p>
- <h2 id="text_'_text"><span id="text_.27_text" typeof="mw:FallbackId"></span>text ' text</h2>
- <p>section 4</p>
- <h2 id='text_"_text'><span id="text_.22_text" typeof="mw:FallbackId"></span>text " text</h2>
- <p>section 5</p>
- !! end
- !! test
- Header with space, plus and underscore as entity
- !! wikitext
- Id should not contain + for spaces
- ==Space between Text==
- section 1
- ==Space-Entity between Text==
- section 2
- ==Plus+between+Text==
- section 3
- ==Plus-Entity+between+Text==
- section 4
- ==Underscore_between_Text==
- section 5
- ==Underscore-Entity_between_Text==
- section 6
- [[#Space between Text]]
- [[#Space-Entity between Text]]
- [[#Plus+between+Text]]
- [[#Plus-Entity+between+Text]]
- [[#Underscore_between_Text]]
- [[#Underscore-Entity_between_Text]]
- !! html/php
- <p>Id should not contain + for spaces
- </p>
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <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>
- <li class="toclevel-1 tocsection-2"><a href="#Space-Entity_between_Text"><span class="tocnumber">2</span> <span class="toctext">Space-Entity between Text</span></a></li>
- <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>
- <li class="toclevel-1 tocsection-4"><a href="#Plus-Entity.2Bbetween.2BText"><span class="tocnumber">4</span> <span class="toctext">Plus-Entity+between+Text</span></a></li>
- <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>
- <li class="toclevel-1 tocsection-6"><a href="#Underscore-Entity_between_Text"><span class="tocnumber">6</span> <span class="toctext">Underscore-Entity_between_Text</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Space between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 1
- </p>
- <h2><span class="mw-headline" id="Space-Entity_between_Text">Space-Entity between Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: Space-Entity between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 2
- </p>
- <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&action=edit&section=3" title="Edit section: Plus+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 3
- </p>
- <h2><span class="mw-headline" id="Plus-Entity.2Bbetween.2BText">Plus-Entity+between+Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=4" title="Edit section: Plus-Entity+between+Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 4
- </p>
- <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&action=edit&section=5" title="Edit section: Underscore between Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 5
- </p>
- <h2><span class="mw-headline" id="Underscore-Entity_between_Text">Underscore-Entity_between_Text</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Underscore-Entity_between_Text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>section 6
- </p><p><a href="#Space_between_Text">#Space between Text</a>
- <a href="#Space-Entity_between_Text">#Space-Entity between Text</a>
- <a href="#Plus.2Bbetween.2BText">#Plus+between+Text</a>
- <a href="#Plus-Entity.2Bbetween.2BText">#Plus-Entity+between+Text</a>
- <a href="#Underscore_between_Text">#Underscore_between_Text</a>
- <a href="#Underscore-Entity_between_Text">#Underscore-Entity_between_Text</a>
- </p>
- !! html/parsoid
- <p>Id should not contain + for spaces</p>
- <h2 id="Space_between_Text">Space between Text</h2>
- <p>section 1</p>
- <h2 id="Space-Entity_between_Text">Space-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&#32;","srcContent":" "}'> </span>between<span typeof="mw:Entity" data-parsoid='{"src":"&#32;","srcContent":" "}'> </span>Text</h2>
- <p>section 2</p>
- <h2 id="Plus+between+Text"><span id="Plus.2Bbetween.2BText" typeof="mw:FallbackId"></span>Plus+between+Text</h2>
- <p>section 3</p>
- <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":"&#43;","srcContent":"+"}'>+</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&#43;","srcContent":"+"}'>+</span>Text</h2>
- <p>section 4</p>
- <h2 id="Underscore_between_Text">Underscore_between_Text</h2>
- <p>section 5</p>
- <h2 id="Underscore-Entity_between_Text">Underscore-Entity<span typeof="mw:Entity" data-parsoid='{"src":"&#95;","srcContent":"_"}'>_</span>between<span typeof="mw:Entity" data-parsoid='{"src":"&#95;","srcContent":"_"}'>_</span>Text</h2>
- <p>section 6</p>
- <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>
- <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&#32;between&#32;Text"}}'>#Space-Entity between Text</a>
- <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>
- <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&#43;between&#43;Text"}}'>#Plus-Entity+between+Text</a>
- <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>
- <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&#95;between&#95;Text"}}'>#Underscore-Entity_between_Text</a></p>
- !! end
- # Parsoid html2wt disabled because it adds padding spaces around =
- !! test
- Headers with excess '=' characters
- (Are similar tests necessary beyond the 1st level?)
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- =foo==
- ==foo=
- =''italic'' heading==
- ==''italic'' heading=
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#foo.3D"><span class="tocnumber">1</span> <span class="toctext">foo=</span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#.3Dfoo"><span class="tocnumber">2</span> <span class="toctext">=foo</span></a></li>
- <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>
- <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>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: foo=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <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&action=edit&section=2" title="Edit section: =foo">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <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&action=edit&section=3" title="Edit section: italic heading=">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <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&action=edit&section=4" title="Edit section: =italic heading">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- !! html/parsoid
- <h1 id="foo="><span id="foo.3D" typeof="mw:FallbackId"></span>foo=</h1>
- <h1 id="=foo"><span id=".3Dfoo" typeof="mw:FallbackId"></span>=foo</h1>
- <h1 id="italic_heading="><span id="italic_heading.3D" typeof="mw:FallbackId"></span><i>italic</i> heading=</h1>
- <h1 id="=italic_heading"><span id=".3Ditalic_heading" typeof="mw:FallbackId"></span>=<i>italic</i> heading</h1>
- !! end
- !! test
- HTML headers vs TOC (T25393)
- (__NOEDITSECTION__ for clearer output, doesn't matter here)
- !! wikitext
- <h1>Header 1</h1>
- ==Header 1.1==
- ==Header 1.2==
- <h1>Header 2
- </h1>
- ==Header 2.1==
- ==Header 2.2==
- __NOEDITSECTION__
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1"><a href="#Header_1"><span class="tocnumber">1</span> <span class="toctext">Header 1</span></a>
- <ul>
- <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>
- <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>
- </ul>
- </li>
- <li class="toclevel-1"><a href="#Header_2"><span class="tocnumber">2</span> <span class="toctext">Header 2</span></a>
- <ul>
- <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>
- <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>
- </ul>
- </li>
- </ul>
- </div>
- <h1><span class="mw-headline" id="Header_1">Header 1</span></h1>
- <h2><span class="mw-headline" id="Header_1.1">Header 1.1</span></h2>
- <h2><span class="mw-headline" id="Header_1.2">Header 1.2</span></h2>
- <h1><span class="mw-headline" id="Header_2">Header 2
- </span></h1>
- <h2><span class="mw-headline" id="Header_2.1">Header 2.1</span></h2>
- <h2><span class="mw-headline" id="Header_2.2">Header 2.2</span></h2>
- !! html/parsoid
- <h1 id="Header_1" data-parsoid='{"stx":"html"}'>Header 1</h1>
- <h2 id="Header_1.1" data-parsoid='{}'>Header 1.1</h2>
- <h2 id="Header_1.2" data-parsoid='{}'>Header 1.2</h2>
- <h1 id="Header_2" data-parsoid='{"stx":"html"}'>Header 2
- </h1>
- <h2 id="Header_2.1" data-parsoid='{}'>Header 2.1</h2>
- <h2 id="Header_2.2" data-parsoid='{}'>Header 2.2</h2>
- <meta property="mw:PageProp/noeditsection"/>
- !! end
- !! test
- Single-line or multiline-comments can follow headings
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- ==foo==<!---->
- ==bar==<!--c1-->
- ==baz==<!--
- c2
- c3-->
- !! html/php
- <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&action=edit&section=1" title="Edit section: foo">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=3" title="Edit section: baz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <h2 id="foo">foo</h2><!---->
- <h2 id="bar">bar</h2><!--c1-->
- <h2 id="baz">baz</h2><!--
- c2
- c3-->
- !! end
- !! test
- T3219 URL next to image (broken)
- !! wikitext
- http://example.com[[File:Foobar.jpg]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !!end
- !! test
- T3186 news: in the middle of text
- !! wikitext
- http://en.wikinews.org/wiki/Wikinews:Workplace
- !! html
- <p><a rel="nofollow" class="external free" href="http://en.wikinews.org/wiki/Wikinews:Workplace">http://en.wikinews.org/wiki/Wikinews:Workplace</a>
- </p>
- !!end
- !! test
- Namespaced link must have a title
- !! wikitext
- [[Project:]]
- !! html
- <p>[[Project:]]
- </p>
- !!end
- !! test
- Namespaced link must have a title (bad fragment version)
- !! wikitext
- [[Project:#fragment]]
- !! html
- <p>[[Project:#fragment]]
- </p>
- !!end
- ###
- ### HTML tags and HTML attributes
- ###
- !! test
- div with no attributes
- !! wikitext
- <div>HTML rocks</div>
- !! html
- <div>HTML rocks</div>
- !! end
- !! test
- div with double-quoted attribute
- !! wikitext
- <div id="rock">HTML rocks</div>
- !! html
- <div id="rock">HTML rocks</div>
- !! end
- !! test
- div with single-quoted attribute
- !! wikitext
- <div id='rock'>HTML rocks</div>
- !! html
- <div id="rock">HTML rocks</div>
- !! end
- !! test
- div with unquoted attribute
- !! wikitext
- <div id=rock>HTML rocks</div>
- !! html
- <div id="rock">HTML rocks</div>
- !! end
- !! test
- div with illegal double attributes
- !! wikitext
- <div id="a" id="b">HTML rocks</div>
- !! html
- <div id="b">HTML rocks</div>
- !!end
- !! test
- div with empty attribute value, space before equals
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <div class =>HTML rocks</div>
- !! html/php
- <div class="">HTML rocks</div>
- !! html/parsoid
- <div class="" data-parsoid='{"stx":"html"}'>HTML rocks</div>
- !! end
- !! test
- div with multiple empty attribute values
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <div id= title=>HTML rocks</div>
- !! html/php
- <div id="title=">HTML rocks</div>
- !! html/parsoid
- <div id="title=" data-parsoid='{"stx":"html"}'>HTML rocks</div>
- !! end
- # FIXME Parsoid doesn't actually match PHP here.
- # Probably we should use the synthetic <foo /> or <indicator>
- # extensions for this test, which are enabled when running parser tests.
- !! test
- Extension tag in attribute value
- !! wikitext
- <span title="<translate>123</translate>">ok</span>
- !! html/php+disabled
- <p><span title="<translate>123</translate>">ok</span>
- </p>
- !! html/parsoid
- <p><span title="123" about="#mwt4" typeof="mw:ExpandedAttrs" data-parsoid='{"stx":"html","a":{"title":"123"},"sa":{"title":"<translate>123</translate>"}}' data-mw='{"attribs":[[{"txt":"title"},{"html":"<translate typeof=\"mw:Extension/translate\" about=\"#mwt3\" data-parsoid='{\"dsr\":[13,39,2,2]}' data-mw='{\"name\":\"translate\",\"attrs\":{},\"body\":{\"extsrc\":\"123\"}}'>123</translate>"}]]}'>ok</span></p>
- !! end
- !! test
- table with multiple empty attribute values
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {| title= id=
- |hi
- |}
- !! html/php
- <table title="id=">
- <tr>
- <td>hi
- </td></tr></table>
- !! html/parsoid
- <table title="id=">
- <tbody><tr><td>hi</td></tr>
- </tbody></table>
- !! end
- !! test
- div with braces in attribute value
- !! wikitext
- <div title="{}">Foo</div>
- !! html/php
- <div title="{}">Foo</div>
- !! html/parsoid
- <div title="{}">Foo</div>
- !! end
- !! test
- div with empty attribute value, no space before equals
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <div class=>HTML rocks</div>
- !! html/php
- <div class="">HTML rocks</div>
- !! html/parsoid
- <div class="">HTML rocks</div>
- !! end
- !! test
- HTML multiple attributes correction
- !! wikitext
- <p class="error" class="awesome">Awesome!</p>
- !! html
- <p class="awesome">Awesome!</p>
- !!end
- !! test
- Table multiple attributes correction
- !! wikitext
- {|
- !+ class="error" class="awesome"|status
- |}
- !! html
- <table>
- <tr>
- <th class="awesome">status
- </th></tr></table>
- !!end
- !! test
- DIV IN UPPERCASE
- !! wikitext
- <DIV ID="x">HTML ROCKS</DIV>
- !! html
- <div id="x">HTML ROCKS</div>
- !!end
- !! test
- Non-ASCII pseudo-tags are rendered as text
- !! wikitext
- <khyô>
- !! html
- <p><khyô>
- </p>
- !! end
- !! test
- Pseudo-tag with URL 'name' renders as url link
- !! wikitext
- <http://example.com/>
- !! html
- <p><<a rel="nofollow" class="external free" href="http://example.com/">http://example.com/</a>>
- </p>
- !! end
- !! test
- text with amp in the middle of nowhere
- !! wikitext
- Remember AT&T?
- !! html
- <p>Remember AT&T?
- </p>
- !! end
- !! test
- text with character entity: eacute
- !! wikitext
- I always thought é was a cute letter.
- !! html+tidy
- <p>I always thought é was a cute letter.
- </p>
- !! end
- !! test
- text with entity-escaped character entity-like string: eacute
- !! wikitext
- I always thought &eacute; was a cute letter.
- !! html
- <p>I always thought &eacute; was a cute letter.
- </p>
- !! end
- !! test
- text with undefined character entity: xacute
- !! wikitext
- I always thought &xacute; was a cute letter.
- !! html
- <p>I always thought &xacute; was a cute letter.
- </p>
- !! end
- !! test
- HTML5 tags
- !! wikitext
- <data value="5">five</data>
- <time datetime="2000-01-01T00:00Z">The new millenium started</time>
- <mark>This highlighted text</mark>
- !! html
- <p><data value="5">five</data>
- <time datetime="2000-01-01T00:00Z">The new millenium started</time>
- <mark>This highlighted text</mark>
- </p>
- !! end
- !! test
- HTML tag with leading space is parsed as text
- !! wikitext
- < div>foo< /div>
- !! html
- <p>< div>foo< /div>
- </p>
- !! end
- ## Don't expect Parsoid and PHP to match, since PHP isn't exactly following
- ## the HTML5 parsing spec.
- !! test
- Element with broken attribute syntax
- !! options
- parsoid=wt2html
- !! wikitext
- <div style=" style="123">hi</div>
- <div =>ho</div>
- !! html/php
- <div style="123">hi</div>
- <div>ho</div>
- !! html/parsoid
- <div style=" style=" data-parsoid='{"stx":"html","a":{"123\"":null},"sa":{"123\"":""}}'>hi</div>
- <div data-parsoid='{"stx":"html","a":{"=":null},"sa":{"=":""}}'>ho</div>
- !! end
- ###
- ### Nesting tests (see T43545, T52604, T53081)
- ###
- # This test case is fixed in Parsoid by domino 1.0.12. (T52604)
- # Note that html2wt is considerably more difficult if we use <b> in
- # the test case, instead of <small>
- !! test
- Ensure that HTML adoption agency algorithm is properly implemented.
- !! wikitext
- <small>X<small>Y</small>Z</small>
- !! html
- <p><small>X<small>Y</small>Z</small>
- </p>
- !! end
- # This was T43545 in the PHP parser.
- !! test
- Nesting of <kbd>
- !! wikitext
- <kbd>X<kbd>Y</kbd>Z</kbd>
- !! html+tidy
- <p><kbd>X<kbd>Y</kbd>Z</kbd>
- </p>
- !! end
- # The following cases were T53081 in the PHP parser.
- # Note that there are some other nestable tags (b, i, etc) which are
- # not covered; see T53081 for discussion.
- !! test
- Nesting of <em>
- !! wikitext
- <em>X<em>Y</em>Z</em>
- !! html+tidy
- <p><em>X<em>Y</em>Z</em>
- </p>
- !! end
- !! test
- Nesting of <strong>
- !! wikitext
- <strong>X<strong>Y</strong>Z</strong>
- !! html+tidy
- <p><strong>X<strong>Y</strong>Z</strong>
- </p>
- !! end
- !! test
- Nesting of <q>
- !! wikitext
- <q>X<q>Y</q>Z</q>
- !! html+tidy
- <p><q>X<q>Y</q>Z</q>
- </p>
- !! end
- !! test
- Nesting of <ruby>
- !! wikitext
- <ruby>X<ruby>Y</ruby>Z</ruby>
- !! html
- <p><ruby>X<ruby>Y</ruby>Z</ruby>
- </p>
- !! end
- !! test
- Nesting of <bdo>
- !! wikitext
- <bdo>X<bdo>Y</bdo>Z</bdo>
- !! html
- <p><bdo>X<bdo>Y</bdo>Z</bdo>
- </p>
- !! end
- ###
- ### Media links
- ###
- !! test
- Media link
- !! wikitext
- [[Media:Foobar.jpg]]
- [[Media:Video.ogv]]
- [[:Media:Video.ogv]]
- !! html/php
- <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Media:Foobar.jpg</a>
- <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
- <a href="http://example.com/images/0/00/Video.ogv" class="internal" title="Video.ogv">Media:Video.ogv</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">Media:Foobar.jpg</a>
- <a rel="mw:MediaLink" href="//example.com/images/0/00/Video.ogv" title="Video.ogv">Media:Video.ogv</a>
- <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>
- !! end
- !! test
- Media link with text
- !! wikitext
- [[Media:Foobar.jpg|A neat file to look at]]
- !! html/php
- <p><a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">A neat file to look at</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:MediaLink" href="//example.com/images/3/3a/Foobar.jpg" title="Foobar.jpg">A neat file to look at</a></p>
- !! end
- # FIXME: this is still bad HTML tag nesting
- # FIXME: doBlockLevels won't wrap this in a paragraph because it contains a div
- # Parsoid & Remex fix the p-wrapping since they operate on the DOM.
- !! test
- Media link with nasty text
- !! wikitext
- [[Media:Foobar.jpg|Safe Link<div style=display:none>" onmouseover="alert(document.cookie)" onfoo="</div>]]
- !! html/php
- <a href="http://example.com/images/3/3a/Foobar.jpg" class="internal" title="Foobar.jpg">Safe Link<div style="display:none">" onmouseover="alert(document.cookie)" onfoo="</div></a>
- !! html/php+tidy
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Media link to nonexistent file (T3702)
- !! wikitext
- [[Media:No such.jpg]]
- [[Media:No_such file.jpg]]
- !! html/php
- <p><a href="/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class="new" title="No such.jpg">Media:No such.jpg</a>
- <a href="/index.php?title=Special:Upload&wpDestFile=No_such_file.jpg" class="new" title="No such file.jpg">Media:No_such file.jpg</a>
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Image link to nonexistent file (T3850 - good)
- !! wikitext
- [[File:No_such.jpg]]
- !! html/php
- <p><a href="/index.php?title=Special:Upload&wpDestFile=No_such.jpg" class="new" title="File:No such.jpg">File:No such.jpg</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- :Image link to nonexistent file (T3850 - bad)
- !! wikitext
- [[:Image:No such.jpg]]
- !! html/php
- <p><a href="/index.php?title=File:No_such.jpg&action=edit&redlink=1" class="new" title="File:No such.jpg (page does not exist)">Image:No such.jpg</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./File:No_such.jpg" title="File:No such.jpg">Image:No such.jpg</a></p>
- !! end
- !! test
- Character reference normalization in link text (T3938)
- !! wikitext
- [[Main Page|this&that]]
- !! html
- <p><a href="/wiki/Main_Page" title="Main Page">this&that</a>
- </p>
- !!end
- !! article
- אַ
- !! text
- Test for unicode normalization
- The page's name is U+05d0 U+05b7, with non-canonical form U+FB2E
- !! endarticle
- !! test
- (T21451) Links should refer to the normalized form.
- !! wikitext
- [[אַ]]
- [[אַ]]
- [[אַ]]
- [[אַ]]
- [[אַ]]
- !! html
- <p><a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
- <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
- <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
- <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
- <a href="/wiki/%D7%90%D6%B7" title="אַ">אַ</a>
- </p>
- !! end
- !! test
- Empty attribute crash test (T4067)
- !! wikitext
- <font color="">foo</font>
- !! html
- <p><font color="">foo</font>
- </p>
- !! end
- !! test
- Empty attribute crash test single-quotes (T4067)
- !! wikitext
- <font color=''>foo</font>
- !! html
- <p><font color="">foo</font>
- </p>
- !! end
- !! test
- Attribute test: equals, then nothing
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <font color=>foo</font>
- !! html/php
- <p><font color="">foo</font>
- </p>
- !! html/parsoid
- <p><font color="" data-parsoid='{"stx":"html"}'>foo</font></p>
- !! end
- !! test
- Attribute test: unquoted value
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <font color=x>foo</font>
- !! html/php
- <p><font color="x">foo</font>
- </p>
- !! html/parsoid
- <p><font color="x" data-parsoid='{"stx":"html"}'>foo</font></p>
- !! end
- !! test
- Attribute test: unquoted but illegal value (hash)
- !! wikitext
- <font color=#x>foo</font>
- !! html
- <p><font color="#x">foo</font>
- </p>
- !! end
- # Parsoid does not serialize to empty attribute syntax,
- # so wt2wt and html2wt cases are skipped
- !! test
- Attribute test: no value (T54330)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <font color>foo</font>
- !! html/php
- <p><font color="">foo</font>
- </p>
- !! html/parsoid
- <p><font color="">foo</font></p>
- !! end
- !! test
- T4095: link with three closing brackets
- !! wikitext
- [[Main Page]]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>]
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a>]</p>
- !! end
- !! test
- T4095: link with pipe and three closing brackets
- !! wikitext
- [[Main Page|link]]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">link</a>]
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">link</a>]</p>
- !! end
- !! test
- T4095: link with pipe and three closing brackets, version 2
- !! wikitext
- [[Main Page|[http://example.com/]]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">[http://example.com/]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Main_Page" title="Main Page">[http://example.com/]</a></p>
- !! end
- ###
- ### Safety
- ###
- !! article
- Template:Dangerous attribute
- !! text
- " onmouseover="alert(document.cookie)
- !! endarticle
- !! article
- Template:Dangerous style attribute
- !! text
- border-size: expression(alert(document.cookie))
- !! endarticle
- !! article
- Template:Div style
- !! text
- <div style="float: right; {{{1}}}">Magic div</div>
- !! endarticle
- !! test
- T4304: HTML attribute safety (safe template; regression T4309)
- !! wikitext
- <div title="{{test}}"></div>
- !! html/php
- <div title="This is a test template"></div>
- !! html/parsoid
- <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":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[]],\"dsr\":[12,20,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"test\",\"href\":\"./Template:Test\"},\"params\":{},\"i\":0}}]}'>This is a test template</span>"}]]}'></div>
- !! end
- # Parsoid has enough context to handle this case
- !! test
- T4304: HTML attribute safety (dangerous template; 2309)
- !! wikitext
- <div title="{{dangerous attribute}}"></div>
- !! html/php
- <div title=""></div>
- !! html/parsoid
- <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":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[]],\"dsr\":[12,35,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous attribute\",\"href\":\"./Template:Dangerous_attribute\"},\"params\":{},\"i\":0}}]}'>\" onmouseover=\"alert(document.cookie)</span>"}]]}'></div>
- !! end
- !! test
- T4304: HTML attribute safety (dangerous style template; 2309)
- !! wikitext
- <div style="{{dangerous style attribute}}"></div>
- !! html/php
- <div style="/* insecure input */"></div>
- !! html/parsoid
- <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":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[]],\"dsr\":[12,41,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"dangerous style attribute\",\"href\":\"./Template:Dangerous_style_attribute\"},\"params\":{},\"i\":0}}]}'>border-size: expression(alert(document.cookie))</span>"}]]}'></div>
- !! end
- !! test
- T4304: HTML attribute safety (safe parameter; 2309)
- !! wikitext
- {{div style|width: 200px}}
- !! html/php
- <div style="float: right; width: 200px">Magic div</div>
- !! html/parsoid
- <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>
- !! end
- !! test
- T4304: HTML attribute safety (unsafe parameter; 2309)
- !! wikitext
- {{div style|width: expression(alert(document.cookie))}}
- !! html/php
- <div style="/* insecure input */">Magic div</div>
- !! html/parsoid
- <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>
- !! end
- ## Parsoid output here differs; needs investigation.
- !! test
- T4304: HTML attribute safety (unsafe breakout parameter; 2309)
- !! wikitext
- {{div style|"><script>alert(document.cookie)</script>}}
- !! html
- <div style="float: right;"><script>alert(document.cookie)</script>">Magic div</div>
- !! end
- ## Parsoid output here differs; needs investigation.
- !! test
- T4304: HTML attribute safety (unsafe breakout parameter 2; 2309)
- !! wikitext
- {{div style|" ><script>alert(document.cookie)</script>}}
- !! html
- <div style="float: right;"><script>alert(document.cookie)</script>">Magic div</div>
- !! end
- !! test
- T4304: HTML attribute safety (link)
- !! wikitext
- <div title="[[Main Page]]"></div>
- !! html/php
- <div title="[[Main Page]]"></div>
- !! html/parsoid
- <div title="[[Main Page]]"></div>
- !! end
- !! test
- T4304: HTML attribute safety (italics)
- !! wikitext
- <div title="''foobar''"></div>
- !! html
- <div title="''foobar''"></div>
- !! end
- !! test
- T4304: HTML attribute safety (bold)
- !! wikitext
- <div title="'''foobar'''"></div>
- !! html
- <div title="'''foobar'''"></div>
- !! end
- !! test
- T4304: HTML attribute safety (ISBN)
- !! wikitext
- <div title="ISBN 1234567890"></div>
- !! html
- <div title="ISBN 1234567890"></div>
- !! end
- !! test
- T4304: HTML attribute safety (RFC)
- !! wikitext
- <div title="RFC 1234"></div>
- !! html
- <div title="RFC 1234"></div>
- !! end
- !! test
- T4304: HTML attribute safety (PMID)
- !! wikitext
- <div title="PMID 1234567890"></div>
- !! html
- <div title="PMID 1234567890"></div>
- !! end
- !! test
- T4304: HTML attribute safety (web link)
- !! wikitext
- <div title="http://example.com/"></div>
- !! html
- <div title="http://example.com/"></div>
- !! end
- !! test
- T4304: HTML attribute safety (named web link)
- !! wikitext
- <div title="[http://example.com/ link]"></div>
- !! html/php
- <div title="[http://example.com/ link]"></div>
- !! html/parsoid
- <div title="[http://example.com/ link]"></div>
- !! end
- !! test
- T5244: HTML attribute safety (extension; safe)
- !! wikitext
- <div style="<nowiki>background:blue</nowiki>"></div>
- !! html/php
- <div style="background:blue"></div>
- !! html/parsoid
- <div style="background:blue" data-parsoid='{"stx":"html","a":{"style":"background:blue"},"sa":{"style":"<nowiki>background:blue</nowiki>"}}'></div>
- !! end
- !! test
- T5244: HTML attribute safety (extension; unsafe)
- !! wikitext
- <div style="<nowiki>border-left:expression(alert(document.cookie))</nowiki>"></div>
- !! html/php
- <div style="/* insecure input */"></div>
- !! html/parsoid
- <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"<nowiki>border-left:expression(alert(document.cookie))</nowiki>"}}'></div>
- !! end
- # More MSIE fun discovered by Tom Gilder
- !! test
- MSIE CSS safety test: spurious slash
- !! wikitext
- <div style="background-image:u\rl(javascript:alert('boo'))">evil</div>
- !! html/php
- <div style="/* insecure input */">evil</div>
- !! html/parsoid
- <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\rl(javascript:alert('boo'))"}}'>evil</div>
- !! end
- !! test
- MSIE CSS safety test: hex code
- !! wikitext
- <div style="background-image:u\72l(javascript:alert('boo'))">evil</div>
- !! html/php
- <div style="/* insecure input */">evil</div>
- !! html/parsoid
- <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:u\\72l(javascript:alert('boo'))"}}'>evil</div>
- !! end
- !! test
- MSIE CSS safety test: comment in url
- !! wikitext
- <div style="background-image:u/**/rl(javascript:alert('boo'))">evil</div>
- !! html/php
- <div style="background-image:u rl(javascript:alert('boo'))">evil</div>
- !! html/parsoid
- <div style="background-image:u rl(javascript:alert('boo'))" data-parsoid='{"stx":"html","a":{"style":"background-image:u rl(javascript:alert('boo'))"},"sa":{"style":"background-image:u/**/rl(javascript:alert('boo'))"}}'>evil</div>
- !! end
- !! test
- MSIE CSS safety test: comment in expression
- !! wikitext
- <div style="background-image:expres/**/sion(alert('boo4'))">evil4</div>
- !! html/php
- <div style="background-image:expres sion(alert('boo4'))">evil4</div>
- !! html/parsoid
- <div style="background-image:expres sion(alert('boo4'))" data-parsoid='{"stx":"html","a":{"style":"background-image:expres sion(alert('boo4'))"},"sa":{"style":"background-image:expres/**/sion(alert('boo4'))"}}'>evil4</div>
- !! end
- !! test
- CSS safety test (all browsers): vertical tab (T57332 / CVE-2013-4567)
- !! wikitext
- <p style="font-size: 100px; background-image:url\b(https://www.google.com/images/srpr/logo6w.png)">A</p>
- !! html/php
- <p style="/* invalid control char */">A</p>
- !! html/parsoid
- <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>
- !! end
- !! test
- MSIE 6 CSS safety test: Fullwidth (T57332)
- !! wikitext
- <p style="font-size: 100px; color: expression((title='XSSed'),'red')">A</p>
- <div style="top:EXPRESSION(alert())">B</div>
- !! html/php
- <p style="/* insecure input */">A</p>
- <div style="/* insecure input */">B</div>
- !! html/parsoid
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expression((title='XSSed'),'red')"}}'>A</p>
- <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"top:EXPRESSION(alert())"}}'>B</div>
- !! end
- !! test
- MSIE 6 CSS safety test: IPA extensions (T57332)
- !! wikitext
- <div style="background-image:uʀʟ(javascript:alert())">A</div>
- <p style="font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')">B</p>
- !! html/php
- <div style="/* insecure input */">A</div>
- <p style="/* insecure input */">B</p>
- !! html/parsoid
- <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:uʀʟ(javascript:alert())"}}'>A</div>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expʀessɪoɴ((title='XSSed'),'red')"}}'>B</p>
- !! end
- !! test
- MSIE 6 CSS safety test: sup/sub script (T57332)
- !! wikitext
- <div style="background-image:url⁽javascript:alert())">A</div>
- <div style="background-image:url₍javascript:alert())">B</div>
- <p style="font-size: 100px; color: expressioⁿ((title='XSSed'),'red')">C</p>
- !! html/php
- <div style="/* insecure input */">A</div>
- <div style="/* insecure input */">B</div>
- <p style="/* insecure input */">C</p>
- !! html/parsoid
- <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url⁽javascript:alert())"}}'>A</div>
- <div style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"background-image:url₍javascript:alert())"}}'>B</div>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expressioⁿ((title='XSSed'),'red')"}}'>C</p>
- !! end
- !! test
- Opera -o-link CSS
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <div
- title="data:text/html,<img src=1 onerror=alert(1)>"
- style="-o-link:attr(title);-o-link-source:current">X</div>
- !! html/php
- <div title="data:text/html,<img src=1 onerror=alert(1)>" style="/* insecure input */">X</div>
- !! html/parsoid
- <div title="data:text/html,<img src=1 onerror=alert(1)>" style="/* insecure input */" data-parsoid='{"stx":"html","a":{"title":"data:text/html,<img src=1 onerror=alert(1)>","style":"/* insecure input */"},"sa":{"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;","style":"-o-link:attr(title);-o-link-source:current"}}'>X</div>
- !! end
- !! test
- MSIE 6 CSS safety test: Repetition markers (T57332)
- !! wikitext
- <p style="font-size: 100px; color: expres〱ion((title='XSSed'),'red')">A</p>
- <p style="font-size: 100px; color: expresゝion((title='XSSed'),'red')">B</p>
- <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">C</p>
- <p style="font-size: 100px; color: expresヽion((title='XSSed'),'red')">D</p>
- <p style="font-size: 100px; color: expresﹽion((title='XSSed'),'red')">E</p>
- <p style="font-size: 100px; color: expresﹼion((title='XSSed'),'red')">F</p>
- <p style="font-size: 100px; color: expresーion((title='XSSed'),'red')">G</p>
- !! html/php
- <p style="/* insecure input */">A</p>
- <p style="/* insecure input */">B</p>
- <p style="/* insecure input */">C</p>
- <p style="/* insecure input */">D</p>
- <p style="/* insecure input */">E</p>
- <p style="/* insecure input */">F</p>
- <p style="/* insecure input */">G</p>
- !! html/parsoid
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expres〱ion((title='XSSed'),'red')"}}'>A</p>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresゝion((title='XSSed'),'red')"}}'>B</p>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title='XSSed'),'red')"}}'>C</p>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresヽion((title='XSSed'),'red')"}}'>D</p>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹽion((title='XSSed'),'red')"}}'>E</p>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresﹼion((title='XSSed'),'red')"}}'>F</p>
- <p style="/* insecure input */" data-parsoid='{"stx":"html","a":{"style":"/* insecure input */"},"sa":{"style":"font-size: 100px; color: expresーion((title='XSSed'),'red')"}}'>G</p>
- !! end
- !! test
- Table attribute legitimate extension
- !! wikitext
- {|
- !+ style="<nowiki>color:blue</nowiki>"|status
- |}
- !! html
- <table>
- <tr>
- <th style="color:blue">status
- </th></tr></table>
- !!end
- !! test
- Table attribute safety
- !! wikitext
- {|
- !+ style="<nowiki>border-width:expression(0+alert(document.cookie))</nowiki>"|status
- |}
- !! html
- <table>
- <tr>
- <th style="/* insecure input */">status
- </th></tr></table>
- !! end
- !! test
- CSS line continuation 1
- !! wikitext
- <div style="background-image: u\ rl(test.jpg);"></div>
- !! html
- <div style="/* insecure input */"></div>
- !! end
- !! test
- CSS line continuation 2
- !! wikitext
- <div style="background-image: u\ rl(test.jpg); "></div>
- !! html
- <div style="/* invalid control char */"></div>
- !! end
- !! article
- Template:Identity
- !! text
- {{{1}}}
- !! endarticle
- !! test
- Expansion of multi-line templates in attribute values (T8255)
- !! wikitext
- <div style="background: {{identity|#00FF00}}">-</div>
- !! html
- <div style="background: #00FF00">-</div>
- !! end
- !! test
- Expansion of multi-line templates in attribute values (T8255 sanity check)
- !! wikitext
- <div style="background:
- #00FF00">-</div>
- !! html/php
- <div style="background: #00FF00">-</div>
- !! html/parsoid
- <div style="background:
- #00FF00">-</div>
- !! end
- !! test
- Expansion of multi-line templates in attribute values (T8255 sanity check 2)
- !! wikitext
- <div style="background: #00FF00">-</div>
- !! html
- <div style="background: #00FF00">-</div>
- !! end
- !! test
- Tags which are hidden from tidiers cannot pass through the Sanitizer
- !! wikitext
- <mw:toc><script>alert();</script></mw:toc>
- !! html+tidy
- <p><mw:toc><script>alert();</script></mw:toc>
- </p>
- !! end
- ###
- ### Parser hooks (see tests/parser/parserTestsParserHook.php for the <tag> extension)
- ###
- !! test
- Parser hook: empty input
- !! wikitext
- <tag></tag>
- !! html/php
- <pre>
- ''
- array (
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- ## Don't expect parsoid to rt this form.
- !! test
- Parser hook: empty input using terminated empty elements
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <tag/>
- !! html/php
- <pre>
- NULL
- array (
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- !! test
- Parser hook: empty input using terminated empty elements (space before)
- !! wikitext
- <tag />
- !! html/php
- <pre>
- NULL
- array (
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":null}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- !! test
- Parser hook: basic input
- !! wikitext
- <tag>input</tag>
- !! html/php
- <pre>
- 'input'
- array (
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- ## Don't expect parsoid to rt this form.
- !! test
- Parser hook: case insensitive
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <TAG>input</TAG>
- !! html/php
- <pre>
- 'input'
- array (
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- ## Don't expect parsoid to rt this form.
- !! test
- Parser hook: case insensitive, redux
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <TaG>input</TAg>
- !! html/php
- <pre>
- 'input'
- array (
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"input"}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- !! test
- Parser hook: nested tags
- !! wikitext
- <tag><tag></tag></tag>
- !! html/php
- <pre>
- '<tag>'
- array (
- )
- </pre></tag>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{},"body":{"extsrc":"<tag>"}}' data-parsoid='{}' about="#mwt2"></pre></tag>
- !! end
- !! test
- Parser hook: basic arguments
- !! wikitext
- <tag width="200" height="100" depth="50" square=""></tag>
- !! html/php
- <pre>
- ''
- array (
- 'width' => '200',
- 'height' => '100',
- 'depth' => '50',
- 'square' => '',
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- ## Don't expect parsoid to rt this form.
- !! test
- Parser hook: basic arguments, variations
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <tag width=200 height = "100" depth = '50' square></tag>
- !! html/php
- <pre>
- ''
- array (
- 'width' => '200',
- 'height' => '100',
- 'depth' => '50',
- 'square' => '',
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"width":"200","height":"100","depth":"50","square":""},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- !! test
- Parser hook: argument containing a forward slash (T7344)
- !! wikitext
- <tag filename="/tmp/bla"></tag>
- !! html/php
- <pre>
- ''
- array (
- 'filename' => '/tmp/bla',
- )
- </pre>
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"filename":"/tmp/bla"},"body":{"extsrc":""}}' data-parsoid='{}' about="#mwt2"></pre>
- !! end
- ## Don't expect parsoid to rt this form.
- !! test
- Parser hook: empty input using terminated empty elements (T4374)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <tag foo=bar/>text
- !! html/php
- <pre>
- NULL
- array (
- 'foo' => 'bar',
- )
- </pre>text
- !! html/parsoid
- <pre typeof="mw:Extension/tag" data-mw='{"name":"tag","attrs":{"foo":"bar"},"body":null}' data-parsoid='{}' about="#mwt2"></pre>text
- !! end
- ## </tag> should be output literally since there is no matching tag that begins it
- ## Don't expect parsoid to rt this form.
- !! test
- Parser hook: basic arguments using terminated empty elements (T4374)
- !! options
- parsoid=wt2html
- !! wikitext
- <tag width=200 height = "100" depth = '50' square/>
- other stuff
- </tag>
- !! html/php
- <pre>
- NULL
- array (
- 'width' => '200',
- 'height' => '100',
- 'depth' => '50',
- 'square' => '',
- )
- </pre>
- <p>other stuff
- </tag>
- </p>
- !! html/parsoid
- <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
- </tag></p>
- !! end
- ## Don't expect parsoid to rt this form.
- !! test
- Parser hook: Don't allow unclosed extension tags
- !! options
- parsoid=wt2html
- !! wikitext
- test <tag>123
- this is a '''test'''
- !! html/php
- <p>test <tag>123
- </p><p>this is a <b>test</b>
- </p>
- !! html/parsoid
- <p>test <tag>123</p>
- <p>this is a <b>test</b></p>
- !! end
- !! test
- Parser hook: horizontal rule inside extension tag that outputs <pre>
- !! wikitext
- <tag>
- Hello
- <hr/>
- Goodbye
- </tag>
- !! html/php
- <pre>
- '
- Hello
- <hr/>
- Goodbye
- '
- array (
- )
- </pre>
- !! end
- ###
- ### (see tests/parser/parserTestsParserHook.php for the <statictag> extension)
- ###
- !! test
- Parser hook: static parser hook not inside a comment
- !! wikitext
- <statictag>hello, world</statictag>
- <statictag action="flush" />
- !! html/php
- <p><br />
- hello, world
- </p>
- !! html/parsoid
- <p><span typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{},"body":{"extsrc":"hello, world"}}' data-parsoid='{}' about="#mwt2"></span></p>
- <p typeof="mw:Extension/statictag" data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about="#mwt4">hello, world</p>
- !! end
- !! test
- Parser hook: static parser hook inside a comment
- !! wikitext
- <!-- <statictag>hello, world</statictag> -->
- <statictag action="flush" />
- !! html/php
- <p><br />
- </p>
- !! html/parsoid
- <!-- <statictag>hello, world</statictag> -->
- <p typeof='mw:Extension/statictag' data-mw='{"name":"statictag","attrs":{"action":"flush"},"body":null}' data-parsoid='{}' about='#mwt2'></p>
- !! end
- # Nested template calls; this case was broken by Parser.php rev 1.506,
- # since reverted.
- !! article
- Template:One-parameter
- !! text
- (My parameter is: {{{1}}})
- !! endarticle
- !! article
- Template:Map-one-parameter
- !! text
- {{{{{1}}}|{{{2}}}}}
- !! endarticle
- !! test
- Nested template calls
- !! wikitext
- {{Map-one-parameter|One-parameter|param}}
- !! html
- <p>(My parameter is: param)
- </p>
- !! end
- ###
- ### Sanitizer
- ###
- # Remex wraps empty tag runs with p-tags.
- # Parsoid strips them out during p-wrapping.
- !! test
- Sanitizer: Closing of open tags
- !! wikitext
- <s></s><table></table>
- !! html/php+tidy
- <p><s></s></p><table></table>
- !! html/parsoid
- <s></s><table></table>
- !! end
- !! test
- Sanitizer: Closing of open but not closed tags
- !! wikitext
- <s>foo
- !! html
- <p><s>foo</s>
- </p>
- !! end
- !! test
- Sanitizer: Closing of closed but not open tags
- !! options
- parsoid=wt2html
- !! wikitext
- </s>
- !! html/php+tidy
- <p class="mw-empty-elt">
- </p>
- !! html/parsoid
- !! end
- !! test
- Sanitizer: Closing of closed but not open table tags
- !! options
- parsoid=wt2html
- !! wikitext
- Table not started</td></tr></table>
- !! html+tidy
- <p>Table not started
- </p>
- !! end
- !! test
- Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id=""
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- <span id="æ: v">byte</span>[[#æ: v|backlink]]
- !! html/php
- <p><span id="æ:_v">byte</span><a href="#æ:_v">backlink</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Sanitizer: Escaping of spaces, multibyte characters, colons & other stuff in id="" (legacy)
- !! config
- wgFragmentMode=[ 'legacy' ]
- !! wikitext
- <span id="æ: v">byte</span>[[#æ: v|backlink]]
- !! html/php
- <p><span id=".C3.A6:_v">byte</span><a href="#.C3.A6:_v">backlink</a>
- </p>
- !! end
- # In HTML5, the restrictions are that id must contain at least one character,
- # and must not contain any space characters.
- !! test
- Sanitizer: Validating the contents of the id attribute (T6515)
- !! options
- disabled
- !! wikitext
- <br id="" /><br id="a space" />
- !! html
- Something ...
- !! end
- # In HTML5, id must be unique amongst all the ids in the element's home subtree.
- !! test
- Sanitizer: Validating id attribute uniqueness (T6515, T8301)
- !! options
- disabled
- !! wikitext
- <br id="foo" /><br id="foo" />
- !! html
- Something need to be done. foo-2 ?
- !! end
- !! test
- Sanitizer: Validating that <meta> and <link> work, but only for Microdata
- !! wikitext
- <div itemscope>
- <meta itemprop="hello" content="world">
- <meta http-equiv="refresh" content="5">
- <meta itemprop="hello" http-equiv="refresh" content="5">
- <link itemprop="hello" href="{{SERVER}}">
- <link rel="stylesheet" href="{{SERVER}}">
- <link rel="stylesheet" itemprop="hello" href="{{SERVER}}">
- </div>
- !! html
- <div itemscope="">
- <p> <meta itemprop="hello" content="world" />
- <meta http-equiv="refresh" content="5">
- <meta itemprop="hello" content="5" />
- <link itemprop="hello" href="http://example.org" />
- <link rel="stylesheet" href="<a rel="nofollow" class="external free" href="http://example.org">http://example.org</a>">
- <link itemprop="hello" href="http://example.org" />
- </p>
- </div>
- !! end
- !! test
- Sanitizer: Strip comments from CSS attributes
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- <span style="margin:/*negate mbox-text padding */-0.125em -0.45em; /*rainbow*/rgba(255, 0, 0, 0.3)">2013</span>
- !! html/php
- <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span>
- </p>
- !! html/parsoid
- <p><span style="margin: -0.125em -0.45em; rgba(255, 0, 0, 0.3)">2013</span></p>
- !! end
- !! test
- Sanitizer: Avoid unnecessary percent encoded characters in interwiki links
- !! wikitext
- [[meatball:Soft"Security]]
- !! html/php
- <p><a href="http://www.usemod.com/cgi-bin/mb.pl?Soft%22Security" class="extiw" title="meatball:Soft"Security">meatball:Soft"Security</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Sanitizer: angle brackets are invalid, even in interwiki links (T182338)
- !! wikitext
- [[meatball:Foo<Bar]]
- [[meatball:Foo>Bar]]
- [[meatball:Foo<bar]]
- [[meatball:Foo>bar]]
- !! html/php
- <p>[[meatball:Foo<Bar]]
- [[meatball:Foo>Bar]]
- [[meatball:Foo<bar]]
- [[meatball:Foo>bar]]
- </p>
- !! html/parsoid
- <p>[[meatball:Foo<Bar]]
- [[meatball:Foo>Bar]]
- [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&lt;","srcContent":"<"}'><</span>bar]]
- [[meatball:Foo<span typeof="mw:Entity" data-parsoid='{"src":"&gt;","srcContent":">"}'>></span>bar]]</p>
- !! end
- !! test
- Language converter: output gets cut off unexpectedly (T7757)
- !! options
- language=zh
- !! wikitext
- this bit is safe: }-
- but if we add a conversion instance: -{zh-cn:xxx;zh-tw:yyy}-
- then we get cut off here: }-
- all additional text is vanished
- !! html/php
- <p>this bit is safe: }-
- </p><p>but if we add a conversion instance: xxx
- </p><p>then we get cut off here: }-
- </p><p>all additional text is vanished
- </p>
- !! html/parsoid
- <p>this bit is safe: }-</p>
- <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>
- <p>then we get cut off here: }-</p>
- <p>all additional text is vanished</p>
- !! end
- !! test
- Language converter glossary rules inside attributes (T119158)
- !! options
- language=sr variant=sr-el
- !! wikitext
- -{H|foAjrjvi=>sr-el:" onload="alert(1)" data-foo="}-
- [[File:Foobar.jpg|alt=-{}-foAjrjvi-{}-]]
- !! html/php
- <p>
- </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="" onload="alert(1)" data-foo="" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
- </p>
- !! html/parsoid
- <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"foAjrjvi","l":"sr-el","t":"\" onload=\"alert(1)\" data-foo=\""}]}'/></p>
- <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>
- !! end
- !! test
- Self closed html pairs (T7487)
- !! wikitext
- <center><font id="bug" />Centered text</center>
- <div><font id="bug2" />In div text</div>
- !! html+tidy
- <center><font id="bug"></font>Centered text</center>
- <div><font id="bug2"></font>In div text</div>
- !! end
- !! test
- Punctuation: nbsp before exclamation
- !! wikitext
- C'est grave !
- !! html
- <p>C'est grave !
- </p>
- !! end
- !! test
- Punctuation: CSS !important (T13874)
- !! wikitext
- <div style="width:50% !important">important</div>
- !! html
- <div style="width:50% !important">important</div>
- !!end
- !! test
- Punctuation: CSS ! important (T13874; with space after)
- !! wikitext
- <div style="width:50% ! important">important</div>
- !! html
- <div style="width:50% ! important">important</div>
- !!end
- !! test
- HTML bullet list, closed tags (T7497)
- !! wikitext
- <ul>
- <li>One</li>
- <li>Two</li>
- </ul>
- !! html/php
- <ul>
- <li>One</li>
- <li>Two</li>
- </ul>
- !! html/parsoid
- <ul data-parsoid='{"stx":"html"}'>
- <li data-parsoid='{"stx":"html"}'>One</li>
- <li data-parsoid='{"stx":"html"}'>Two</li>
- </ul>
- !! end
- !! test
- HTML bullet list, unclosed tags (T7497)
- !! wikitext
- <ul>
- <li>One
- <li>Two
- </ul>
- !! html/php+tidy
- <ul>
- <li>One
- </li><li>Two
- </li></ul>
- !! html/parsoid
- <ul data-parsoid='{"stx":"html"}'>
- <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
- <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
- </ul>
- !! end
- !! test
- HTML ordered list, closed tags (T7497)
- !! wikitext
- <ol>
- <li>One</li>
- <li>Two</li>
- </ol>
- !! html/php
- <ol>
- <li>One</li>
- <li>Two</li>
- </ol>
- !! html/parsoid
- <ol data-parsoid='{"stx":"html"}'>
- <li data-parsoid='{"stx":"html"}'>One</li>
- <li data-parsoid='{"stx":"html"}'>Two</li>
- </ol>
- !! end
- !! test
- HTML ordered list, unclosed tags (T7497)
- !! options
- !! wikitext
- <ol>
- <li>One
- <li>Two
- </ol>
- !! html/php+tidy
- <ol>
- <li>One
- </li><li>Two
- </li></ol>
- !! html/parsoid
- <ol data-parsoid='{"stx":"html"}'>
- <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>One</li>
- <li data-parsoid='{"stx":"html","autoInsertedEnd":true}'>Two</li>
- </ol>
- !! end
- !! test
- HTML nested bullet list, closed tags (T7497)
- !! wikitext
- <ul>
- <li>One</li>
- <li>Two:
- <ul>
- <li>Sub-one</li>
- <li>Sub-two</li>
- </ul>
- </li>
- </ul>
- !! html/php
- <ul>
- <li>One</li>
- <li>Two:
- <ul>
- <li>Sub-one</li>
- <li>Sub-two</li>
- </ul>
- </li>
- </ul>
- !! html/parsoid
- <ul data-parsoid='{"stx":"html"}'>
- <li data-parsoid='{"stx":"html"}'>One</li>
- <li data-parsoid='{"stx":"html"}'>Two:
- <ul data-parsoid='{"stx":"html"}'>
- <li data-parsoid='{"stx":"html"}'>Sub-one</li>
- <li data-parsoid='{"stx":"html"}'>Sub-two</li>
- </ul>
- </li>
- </ul>
- !! end
- !! test
- HTML nested bullet list, open tags (T7497)
- !! wikitext
- <ul>
- <li>One
- <li>Two:
- <ul>
- <li>Sub-one
- <li>Sub-two
- </ul>
- </ul>
- !! html+tidy
- <ul>
- <li>One
- </li><li>Two:
- <ul>
- <li>Sub-one
- </li><li>Sub-two
- </li></ul>
- </li></ul>
- !! end
- !! test
- HTML nested ordered list, closed tags (T7497)
- !! wikitext
- <ol>
- <li>One</li>
- <li>Two:
- <ol>
- <li>Sub-one</li>
- <li>Sub-two</li>
- </ol>
- </li>
- </ol>
- !! html
- <ol>
- <li>One</li>
- <li>Two:
- <ol>
- <li>Sub-one</li>
- <li>Sub-two</li>
- </ol>
- </li>
- </ol>
- !! end
- !! test
- HTML nested ordered list, open tags (T7497)
- !! wikitext
- <ol>
- <li>One
- <li>Two:
- <ol>
- <li>Sub-one
- <li>Sub-two
- </ol>
- </ol>
- !! html/php
- <ol>
- <li>One
- <li>Two:
- <ol>
- <li>Sub-one
- <li>Sub-two
- </ol>
- </ol>
- !! html/parsoid
- <ol>
- <li>One
- </li>
- <li>Two:
- <ol>
- <li>Sub-one
- </li>
- <li>Sub-two
- </li>
- </ol>
- </li>
- </ol>
- !! end
- !! test
- HTML ordered list item with parameters oddity
- !! wikitext
- <ol><li id="fragment">One</li>
- </ol>
- !! html
- <ol><li id="fragment">One</li>
- </ol>
- !! end
- # parsoid doesn't explicitly mark autonumbered links, see T55505
- !!test
- T7918: autonumbering
- !! wikitext
- [http://first/] [http://second] [ftp://ftp]
- ftp://inlineftp
- [mailto:enclosed@mail.tld With target]
- [mailto:enclosed@mail.tld]
- mailto:inline@mail.tld
- !! html/php
- <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>
- </p><p><a rel="nofollow" class="external free" href="ftp://inlineftp">ftp://inlineftp</a>
- </p><p><a rel="nofollow" class="external text" href="mailto:enclosed@mail.tld">With target</a>
- </p><p><a rel="nofollow" class="external autonumber" href="mailto:enclosed@mail.tld">[4]</a>
- </p><p><a rel="nofollow" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a>
- </p>
- !! html/parsoid
- <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>
- <p><a rel="mw:ExtLink" class="external free" href="ftp://inlineftp">ftp://inlineftp</a></p>
- <p><a rel="mw:ExtLink" class="external text" href="mailto:enclosed@mail.tld">With target</a></p>
- <p><a rel="mw:ExtLink" class="external autonumber" href="mailto:enclosed@mail.tld"></a></p>
- <p><a rel="mw:ExtLink" class="external free" href="mailto:inline@mail.tld">mailto:inline@mail.tld</a></p>
- !! end
- #
- # Security and HTML correctness
- # From Nick Jenkins' fuzz testing
- #
- !! test
- Fuzz testing: Parser13
- !! wikitext
- {|
- | http://a|
- !! html
- <table>
- <tr>
- <td>
- </td>
- </tr>
- </table>
- !! end
- # Note that Parsoid output differs from the PHP parser here: the PHP
- # parser breaks the URL for the magic word, while in Parsoid the URL
- # production takes precedence.
- !! test
- Fuzz testing: Parser14
- !! wikitext
- ==onmouseover===
- http://__TOC__
- !! html/php
- <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&action=edit&section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- http://<div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
- </ul>
- </div>
- !! html/php+tidy
- <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&action=edit&section=1" title="Edit section: onmouseover=">edit</a><span class="mw-editsection-bracket">]</span></span></h2><p>
- http://</p><div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#onmouseover.3D"><span class="tocnumber">1</span> <span class="toctext">onmouseover=</span></a></li>
- </ul>
- </div>
- !! html/parsoid
- <h2 id="onmouseover="><span id="onmouseover.3D" typeof="mw:FallbackId"></span>onmouseover=</h2>
- <p><a rel="mw:ExtLink" class="external free" href="http://__TOC__" data-parsoid='{"stx":"url"}'>http://__TOC__</a></p>
- !! end
- !! test
- Fuzz testing: Parser14-table
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- ==a==
- {| STYLE=__TOC__
- !! html
- <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&action=edit&section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <table style="__TOC__">
- <tr><td></td></tr>
- </table>
- !! html+tidy
- <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&action=edit&section=1" title="Edit section: a">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <table style="__TOC__">
- <tr>
- <td></td>
- </tr>
- </table>
- !! html/parsoid
- <h2 id="a">a</h2>
- <table style="__TOC__"></table>
- !! end
- # Known to produce bogus xml (extra </td>)
- # Don't add the html/php section since it generates broken HTML
- !! test
- Fuzz testing: Parser16
- !! wikitext
- {|
- !https://||||||
- !! html+tidy
- <table>
- <tbody><tr>
- <th>https://</th>
- <th></th>
- <th></th>
- <th>
- </th></tr>
- </tbody></table>
- !! end
- !! test
- Fuzz testing: Parser21
- !! wikitext
- {|
- !irc://{{ftp://a" onmouseover="alert('hello world');"
- |
- !! html
- <table>
- <tr>
- <th><a rel="nofollow" class="external free" href="irc://{{ftp://a">irc://{{ftp://a</a>" onmouseover="alert('hello world');"
- </th>
- <td>
- </td>
- </tr>
- </table>
- !! end
- !! test
- Fuzz testing: Parser22
- !! wikitext
- http://===r:::https://b
- {|
- !! html
- <p><a rel="nofollow" class="external free" href="http://===r:::https://b">http://===r:::https://b</a>
- </p>
- <table>
- <tr><td></td></tr>
- </table>
- !! end
- # Known to produce bad XML for now
- !! test
- Fuzz testing: Parser24
- !! options
- parsoid=wt2html
- !! wikitext
- {|
- {{{|
- <u CLASS=
- | {{{{SSSll!!!!!!!VVVV)]]][[Special:*xxxxxxx--><noinclude>}}}} >
- <br style="onmouseover='alert(document.cookie);' " />
- MOVE YOUR MOUSE CURSOR OVER THIS TEXT
- |
- !! html/php
- <table>
- {{{|
- <u class="|">}}}} >
- <br style="onmouseover='alert(document.cookie);'" />
- MOVE YOUR MOUSE CURSOR OVER THIS TEXT
- <tr>
- <td></u>
- </td>
- </tr>
- </table>
- !! html/parsoid
- <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}'><meta typeof="mw:Includes/NoInclude" data-parsoid='{"src":"<noinclude>"}'/>}}}} >
- <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}'>
- <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'></td></tr></tbody></table>
- !! end
- # Note: the current result listed for this is not what the original one was,
- # but the original bug was JavaScript injection, which is fixed in any case.
- # It's not clear that the original result listed was any more correct than the
- # current one. Original result:
- # <p>{{{|
- # </p>
- # <li class="||">
- # }}}blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
- !!test
- Fuzz testing: Parser25 (T8055)
- !! wikitext
- {{{
- |
- <LI CLASS=||
- >
- }}}blah" onmouseover="alert('hello world');" align="left"'''MOVE MOUSE CURSOR OVER HERE
- !! html/php
- <p><LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b>
- </p>
- !! html/parsoid
- <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<LI CLASS="},"2":{"wt":""},"3":{"wt":"\n >\n"}},"i":0}},"blah\" onmouseover=\"alert('hello world');\" align=\"left\"'''MOVE MOUSE CURSOR OVER HERE"]}'>
- </span><p about="#mwt1"><LI CLASS=blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER HERE</b></p>
- !! end
- !!test
- Fuzz testing: URL adjacent extension (with space, clean)
- !! wikitext
- http://example.com <nowiki>junk</nowiki>
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a> junk
- </p>
- !! html/parsoid
- <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>
- !! end
- !!test
- Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
- !! wikitext
- http://example.com<nowiki>junk</nowiki>
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>junk
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Fuzz testing: URL adjacent extension (no space, dirty; pre)
- !! wikitext
- http://example.com<pre>junk</pre>
- !! html/php
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a><pre>junk</pre>
- !! html/php+tidy
- <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a></p><pre>junk</pre>
- !! html/parsoid
- <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>
- !! end
- !! test
- Fuzz testing: image with bogus manual thumbnail
- !! wikitext
- [[Image:foobar.jpg|thumbnail= ]]
- !! html/php
- <div class="thumb tright"><div class="thumbinner" style="width:182px;">Error creating thumbnail: <div class="thumbcaption"></div></div></div>
- !! html/parsoid
- <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>
- !! end
- # Parsoid will emit the newline literally in wt2wt; see next test case.
- !! test
- Fuzz testing: encoded newline in generated HTML replacements (T8577)
- !! options
- parsoid=wt2html
- !! wikitext
- <pre dir=" "></pre>
- !! html/php
- <pre dir=" "></pre>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" dir="
- " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
- !! end
- !! test
- Fuzz testing: encoded newline in generated HTML replacements, html2wt (T8577)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" dir="
- " data-mw='{"name":"pre","attrs":{"dir":"\n"},"body":{"extsrc":""}}'></pre>
- !! wikitext
- <pre dir="
- "></pre>
- !! html/php
- <pre dir=""></pre>
- !! end
- !! test
- Templates in extension attributes are not expanded
- !! wikitext
- <pre dir="{{echo|ltr}}"></pre>
- !! html/php
- <pre dir="{{echo|ltr}}"></pre>
- !! html/parsoid
- <pre typeof="mw:Extension/pre" about="#mwt2" dir="{{echo|ltr}}" data-mw='{"name":"pre","attrs":{"dir":"{{echo|ltr}}"},"body":{"extsrc":""}}'></pre>
- !! end
- !! test
- Parsing optional HTML elements (T8171)
- !! options
- !! wikitext
- <table>
- <tr>
- <td> Some tabular data</td>
- <td> More tabular data ...
- <td> And yet som tabular data</td>
- </tr>
- </table>
- !! html
- <table>
- <tr>
- <td> Some tabular data</td>
- <td> More tabular data ...
- </td><td> And yet som tabular data</td>
- </tr>
- </table>
- !! end
- !! test
- Correct handling of <td>, <tr> (T8171)
- !! options
- !! wikitext
- <table>
- <tr>
- <td> Some tabular data</td>
- <td> More tabular data ...</td>
- <td> And yet som tabular data</td>
- </tr>
- </table>
- !! html
- <table>
- <tr>
- <td> Some tabular data</td>
- <td> More tabular data ...</td>
- <td> And yet som tabular data</td>
- </tr>
- </table>
- !! end
- !! test
- Parsing crashing regression (fr:JavaScript)
- !! wikitext
- </body></x>
- !! html
- <p></body></x>
- </p>
- !! end
- !! test
- Inline wiki vs wiki block nesting
- !! wikitext
- '''Bold paragraph
- New wiki paragraph
- !! html
- <p><b>Bold paragraph</b>
- </p><p>New wiki paragraph
- </p>
- !! end
- # FIXME: The current php output is documented
- # and desired output is the parsoid target.
- !! test
- Inline HTML vs wiki block nesting
- !! wikitext
- <b>Bold paragraph
- New wiki paragraph
- !! html/php
- <p><b>Bold paragraph
- </p><p>New wiki paragraph</b>
- </p>
- !! html/parsoid
- <p><b>Bold paragraph</b>
- </p><p>New wiki paragraph
- </p>
- !! end
- # Original result was this:
- # <p><b>bold</b><b>bold<i>bolditalics</i></b>
- # </p>
- # While that might be marginally more intuitive, maybe, the six-apostrophe
- # construct is clearly pathological and the result stated here (which is what
- # the parser actually does) is about as reasonable as anything.
- !!test
- Mixing markup for italics and bold
- !! options
- !! wikitext
- '''bold''''''bold''bolditalics'''''
- !! html
- <p>'<i>bold'</i><b>bold<i>bolditalics</i></b>
- </p>
- !! end
- !! article
- Xyzzyx
- !! text
- Article for special page transclusion test
- !! endarticle
- !! test
- Special page transclusion
- !! options
- !! wikitext
- {{Special:Prefixindex/Xyzzyx}}
- !! html
- <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
- </ul>
- !! end
- !! test
- Special page transclusion twice (T7021)
- !! options
- !! wikitext
- {{Special:Prefixindex/Xyzzyx}}
- {{Special:Prefixindex/Xyzzyx}}
- !! html
- <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
- </ul>
- <ul class="mw-prefixindex-list"><li><a href="/wiki/Xyzzyx" title="Xyzzyx">Xyzzyx</a></li>
- </ul>
- !! end
- !! test
- Transclusion of default MediaWiki message
- !! wikitext
- {{MediaWiki:Mainpage}}
- !! html
- <p>Main Page
- </p>
- !! end
- !! test
- Transclusion of nonexistent MediaWiki message
- !! wikitext
- {{MediaWiki:Mainpagexxx}}
- !! html
- <p><a href="/index.php?title=MediaWiki:Mainpagexxx&action=edit&redlink=1" class="new" title="MediaWiki:Mainpagexxx (page does not exist)">MediaWiki:Mainpagexxx</a>
- </p>
- !! end
- !! test
- Transclusion of MediaWiki message with underscore
- !! wikitext
- {{MediaWiki:history_short}}
- !! html
- <p>History
- </p>
- !! end
- !! test
- Transclusion of MediaWiki message with space
- !! wikitext
- {{MediaWiki:history short}}
- !! html
- <p>History
- </p>
- !! end
- !! test
- Invalid header with following text
- !! wikitext
- = x = y
- !! html
- <p>= x = y
- </p>
- !! end
- !! test
- Section extraction test (section 0)
- !! options
- section=0
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- !! end
- !! test
- Section extraction test (section 1)
- !! options
- section=1
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ==a==
- ===aa===
- ====aaa====
- !! end
- !! test
- Section extraction test (section 2)
- !! options
- section=2
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ===aa===
- ====aaa====
- !! end
- !! test
- Section extraction test (section 3)
- !! options
- section=3
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ====aaa====
- !! end
- !! test
- Section extraction test (section 4)
- !! options
- section=4
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- !! end
- !! test
- Section extraction test (section 5)
- !! options
- section=5
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ===ba===
- !! end
- !! test
- Section extraction test (section 6)
- !! options
- section=6
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ===bb===
- ====bba====
- !! end
- !! test
- Section extraction test (section 7)
- !! options
- section=7
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ====bba====
- !! end
- !! test
- Section extraction test (section 8)
- !! options
- section=8
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ===bc===
- !! end
- !! test
- Section extraction test (section 9)
- !! options
- section=9
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ==c==
- ===ca===
- !! end
- !! test
- Section extraction test (section 10)
- !! options
- section=10
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- ===ca===
- !! end
- !! test
- Section extraction test (nonexistent section 11)
- !! options
- section=11
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- !! end
- !! test
- Section extraction test with bogus heading (section 1)
- !! options
- section=1
- !! wikitext
- ==a==
- ==bogus== not a legal section
- ==b==
- !! html/php
- ==a==
- ==bogus== not a legal section
- !! end
- !! test
- Section extraction test with bogus heading (section 2)
- !! options
- section=2
- !! wikitext
- ==a==
- ==bogus== not a legal section
- ==b==
- !! html/php
- ==b==
- !! end
- !! test
- Section extraction test with comment after heading (section 1)
- !! options
- section=1
- !! wikitext
- ==a==
- ==b== <!-- -->
- ==c==
- !! html/php
- ==a==
- !! end
- !! test
- Section extraction test with comment after heading (section 2)
- !! options
- section=2
- !! wikitext
- ==a==
- ==b== <!-- -->
- ==c==
- !! html/php
- ==b== <!-- -->
- !! end
- !! test
- Section extraction test with bogus <nowiki> heading (section 1)
- !! options
- section=1
- !! wikitext
- ==a==
- ==bogus== <nowiki>not a legal section</nowiki>
- ==b==
- !! html/php
- ==a==
- ==bogus== <nowiki>not a legal section</nowiki>
- !! end
- !! test
- Section extraction test with bogus <nowiki> heading (section 2)
- !! options
- section=2
- !! wikitext
- ==a==
- ==bogus== <nowiki>not a legal section</nowiki>
- ==b==
- !! html/php
- ==b==
- !! end
- # Formerly testing for T4587, now resolved by the use of unmarked sections
- # instead of respecting commented sections
- !! test
- Section extraction prefixed by comment (section 1)
- !! options
- section=1
- !! wikitext
- <!-- -->==sec1==
- ==sec2==
- !! html/php
- ==sec2==
- !!end
- !! test
- Section extraction prefixed by comment (section 2)
- !! options
- section=2
- !! wikitext
- <!-- -->==sec1==
- ==sec2==
- !! html/php
- !!end
- # Formerly testing for T4607, now resolved by the use of unmarked sections
- # instead of respecting HTML-style headings
- !! test
- Section extraction, mixed wiki and html (section 1)
- !! options
- section=1
- !! wikitext
- <h2>unmarked</h2>
- unmarked
- ==1==
- one
- ==2==
- two
- !! html/php
- ==1==
- one
- !! end
- !! test
- Section extraction, mixed wiki and html (section 2)
- !! options
- section=2
- !! wikitext
- <h2>unmarked</h2>
- unmarked
- ==1==
- one
- ==2==
- two
- !! html/php
- ==2==
- two
- !! end
- # Formerly testing for T5342
- !! test
- Section extraction, heading surrounded by <noinclude>
- !! options
- section=1
- !! wikitext
- <noinclude>==unmarked==</noinclude>
- ==marked==
- !! html/php
- ==marked==
- !!end
- # Test behavior of T21910
- !! test
- Sectiion with all-equals
- !! options
- section=2
- !! wikitext
- ===
- The line above must have a trailing space
- === <!--
- --> <!-- -->
- But just in case it doesn't...
- !! html/php
- === <!--
- --> <!-- -->
- But just in case it doesn't...
- !! end
- !! test
- Section replacement test (section 0)
- !! options
- replace=0,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- xxx
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 1)
- !! options
- replace=1,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- xxx
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 2)
- !! options
- replace=2,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- xxx
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 3)
- !! options
- replace=3,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- xxx
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 4)
- !! options
- replace=4,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- ====aaa====
- xxx
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 5)
- !! options
- replace=5,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- xxx
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 6)
- !! options
- replace=6,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- xxx
- ===bc===
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 7)
- !! options
- replace=7,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- xxx
- ===bc===
- ==c==
- ===ca===
- !! end
- !! test
- Section replacement test (section 8)
- !! options
- replace=8,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- xxx
- ==c==
- ===ca===
- !!end
- !! test
- Section replacement test (section 9)
- !! options
- replace=9,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- xxx
- !! end
- !! test
- Section replacement test (section 10)
- !! options
- replace=10,"xxx"
- !! wikitext
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- ===ca===
- !! html/php
- start
- ==a==
- ===aa===
- ====aaa====
- ==b==
- ===ba===
- ===bb===
- ====bba====
- ===bc===
- ==c==
- xxx
- !! end
- !! test
- Section replacement test with initial whitespace (T15728)
- !! options
- replace=2,"xxx"
- !! wikitext
- Preformatted initial line
- ==a==
- ===a===
- !! html/php
- Preformatted initial line
- ==a==
- xxx
- !! end
- !! test
- Section extraction, heading followed by pre with 20 spaces (T8398)
- !! options
- section=1
- !! wikitext
- ==a==
- a
- !! html/php
- ==a==
- a
- !! end
- !! test
- Section extraction, heading followed by pre with 19 spaces (T8398 sanity check)
- !! options
- section=1
- !! wikitext
- ==a==
- a
- !! html/php
- ==a==
- a
- !! end
- !! test
- Section extraction, <pre> around bogus header (T12309)
- !! options
- section=2
- !! wikitext
- == Section One ==
- <pre>
- =======
- </pre>
- == Section Two ==
- stuff
- !! html/php
- == Section Two ==
- stuff
- !! end
- !! test
- Section replacement, <pre> around bogus header (T12309)
- !! options
- replace=2,"xxx"
- !! wikitext
- == Section One ==
- <pre>
- =======
- </pre>
- == Section Two ==
- stuff
- !! html/php
- == Section One ==
- <pre>
- =======
- </pre>
- xxx
- !! end
- !! test
- Handling of 
 in URLs
- !! wikitext
- *irc://
a
- !! html/php
- <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
- !! html/parsoid
- <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa" data-parsoid='{"stx":"url","a":{"href":"irc://%0Aa"},"sa":{"href":"irc://&#x0A;a"}}'>irc://%0Aa</a></li></ul>
- !! end
- !! test
- Handling of %0A in URLs
- !! wikitext
- *irc://%0Aa
- !! html/php
- <ul><li><a rel="nofollow" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
- !! html/parsoid
- <ul><li><a rel="mw:ExtLink" class="external free" href="irc://%0Aa">irc://%0Aa</a></li></ul>
- !! end
- # The PHP parser strips the empty tags out for giggles; parsoid doesn't.
- !! test
- 5 quotes, code coverage +1 line
- !! options
- parsoid=wt2html
- !! wikitext
- '''''
- !! html/php
- !! html/parsoid
- <b><i></i></b>
- !! end
- # same html as previous, but wikitext adjusted to match parsoid html2wt
- # note that wt2html and html2html will put the <i> before the <b>
- !! test
- 5 quotes, code coverage +1 line w/ nowiki (1)
- !! options
- parsoid=wt2wt,html2wt
- !! wikitext
- '''''<nowiki/>'''''
- !! html/php
- <p><i></i>
- </p>
- !! html/parsoid
- <p><b><i></i></b></p>
- !! end
- # same as previous, just swapping the <i> and <b>
- !! test
- 5 quotes, code coverage +1 line w/ nowiki (2)
- !! wikitext
- '''''<nowiki/>'''''
- !! html/php
- <p><i></i>
- </p>
- !! html/parsoid
- <p><i><b></b></i></p>
- !! end
- !! test
- Special:Search page linking.
- !! wikitext
- {{Special:search}}
- !! html
- <p><a href="/wiki/Special:Search" title="Special:Search">Special:Search</a>
- </p>
- !! end
- !! test
- {{!}} is a magic word
- !! wikitext
- {{!}} is a magic word there and {{!}} is still a magic word here
- | is not a magic word here but {{!}} is still a magic word here
- !! html/php
- <p>| is a magic word there and | is still a magic word here
- | is not a magic word here but | is still a magic word here
- </p>
- !! html/parsoid
- <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
- | 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>
- !! end
- !! test
- Say the magic word
- !! options
- title=[[Parser test]]
- !! wikitext
- *{{PAGENAME}}
- *{{PAGENAMEE}}
- *{{FULLPAGENAME}}
- *{{FULLPAGENAMEE}}
- *{{BASEPAGENAME}}
- *{{BASEPAGENAMEE}}
- *{{SUBPAGENAME}}
- *{{SUBPAGENAMEE}}
- *{{ROOTPAGENAME}}
- *{{ROOTPAGENAMEE}}
- *{{TALKPAGENAME}}
- *{{TALKPAGENAMEE}}
- *{{SUBJECTPAGENAME}}
- *{{SUBJECTPAGENAMEE}}
- *{{NAMESPACEE}}
- *{{NAMESPACE}}
- *{{NAMESPACENUMBER}}
- *{{TALKSPACE}}
- *{{TALKSPACEE}}
- *{{SUBJECTSPACE}}
- *{{SUBJECTSPACEE}}
- *{{Dynamic|{{NUMBEROFUSERS}}|{{NUMBEROFPAGES}}|{{CURRENTVERSION}}|{{CONTENTLANGUAGE}}|{{DIRECTIONMARK}}|{{CURRENTTIMESTAMP}}|{{NUMBEROFARTICLES}}}}
- !! html
- <ul><li>Parser test</li>
- <li>Parser_test</li>
- <li>Parser test</li>
- <li>Parser_test</li>
- <li>Parser test</li>
- <li>Parser_test</li>
- <li>Parser test</li>
- <li>Parser_test</li>
- <li>Parser test</li>
- <li>Parser_test</li>
- <li>Talk:Parser test</li>
- <li>Talk:Parser_test</li>
- <li>Parser test</li>
- <li>Parser_test</li>
- <li></li>
- <li></li>
- <li>0</li>
- <li>Talk</li>
- <li>Talk</li>
- <li></li>
- <li></li>
- <li><a href="/index.php?title=Template:Dynamic&action=edit&redlink=1" class="new" title="Template:Dynamic (page does not exist)">Template:Dynamic</a></li></ul>
- !! end
- ### Note: Above tests excludes the "{{NUMBEROFADMINS}}" magic word because it generates a MySQL error when included.
- !! test
- Gallery with valid attributes
- !! wikitext
- <gallery type="123" summary="345">
- File:File:Foobar.jpg
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional" type="123">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">File:Foobar.jpg</div>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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"}}'>
- <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>
- </ul>
- !! end
- ## Parsoid thinks the "centre" here is a property, not a caption.
- !! test
- Gallery
- !! options
- parsoid={
- "modes": ["wt2html"],
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- image1.png |
- image2.gif|||||
- image3|
- image4 |300px| centre
- image5.svg| http://///////
- [[x|xx]]]]
- * image6
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Image1.png</div>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Image2.gif</div>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Image3</div>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Image4</div>
- <div class="gallerytext">
- <pre>centre
- </pre>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Image5.svg</div>
- <div class="gallerytext">
- <p><a rel="nofollow" class="external free" href="http://///////">http://///////</a>
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">* image6</div>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- <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>
- <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>
- <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>
- <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>
- <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>
- </ul>
- !! end
- !! test
- Gallery (with options, html)
- !! options
- parsoid={
- "modes": ["wt2html", "html2html"],
- "nativeGallery": true
- }
- !! wikitext
- <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
- File:Nonexistent.jpg|caption
- File:Nonexistent.jpg
- image:foobar.jpg|some '''caption''' [[Main Page]]
- image:foobar.jpg
- image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
- <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- <p>caption
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <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>
- <div class="gallerytext">
- <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <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>
- <div class="gallerytext">
- <p>blabla.
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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":{}}'>
- <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
- <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>
- <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>
- <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>
- <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>
- <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>
- </ul>
- !! end
- !! test
- Gallery (with options, extsrc)
- !! options
- parsoid={
- "nativeGallery": false
- }
- !! wikitext
- <gallery widths="70px" heights="40px" perrow="2" caption="Foo [[Main Page]]">
- File:Nonexistent.jpg|caption
- File:Nonexistent.jpg
- image:foobar.jpg|some '''caption''' [[Main Page]]
- image:foobar.jpg
- image:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional" style="max-width: 226px;_width: 226px;">
- <li class='gallerycaption'>Foo <a href="/wiki/Main_Page" title="Main Page">Main Page</a></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- <p>caption
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <div class="thumb" style="height: 70px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <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>
- <div class="gallerytext">
- <p>some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <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>
- <div class="gallerytext">
- <p>blabla.
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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 '''caption''' [[Main Page]]\nimage:foobar.jpg\nimage:foobar.jpg|Blabla|alt=This is a foo-bar.|blabla.\n"}}'>
- <li class="gallerycaption">Foo <a rel="mw:WikiLink" href="./Main_Page" title="Main Page">Main Page</a></li>
- <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>
- <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>
- <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>
- <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>
- <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>
- </ul>
- !! end
- !! test
- Gallery (without px units)
- !! wikitext
- <gallery widths="70" heights="40">
- File:Foobar.jpg
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 105px"><div style="width: 105px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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"}}'>
- <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>
- </ul>
- !! end
- !! test
- Gallery (with invalid units)
- !! wikitext
- <gallery widths="70em" heights="40em">
- File:Foobar.jpg
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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"}}'>
- <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>
- </ul>
- !! end
- !! test
- Gallery with link that has fragment
- !! options
- parsoid={
- "modes": ["wt2html", "html2html"],
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- image:foobar.jpg|link=Main_Page
- image:foobar.jpg|link=Main_Page#section
- image:foobar.jpg|link=Main Page#section|caption
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <p>caption
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- <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>
- <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>
- </ul>
- !! end
- ## Whoops, Parsoid shouldn't be parsing templates in the attribute caption!
- !! test
- Gallery with template inside caption
- !! options
- parsoid={
- "nativeGallery": true
- }
- !! wikitext
- <gallery caption="{{echo|hi}}">
- File:Foobar.jpg|{{echo|ho}}
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class='gallerycaption'>{{echo|hi}}</li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <p>ho
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- <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>
- </ul>
- !! end
- !! test
- Gallery with wikitext inside caption
- !! options
- parsoid={
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- File:Foobar.jpg|alt=galleryalt|[[File:Foobar.jpg|alt=inneralt|20x20px|desc]]
- File:Foobar.jpg|alt=galleryalt|{{Test|unamedParam|alt=param}}
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <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>
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <p>This is a test template
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt6" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- <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>
- </ul>
- !! end
- !! test
- Gallery (with showfilename option)
- !! options
- parsoid={
- "nativeGallery": true
- }
- !! wikitext
- <gallery showfilename="">
- File:Nonexistent.jpg|caption
- File:Nonexistent.jpg
- File:Foobar.jpg|some '''caption''' [[Main Page]]
- File:Foobar.jpg
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
- caption
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- <p><a href="/wiki/File:Nonexistent.jpg" class="galleryfilename galleryfilename-truncate" title="File:Nonexistent.jpg">Nonexistent.jpg</a>
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
- some <b>caption</b> <a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <p><a href="/wiki/File:Foobar.jpg" class="galleryfilename galleryfilename-truncate" title="File:Foobar.jpg">Foobar.jpg</a>
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt3" data-mw='{"name":"gallery","attrs":{"showfilename":""},"body":{}}'>
- <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>
- <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>
- <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>
- <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>
- </ul>
- !! end
- ## Should Parsoid be preserving these variations? See T151367
- !! test
- Gallery (with namespace-less filenames)
- !! options
- parsoid={
- "modes": ["wt2html", "html2html"],
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- File:Nonexistent.jpg
- Nonexistent.jpg
- image:foobar.jpg
- foobar.jpg
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <div class="thumb" style="height: 150px;">Nonexistent.jpg</div>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- <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>
- <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>
- <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>
- </ul>
- !! end
- !! test
- Gallery override link with wikilink (T36852)
- !! options
- parsoid={
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- File:Foobar.jpg|alt=galleryalt|link=Wikilink
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- </ul>
- !! end
- !! test
- Gallery override link with absolute external link (T36852)
- !! options
- parsoid={
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- File:Foobar.jpg|alt=galleryalt|link=http://www.example.org
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- </ul>
- !! end
- !! test
- Gallery override link with absolute external link with LanguageConverter
- !! options
- language=zh
- !! wikitext
- <gallery>
- File:foobar.jpg|caption|alt=galleryalt|link=http://www.example.org
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <p>caption
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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"}}'>
- <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>
- </ul>
- !! end
- !! test
- Gallery override link with malicious javascript (T36852)
- !! options
- parsoid={
- "modes": ["wt2html", "html2html"],
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- File:Foobar.jpg|alt=galleryalt|link=" onclick="alert('malicious javascript code!');
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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>
- </ul>
- !! end
- # Note that parsoid uses the invalid link as a caption, PHP does not.
- !! test
- Gallery with invalid title as link (T45964)
- !! options
- parsoid={
- "modes": ["wt2html", "html2html"],
- "nativeGallery": true
- }
- !! wikitext
- <gallery>
- File:Foobar.jpg|link=<
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{},"body":{}}'>
- <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=<</div></li>
- </ul>
- !! end
- !! test
- Serialize gallery without attrs in data-mw
- !! options
- parsoid={
- "modes": ["html2wt"],
- "nativeGallery": true
- }
- !! html/parsoid
- <ul class="gallery mw-gallery-traditional" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","body":{}}'>
- <li class="gallerycaption">123</li>
- <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>
- </ul>
- !! wikitext
- <gallery caption="123">
- File:Test.png
- </gallery>
- !! end
- !! test
- Gallery with class and style attributes
- !! options
- parsoid={
- "nativeGallery": true
- }
- !! wikitext
- <gallery class="center" style="text-align: center;">
- File:Foobar.jpg
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional center" style="text-align: center;">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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":{}}'>
- <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>
- </ul>
- !! end
- !! test
- Gallery in slideshow mode
- !! options
- parsoid={
- "nativeGallery": true
- }
- !! wikitext
- <gallery mode="slideshow" showthumbnails="">
- File:Foobar.jpg
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <ul class="gallery mw-gallery-slideshow" data-showthumbnails="1" typeof="mw:Extension/gallery" about="#mwt2" data-mw='{"name":"gallery","attrs":{"mode":"slideshow","showthumbnails":""},"body":{}}'>
- <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>
- </ul>
- !! end
- !! test
- HTML Hex character encoding (spells the word "JavaScript")
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- JavaScript
- !! html/php
- <p>JavaScript
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- HTML Hex character encoding bogus encoding (T28437 regression check)
- !! wikitext
- &#xsee;&#XSEE;
- !! html
- <p>&#xsee;&#XSEE;
- </p>
- !! end
- !! test
- HTML Hex character encoding mixed case
- !! options
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- îî
- !! html/php
- <p>îî
- </p>
- !! html/parsoid
- <p><span typeof="mw:Entity">î</span><span typeof="mw:Entity">î</span></p>
- !! end
- # See: https://www.w3.org/TR/html5/syntax.html#character-references
- # Note that U+000C (form feed) is not a valid XML character, so
- # it is banned even though allowed in HTML5.
- !! test
- Illegal character references (T106578)
- !! wikitext
- ; Null: �
- ; FF: 
- ; CR: 
- ; Control (low): 
- ; Control (high):  Ÿ
- ; Surrogate: ��
- ; This is an okay astral character: 💩
- !! html+tidy
- <dl><dt>Null</dt>
- <dd>&#00;</dd>
- <dt>FF</dt>
- <dd>&#xC;</dd>
- <dt>CR</dt>
- <dd>&#xD;</dd>
- <dt>Control (low)</dt>
- <dd>&#8;</dd>
- <dt>Control (high)</dt>
- <dd>&#x7F; &#x9F;</dd>
- <dt>Surrogate</dt>
- <dd>&#xD83D;&#xDCA9;</dd>
- <dt>This is an okay astral character</dt>
- <dd>💩</dd></dl>
- !! end
- !! test
- __FORCETOC__ override
- !! wikitext
- __NEWSECTIONLINK__
- __FORCETOC__
- !! html/php
- <p><br />
- </p>
- !! end
- !! test
- ISBN code coverage
- !! wikitext
- ISBN 978-0-1234-56 789
- !! html/php
- <p><a href="/wiki/Special:BookSources/9780123456" class="internal mw-magiclink-isbn">ISBN 978-0-1234-56</a> 789
- </p>
- !! html/parsoid
- <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":"&#x20;","srcContent":" "}'> </span>789</p>
- !! end
- !! test
- ISBN followed by 5 spaces
- !! wikitext
- ISBN
- !! html
- <p>ISBN
- </p>
- !! end
- !! test
- Double ISBN
- !! wikitext
- ISBN ISBN 1234567890
- !! html/php
- <p>ISBN <a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
- </p>
- !! html/parsoid
- <p>ISBN <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
- !! end
- # Uppercase X and lowercase x as well
- !! test
- ISBN with an X
- !! wikitext
- ISBN 3-462-04561-X
- ISBN 3-462-04561-x
- ISBN 080442957X
- ISBN 080442957x
- ISBN 978080442957X
- ISBN 978080442957x
- !! html/php
- <p><a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-X</a>
- <a href="/wiki/Special:BookSources/346204561X" class="internal mw-magiclink-isbn">ISBN 3-462-04561-x</a>
- <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957X</a>
- <a href="/wiki/Special:BookSources/080442957X" class="internal mw-magiclink-isbn">ISBN 080442957x</a>
- <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957X</a>
- <a href="/wiki/Special:BookSources/978080442957X" class="internal mw-magiclink-isbn">ISBN 978080442957x</a>
- </p>
- !! html/parsoid
- <p><a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-X</a>
- <a href="./Special:BookSources/346204561X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 3-462-04561-x</a>
- <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957X</a>
- <a href="./Special:BookSources/080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 080442957x</a>
- <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957X</a>
- <a href="./Special:BookSources/978080442957X" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 978080442957x</a></p>
- !! end
- !! test
- ISBN with empty prefix (parsoid test)
- !! wikitext
- ISBN 1234567890
- !! html/php
- <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
- </p>
- !! html/parsoid
- <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink">ISBN 1234567890</a></p>
- !! end
- !! test
- T24905: <abbr> followed by ISBN followed by </a>
- !! wikitext
- <abbr>(fr)</abbr> ISBN 2753300917 [http://www.example.com example.com]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Double RFC
- !! wikitext
- RFC RFC 1234
- !! html
- <p>RFC <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc1234">RFC 1234</a>
- </p>
- !! end
- !! test
- Double RFC with a wiki link
- !! wikitext
- RFC [[RFC 1234]]
- !! html
- <p>RFC <a href="/index.php?title=RFC_1234&action=edit&redlink=1" class="new" title="RFC 1234 (page does not exist)">RFC 1234</a>
- </p>
- !! end
- !! test
- RFC code coverage
- !! wikitext
- RFC 983 987
- !! html/php
- <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc983">RFC 983</a> 987
- </p>
- !! html/parsoid
- <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":"&#x20;","srcContent":" "}'> </span>987</p>
- !! end
- !! test
- Centre-aligned image
- !! wikitext
- [[Image:foobar.jpg|centre]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- None-aligned image
- !! wikitext
- [[Image:foobar.jpg|none]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- Width + Height sized image (using px) (height is ignored)
- !! wikitext
- [[Image:foobar.jpg|640x480px]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Width-sized image (using px, no following whitespace)
- !! wikitext
- [[Image:foobar.jpg|640px]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Width-sized image (using px, with following whitespace - test regression from r39467)
- !! wikitext
- [[Image:foobar.jpg|640px ]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !!end
- !! test
- Width-sized image (using px, with preceding whitespace - test regression from r39467)
- !! wikitext
- [[Image:foobar.jpg| 640px]]
- !! html/php
- <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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Image with page parameter
- !! options
- djvu
- !! wikitext
- [[File:LoremIpsum.djvu|page=2]]
- !! html/php
- <p><a href="/index.php?title=File:LoremIpsum.djvu&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>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Another italics / bold test
- !! wikitext
- ''' ''x'
- !! html
- <pre>'<i> </i>x'
- </pre>
- !!end
- # FIXME: The php output seems broken. It's interleaving some open/close tags.
- !! test
- dt/dd/dl test
- !! wikitext
- :;;;::
- !! html/php
- <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dt></dl></dd></dl></dd></dl></dd></dl></dd></dl></dd></dl>
- !! html/parsoid
- <dl><dd><dl><dt><dl><dt><dl><dt><dl><dd><dl><dd></dd></dl></dd></dl></dt></dl></dt></dl></dt></dl></dd></dl>
- !!end
- # Images with the "|" character in external URLs in comment tags; Eats half the comment, leaves unmatched "</a>" tag.
- !! test
- Images with the "|" character in the comment
- !! wikitext
- [[File:Foobar.jpg|thumb|An [http://test/?param1=|left|¶m2=|x external] URL]]
- !! html/php
- <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&param2=%7Cx">external</a> URL</div></div></div>
- !! html/parsoid
- <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&param2=%7Cx" data-parsoid='{"a":{"href":"http://test/?param1=%7Cleft%7C&param2=%7Cx"},"sa":{"href":"http://test/?param1=|left|&param2=|x"}}'>external</a> URL</figcaption></figure>
- !! end
- !! test
- [Before] HTML without raw HTML enabled ($wgRawHtml==false)
- !! wikitext
- <html><script>alert(1);</script></html>
- !! html
- <p><html><script>alert(1);</script></html>
- </p>
- !! end
- !! test
- HTML with raw HTML ($wgRawHtml==true)
- !! options
- wgRawHtml=1
- !! wikitext
- <html><script>alert(1);</script></html>
- !! html/php
- <p><script>alert(1);</script>
- </p>
- !! end
- !! test
- Parents of subpages, one level up
- !! options
- subpage title=[[Subpage test/L1/L2/L3]]
- !! wikitext
- [[../|L2]]
- !! html
- <p><a href="/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">L2</a>
- </p>
- !! end
- !! test
- Parents of subpages, one level up, not named
- !! options
- subpage title=[[Subpage test/L1/L2/L3]]
- !! wikitext
- [[../]]
- !! html
- <p><a href="/index.php?title=Subpage_test/L1/L2&action=edit&redlink=1" class="new" title="Subpage test/L1/L2 (page does not exist)">Subpage test/L1/L2</a>
- </p>
- !! end
- !! test
- Parents of subpages, two levels up
- !! options
- subpage title=[[Subpage test/L1/L2/L3]]
- !! wikitext
- [[../../|L1]]2
- [[../../|L1]]l
- !! html
- <p><a href="/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1</a>2
- </p><p><a href="/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">L1l</a>
- </p>
- !! end
- !! test
- Parents of subpages, two levels up, without trailing slash or name.
- !! options
- subpage title=[[Subpage test/L1/L2/L3]]
- !! wikitext
- [[../..]]
- !! html
- <p>[[../..]]
- </p>
- !! end
- !! test
- Parents of subpages, two levels up, with lots of extra trailing slashes.
- !! options
- subpage title=[[Subpage test/L1/L2/L3]]
- !! wikitext
- [[../../////]]
- !! html
- <p><a href="/index.php?title=Subpage_test/L1&action=edit&redlink=1" class="new" title="Subpage test/L1 (page does not exist)">Subpage test/L1</a>
- </p>
- !! end
- !! article
- Subpage test/L1/L2/L3Sibling
- !! text
- Sibling article
- !! endarticle
- !! test
- Transclusion of a sibling page (one level up)
- !! options
- subpage title=[[Subpage test/L1/L2/L3]]
- !! wikitext
- {{../L3Sibling}}
- !! html
- <p>Sibling article
- </p>
- !! end
- !! test
- Transclusion of a child page
- !! options
- subpage title=[[Subpage test/L1/L2]]
- !! wikitext
- {{/L3Sibling}}
- !! html
- <p>Sibling article
- </p>
- !! end
- # This is wt2html only in Parsoid because we add <nowiki>
- # because of {{..}} and we don't expect to fix that to
- # eliminate the nowikis selective for {{..}} markup.
- !! test
- Non-transclusion because of too many up levels
- !! options
- subpage title=[[Subpage test/L1/L2/L3]]
- parsoid=wt2html
- !! wikitext
- {{../../../../More than parent}}
- !! html/php
- <p>{{../../../../More than parent}}
- </p>
- !! html/parsoid
- <p>{{../../../../More than parent}}</p>
- !! end
- !! test
- Definition list code coverage
- !! wikitext
- ;title : def
- ;title : def
- ;title: def
- !! html/php
- <dl><dt>title  </dt>
- <dd>def</dd>
- <dt>title </dt>
- <dd>def</dd>
- <dt>title</dt>
- <dd>def</dd></dl>
- !! html/parsoid
- <dl><dt>title <span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
- <dt>title<span typeof="mw:Placeholder"> </span></dt><dd> def</dd>
- <dt>title</dt><dd> def</dd></dl>
- !! end
- !! test
- Don't fall for the self-closing div
- !! wikitext
- <div>hello world</div/>
- !! html
- <div>hello world</div>
- !! end
- !! test
- MSGNW magic word
- !! wikitext
- {{MSGNW:msg}}
- !! html/php
- <p>[[:Template:Msg]]
- </p>
- !! end
- !! test
- RAW magic word
- !! wikitext
- {{RAW:QUERTY}}
- !! html
- <p><a href="/index.php?title=Template:QUERTY&action=edit&redlink=1" class="new" title="Template:QUERTY (page does not exist)">Template:QUERTY</a>
- </p>
- !! end
- # This isn't needed for XHTML conformance, but would be handy as a fallback security measure
- !! test
- Always escape literal '>' in output, not just after '<'
- !! wikitext
- ><>
- !! html
- <p>><>
- </p>
- !! end
- !! test
- Template caching
- !! wikitext
- {{Test}}
- {{Test}}
- !! html
- <p>This is a test template
- This is a test template
- </p>
- !! end
- !! article
- MediaWiki:Fake
- !! text
- ==header==
- !! endarticle
- !! test
- Inclusion of !userCanEdit() content
- !! wikitext
- {{MediaWiki:Fake}}
- !! html
- <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&action=edit&section=T-1" title="MediaWiki:Fake">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- Out-of-order TOC heading levels
- !! wikitext
- ==2==
- ======6======
- ===3===
- =1=
- =====5=====
- ==2==
- !! html
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#2"><span class="tocnumber">1</span> <span class="toctext">2</span></a>
- <ul>
- <li class="toclevel-2 tocsection-2"><a href="#6"><span class="tocnumber">1.1</span> <span class="toctext">6</span></a></li>
- <li class="toclevel-2 tocsection-3"><a href="#3"><span class="tocnumber">1.2</span> <span class="toctext">3</span></a></li>
- </ul>
- </li>
- <li class="toclevel-1 tocsection-4"><a href="#1"><span class="tocnumber">2</span> <span class="toctext">1</span></a>
- <ul>
- <li class="toclevel-2 tocsection-5"><a href="#5"><span class="tocnumber">2.1</span> <span class="toctext">5</span></a></li>
- <li class="toclevel-2 tocsection-6"><a href="#2_2"><span class="tocnumber">2.2</span> <span class="toctext">2</span></a></li>
- </ul>
- </li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: 6">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- <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&action=edit&section=3" title="Edit section: 3">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
- <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&action=edit&section=4" title="Edit section: 1">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <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&action=edit&section=5" title="Edit section: 5">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
- <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&action=edit&section=6" title="Edit section: 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- ISBN with a dummy number
- !! wikitext
- ISBN ---
- !! html
- <p>ISBN ---
- </p>
- !! end
- !! test
- ISBN with space-delimited number
- !! wikitext
- ISBN 92 9017 032 8
- !! html/php
- <p><a href="/wiki/Special:BookSources/9290170328" class="internal mw-magiclink-isbn">ISBN 92 9017 032 8</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- ISBN with multiple spaces, no number
- !! wikitext
- ISBN foo
- !! html
- <p>ISBN foo
- </p>
- !! end
- !! test
- ISBN length
- !! wikitext
- ISBN 123456789
- ISBN 1234567890
- ISBN 12345678901
- !! html/php
- <p>ISBN 123456789
- </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>
- </p><p>ISBN 12345678901
- </p>
- !! html/parsoid
- <p>ISBN 123456789</p>
- <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a></p>
- <p>ISBN 12345678901</p>
- !! end
- !! test
- ISBN with trailing year (T9110)
- !! wikitext
- ISBN 1-234-56789-0 - 2006
- ISBN 1 234 56789 0 - 2006
- !! html/php
- <p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1-234-56789-0</a> - 2006
- </p><p><a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1 234 56789 0</a> - 2006
- </p>
- !! html/parsoid
- <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1-234-56789-0</a> - 2006</p>
- <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1 234 56789 0</a> - 2006</p>
- !! end
- !! test
- anchorencode
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- {{anchorencode:foo bar©#%n}}
- !! html/php
- <p>foo_bar©#%n
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- anchorencode (legacy)
- !! config
- wgFragmentMode=[ 'legacy' ]
- !! wikitext
- {{anchorencode:foo bar©#%n}}
- !! html/php
- <p>foo_bar.C2.A9.23.25n
- </p>
- !! end
- !! test
- anchorencode trims spaces
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- {{anchorencode: __pretty__please__}}
- !! html/php
- <p>pretty_please
- </p>
- !! html/parsoid
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: __pretty__please__","function":"anchorencode"},"params":{},"i":0}}]}'>pretty_please</p>
- !! end
- !! test
- anchorencode deals with links
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- {{anchorencode: [[hello|world]] [[hi]]}}
- !! html/php
- <p>world_hi
- </p>
- !! html/parsoid
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: [[hello|world]] [[hi]]","function":"anchorencode"},"params":{},"i":0}}]}'>world_hi</p>
- !! end
- !! test
- anchorencode deals with templates
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- {{anchorencode: {{Foo}} x}}
- !! html/php
- <p>FOO_x
- </p>
- !! html/parsoid
- <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: {{Foo}} x","function":"anchorencode"},"params":{},"i":0}}]}'>FOO_x</p>
- !! end
- !! test
- anchorencode encodes like the TOC generator: (T20431)
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- ===_ +:.3A%3A _ &&]] x===
- {{anchorencode: _ +:.3A%3A _ &&]] x}}
- __NOEDITSECTION__
- !! html/php
- <h3><span id=".2B:.3A.253A_.26.26.5D.5D_x"></span><span class="mw-headline" id="+:.3A%3A_&&]]_x">_ +:.3A%3A _ &&]] x</span></h3>
- <p>+:.3A%3A_&&]]_x
- </p>
- !! html/parsoid
- <h3 id="+:.3A%3A_&&]]_x"><span id=".2B:.3A.253A_.26.26.5D.5D_x" typeof="mw:FallbackId"></span>_ +:.3A%3A _ &<span typeof="mw:Entity" data-parsoid='{"src":"&amp;","srcContent":"&","dsr":[18,23,null,null]}'>&</span>]] x</h3>
- <p about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode: _ +:.3A%3A _ &&amp;]] x","function":"anchorencode"},"params":{},"i":0}}]}'>+:.3A%3A_&&<span typeof="mw:Entity">]</span><span typeof="mw:Entity">]</span>_x</p>
- <meta property="mw:PageProp/noeditsection"/>
- !! end
- !! test
- anchorencode encodes like the TOC generator: (T20431) (legacy)
- !! config
- wgFragmentMode=[ 'legacy' ]
- !! wikitext
- ===_ +:.3A%3A&&]]===
- {{anchorencode: _ +:.3A%3A&&]] }}
- __NOEDITSECTION__
- !! html/php
- <h3><span class="mw-headline" id=".2B:.3A.253A.26.26.5D.5D">_ +:.3A%3A&&]]</span></h3>
- <p>.2B:.3A.253A.26.26.5D.5D
- </p>
- !! end
- !! test
- T8200: blockquotes and paragraph formatting
- !! wikitext
- <blockquote>
- foo
- </blockquote>
- bar
- baz
- !! html
- <blockquote>
- <p>foo
- </p>
- </blockquote>
- <p>bar
- </p>
- <pre>baz
- </pre>
- !! end
- !! test
- T10293: Use of center tag ruins paragraph formatting
- !! wikitext
- <center>
- foo
- </center>
- bar
- baz
- !! html
- <center>
- <p>foo
- </p>
- </center>
- <p>bar
- </p>
- <pre>baz
- </pre>
- !! end
- !!test
- Parsing of overlapping (improperly nested) inline html tags
- !! wikitext
- <span><s>x</span></s>
- !! html/php
- <p><span><s>x</span></s></span>
- </p>
- !! html/parsoid
- <p><span><s>x</s></span>
- </p>
- !!end
- ###
- ### Language variants related tests
- ###
- # Parsoid does not mark self-links.
- # Parsoid does not convert links; PHP will do any necessary redirects.
- !! test
- Self-link in language variants
- !! options
- title=[[Dunav]] language=sr
- !! wikitext
- Both [[Dunav]] and [[Дунав]] are names for this river.
- !! html/php
- <p>Both <a class="mw-selflink selflink">Dunav</a> and <a class="mw-selflink selflink">Дунав</a> are names for this river.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! article
- Дуна
- !! text
- content
- !! endarticle
- !! test
- Link to another existing title shouldn't be parsed as self-link even if it's a variant of this title
- !! options
- title=[[Duna]] language=sr
- !! wikitext
- [[Дуна]] is not a self-link while [[Duna]] and [[Dуна]] are still self-links.
- !! html/php
- <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.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Link to a section of a variant of this title shouldn't be parsed as self-link
- !! options
- title=[[Duna]] language=sr
- !! wikitext
- [[Dуна]] is a self-link while [[Dunа#Foo]] and [[Dуна#Foo]] are not self-links.
- !! html/php
- <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.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Link to pages in language variants
- !! options
- language=sr
- !! wikitext
- Main Page can be written as [[Маин Паге]]
- !! html/php
- <p>Main Page can be written as <a href="/wiki/Main_Page" title="Main Page">Маин Паге</a>
- </p>
- !! html/parsoid
- <p>Main Page can be written as <a rel="mw:WikiLink" href="./Маин_Паге" title="Маин Паге">Маин Паге</a></p>
- !! end
- !! test
- Multiple links to pages in language variants
- !! options
- language=sr
- !! wikitext
- [[Main Page]] can be written as [[Маин Паге]] same as [[Маин Паге]].
- !! html/php
- <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>.
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Simple template in language variants
- !! options
- language=sr
- !! wikitext
- {{тест}}
- !! html/php
- <p>This is a test template
- </p>
- !! end
- !! test
- Template with explicit namespace in language variants
- !! options
- language=sr
- !! wikitext
- {{Template:тест}}
- !! html/php
- <p>This is a test template
- </p>
- !! end
- !! test
- Basic test for template parameter in language variants
- !! options
- language=sr
- !! wikitext
- {{парамтест|param=foo}}
- !! html/php
- <p>This is a test template with parameter foo
- </p>
- !! end
- !! test
- Simple category in language variants
- !! options
- language=sr cat
- !! wikitext
- [[Category:МедиаWики Усер'с Гуиде]]
- !! html/php
- cat=МедиаWики_Усер'с_Гуиде sort=
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Категорија:МедиаWики_Усер'с_Гуиде" data-parsoid='{"stx":"simple","a":{"href":"./Категорија:МедиаWики_Усер'с_Гуиде"},"sa":{"href":"Category:МедиаWики Усер'с Гуиде"}}'/>
- !! end
- !! article
- Category:分类
- !! text
- blah
- !! endarticle
- !! article
- Category:分類
- !! text
- blah
- !! endarticle
- ## We used to, but no longer wt2wt this test since the default serializer
- ## will normalize all categories to serialize on their own line.
- ## This wikitext usage is going to be fairly uncommon in production and
- ## selser will take care of preserving formatting in those scenarios.
- !! test
- Don't convert blue categorylinks to another variant (T35210)
- !! options
- cat
- language=zh
- parsoid=wt2html
- !! wikitext
- [[A]][[Category:分类]]
- !! html/php
- cat=分类 sort=
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./A" title="A">A</a></p>
- <link rel="mw:PageProp/Category" href="./Category:分类"/>
- !! end
- !! test
- Stripping -{}- tags (language variants)
- !! options
- language=sr
- !! wikitext
- Latin proverb: -{Ne nuntium necare}-
- !! html/php
- <p>Latin proverb: Ne nuntium necare
- </p>
- !! html/parsoid
- <p>Latin proverb: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
- !! end
- !! test
- Prevent conversion with -{}- tags (language variants)
- !! options
- language=sr variant=sr-ec
- !! wikitext
- Latinski: -{Ne nuntium necare}-
- !! html/php
- <p>Латински: Ne nuntium necare
- </p>
- !! html/parsoid
- <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
- !! end
- !! test
- Prevent conversion of text with -{}- tags (language variants)
- !! options
- language=sr variant=sr-ec
- !! wikitext
- Latinski: -{Ne nuntium necare}-
- !! html/php
- <p>Латински: Ne nuntium necare
- </p>
- !! html/parsoid
- <p>Latinski: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Ne nuntium necare"}}'></span></p>
- !! end
- !! test
- Prevent conversion of links with -{}- tags (language variants)
- !! options
- language=sr variant=sr-ec
- !! wikitext
- -{[[Main Page]]}-
- !! html/php
- <p><a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"<a rel=\"mw:WikiLink\" href=\"./Main_Page\" title=\"Main Page\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Main_Page\"},\"sa\":{\"href\":\"Main Page\"},\"dsr\":[2,15,2,2]}'>Main Page</a>"}}'></span></p>
- !! end
- !! test
- -{}- tags within headlines (within html for parserConvert())
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! options
- language=sr variant=sr-ec
- !! wikitext
- ==-{Naslov}-==
- Note that even an unprotected headline ID is not affected by language
- conversion:
- ==Latinski==
- !! html/php
- <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&action=edit&section=1" title="Уреди одељак „Naslov“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p>Ноте тхат евен ан унпротецтед хеадлине ИД ис нот аффецтед бy лангуаге
- цонверсион:
- </p>
- <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&action=edit&section=2" title="Уреди одељак „Латински“">уреди</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <h2 id="-{Naslov}-"><span id="-.7BNaslov.7D-" typeof="mw:FallbackId"></span><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Naslov"}}'></span></h2>
- <p>Note that even an unprotected headline ID is not affected by language
- conversion:</p>
- <h2 id="Latinski">Latinski</h2>
- !! end
- !! test
- Explicit definition of language variant alternatives
- !! options
- language=zh variant=zh-tw
- !! wikitext
- -{zh:China;zh-tw:Taiwan}-, not China
- !! html/php
- <p>Taiwan, not China
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Filter syntax for language variants
- !! options
- language=zh variant=zh-tw
- !! wikitext
- foo-{zh;zh-hans;zh-hant|blog, WEBJOURNAL, WEBLOG}-quux
- !! html/php
- <p>fooblog, WEBJOURNAL, WEBLOGquux
- </p>
- !! html/parsoid
- <p>foo<span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"blog, WEBJOURNAL, WEBLOG"}}'></span>quux</p>
- !! end
- # Note that Parsoid post-processing for language variants needs to
- # update the `title` attribute here, based on the mw:ExpandedAttrs property
- !! test
- Conversion around HTML tags
- !! options
- language=sr variant=sr-ec
- !! wikitext
- -{H|span=>sr-ec:script;title=>sr-ec:src}-
- <span title="La-{sr-el:L;sr-ec:C}-tin">ski</span>
- !! html/php
- <p>
- <span title="ЛаCтин">ски</span>
- </p>
- !! html/parsoid
- <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"}]}'/>
- <span title="Latin" typeof="mw:ExpandedAttrs" data-mw='{"attribs":[[{"txt":"title"},{"html":"La<span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"sr-el\",\"t\":\"L\"},{\"l\":\"sr-ec\",\"t\":\"C\"}]}' data-parsoid='{\"fl\":[],\"tSp\":[6],\"dsr\":[57,76,null,2]}'></span>tin"}]]}'>ski</span></p>
- !! end
- !! test
- Explicit session-wise two-way language variant mapping (A flag and - flag)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- This is -{zh:China; zh-tw:Taiwan}-, but we'll forget that now.
- Taiwan is not China.
- But -{A|zh:China; zh-tw:Taiwan}- is China,
- (This-{-|zh:China; zh-tw:Taiwan}- should be stripped!)
- and -{China}- is China.
- !! html/php
- <p>This is Taiwan, but we'll forget that now.
- </p><p>Taiwan is not China.
- </p><p>But Taiwan is Taiwan,
- </p><p>(This should be stripped!)
- </p><p>and China is China.
- </p>
- !! html/parsoid
- <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>
- <p>Taiwan is not China.</p>
- <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>
- <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>
- <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"China"}}'></span> is China.</p>
- !! end
- !! test
- Explicit session-wise one-way language variant mapping (A flag and - flag)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- This is -{COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}-, but we'll forget that now.
- COUNTRY is China or Taiwan.
- But -{A|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- is COUNTRY,
- (This-{-|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
- and -{COUNTRY}- is COUNTRY.
- !! html/php
- <p>This is Taiwan, but we'll forget that now.
- </p><p>COUNTRY is China or Taiwan.
- </p><p>But Taiwan is Taiwan,
- </p><p>(This should be stripped!)
- </p><p>and COUNTRY is COUNTRY.
- </p>
- !! html/parsoid
- <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>
- <p>COUNTRY is China or Taiwan.</p>
- <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>
- <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>
- <p>and <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"COUNTRY"}}'></span> is COUNTRY.</p>
- !! end
- !! test
- Explicit session-wise two-way language variant mapping (H flag for hide)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- (This-{H|zh:China;zh-tw:Taiwan}- should be stripped!)
- Taiwan is China.
- !! html/php
- <p>(This should be stripped!)
- </p><p>Taiwan is Taiwan.
- </p>
- !! html/parsoid
- <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>
- <p>Taiwan is China.</p>
- !! end
- !! test
- Explicit session-wise one-way language variant mapping (H flag for hide)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- (This-{H|COUNTRY=>zh:China;COUNTRY=>zh-tw:Taiwan}- should be stripped!)
- COUNTRY is Taiwan or China.
- !! html/php
- <p>(This should be stripped!)
- </p><p>Taiwan is Taiwan or China.
- </p>
- !! html/parsoid
- <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>
- <p>COUNTRY is Taiwan or China.</p>
- !! end
- ## Note that parsoid test runner does not support 'showtitle' option.
- !! test
- Adding explicit conversion rule for title (T flag)
- !! options
- language=zh variant=zh-tw showtitle
- !! wikitext
- Should be stripped-{T|zh:China;zh-tw:Taiwan}-!
- Taiwan is China.
- !! html/php
- Taiwan
- <p>Should be stripped!
- </p><p>Taiwan is China.
- </p>
- !! html/parsoid
- <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>
- <p>Taiwan is China.</p>
- !! end
- !! test
- Code coverage: T combined with H flag
- !! options
- language=zh variant=zh-tw showtitle
- !! wikitext
- Should be stripped-{T;H|zh:China; zh-tw:Taiwan}-!
- Taiwan is China.
- !! html/php
- Taiwan
- <p>Should be stripped!
- </p><p>Taiwan is Taiwan.
- </p>
- !! html/parsoid
- <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>
- <p>Taiwan is China.</p>
- !! end
- !! test
- Code coverage: T with no variants
- !! options
- language=zh variant=zh-tw showtitle
- !! wikitext
- -{H|zh:China; zh-tw:Taiwan}-
- Taiwan is China.-{T|Taiwan is China}-
- !! html/php
- Taiwan is China
- <p>
- Taiwan is Taiwan.
- </p>
- !! html/parsoid
- <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
- Taiwan is China.<meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"Taiwan is China"},"title":true}'/></p>
- !! end
- !! test
- Code coverage: rules with no variants
- !! options
- language=zh variant=zh-tw
- !! wikitext
- -{H|zh:China; zh-tw:Taiwan}-
- Taiwan is China.
- -{H|China}-
- Taiwan is China.
- !! html/php
- <p>
- Taiwan is Taiwan.
- Taiwan is China.
- </p>
- !! html/parsoid
- <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>
- Taiwan is China.
- <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":"China"}]}'/>
- Taiwan is China.</p>
- !! end
- !! test
- Code coverage: D flag for conversion rule
- !! options
- language=zh variant=zh-tw
- !! wikitext
- -{D|zh-cn:XA; zh-tw:YA}-
- -{A;D|zh-cn:XB; zh-tw:YB}-
- -{D;H|zh-cn:XC; zh-tw:YC}-
- -{D;H|FOO=>zh-tw:BAR;FOO=>zh-cn:BAT}-
- -{D|0=>zh-tw:1}-
- -{A;D|2=>zh-tw:3}-
- -{D;H|4=>zh-tw:5}-
- XA XB XC YA YB YC FOO BAR BAT 012345
- !! html/php
- <p>大陆:XA;台灣:YA;
- 大陆:XC;台灣:YC;
- </p><p>FOO⇒台灣:BAR;FOO⇒大陆:BAT;
- </p><p>0⇒台灣:1;
- 4⇒台灣:5;
- </p><p>XA YB YC YA YB YC BAR BAR BAT 013355
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"twoway":[{"l":"zh-cn","t":"XA"},{"l":"zh-tw","t":"YA"}]}'></span>
- <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XB"},{"l":"zh-tw","t":"YB"}]}'/>
- <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"twoway":[{"l":"zh-cn","t":"XC"},{"l":"zh-tw","t":"YC"}]}'></span></p>
- <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>
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"describe":true,"oneway":[{"f":"0","l":"zh-tw","t":"1"}]}'></span>
- <meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"2","l":"zh-tw","t":"3"}]}'/>
- <span typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"describe":true,"oneway":[{"f":"4","l":"zh-tw","t":"5"}]}'></span></p>
- <p>XA XB XC YA YB YC FOO BAR BAT 012345</p>
- !! end
- !! test
- Code coverage: N flag for conversion rule
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{N|zh-cn}-
- -{N|zh-tw}-
- -{N|sr-ec}-
- !! html/php
- <p>大陆
- </p><p>台灣
- </p><p>српски (ћирилица)
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-cn"}}'></span></p>
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"zh-tw"}}'></span></p>
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"sr-ec"}}'></span></p>
- !! end
- # html2wt suppresses the bogus 'D' flag, so this is wt2html only
- !! test
- Code coverage: N flag for conversion rule (wt2html only)
- !! options
- language=zh variant=zh-cn
- parsoid=wt2html,html2html
- !! wikitext
- -{D;N|en}-
- !! html/php
- <p>English
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"name":{"t":"en"}}' data-parsoid='{"fl":["D","N"]}'></span></p>
- !! end
- !! test
- Testing that changing the language variant here in the tests actually works
- !! options
- language=zh variant=zh showtitle
- !! wikitext
- Should be stripped-{T|zh:China; zh-tw:Taiwan}-!
- !! html/php
- China
- <p>Should be stripped!
- </p>
- !! html/parsoid
- <p>Should be stripped<meta typeof="mw:LanguageVariant" data-mw-variant='{"title":true,"twoway":[{"l":"zh","t":"China"},{"l":"zh-tw","t":"Taiwan"}]}'/>!</p>
- !! end
- !! test
- Recursive conversion of alt and title attrs shouldn't clear converter state
- !! options
- language=zh variant=zh-cn
- showtitle
- !! wikitext
- -{H|zh-cn:Exclamation; zh-tw:exclamation}-
- Should be stripped-{T|zh-cn:China; zh-tw:Taiwan}-<span title="exclamation">!</span>
- !! html/php
- China
- <p>
- Should be stripped<span title="Exclamation">!</span>
- </p>
- !! html/parsoid
- <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"zh-cn","t":"Exclamation"},{"l":"zh-tw","t":"exclamation"}]}'/>
- 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>
- !! end
- !! test
- T26072: more test on conversion rule for title
- !! options
- language=zh variant=zh-tw showtitle
- !! wikitext
- This should be stripped-{T|zh:China; zh-tw:Taiwan}-!
- This won't take interferes with the title rule-{H|zh:Beijing; zh-tw:Taipei}-.
- !! html/php
- Taiwan
- <p>This should be stripped!
- </p><p>This won't take interferes with the title rule.
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Partly disable title conversion if variant == main language code
- !! options
- language=zh variant=zh title=[[ZH]] showtitle
- !! wikitext
- -{T|zh-cn:CN;zh-tw:TW}-
- !! html/php
- ZH
- <p>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Partly disable title conversion if variant == main language code, more
- !! options
- language=zh variant=zh title=[[ZH]] showtitle
- !! wikitext
- -{T|TW}-
- !! html/php
- ZH
- <p>
- </p>
- !! html/parsoid
- <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"TW"},"title":true}'/></p>
- !! end
- !! test
- Raw output of variant escape tags (R flag)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- Raw: -{R|zh:China;zh-tw:Taiwan}-
- !! html/php
- <p>Raw: zh:China;zh-tw:Taiwan
- </p>
- !! html/parsoid
- <p>Raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"zh:China;zh-tw:Taiwan"}}'></span></p>
- !! end
- # html2wt suppresses the bogus 'D' flags, so this is wt2html only
- !! test
- Raw output of variant escape tags (R flag) (wt2html only)
- !! options
- language=zh variant=zh-tw
- parsoid=wt2html,html2html
- !! wikitext
- -{Variant}- -{D|syntax}- -{D;R|options}-
- !! html/php
- <p>Variant syntax options
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Nested markup inside raw output of variant escape tags (R flag)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- Nested raw: -{R|nested -{zh:China;zh-tw:Taiwan}- nested}-
- !! html/php
- <p>Nested raw: nested Taiwan nested
- </p>
- !! html/parsoid
- <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"zh\",\"t\":\"China\"},{\"l\":\"zh-tw\",\"t\":\"Taiwan\"}]}' data-parsoid='{\"fl\":[],\"tSp\":[6],\"dsr\":[23,48,null,2]}'></span> nested"}}'></span></p>
- !! end
- !! test
- Nested markup and spaces inside raw output of variant escape tags (R flag)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- X-{ outer -{ inner }- outer }-X
- !! html/php
- <p>X outer inner outer X
- </p>
- !! html/parsoid
- <p>X<span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":" outer <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"disabled\":{\"t\":\" inner \"}}' data-parsoid='{\"fl\":[],\"dsr\":[10,21,null,2]}'></span> outer "}}'></span>X</p>
- !! end
- !! test
- Templates inside raw output of variant escape tags (R flag)
- !! options
- language=zh variant=zh-tw
- !! wikitext
- Nested raw: -{R|nested {{echo|hi}} templates}-
- !! html/php
- <p>Nested raw: nested hi templates
- </p>
- !! html/parsoid
- <p>Nested raw: <span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"nested <span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[23,34,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hi\"}},\"i\":0}}]}'>hi</span> templates"}}'></span></p>
- !! end
- !! test
- Strings evaluating false shouldn't be ignored by Language converter (T51072)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{zh-cn:0;zh-sg:1;zh-tw:2;zh-hk:3}-
- !! html/php
- <p>0
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Conversion rules from [numeric-only string] to [something else] (T48634)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{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
- !! html/php
- <p>D12345EE12345
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- Two-way converter rule entries with an empty value should be ignored (T53551)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{H|zh-cn:foo;zh-tw:;}-foobar
- !! html/php
- <p>foobar
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- One-way converter rule entries with an empty "from" string should be ignored (T53551)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{H|=>zh-cn:foo;}-foobar
- !! html/php
- <p>foobar
- </p>
- !! html/parsoid
- <p><meta typeof="mw:LanguageVariant" data-parsoid='{"tSp":[5]}' data-mw-variant='{"add":true,"oneway":[{"f":"","l":"zh-cn","t":"foo"}]}'/>foobar</p>
- !! end
- !! test
- Empty converter rule entries shouldn't be inserted into the conversion table (T53551)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{H|}-foobar
- !! html/php
- <p>foobar
- </p>
- !! html/parsoid
- <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"twoway":[{"l":"*","t":""}]}'/>foobar</p>
- !! end
- !! test
- Nested using of manual convert syntax
- !! options
- language=zh variant=zh-hk
- !! wikitext
- Nested: -{zh-hans:Hi -{zh-cn:China;zh-sg:Singapore;}-;zh-hant:Hello -{zh-tw:Taiwan;zh-hk:H-{ong}- K-{}-ong;}-;}-!
- !! html/php
- <p>Nested: Hello Hong Kong!
- </p>
- !! html/parsoid
- <p>Nested: <span typeof="mw:LanguageVariant" data-parsoid='{"tSp":[7]}' data-mw-variant='{"twoway":[{"l":"zh-hans","t":"Hi <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"zh-cn\",\"t\":\"China\"},{\"l\":\"zh-sg\",\"t\":\"Singapore\"}]}' data-parsoid='{\"fl\":[],\"tSp\":[7],\"dsr\":[21,53,null,2]}'></span>"},{"l":"zh-hant","t":"Hello <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"twoway\":[{\"l\":\"zh-tw\",\"t\":\"Taiwan\"},{\"l\":\"zh-hk\",\"t\":\"H&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"ong\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"dsr\\\":[90,97,null,2]}&apos;>&lt;/span> K&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"dsr\\\":[99,103,null,2]}&apos;>&lt;/span>ong\"}]}' data-parsoid='{\"fl\":[],\"tSp\":[7],\"dsr\":[68,109,null,2]}'></span>"}]}'></span>!</p>
- !! end
- !! test
- HTML markups with conversion syntax in attribs, nested in other conversion blocks
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{zh;zh-hans;zh-hant|<span title="-{X}-">A</span>}-
- !! html/php
- <p><span title="X">A</span>
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"filter":{"l":["zh","zh-hans","zh-hant"],"t":"<span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid='{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[21,49,20,7]}' data-mw='{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"dsr\\\":[34,39,null,2]}&apos;>&lt;/span>\"}]]}'>A</span>"}}'></span></p>
- !! end
- !! test
- HTML markups with conversion syntax in attribs, nested in other conversion blocks (not working yet in PHP parser)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- -{<span title="-{X}-">A</span>}-
- !! html/php+disabled
- <p><span title="X">A</span>
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"<span title=\"\" about=\"#mwt1\" typeof=\"mw:ExpandedAttrs\" data-parsoid='{\"stx\":\"html\",\"a\":{\"title\":\"\"},\"sa\":{\"title\":\"-{X}-\"},\"dsr\":[2,30,20,7]}' data-mw='{\"attribs\":[[{\"txt\":\"title\"},{\"html\":\"&lt;span typeof=\\\"mw:LanguageVariant\\\" data-mw-variant=&apos;{\\\"disabled\\\":{\\\"t\\\":\\\"X\\\"}}&apos; data-parsoid=&apos;{\\\"fl\\\":[],\\\"dsr\\\":[15,20,null,2]}&apos;>&lt;/span>\"}]]}'>A</span>"}}'></span></p>
- !! end
- # Parsoid and PHP disagree on how to parse this example: Parsoid
- # insists that the content of a language converter element be a valid
- # DOM fragment or attribute string
- !! test
- Language converter markup with block content
- !! options
- language=zh variant=zh-cn
- !! wikitext
- <span>a-{b<div>c}-d
- <span>a-{zh;zh-hans;zh-hant|b<div>c}-d
- <span>a-{H|0=>zh-cn:x<span>y;0=>zh-tw:b<div>c}-d
- !! html/php+tidy
- <span>ab<div>cd
- <span>ab<div>cd
- <span>ad
- </span></div></span></div></span>
- !! html/parsoid
- <p><span data-parsoid='{"stx":"html","autoInsertedEnd":true}'>a</span></p><div typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"b<div data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[10,16,5,0]}'>c</div>"}}'></div><p>d</p>
- <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<div data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[50,56,5,0]}'>c</div>"}}'></div><p>d</p>
- <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<span data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[82,89,6,0]}'>y</span>"},{"f":"0","l":"zh-tw","t":"b<div data-parsoid='{\"stx\":\"html\",\"autoInsertedEnd\":true,\"dsr\":[100,106,5,0]}'>c</div>"}]}'/>d</span></p>
- !! end
- !! test
- LanguageConverter selser (1)
- !! options
- language=zh variant=zh-cn
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- ["span[typeof]", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
- ]
- }
- !! wikitext
- -{raw}-
- !! wikitext/edited
- -{edited}-
- !! end
- !! test
- LanguageConverter selser (2)
- !! options
- language=zh variant=zh-cn
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- ["span[class='x']", "contents", "text", "-{foo}-"],
- ["a", "contents", "text", "-{"],
- ["span[typeof]", "attr", "data-mw", "{\"parts\":[{\"template\":{\"target\":{\"wt\":\"1x\",\"href\":\"./Template:1x\"},\"params\":{\"1\":{\"wt\":\"-{\"}},\"i\":0}}]}"]
- ]
- }
- !! wikitext
- <span class="x">TEXT1</span>
- [http://example.com TEXT2]
- [[Foo|TEXT3]]
- {{echo|TEXT4}}
- !! wikitext/edited
- <span class="x"><nowiki>-{foo}-</nowiki></span>
- [http://example.com -{]
- [[Foo|<nowiki>-{</nowiki>]]
- {{1x|<nowiki>-{</nowiki>}}
- !! end
- # Tests LanguageVariantText in ConstrainedText
- !! test
- LanguageConverter selser (3)
- !! options
- language=zh variant=zh-cn
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- ["td > span", "attr", "typeof", "mw:LanguageVariant"],
- ["td > span", "attr", "data-mw-variant", "{\"disabled\":{\"t\":\"edited\"}}"]
- ]
- }
- !! wikitext
- {|
- |-
- |<span>Foo</span>
- |}
- !! wikitext/edited
- {|
- |-
- |<nowiki/>-{edited}-
- |}
- !! end
- # Tests LanguageVariantText._fromSelSer
- !! test
- LanguageConverter selser (4)
- !! options
- language=zh variant=zh-cn
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- ["td > span.x", "remove"]
- ]
- }
- !! wikitext
- {|
- |-
- |<span class="x">Foo</span>-{Bar}-
- ||<span class="x">Foo</span>-{Bar}-
- |}
- !! wikitext/edited
- {|
- |-
- |<nowiki/>-{Bar}-
- ||-{Bar}-
- |}
- !! end
- # Since Parsoid is starting to emit canonical wikitext for links,
- # [http://example.com http://example.com] will not RT back to that
- # form anymore.
- # Parsoid does not language-convert links (it is done in a
- # post-processing step)
- !! test
- Proper conversion of text in external links
- !! options
- language=sr variant=sr-ec
- parsoid=wt2html
- !! wikitext
- http://www.google.com
- gopher://www.google.com
- [http://www.google.com http://www.google.com]
- [gopher://www.google.com gopher://www.google.com]
- [https://www.google.com irc://www.google.com]
- [ftp://www.google.com www.google.com/ftp://dir]
- [//www.google.com www.google.com]
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://www.google.com">http://www.google.com</a>
- <a rel="nofollow" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
- <a rel="nofollow" class="external text" href="http://www.google.com">http://www.google.com</a>
- <a rel="nofollow" class="external text" href="gopher://www.google.com">gopher://www.google.com</a>
- <a rel="nofollow" class="external text" href="https://www.google.com">irc://www.google.com</a>
- <a rel="nofollow" class="external text" href="ftp://www.google.com">www.гоогле.цом/фтп://дир</a>
- <a rel="nofollow" class="external text" href="//www.google.com">www.гоогле.цом</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
- <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
- <a rel="mw:ExtLink" class="external free" href="http://www.google.com">http://www.google.com</a>
- <a rel="mw:ExtLink" class="external free" href="gopher://www.google.com">gopher://www.google.com</a>
- <a rel="mw:ExtLink" class="external text" href="https://www.google.com">irc://www.google.com</a>
- <a rel="mw:ExtLink" class="external text" href="ftp://www.google.com">www.google.com/ftp://dir</a>
- <a rel="mw:ExtLink" class="external text" href="//www.google.com">www.google.com</a></p>
- !! end
- !! test
- Do not convert roman numbers to language variants
- !! options
- language=sr variant=sr-ec
- !! wikitext
- Fridrih IV je car.
- !! html/php
- <p>Фридрих IV је цар.
- </p>
- !! html/parsoid
- <p>Fridrih IV je car.</p>
- !! end
- !! test
- Unclosed language converter markup "-{"
- !! options
- language=sr
- !! wikitext
- -{T|hello
- !! html
- <p>-{T|hello
- </p>
- !! end
- !! test
- Don't convert raw rule "-{R|=>}-" to "=>"
- !! options
- language=sr
- !! wikitext
- -{R|=>}-
- !! html/php
- <p>=>
- </p>
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"=<span typeof=\"mw:Entity\" data-parsoid='{\"src\":\"&amp;gt;\",\"srcContent\":\">\",\"dsr\":[5,9,null,null]}'>></span>"}}'></span></p>
- !!end
- !! test
- Don't break link parsing if language converter markup is in the caption.
- !! options
- language=sr variant=sr-ec
- !! wikitext
- [[Main Page|-{R|main page}-]]
- !! html/php
- <p><a href="/wiki/Main_Page" title="Маин Паге">main page</a>
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- T146304: Don't break template parsing if language converter markup is in the parameter.
- !! options
- language=sr variant=sr-ec
- !! wikitext
- {{echo|-{R|foo}-}}
- !! html/php
- <p>foo
- </p>
- !! html/parsoid
- <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>
- !! end
- !! test
- T146305: Don't break image parsing if language converter markup is in the caption.
- !! options
- language=sr
- !! wikitext
- [[Датотека:Foobar.jpg|thumb|-{R|caption:}-]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- T146305: Don't break image parsing if nested language converter markup is in the caption.
- !! options
- language=zh variant=zh-cn
- !! wikitext
- [[File:Foobar.jpg|thumb|-{|zh-cn:blog (hk: -{zh-hans|WEBJOURNAL}-, tw: -{zh-hans|WEBLOG}-)}-]]
- !! html/php
- <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>
- !! html/parsoid
- <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: <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBJOURNAL\"}}' data-parsoid='{\"fl\":[\"zh-hans\"],\"dsr\":[43,65,null,2]}'></span>, tw: <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"WEBLOG\"}}' data-parsoid='{\"fl\":[\"zh-hans\"],\"dsr\":[71,89,null,2]}'></span>)"}]}'></span></figcaption></figure>
- !! end
- # XXX html2wt disabled because rich markup in alt is not preserved.
- !! test
- Don't break gallery if language converter markup is inside.
- !! options
- language=zh
- !! wikitext
- <gallery>
- File:foobar.jpg|[[File:foobar.jpg|20px|desc|alt=-{R|foo}-|-{R|bar}-]]|alt=-{R|bat}-
- File:foobar.jpg|{{Test|unamedParam|alt=-{R|param}-}}|alt=galleryalt
- </gallery>
- !! html/php
- <ul class="gallery mw-gallery-traditional">
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <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>
- </p>
- </div>
- </div></li>
- <li class="gallerybox" style="width: 155px"><div style="width: 155px">
- <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>
- <div class="gallerytext">
- <p>This is a test template
- </p>
- </div>
- </div></li>
- </ul>
- !! html/parsoid
- <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"}}'>
- <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":"<span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"disabled\":{\"t\":\"bar\"}}' data-parsoid='{\"fl\":[\"R\"],\"dsr\":[68,77,null,2]}'></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>
- <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>
- </ul>
- !! end
- !! test
- T153135: Don't break list handling if language converter markup is in the item.
- !! options
- language=zh variant=zh-cn
- !! wikitext
- ;-{zh-cn:AAA;zh-tw:BBB}-
- ;-{R|foo:bar}-
- !! html/php
- <dl><dt>AAA</dt>
- <dt>foo:bar</dt></dl>
- !! html/parsoid
- <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>
- <dt data-parsoid='{"dsr":[25,39,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"foo:bar"}}'></span></dt>
- </dl>
- !! end
- // Note that parsoid does not protect colons unless language converter
- // markup is properly nested, because it is a backtracking parser.
- !! test
- T153135: Unclosed markup in definition list (code coverage)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- ;<b>foo:bar
- ;-{zh-cn:AAA
- !! html/php+tidy
- <dl><dt><b>foo:bar</b></dt><b>
- <dt>-{zh-cn:AAA</dt></b></dl><p><b>
- </b></p>
- !! html/parsoid
- <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}'>
- <dt data-parsoid='{"dsr":[12,20,1,0]}'>-{zh-cn</dt>
- <dd data-parsoid='{"stx":"row","dsr":[20,24,1,0]}'>AAA</dd>
- </b></dl>
- !! end
- !! test
- T153135: Nested language converter markup in definition list (code coverage)
- !! options
- language=zh variant=zh-cn
- !! wikitext
- ;-{|zh-cn:AAA -{zh-hans|foo:bar}- -{R|bat:baz}-}-:def
- !! html/php
- <dl><dt>AAA foo:bar bat:baz</dt>
- <dd>def</dd></dl>
- !! html/parsoid
- <dl><dt data-parsoid='{"dsr":[0,49,1,0]}'><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"zh-cn","t":"AAA <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"filter\":{\"l\":[\"zh-hans\"],\"t\":\"foo:bar\"}}' data-parsoid='{\"fl\":[\"zh-hans\"],\"dsr\":[14,33,null,2]}'></span> <span typeof=\"mw:LanguageVariant\" data-mw-variant='{\"disabled\":{\"t\":\"bat:baz\"}}' data-parsoid='{\"fl\":[\"R\"],\"dsr\":[34,47,null,2]}'></span>"}]}'></span></dt>
- <dd data-parsoid='{"stx":"row","dsr":[49,53,1,0]}'>def</dd>
- </dl>
- !! end
- # html2wt mode disabled due to <nowiki> insertion.
- !! test
- T153140: Don't break table handling if language converter markup is in the cell.
- !! options
- language=sr variant=sr-ec
- parsoid=wt2html,wt2wt,html2html
- !! wikitext
- {|
- |-
- | -{R|B}-
- |}
- !! html/php
- <table>
- <tr>
- <td>B
- </td></tr></table>
- !! html/parsoid
- <table>
- <tbody>
- <tr>
- <td><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"B"}}'></span></td>
- </tr>
- </tbody>
- </table>
- !! end
- !! test
- Language converter tricky html2wt cases (1)
- !! options
- language=sr
- parsoid=html2wt,wt2wt
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"}-"}}'></span></p>
- !! wikitext
- -{<nowiki>}-</nowiki>}-
- !! html/php
- <p>}-
- </p>
- !! end
- !! test
- Language converter tricky html2wt cases (2)
- !! options
- language=sr
- parsoid=html2wt,wt2wt
- !! html/parsoid
- <p>-{foo}-</p>
- !! wikitext
- <nowiki>-{foo}-</nowiki>
- !! html/php
- <p>-{foo}-
- </p>
- !! end
- !! test
- Language converter tricky html2wt cases (3)
- !! options
- language=sr
- parsoid=html2wt,wt2wt
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"|"}}'></span></p>
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"R|raw"}}'></span></p>
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"-{foo}-"}}'></span></p>
- !! wikitext
- -{R||}-
- -{R|R|raw}-
- -{<nowiki>-{foo}-</nowiki>}-
- !! html/php
- <p>|
- </p><p>R|raw
- </p><p>-{foo}-
- </p>
- !! end
- !! test
- Language converter tricky html2wt cases (4)
- !! options
- language=sr
- parsoid=html2wt,wt2wt
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"<span about=\"#mwt1\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[{\"k\":\"1\"}]],\"dsr\":[2,14,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"echo\",\"href\":\"./Template:Echo\"},\"params\":{\"1\":{\"wt\":\"hey\"}},\"i\":0}}]}'>hey</span>"}}'></span></p>
- !! wikitext
- -{R|{{echo|hey}}}-
- !! html/php
- <p>hey
- </p>
- !! end
- # Note that the <nowiki> escaping added by parsoid for source text,
- # destination text, and language names only works on the PHP side
- # for *destination text*. (HTML entity escaping wouldn't work
- # any better.) This is probably a bug, at least for source texts.
- # (For language names PHP uses a precise regexp based on the languages
- # it currently knows have variants, which is fragile since this set
- # can grow/shrink over time.)
- !! test
- Language converter tricky html2wt cases (5)
- !! options
- language=zh variant=zh-cn
- !! html/parsoid
- <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>
- <p><meta typeof="mw:LanguageVariant" data-mw-variant='{"add":true,"oneway":[{"f":"A","l":"bo:g;us","t":"B"}]}'/></p>
- <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>
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"twoway":[{"l":"bo:g;us","t":"xyz"},{"l":"zh-cn","t":"abc"}]}'></span></p>
- <p>a:b=>c xyz</p>
- !! wikitext
- -{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
- -{H|A=><nowiki>bo:g;us</nowiki>:B}-
- -{A|zh-tw:xyz; zh-cn:<nowiki>0;zh-tw:bar</nowiki>}-
- -{<nowiki>bo:g;us</nowiki>:xyz; zh-cn:abc}-
- a:b=>c xyz
- !! html/php+disabled
- <p>foobat;xyz=>zh-cn:abc
- </p><p>A
- </p><p>0;zh-tw:bar
- </p><p>abc
- </p><p>a:b=>c 0;zh-tw:bar
- </p>
- !! end
- !! test
- T179579: Nowiki and lc interaction
- !! options
- parsoid=wt2html
- language=sr
- !! wikitext
- -{</nowiki>123}-
- -{123<nowiki>|</nowiki>456}-
- !! html/parsoid
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"&lt;/nowiki>123"}}' data-parsoid='{"fl":[],"src":"-{</nowiki>123}-"}'></span></p>
- <p><span typeof="mw:LanguageVariant" data-mw-variant='{"disabled":{"t":"123<span typeof=\"mw:Nowiki\" data-parsoid='{\"dsr\":[23,41,8,9]}'>|</span>456"}}' data-parsoid='{"fl":[],"src":"-{123<nowiki>|</nowiki>456}-"}'></span></p>
- !! end
- !! test
- T2529: Uncovered bullet
- !! wikitext
- *Foo {{bullet}}
- !! html
- <ul><li>Foo</li>
- <li>Bar</li></ul>
- !! end
- !! test
- T2529: Uncovered bullet in a deeply nested list
- !! wikitext
- *******Foo {{bullet}}
- !! html
- <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>
- <li>Bar</li></ul>
- !! end
- !! test
- T2529: Uncovered table already at line-start
- !! wikitext
- x
- {{table}}
- y
- !! html
- <p>x
- </p>
- <table>
- <tr>
- <td>1</td>
- <td>2
- </td></tr>
- <tr>
- <td>3</td>
- <td>4
- </td></tr></table>
- <p>y
- </p>
- !! end
- !! test
- T2529: Uncovered bullet in parser function result
- !! wikitext
- *Foo {{lc:{{bullet}} }}
- !! html
- <ul><li>Foo</li>
- <li>bar</li></ul>
- !! end
- !! test
- T7678: Double-parsed template argument
- !! wikitext
- {{lc:{{{1}}}|hello}}
- !! html
- <p>{{{1}}}
- </p>
- !! end
- !! test
- T7678: Double-parsed template invocation
- !! wikitext
- {{lc:{{paramtest {{!}} param = hello }} }}
- !! html
- <p>{{paramtest | param = hello }}
- </p>
- !! end
- !! test
- Case insensitivity of parser functions for non-ASCII characters (T10143)
- !! options
- language=cs
- title=[[Main Page]]
- !! wikitext
- {{PRVNÍVELKÉ:ěščř}}
- {{prvnívelké:ěščř}}
- {{PRVNÍMALÉ:ěščř}}
- {{prvnímalé:ěščř}}
- {{MALÁ:ěščř}}
- {{malá:ěščř}}
- {{VELKÁ:ěščř}}
- {{velká:ěščř}}
- !! html
- <p>Ěščř
- Ěščř
- ěščř
- ěščř
- ěščř
- ěščř
- ĚŠČŘ
- ĚŠČŘ
- </p>
- !! end
- !! test
- Morwen/13: Unclosed link followed by heading
- !! wikitext
- [[link
- ==heading==
- !! html
- <p>[[link
- </p>
- <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&action=edit&section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- HHP2.1: Heuristics for headings in preprocessor parenthetical structures
- !! wikitext
- {{foo|
- =heading=
- !! html
- <p>{{foo|
- </p>
- <h1><span class="mw-headline" id="heading">heading</span></h1>
- !! end
- !! test
- HHP2.2: Heuristics for headings in preprocessor parenthetical structures
- !! wikitext
- {{foo|
- ==heading==
- !! html
- <p>{{foo|
- </p>
- <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&action=edit&section=1" title="Edit section: heading">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- Tildes in comments
- !! options
- pst
- !! wikitext
- <!-- ~~~~ -->
- !! html/php
- <!-- ~~~~ -->
- !! end
- !! test
- Paragraphs inside divs (no extra line breaks)
- !! wikitext
- <div>Line one
- Line two</div>
- !! html
- <div>Line one
- Line two</div>
- !! end
- !! test
- Paragraphs inside divs (extra line break on open)
- !! wikitext
- <div>
- Line one
- Line two</div>
- !! html
- <div>
- <p>Line one
- </p>
- Line two</div>
- !! end
- !! test
- Paragraphs inside divs (extra line break on close)
- !! wikitext
- <div>Line one
- Line two
- </div>
- !! html
- <div>Line one
- <p>Line two
- </p>
- </div>
- !! end
- !! test
- Paragraphs inside divs (extra line break on open and close)
- !! wikitext
- <div>
- Line one
- Line two
- </div>
- !! html
- <div>
- <p>Line one
- </p><p>Line two
- </p>
- </div>
- !! end
- # doBlockLevels screws up this output and Remex cleans up as much as it can.
- # Parsoid seems to do a better job here since its p-wrapper is probably smarter.
- !! test
- Nesting tags, paragraphs on lines which begin with <div>
- !! wikitext
- <div></div><strong>A
- B</strong>
- !! html/php+tidy
- <div></div><p><strong>A
- </strong></p><strong></strong><p><strong>B</strong>
- </p>
- !! html/parsoid
- <div></div>
- <p><strong>A
- B</strong>
- </p>
- !! end
- # T8200: <blockquote> should behave like <div> with respect to line breaks
- !! test
- T8200: paragraphs inside blockquotes (no extra line breaks)
- !! wikitext
- <blockquote>Line one
- Line two</blockquote>
- !! html
- <blockquote>Line one
- Line two</blockquote>
- !! html+tidy
- <blockquote><p>Line one
- Line two</p></blockquote>
- !! end
- !! test
- T8200: paragraphs inside blockquotes (extra line break on open)
- !! wikitext
- <blockquote>
- Line one
- Line two</blockquote>
- !! html
- <blockquote>
- <p>Line one
- </p>
- Line two</blockquote>
- !! html+tidy
- <blockquote>
- <p>Line one
- </p><p>
- Line two</p></blockquote>
- !! end
- # Parsoid's output is broken on this because of Tidy-compatibility cruft
- !! test
- T8200: paragraphs inside blockquotes (extra line break on close)
- !! wikitext
- <blockquote>Line one
- Line two
- </blockquote>
- !! html
- <blockquote>Line one
- <p>Line two
- </p>
- </blockquote>
- !! html+tidy
- <blockquote><p>Line one
- </p><p>Line two
- </p>
- </blockquote>
- !! end
- !! test
- T8200: paragraphs inside blockquotes (extra line break on open and close)
- !! wikitext
- <blockquote>
- Line one
- Line two
- </blockquote>
- !! html
- <blockquote>
- <p>Line one
- </p><p>Line two
- </p>
- </blockquote>
- !! end
- # FIXME: Why does/should the blockquote+div combo suppress p-wrapping here?
- !! test
- Paragraphs inside blockquotes/divs (no extra line breaks)
- !! wikitext
- <blockquote><div>Line one
- Line two</div></blockquote>
- !! html
- <blockquote><div>Line one
- Line two</div></blockquote>
- !! end
- !! test
- Paragraphs inside blockquotes/divs (extra line break on open)
- !! wikitext
- <blockquote><div>
- Line one
- Line two</div></blockquote>
- !! html
- <blockquote><div>
- <p>Line one
- </p>
- Line two</div></blockquote>
- !! end
- !! test
- Paragraphs inside blockquotes/divs (extra line break on close)
- !! wikitext
- <blockquote><div>Line one
- Line two
- </div></blockquote>
- !! html
- <blockquote><div>Line one
- <p>Line two
- </p>
- </div></blockquote>
- !! end
- !! test
- Paragraphs inside blockquotes/divs (extra line break on open and close)
- !! wikitext
- <blockquote><div>
- Line one
- Line two
- </div></blockquote>
- !! html
- <blockquote><div>
- <p>Line one
- </p><p>Line two
- </p>
- </div></blockquote>
- !! end
- !! test
- Interwiki links trounced by replaceExternalLinks after early LinkHolderArray expansion
- !! options
- wgLinkHolderBatchSize=0
- !! wikitext
- [[meatball:1]]
- [[meatball:2]]
- [[meatball:3]]
- !! html
- <p><a href="http://www.usemod.com/cgi-bin/mb.pl?1" class="extiw" title="meatball:1">meatball:1</a>
- <a href="http://www.usemod.com/cgi-bin/mb.pl?2" class="extiw" title="meatball:2">meatball:2</a>
- <a href="http://www.usemod.com/cgi-bin/mb.pl?3" class="extiw" title="meatball:3">meatball:3</a>
- </p>
- !! end
- !! test
- Free external link invading image caption
- !! wikitext
- [[Image:Foobar.jpg|thumb|http://x|hello]]
- !! html/php
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- T17196: localised external link numbers
- !! options
- language=fa
- !! wikitext
- [http://en.wikipedia.org/]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="http://en.wikipedia.org/">[۱]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="http://en.wikipedia.org/"></a></p>
- !! end
- !! test
- Multibyte character in padleft
- !! wikitext
- {{padleft:-Hello|7|Æ}}
- !! html/php
- <p>Æ-Hello
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:-Hello","function":"padleft"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Æ-Hello</p>
- !! end
- !! test
- Multibyte character in padright
- !! wikitext
- {{padright:Hello-|7|Æ}}
- !! html/php
- <p>Hello-Æ
- </p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:Hello-","function":"padright"},"params":{"1":{"wt":"7"},"2":{"wt":"Æ"}},"i":0}}]}'>Hello-Æ</p>
- !! end
- !!test
- formatdate parser function
- !! wikitext
- {{#formatdate:2009-03-24}}
- !! html
- <p><span class="mw-formatted-date" title="2009-03-24">2009-03-24</span>
- </p>
- !! end
- !!test
- formatdate parser function, with default format
- !! wikitext
- {{#formatdate:2009-03-24|mdy}}
- !! html
- <p><span class="mw-formatted-date" title="2009-03-24">March 24, 2009</span>
- </p>
- !! end
- !! test
- Spacing of numbers in formatted dates
- !! wikitext
- {{#formatdate:January 15}}
- !! html
- <p><span class="mw-formatted-date" title="01-15">January 15</span>
- </p>
- !! end
- !! test
- 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
- !! options
- language=nl title=[[MediaWiki:Common.css]]
- !! wikitext
- {{#formatdate:2009-03-24|dmy}}
- !! html
- <p><span class="mw-formatted-date" title="2009-03-24">24 March 2009</span>
- </p>
- !! end
- #
- #
- #
- #
- # Edit comments
- #
- !! test
- Edit comment with link
- !! options
- comment
- !! wikitext
- I like the [[Main Page]] a lot
- !! html/php
- I like the <a href="/wiki/Main_Page" title="Main Page">Main Page</a> a lot
- !!end
- !! test
- Edit comment with link and link text
- !! options
- comment
- !! wikitext
- I like the [[Main Page|best pages]] a lot
- !! html/php
- I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
- !!end
- !! test
- Edit comment with link and link text with suffix
- !! options
- comment
- !! wikitext
- I like the [[Main Page|best page]]s a lot
- !! html/php
- I like the <a href="/wiki/Main_Page" title="Main Page">best pages</a> a lot
- !!end
- !! test
- Edit comment with section link (non-local, eg in history list)
- !! options
- comment title=[[Main Page]]
- !! wikitext
- /* External links */ removed bogus entries
- !! html/php
- <a href="/wiki/Main_Page#External_links" title="Main Page">→</a><span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
- !!end
- !! test
- Edit comment with section link and text before it (non-local, eg in history list)
- !! options
- comment title=[[Main Page]]
- !! wikitext
- pre-comment text /* External links */ removed bogus entries
- !! html/php
- 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>
- !!end
- !! test
- Edit comment with section link (local, eg in diff view)
- !! options
- comment local title=[[Main Page]]
- !! wikitext
- /* External links */ removed bogus entries
- !! html/php
- <a href="#External_links">→</a><span dir="auto"><span class="autocomment">External links: </span> removed bogus entries</span>
- !!end
- !! test
- Edit comment with subpage link (T16080)
- !! options
- comment
- subpage
- title=[[Subpage test]]
- !! wikitext
- Poked at a [[/subpage]] here...
- !! html/php
- Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">/subpage</a> here...
- !!end
- !! test
- Edit comment with subpage link and link text (T16080)
- !! options
- comment
- subpage
- title=[[Subpage test]]
- !! wikitext
- Poked at a [[/subpage|neat little page]] here...
- !! html/php
- Poked at a <a href="/wiki/Subpage_test/subpage" title="Subpage test/subpage">neat little page</a> here...
- !!end
- !! test
- Edit comment with bogus subpage link in non-subpage NS (T16080)
- !! options
- comment
- title=[[Subpage test]]
- !! wikitext
- Poked at a [[/subpage]] here...
- !! html/php
- Poked at a <a href="/index.php?title=/subpage&action=edit&redlink=1" class="new" title="/subpage (page does not exist)">/subpage</a> here...
- !!end
- !! test
- Edit comment with bare anchor link (local, as on diff)
- !! options
- comment
- local
- title=[[Main Page]]
- !! wikitext
- [[#section]]
- !! html/php
- <a href="#section">#section</a>
- !! end
- !! test
- Edit comment with bare anchor link (non-local, as on history)
- !! options
- comment
- title=[[Main Page]]
- !! wikitext
- [[#section]]
- !! html/php
- <a href="/wiki/Main_Page#section" title="Main Page">#section</a>
- !! end
- !! test
- Anchor starting with underscore
- !! options
- title=[[Foo]]
- !! wikitext
- [[#_ref|One]]
- !! html/php
- <p><a href="#_ref">One</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo#_ref" data-parsoid='{"stx":"piped","a":{"href":"./Foo#_ref"},"sa":{"href":"#_ref"}}'>One</a></p>
- !! end
- !! test
- Id starting with underscore
- !! wikitext
- <div id="_ref"></div>
- !! html/*
- <div id="_ref"></div>
- !! end
- !! test
- Edit comment with link with more than one pipe (T99346)
- !! options
- comment
- !! wikitext
- [[Main Page|Many|pipes]]
- !! html/php
- <a href="/wiki/Main_Page" title="Main Page">Many|pipes</a>
- !! end
- !! test
- Complex edit comment with link with more than one pipe (T99346)
- !! options
- comment
- !! wikitext
- Created page with "<noinclude>[[Category:Requests for permissions/Bot|{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}]]</noinclude> === [[User:MineoBot|]] 8=== {{Request for permissions/links|Mineo..."
- !! html/php
- Created page with "<noinclude><a href="/index.php?title=Category:Requests_for_permissions/Bot&action=edit&redlink=1" class="new" title="Category:Requests for permissions/Bot (page does not exist)">{{subst:#titleparts:{{subst:PAGENAME}}|1|3}}</a></noinclude> === <a href="/index.php?title=User:MineoBot&action=edit&redlink=1" class="new" title="User:MineoBot (page does not exist)">User:MineoBot</a> 8=== {{Request for permissions/links|Mineo..."
- !! end
- !! test
- Space normalisation on autocomment (T24784)
- !! options
- comment
- title=[[Main Page]]
- !! wikitext
- /* __hello__world__ */
- !! html/php
- <a href="/wiki/Main_Page#hello_world" title="Main Page">→</a><span dir="auto"><span class="autocomment">__hello__world__</span></span>
- !! end
- !! test
- percent-encoding and + signs in comments (T28410)
- !! options
- comment
- !! wikitext
- [[ABC%33D% ++]] [[ABC%33D% ++|+%20]]
- !! html/php
- <a href="/index.php?title=ABC3D%25_%2B%2B&action=edit&redlink=1" class="new" title="ABC3D% ++ (page does not exist)">ABC3D% ++</a> <a href="/index.php?title=ABC3D%25_%2B%2B&action=edit&redlink=1" class="new" title="ABC3D% ++ (page does not exist)">+%20</a>
- !! end
- # Parsoid doesn't support this yet: see T75581
- # but it *should* omit the 'src' attribute if the image is bad.
- # PHP side of tests was disabled in
- # mediawiki/core:6bd31e7d95161a6e88fa86df60871051da997c3c
- # because of issues in the PHP parserTests infrastructure
- # (but the output below is indeed what the PHP side emits)
- !! test
- Bad images - basic functionality
- !! wikitext
- [[File:Bad.jpg]]
- !! html/php+disabled
- !! html/parsoid
- <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>
- !! end
- !! test
- Bad images - T18039: text after bad image disappears
- !! wikitext
- Foo bar
- [[File:Bad.jpg]]
- Bar foo
- !! html/php+disabled
- <p>Foo bar
- </p><p>Bar foo
- </p>
- !! html/parsoid
- <p>Foo bar
- <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>
- Bar foo</p>
- !! end
- !! test
- Verify that displaytitle works (T24501) no displaytitle
- !! options
- showtitle
- !! config
- wgAllowDisplayTitle=true
- wgRestrictDisplayTitle=false
- !! wikitext
- this is not the the title
- !! html/php
- Parser test
- <p>this is not the the title
- </p>
- !! end
- !! test
- Verify that displaytitle works (T24501) RestrictDisplayTitle=false
- !! options
- showtitle
- title=[[Screen]]
- !! config
- wgAllowDisplayTitle=true
- wgRestrictDisplayTitle=false
- !! wikitext
- this is not the the title
- {{DISPLAYTITLE:whatever}}
- !! html/php
- whatever
- <p>this is not the the title
- </p>
- !! end
- !! test
- Verify that displaytitle works (T24501) RestrictDisplayTitle=true mismatch
- !! options
- showtitle
- title=[[Screen]]
- !! config
- wgAllowDisplayTitle=true
- wgRestrictDisplayTitle=true
- !! wikitext
- this is not the the title
- {{DISPLAYTITLE:whatever}}
- !! html/php
- Screen
- <p>this is not the the title
- </p>
- !! end
- !! test
- Verify that displaytitle works (T24501) RestrictDisplayTitle=true matching
- !! options
- showtitle
- title=[[Screen]]
- !! config
- wgAllowDisplayTitle=true
- wgRestrictDisplayTitle=true
- !! wikitext
- this is not the the title
- {{DISPLAYTITLE:screen}}
- !! html/php
- screen
- <p>this is not the the title
- </p>
- !! end
- !! test
- Verify that displaytitle works (T24501) AllowDisplayTitle=false
- !! options
- showtitle
- title=[[Screen]]
- !! config
- wgAllowDisplayTitle=false
- !! wikitext
- this is not the the title
- {{DISPLAYTITLE:screen}}
- !! html/php
- Screen
- <p>this is not the the title
- <a href="/index.php?title=Template:DISPLAYTITLE:screen&action=edit&redlink=1" class="new" title="Template:DISPLAYTITLE:screen (page does not exist)">Template:DISPLAYTITLE:screen</a>
- </p>
- !! end
- !! test
- Verify that displaytitle works (T24501) AllowDisplayTitle=false no DISPLAYTITLE
- !! options
- showtitle
- title=[[Screen]]
- !! config
- wgAllowDisplayTitle=false
- !! wikitext
- this is not the the title
- !! html/php
- Screen
- <p>this is not the the title
- </p>
- !! end
- !! test
- Verify that displaytitle handles inline CSS styles (T28547) - rejected value
- !! options
- showtitle
- title=[[Screen]]
- !! config
- wgAllowDisplayTitle=true
- wgRestrictDisplayTitle=true
- !! wikitext
- this is not the the title
- {{DISPLAYTITLE:<span style="display: none;">s</span>creen}}
- !! html/php
- <span style="/* attempt to bypass $wgRestrictDisplayTitle */">s</span>creen
- <p>this is not the the title
- </p>
- !! end
- !! test
- Verify that displaytitle handles inline CSS styles (T28547) - accepted value
- !! options
- showtitle
- title=[[Screen]]
- !! config
- wgAllowDisplayTitle=true
- wgRestrictDisplayTitle=true
- !! wikitext
- this is not the the title
- {{DISPLAYTITLE:<span style="color: red;">s</span>creen}}
- !! html/php
- <span style="color: red;">s</span>creen
- <p>this is not the the title
- </p>
- !! end
- !! test
- Page status indicators: Empty name is invalid
- !! options
- showindicators
- !! wikitext
- <indicator name=" "></indicator>
- <indicator></indicator>
- !! html/php
- <p><span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
- <span class="error"><strong>Error:</strong> Page status indicators' <code>name</code> attribute must not be empty.</span>
- </p>
- !! end
- !! test
- Page status indicators: Weird syntaxes that are okay
- !! options
- showindicators
- !! wikitext
- <indicator name="empty" />
- <indicator name="name"></indicator>
- !! html/php
- empty=
- name=
- <p><br />
- </p>
- !! end
- !! test
- Page status indicators: Torture test
- !! options
- showindicators
- !! wikitext
- <indicator name="01">hello world</indicator>
- <indicator name="02">[[Main Page]]</indicator>
- <indicator name="03">[[File:Foobar.jpg|25px|link=]]</indicator>
- <indicator name="04">[[File:Foobar.jpg|25px]]</indicator>
- <indicator name="05">*foo
- *bar</indicator>
- <indicator name="06"><nowiki>foo</nowiki></indicator>
- <indicator name="07"> Preformatted</indicator>
- <indicator name="08"><div>Broken tag</indicator>
- <indicator name="09">{| class=wikitable
- |cell
- |}</indicator>
- <indicator name="10">Two
- paragraphs</indicator>
- !! html/php
- 01=hello world
- 02=<a href="/wiki/Main_Page" title="Main Page">Main Page</a>
- 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" />
- 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>
- 05=<ul><li>foo</li>
- <li>bar</li></ul>
- 06=foo
- 07=<pre>Preformatted
- </pre>
- 08=<div>Broken tag</div>
- 09=<table class="wikitable">
- <tr>
- <td>cell
- </td></tr></table>
- 10=<p>Two
- </p><p>paragraphs
- </p>
- <p><br />
- </p><p><br />
- </p><p><br />
- </p><p><br />
- </p><p><br />
- </p>
- !! end
- !! test
- preload: check <noinclude> and <includeonly>
- !! options
- preload
- !! wikitext
- Hello <noinclude>cruel</noinclude><includeonly>kind</includeonly> world.
- !! html/php
- Hello kind world.
- !! end
- !! test
- preload: check <onlyinclude>
- !! options
- preload
- !! wikitext
- Goodbye <onlyinclude>Hello world</onlyinclude>
- !! html/php
- Hello world
- !! end
- !! test
- preload: can pass tags through if we want to
- !! options
- preload
- !! wikitext
- <includeonly><</includeonly>includeonly>Hello world<includeonly><</includeonly>/includeonly>
- !! html/php
- <includeonly>Hello world</includeonly>
- !! end
- !! test
- preload: check that it doesn't try to do tricks
- !! options
- preload
- !! wikitext
- * <!-- Hello --> ''{{world}}'' {{<includeonly>subst:</includeonly>How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
- !! html/php
- * <!-- Hello --> ''{{world}}'' {{subst:How are you}}{{ {{{|safesubst:}}} #if:1|2|3}}
- !! end
- !! test
- Play a bit with r67090 and T5158
- !! wikitext
- <div style="width:50% !important"> </div>
- <div style="width:50% !important"> </div>
- <div style="width:50% !important"> </div>
- <div style="border : solid;"> </div>
- !! html/php
- <div style="width:50% !important"> </div>
- <div style="width:50% !important"> </div>
- <div style="width:50% !important"> </div>
- <div style="border : solid;"> </div>
- !! html/parsoid
- <div style="width:50% !important" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
- <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&nbsp;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
- <div style="width:50% !important" data-parsoid='{"stx":"html","a":{"style":"width:50% !important"},"sa":{"style":"width:50%&#160;!important"}}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
- <div style="border : solid;" data-parsoid='{"stx":"html"}'><span typeof="mw:Entity" data-parsoid='{"srcContent":" "}'> </span></div>
- !! end
- !! test
- HTML5 data attributes
- !! wikitext
- <span data-foo="bar">Baz</span>
- <p data-abc-def_hij="">Quuz</p>
- !! html/php
- <p><span data-foo="bar">Baz</span>
- </p>
- <p data-abc-def_hij="">Quuz</p>
- !! html/parsoid
- <p><span data-foo="bar" data-parsoid='{"stx":"html"}'>Baz</span></p>
- <p data-abc-def_hij="" data-parsoid='{"stx":"html"}'>Quuz</p>
- !! end
- !! test
- Strip reserved data attributes
- !! wikitext
- <div data-mw="foo" data-parsoid="bar" data-mw-someext="baz" data-ok="fred" data-ooui="xyzzy" data-bad:ns="ns">d</div>
- !! html/php
- <div data-ok="fred">d</div>
- !! html/parsoid
- <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>
- !! end
- !! test
- percent-encoding and + signs in internal links (T28410)
- !! wikitext
- [[User:+%]] [[Page+title%]]
- [[%+]] [[%+|%20]] [[%+ ]] [[%+r]]
- [[%]] [[+]] [[File:%+abc%39|foo|[[bar]]]]
- [[%33%45]] [[%33%45+]]
- !! html/php
- <p><a href="/index.php?title=User:%2B%25&action=edit&redlink=1" class="new" title="User:+% (page does not exist)">User:+%</a> <a href="/index.php?title=Page%2Btitle%25&action=edit&redlink=1" class="new" title="Page+title% (page does not exist)">Page+title%</a>
- <a href="/index.php?title=%25%2B&action=edit&redlink=1" class="new" title="%+ (page does not exist)">%+</a> <a href="/index.php?title=%25%2B&action=edit&redlink=1" class="new" title="%+ (page does not exist)">%20</a> <a href="/index.php?title=%25%2B&action=edit&redlink=1" class="new" title="%+ (page does not exist)">%+ </a> <a href="/index.php?title=%25%2Br&action=edit&redlink=1" class="new" title="%+r (page does not exist)">%+r</a>
- <a href="/index.php?title=%25&action=edit&redlink=1" class="new" title="% (page does not exist)">%</a> <a href="/index.php?title=%2B&action=edit&redlink=1" class="new" title="+ (page does not exist)">+</a> <a href="/index.php?title=Special:Upload&wpDestFile=%25%2Babc9" class="new" title="File:%+abc9">bar</a>
- <a href="/index.php?title=3E&action=edit&redlink=1" class="new" title="3E (page does not exist)">3E</a> <a href="/index.php?title=3E%2B&action=edit&redlink=1" class="new" title="3E+ (page does not exist)">3E+</a>
- </p>
- !! html/parsoid
- <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>
- <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>
- <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":"<a rel=\"mw:WikiLink\" href=\"./Bar\" title=\"Bar\" data-parsoid='{\"stx\":\"simple\",\"a\":{\"href\":\"./Bar\"},\"sa\":{\"href\":\"bar\"},\"dsr\":[94,101,2,2]}'>bar</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>
- <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>
- !! end
- !! test
- Special characters in embedded file links (T29679)
- !! wikitext
- [[File:Contains & ampersand.jpg]]
- [[File:Does not exist.jpg|Title with & ampersand]]
- !! html/php
- <p><a href="/index.php?title=Special:Upload&wpDestFile=Contains_%26_ampersand.jpg" class="new" title="File:Contains & ampersand.jpg">File:Contains & ampersand.jpg</a>
- <a href="/index.php?title=Special:Upload&wpDestFile=Does_not_exist.jpg" class="new" title="File:Does not exist.jpg">Title with & ampersand</a>
- </p>
- !! html/parsoid
- <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_&_ampersand.jpg"><img resource="./File:Contains_&_ampersand.jpg" src="./Special:FilePath/Contains_&_ampersand.jpg" height="220" width="220"/></a></figure-inline>
- <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; 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>
- !! end
- !! test
- Confirm that 'apos' named character reference doesn't make it to output (not legal in HTML 4)
- !! wikitext
- Text's been normalized?
- !! html
- <p>Text's been normalized?
- </p>
- !! end
- !! test
- T21052 U+3000 IDEOGRAPHIC SPACE should terminate free external links
- !! wikitext
- http://www.example.org/ <-- U+3000 (vim: ^Vu3000)
- !! html
- <p><a rel="nofollow" class="external free" href="http://www.example.org/">http://www.example.org/</a> <-- U+3000 (vim: ^Vu3000)
- </p>
- !! end
- !! test
- T21052 U+3000 IDEOGRAPHIC SPACE should terminate bracketed external links
- !! wikitext
- [http://www.example.org/ ideograms]
- !! html
- <p><a rel="nofollow" class="external text" href="http://www.example.org/">ideograms</a>
- </p>
- !! end
- !! test
- T21052 U+3000 IDEOGRAPHIC SPACE should terminate external images links
- !! wikitext
- http://www.example.org/pic.png <-- U+3000 (vim: ^Vu3000)
- !! html
- <p><img src="http://www.example.org/pic.png" alt="pic.png"/> <-- U+3000 (vim: ^Vu3000)
- </p>
- !! end
- !! article
- Mediawiki:loop1
- !! text
- {{Identical|A}}
- !! endarticle
- !! article
- Mediawiki:loop2
- !! text
- {{Identical|B}}
- !! endarticle
- !! article
- Template:Identical
- !! text
- {{int:loop1}}
- {{int:loop2}}
- !! endarticle
- !! test
- T33098 Template which includes system messages which includes the template
- !! wikitext
- {{Identical}}
- !! html
- <p><span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
- <span class="error">Template loop detected: <a href="/wiki/Template:Identical" title="Template:Identical">Template:Identical</a></span>
- </p>
- !! end
- !! test
- T33490 Turkish: ucfirst 'blah'
- !! options
- language=tr
- !! wikitext
- {{ucfirst:blah}}
- !! html
- <p>Blah
- </p>
- !! end
- !! test
- T33490 Turkish: ucfirst 'ix'
- !! options
- language=tr
- !! wikitext
- {{ucfirst:ix}}
- !! html
- <p>İx
- </p>
- !! end
- !! test
- T33490 Turkish: lcfirst 'BLAH'
- !! options
- language=tr
- !! wikitext
- {{lcfirst:BLAH}}
- !! html
- <p>bLAH
- </p>
- !! end
- !! test
- T33490 Turkish: ucfırst (with a dotless i)
- !! options
- language=tr
- !! wikitext
- {{ucfırst:blah}}
- !! html
- <p><a href="/index.php?title=%C5%9Eablon:Ucf%C4%B1rst:blah&action=edit&redlink=1" class="new" title="Şablon:Ucfırst:blah (sayfa mevcut değil)">Şablon:Ucfırst:blah</a>
- </p>
- !! end
- !! test
- T33490 ucfırst (with a dotless i) with English language
- !! options
- language=en
- !! wikitext
- {{ucfırst:blah}}
- !! html
- <p><a href="/index.php?title=Template:Ucf%C4%B1rst:blah&action=edit&redlink=1" class="new" title="Template:Ucfırst:blah (page does not exist)">Template:Ucfırst:blah</a>
- </p>
- !! end
- # Note that Parsoid doesn't emit an explicit TOC.
- # Note also that the html2wt direction tends to emit an extra newline
- # between the __TOC__ magicword and the first heading unless *both*
- # the <meta> and the <h2> have a data-parsoid attribute set (even if
- # it's "{}").
- !! test
- T28375: TOC with italics
- !! options
- title=[[Main Page]]
- !! wikitext
- __TOC__
- ==''Lost'' episodes==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <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>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Lost episodes">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="Lost_episodes" data-parsoid='{}'><i>Lost</i> episodes</h2>
- !! end
- !! test
- T28375: TOC with bold
- !! options
- title=[[Main Page]]
- !! wikitext
- __TOC__
- =='''should be bold''' then normal text==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <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>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: should be bold then normal text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="should_be_bold_then_normal_text" data-parsoid='{}'><b>should be bold</b> then normal text</h2>
- !! end
- !! test
- T35845: Headings become cursive in TOC when they contain an image
- !! options
- title=[[Main Page]]
- !! wikitext
- __TOC__
- ==Image [[Image:foobar.jpg]]==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Image"><span class="tocnumber">1</span> <span class="toctext">Image</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Image">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <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>
- !! end
- !! test
- T35845 (2): Headings become bold in TOC when they contain a blockquote
- !! options
- title=[[Main Page]]
- !! wikitext
- __TOC__
- ==<blockquote>Quote</blockquote>==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/php+tidy
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Quote"><span class="tocnumber">1</span> <span class="toctext">Quote</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Quote">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="Quote" data-parsoid='{}'><blockquote>Quote</blockquote></h2>
- !! end
- !! test
- Unclosed tags in TOC
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! options
- title=[[Main Page]]
- !! wikitext
- __TOC__
- ==Proof: 2 < 3==
- <small>Hanc marginis exiguitas non caperet.</small>
- QED
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Proof:_2_<_3"><span class="tocnumber">1</span> <span class="toctext">Proof: 2 < 3</span></a></li>
- </ul>
- </div>
- <h2><span id="Proof:_2_.3C_3"></span><span class="mw-headline" id="Proof:_2_<_3">Proof: 2 < 3</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Main_Page&action=edit&section=1" title="Edit section: Proof: 2 < 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p><small>Hanc marginis exiguitas non caperet.</small>
- QED
- </p>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="Proof:_2_<_3" data-parsoid='{}'><span id="Proof:_2_.3C_3" typeof="mw:FallbackId"></span>Proof: 2 < 3</h2>
- <p><small>Hanc marginis exiguitas non caperet.</small>
- QED</p>
- !! end
- !! test
- Multiple tags in TOC
- !! wikitext
- __TOC__
- ==<i>Foo</i> <b>Bar</b>==
- ==<i>Foo</i> <blockquote>Bar</blockquote>==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <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>
- <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>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/php+tidy
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <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>
- <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>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="Foo_Bar" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <b data-parsoid='{"stx":"html"}'>Bar</b></h2>
- <h2 id="Foo_Bar_2" data-parsoid='{}'><i data-parsoid='{"stx":"html"}'>Foo</i> <blockquote>Bar</blockquote></h2>
- !! end
- # Don't expect Parsoid to roundtrip this until the php parser comes closer to
- # html5 tag parsing.
- !! test
- Tags with parameters in TOC
- !! options
- parsoid=wt2html
- !! wikitext
- __TOC__
- ==<sup class="in-h2">Hello</sup>==
- ==<sup class="a > b">Evilbye</sup>==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Hello"><span class="tocnumber">1</span> <span class="toctext"><sup>Hello</sup></span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#b.22.3EEvilbye"><span class="tocnumber">2</span> <span class="toctext"><sup> b">Evilbye</sup></span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Hello">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <h2><span class="mw-headline" id="b.22.3EEvilbye"><sup class="a"> b">Evilbye</sup></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=2" title="Edit section: b">Evilbye">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" />
- <h2 id="Hello"><sup class="in-h2" data-parsoid='{"stx":"html"}'>Hello</sup></h2>
- <h2 id='b">Evilbye'><span id="b.22.3EEvilbye" typeof="mw:FallbackId"></span><sup class="a " data-parsoid='{"stx":"html"}'> b">Evilbye</sup></h2>
- !! end
- !! test
- span tags with directionality in TOC
- !! wikitext
- __TOC__
- ==<span dir="ltr">C++</span>==
- ==<span dir="rtl">זבנג!</span>==
- ==<span style="font-style: italic">The attributes on these span tags must be deleted from the TOC</span>==
- ==<span style="font-style: italic" dir="ltr">All attributes on these span tags must be deleted from the TOC</span>==
- ==<span dir="ltr" style="font-style: italic">Attributes after dir on these span tags must be deleted from the TOC</span>==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <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>
- <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>
- <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>
- <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>
- <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>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: C++">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: זבנג!">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&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>
- <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&action=edit&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>
- <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&action=edit&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>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="C++" data-parsoid='{}'><span id="C.2B.2B" typeof="mw:FallbackId"></span><span dir="ltr">C++</span></h2>
- <h2 id="זבנג!"><span id=".D7.96.D7.91.D7.A0.D7.92.21" typeof="mw:FallbackId"></span><span dir="rtl">זבנג!</span></h2>
- <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>
- <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>
- <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>
- !! end
- !! test
- T74884: bdi element in ToC
- !! wikitext
- __TOC__
- ==<bdi>test</bdi>==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#test"><span class="tocnumber">1</span> <span class="toctext"><bdi>test</bdi></span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="test" data-parsoid='{}'><bdi>test</bdi></h2>
- !! end
- !! test
- T35715: s/strike element in ToC
- !! wikitext
- __TOC__
- ==<s>test</s> test <strike>test</strike>==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <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>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: test test test">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="test_test_test" data-parsoid='{}'><s>test</s> test <strike>test</strike></h2>
- !! end
- !! test
- Empty <p> tag in TOC, removed by Sanitizer (T92892)
- !! wikitext
- __TOC__
- ==x==
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#x"><span class="tocnumber">1</span> <span class="toctext">x</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: x">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <meta property="mw:PageProp/toc" data-parsoid='{}'/>
- <h2 id="x" data-parsoid='{}'>x</h2>
- !! end
- !! article
- MediaWiki:T34057
- !! text
- == {{int:headline_sample}} ==
- !! endarticle
- !! test
- T34057: Title needed when expanding <h> nodes.
- !! options
- title=[[Main Page]]
- !! wikitext
- {{int:T34057}}
- !! html
- <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&action=edit&section=1" title="Edit section: Headline text">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- Strip marker in urlencode
- !! wikitext
- {{urlencode:x<nowiki/>y}}
- {{urlencode:x<nowiki/>y|wiki}}
- {{urlencode:x<nowiki/>y|path}}
- {{urlencode:x<pre id="one">two</pre>y}}
- !! html/php
- <p>xy
- xy
- xy
- xy
- </p>
- !! end
- !! test
- Strip marker in lc
- !! wikitext
- {{lc:x<nowiki/>y}}
- !! html
- <p>xy
- </p>
- !! end
- !! test
- Strip marker in uc
- !! wikitext
- {{uc:x<nowiki/>y}}
- !! html
- <p>XY
- </p>
- !! end
- !! test
- Strip marker in formatNum
- !! wikitext
- {{formatnum:1<nowiki/>2}}
- {{formatnum:1<nowiki/>2|R}}
- !! html
- <p>12
- 12
- </p>
- !! end
- !! test
- Check noCommafy in formatNum
- !! options
- language=be-tarask
- !! wikitext
- {{formatnum:123456.78}}
- {{formatnum:123456.78|NOSEP}}
- !! html
- <p>123 456,78
- 123456.78
- </p>
- !! end
- !! test
- Wrong option for formatNum (T58199)
- !! wikitext
- {{formatnum:1,234.56|Random}}
- {{formatnum:1,234.56|EVERYTHING}}
- {{formatnum:1234.56|any argument that has the string 'NOSEP'}}
- !! html
- <p>1,234.56
- 1,234.56
- 1,234.56
- </p>
- !! end
- !! test
- Strip marker in grammar
- !! options
- language=fi
- !! wikitext
- {{grammar:elative|foo<nowiki/>bar}}
- !! html
- <p>foobarista
- </p>
- !! end
- !! test
- Strip marker in padleft
- !! wikitext
- {{padleft:|2|x<nowiki/>y}}
- !! html
- <p>xy
- </p>
- !! end
- !! test
- Strip marker in padright
- !! wikitext
- {{padright:|2|x<nowiki/>y}}
- !! html
- <p>xy
- </p>
- !! end
- !! test
- Strip marker in anchorencode
- !! wikitext
- {{anchorencode:x<nowiki/>y}}
- !! html/php
- <p>xy
- </p>
- !! html/parsoid
- <p about="#mwt2" typeof="mw:Transclusion" data-parsoid='{"pi":[[]]}' data-mw='{"parts":[{"template":{"target":{"wt":"anchorencode:x<nowiki/>y","function":"anchorencode"},"params":{},"i":0}}]}'>xy</p>
- !! end
- !! test
- nowiki inside link inside heading (T20295)
- !! wikitext
- ==[[foo|x<nowiki>y</nowiki>z]]==
- !! html
- <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&action=edit&section=1" title="Edit section: xyz">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- !! test
- new support for bdi element (T33817)
- !! wikitext
- <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
- !! html
- <p dir="rtl" lang="he">ולדימיר לנין (ברוסית: <bdi lang="ru">Владимир Ленин</bdi>, 24 באפריל 1870–22 בינואר 1924) הוא מנהיג פוליטי קומוניסטי רוסי.</p>
- !!end
- !! test
- Ignore pipe between table row attributes
- !! wikitext
- {|
- |quux
- |- id=foo | style='color: red'
- |bar
- |}
- !! html
- <table>
- <tr>
- <td>quux
- </td></tr>
- <tr id="foo" style="color: red">
- <td>bar
- </td></tr></table>
- !! end
- !!test
- Language parser function
- !! wikitext
- {{#language:ar}}
- !! html
- <p>العربية
- </p>
- !! end
- !!test
- Padleft and padright (default 0-padding)
- !! wikitext
- {{padleft:xyz|5}}
- {{padright:xyz|5}}
- !! html/php
- <p>00xyz
- xyz00
- </p>
- !! html/parsoid
- <p><span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padleft:xyz","function":"padleft"},"params":{"1":{"wt":"5"}},"i":0}}]}'>00xyz</span>
- <span typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"padright:xyz","function":"padright"},"params":{"1":{"wt":"5"}},"i":0}}]}'>xyz00</span></p>
- !! end
- !!test
- Padleft and padright (partial fill)
- !! wikitext
- {{padleft:xyz|6|ab}}
- {{padright:xyz|6|ab}}
- !! html/php
- <p>abaxyz
- xyzaba
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !!test
- Padleft and padright as substr
- !! wikitext
- {{padleft:|3|abcde}}
- {{padright:|3|abcde}}
- !! html/php
- <p>abc
- abc
- </p>
- !! html/parsoid
- <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>
- <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>
- !! end
- !! test
- Padleft and padright with non-numerical length (T180403)
- !! wikitext
- {{padleft:abcdef|junk}}
- {{padright:abcdef|junk}}
- !! html/php
- <p>abcdef
- abcdef
- </p>
- !! end
- !!test
- Special parser function
- !! wikitext
- {{#special:RandomPage}}
- {{#special:BaDtItLe}}
- {{#special:Foobar}}
- !! html
- <p>Special:Random
- Special:Badtitle
- Special:Foobar
- </p>
- !! end
- !!test
- T36939 - Case insensitive link parsing ([HttP://])
- !! wikitext
- [HttP://MediaWiki.Org/]
- !! html/php
- <p><a rel="nofollow" class="external autonumber" href="HttP://MediaWiki.Org/">[1]</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external autonumber" href="HttP://MediaWiki.Org/"></a></p>
- !! end
- !!test
- T36939 - Case insensitive link parsing ([HttP:// title])
- !! wikitext
- [HttP://MediaWiki.Org/ MediaWiki]
- !! html
- <p><a rel="nofollow" class="external text" href="HttP://MediaWiki.Org/">MediaWiki</a>
- </p>
- !! end
- !!test
- T36939 - Case insensitive link parsing (HttP://)
- !! wikitext
- HttP://MediaWiki.Org/
- !! html/php
- <p><a rel="nofollow" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external free" href="HttP://MediaWiki.Org/">HttP://MediaWiki.Org/</a></p>
- !! end
- !!test
- Disable TOC
- !! options
- notoc
- !! wikitext
- Lead
- ==Section 1==
- ==Section 2==
- ==Section 3==
- ==Section 4==
- ==Section 5==
- !! html
- <p>Lead
- </p>
- <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&action=edit&section=1" title="Edit section: Section 1">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Section 2">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=3" title="Edit section: Section 3">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=4" title="Edit section: Section 4">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=5" title="Edit section: Section 5">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! end
- ###
- ### Parsoid-specific tests
- ### Parsoid-PHP parser incompatibilities
- ###
- !!test
- 1. SOL-sensitive wikitext tokens as template-args
- !!options
- parsoid=wt2html,wt2wt
- !! wikitext
- {{echo|*a}}
- {{echo|#a}}
- {{echo|:a}}
- !! html
- <span about="#mwt1" typeof="mw:Transclusion">
- </span><ul about="#mwt1"><li>a</li>
- </ul>
- <span about="#mwt2" typeof="mw:Transclusion">
- </span><ol about="#mwt2"><li>a</li>
- </ol>
- <span about="#mwt3" typeof="mw:Transclusion">
- </span><dl about="#mwt3"><dd>a</dd>
- </dl>
- !!end
- #### -----------------------------------------------------------------
- #### Parsoid-specific functionality tests
- #### -----------------------------------------------------------------
- # T65642/T68749: Formatting elt fixup around images is cleaned up.
- # We know wt2wt will fail, but we expect selser to pass.
- # Due to the nature of our testing, wt2wt and selser tests will enter the
- # blacklist and we'll catch selser regressions based on changes to the
- # blacklist entries for selser tests.
- !! test
- 1. Bad treebuilder fixup of formatting elt is cleaned up
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- {|
- |
- <small>
- [[Image:Foobar.jpg|right|Test]]
- </small>
- |}
- !! html/parsoid
- <table>
- <tbody><tr><td>
- <small>
- <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>
- </small>
- </td></tr>
- </tbody></table>
- !! end
- !! test
- 2. Bad treebuilder fixup of formatting elt is cleaned up
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- '''foo[[File:Foobar.jpg|thumb|caption]]bar'''
- <small>[[Image:Foobar.jpg|right|300px]]</small>
- !! html/parsoid
- <p><b>foo</b></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><figcaption><b>caption</b></figcaption></figure>
- <p><b>bar</b></p>
- <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>
- !! end
- !! test
- 3. Bad treebuilder fixup of formatting elt is cleaned up
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- <small>'''foo[[File:Foobar.jpg|thumb|caption]]bar'''</small>
- !! html/parsoid
- <p><small><b>foo</b></small></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><figcaption><small><b>caption</b></small></figcaption></figure>
- <p><small><b>bar</b></small></p>
- !! end
- !! test
- 4. Bad treebuilder fixup of formatting elt is cleaned up: formatting tags around captionless images are ignored
- !! options
- parsoid=wt2html,wt2wt
- !! wikitext
- '''<small>[[Image:Foobar.jpg|right|300px]]</small>'''
- !! html/parsoid
- <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>
- !! end
- #### ----------------------------------------------------------------
- #### Parsoid-only testing of Parsoid's impl of LST
- #### Not implemented yet, see
- #### https://www.mediawiki.org/wiki/Parsoid/HTML_based_LST
- #### ----------------------------------------------------------------
- ## We still need to support serializing the older format while content is stored.
- !! test
- LST Sections: Backwards compatibility
- !! options
- parsoid={
- "suppressErrors": true,
- "modes": ["html2wt"]
- }
- !! wikitext
- <section begin="2011-05-16" />
- <section end="2014-04-10 (MW 1.23wmf22)" />
- !! html/parsoid
- <p><meta typeof="mw:Extension/LabeledSectionTransclusion/begin" content="2011-05-16"/>
- <meta typeof="mw:Extension/LabeledSectionTransclusion/end" content="2014-04-10 (MW 1.23wmf22)"/></p>
- !! end
- !! test
- LST Sections: Newfangled approach
- !! wikitext
- <section begin="2011-05-16" />
- <section end="2014-04-10 (MW 1.23wmf22)" />
- !! html/parsoid
- <p><span typeof="mw:Extension/section" about="#mwt4" data-mw='{"name":"section","attrs":{"begin":"2011-05-16"},"body":null}'>
- </span>
- <span typeof="mw:Extension/section" about="#mwt6" data-mw='{"name":"section","attrs":{"end":"2014-04-10 (MW 1.23wmf22)"},"body":null}'>
- </span></p>
- !! end
- #--------- Test stripping of empty nodes in template content ----------
- !! test
- Empty LI and TR nodes should be stripped from template content
- !! wikitext
- {{EmptyLITest}}
- {{EmptyTRTest}}
- !! html/parsoid
- <ul about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyLITest","href":"./Template:EmptyLITest"},"params":{},"i":0}}]}'>
- <li>a</li>
- <li>b</li>
- </ul>
- <table about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRTest","href":"./Template:EmptyTRTest"},"params":{},"i":0}}]}'>
- <tbody>
- <tr>
- <td>foo</td>
- </tr>
- <tr>
- <td>bar</td>
- </tr>
- </tbody>
- </table>
- !! end
- !! test
- Empty LI and TR nodes should not be stripped from top-level content
- !! wikitext
- * a
- *
- * b
- {|
- |-
- |-
- |foo
- |}
- !! html/parsoid
- <ul>
- <li> a</li>
- <li class='mw-empty-elt'></li>
- <li> b</li>
- </ul>
- <table>
- <tbody>
- <tr class='mw-empty-elt'></tr>
- <tr>
- <td>foo</td>
- </tr>
- </tbody>
- </table>
- !! end
- !! test
- Empty TR nodes should not be stripped if they have any attributes set
- !! wikitext
- {{EmptyTRWithHTMLAttrTest}}
- !! html/parsoid
- <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"EmptyTRWithHTMLAttrTest","href":"./Template:EmptyTRWithHTMLAttrTest"},"params":{},"i":0}}]}'>
- <tr align='center'></tr>
- <tr><td>foo</td></tr>
- <tr align='center'></tr>
- <tr><td>bar</td></tr>
- </table>
- !! end
- #### ----------------------------------------------------------------
- #### The following section of tests are primarily to test
- #### wikitext escaping capabilities of Parsoid. Given that
- #### escaping can be done any number of ways, the wikitext (input)
- #### is always adjusted to reflect how Parsoid adds nowiki
- #### escape tags.
- ####
- #### We are marking several tests as parsoid-only since the
- #### HTML in the result section is different from what the
- #### PHP parser generates for it.
- #### ----------------------------------------------------------------
- #### --------------- Headings ---------------
- #### 0. Unnested
- #### 1. Nested inside html <h1>=foo=</h1>
- #### 2. Outside heading nest on a single line <h1>foo</h1>*bar
- #### 3. Nested inside html with wikitext split by html tags
- #### 4. No escape needed
- #### 5. Empty headings <h1></h1>
- #### 6. Heading chars in SOL context
- #### ----------------------------------------
- !! test
- Headings: 0. Unnested
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>=foo=</p>
- <p> =foo=
- <!--cmt-->
- =foo=</p>
- <p>=foo<i>a</i>=</p>
- !! wikitext
- <nowiki>=foo=</nowiki>
- <nowiki> </nowiki>=foo=
- <!--cmt-->
- <nowiki>=foo=</nowiki>
- =foo''a''<nowiki>=</nowiki>
- !!end
- # New headings and existing headings are handled differently
- !! test
- Headings: 1. Nested inside html
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h1>=foo=</h1>
- <h2>=foo=</h2>
- <h3>=foo=</h3>
- <h1 data-parsoid=''>=foo=</h1>
- <h2 data-parsoid=''>=foo=</h2>
- <h3 data-parsoid=''>=foo=</h3>
- <h4 data-parsoid=''>=foo=</h4>
- <h5 data-parsoid=''>=foo=</h5>
- <h6 data-parsoid=''>=foo=</h6>
- !! wikitext
- = =foo= =
- == =foo= ==
- === =foo= ===
- =<nowiki>=foo=</nowiki>=
- ==<nowiki>=foo=</nowiki>==
- ===<nowiki>=foo=</nowiki>===
- ====<nowiki>=foo=</nowiki>====
- =====<nowiki>=foo=</nowiki>=====
- ======<nowiki>=foo=</nowiki>======
- !!end
- !! test
- Headings: 2. Outside heading nest on a single line <h1>foo</h1>*bar
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h1>foo</h1>*bar
- <h1>foo</h1>=bar
- <h1>foo</h1>=bar=
- !! wikitext
- = foo =
- <nowiki>*</nowiki>bar
- = foo =
- =bar
- = foo =
- <nowiki>=bar=</nowiki>
- !!end
- !! test
- Headings: 3. Nested inside html with wikitext split by html tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h1>=<b>bold</b>foo=</h1>
- !! wikitext
- = ='''bold'''foo= =
- !!end
- !! test
- Headings: 4a. No escaping needed (testing just h1 and h2)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h1>=foo</h1>
- <h1>foo=</h1>
- <h1> =foo= </h1>
- <h1>=foo= bar</h1>
- <h2>=foo</h2>
- <h2>foo=</h2>
- <h1>=</h1>
- <h1><i>=</i>foo=</h1>
- !! wikitext
- = =foo =
- = foo= =
- = =foo= =
- = =foo= bar =
- == =foo ==
- == foo= ==
- = = =
- = ''=''foo= =
- !!end
- !! test
- Headings: 4b. No escaping needed (inside p-tags)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>=foo= x
- =foo= <s></s>
- </p>
- !! wikitext
- =foo= x
- =foo= <s></s>
- !! html/php
- <p>=foo= x
- =foo= <s></s>
- </p>
- !!end
- !! test
- Headings: 4c. Short headings (1)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>===
- </p>
- !! wikitext
- <nowiki>===</nowiki>
- !! html/php
- <p>===
- </p>
- !! end
- # in the html2wt direction we emit '= = =' or '=<nowiki>=</nowiki>='
- !! test
- Headings: 4d. Short headings (2)
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- =
- ==
- ===
- ====
- =====
- !! html/php
- <p>=
- ==
- </p>
- <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&action=edit&section=1" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <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&action=edit&section=2" title="Edit section: ==">edit</a><span class="mw-editsection-bracket">]</span></span></h1>
- <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&action=edit&section=3" title="Edit section: =">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- !! html/parsoid
- <p>=
- ==</p>
- <h1 id="="><span id=".3D" typeof="mw:FallbackId"></span>=</h1>
- <h1 id="=="><span id=".3D.3D" typeof="mw:FallbackId"></span>==</h1>
- <h2 id="=_2"><span id=".3D_2" typeof="mw:FallbackId"></span>=</h2>
- !! end
- !! test
- Headings: 5. Empty headings
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h1 data-parsoid='{}'></h1>
- <h2 data-parsoid='{}'></h2>
- <h3 data-parsoid='{}'></h3>
- <h4 data-parsoid='{}'></h4>
- <h5 data-parsoid='{}'></h5>
- <h6 data-parsoid='{}'></h6>
- !! wikitext
- =<nowiki/>=
- ==<nowiki/>==
- ===<nowiki/>===
- ====<nowiki/>====
- =====<nowiki/>=====
- ======<nowiki/>======
- !!end
- !! test
- Headings: 6a. Heading chars in SOL context (with trailing spaces)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>=a=</p>
- <p>=a=</p>
- <p>=a=</p>
- !! wikitext
- <nowiki>=a=</nowiki>
- <nowiki>=a=</nowiki>
- <nowiki>=a=</nowiki>
- !!end
- !! test
- Headings: 6b. Heading chars in SOL context (with trailing newlines)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>=a=
- b</p>
- <p>=a=
- b</p>
- <p>=a=
- b</p>
- !! wikitext
- <nowiki>=a=</nowiki>
- b
- <nowiki>=a=</nowiki>
- b
- <nowiki>=a=</nowiki>
- b
- !!end
- !! test
- Headings: 6c. Heading chars in SOL context (leading newline break)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>a
- =b=</p>
- !! wikitext
- a
- <nowiki>=b=</nowiki>
- !!end
- !! test
- Headings: 6d. Heading chars in SOL context (with interspersed comments)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <!--c0--><p>=a=</p>
- <!--c1--><p>=a=</p> <!--c2--> <!--c3-->
- !! wikitext
- <!--c0--><nowiki>=a=</nowiki>
- <!--c1--><nowiki>=a=</nowiki> <!--c2--> <!--c3-->
- !!end
- !! test
- Headings: 6d. Heading chars in SOL context (No escaping needed)
- !! options
- parsoid=html2wt
- !! html/parsoid
- =a=<div>b</div>
- !! wikitext
- =a=<div>b</div>
- !!end
- !! test
- Headings: 7. Insert a newline between new content and headings
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h2>NEW</h2>
- <p>new</p>
- <h2 data-parsoid='{}'>A</h2>
- <p data-parsoid='{}'>a</p>
- !! wikitext
- == NEW ==
- new
- ==A==
- a
- !! end
- !! test
- Headings: Used as horizontal rule
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! options
- parsoid=wt2html
- !! wikitext
- ===============
- !! html/php
- <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&action=edit&section=1" title="Edit section: ===">edit</a><span class="mw-editsection-bracket">]</span></span></h6>
- !! html/parsoid
- <h6 id="==="><span id=".3D.3D.3D" typeof="mw:FallbackId"></span>===</h6>
- !! end
- #### --------------- Lists ---------------
- #### 0. Outside nests (*foo, etc.)
- #### 1. Nested inside html <ul><li>*foo</li></ul>
- #### 2. Inside definition lists
- #### 3. Only bullets at start should be escaped
- #### 4. No escapes needed
- #### 5. No unnecessary escapes
- #### 6. Escape bullets in SOL position
- #### 7. Escape bullets in a multi-line context
- #### ----------------------------------------
- !! test
- Lists: 0. Outside nests
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>*foo</p>
- <p>#foo</p>
- <p>;Foo:bar</p>
- !! wikitext
- <nowiki>*</nowiki>foo
- <nowiki>#</nowiki>foo
- <nowiki>;</nowiki>Foo<nowiki>:</nowiki>bar
- !!end
- ## Making these next 3 tests Parsoid-only since they are html2wt tests
- ## to test wikitext escaping, and insignificant whitespace diffs
- ## cause PHP parser tests to barf
- !! test
- Lists: 1. Nested inside html (No unnecessary escapes)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul>
- <li>*foo</li>
- <li>#foo</li>
- <li>:foo</li>
- <li>;foo</li>
- <li data-parsoid='{}'>*foo</li>
- <li data-parsoid='{}'>#foo</li>
- <li data-parsoid='{}'>:foo</li>
- <li data-parsoid='{}'>;foo</li>
- </ul>
- <ol>
- <li>*foo</li>
- <li>#foo</li>
- <li>:foo</li>
- <li>;foo</li>
- <li data-parsoid='{}'>*foo</li>
- <li data-parsoid='{}'>#foo</li>
- <li data-parsoid='{}'>:foo</li>
- <li data-parsoid='{}'>;foo</li>
- </ol>
- !! wikitext
- * *foo
- * #foo
- * :foo
- * ;foo
- *<nowiki>*foo</nowiki>
- *<nowiki>#foo</nowiki>
- *<nowiki>:foo</nowiki>
- *<nowiki>;foo</nowiki>
- # *foo
- # #foo
- # :foo
- # ;foo
- #<nowiki>*foo</nowiki>
- #<nowiki>#foo</nowiki>
- #<nowiki>:foo</nowiki>
- #<nowiki>;foo</nowiki>
- !!end
- !! test
- Lists: 2. Inside definition lists
- !! options
- parsoid=html2wt
- !! html/parsoid
- <dl><dt>;foo</dt></dl>
- <dl><dt>:foo</dt></dl>
- <dl><dt>:foo</dt>
- <dd>bar</dd></dl>
- <dl><dd>:foo</dd></dl>
- !! wikitext
- ; ;foo
- ; <nowiki>:foo</nowiki>
- ; <nowiki>:foo</nowiki>
- : bar
- : :foo
- !!end
- !! test
- Lists: 3. Only bullets at start of text in wikitext-generated HTML should be escaped
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul>
- <li>*foo*bar</li>
- <li data-parsoid='{}'>*foo<i>it</i>*bar</li>
- </ul>
- !! wikitext
- * *foo*bar
- *<nowiki>*foo</nowiki>''it''*bar
- !!end
- !! test
- Lists: 4. No escapes needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul>
- <li>foo*bar
- </li>
- </ul>
- <ul>
- <li><i>foo</i>*bar
- </li>
- </ul>
- <ul>
- <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>: bar
- </li>
- </ul>
- <ul>
- <li><a rel="mw:WikiLink" href="Foo" title="Foo">Foo</a>*bar
- </li>
- </ul>
- !! wikitext
- *foo*bar
- *''foo''*bar
- *[[Foo]]: bar
- *[[Foo]]*bar
- !!end
- !! test
- Lists: 5. No unnecessary escapes
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul><li> bar <span>[[foo]]</span></li></ul>
- <ul><li> =bar <span>[[foo]]</span></li></ul>
- <ul><li> [[bar <span>[[foo]]</span></li></ul>
- <ul><li> ]]bar <span>[[foo]]</span></li></ul>
- <ul><li> =bar <span>foo]]</span>=</li></ul>
- <ul><li> <s></s>: a</li></ul>
- <ul><li> <i>* foo</i></li></ul>
- !! wikitext
- * bar <span><nowiki>[[foo]]</nowiki></span>
- * =bar <span><nowiki>[[foo]]</nowiki></span>
- * [[bar <span><nowiki>[[foo]]</nowiki></span>
- * ]]bar <span><nowiki>[[foo]]</nowiki></span>
- * =bar <span>foo]]</span>=
- * <s></s>: a
- * ''* foo''
- !!end
- !! test
- Lists: 6. Escape bullets in SOL position
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><!--cmt-->*foo</p>
- !! wikitext
- <!--cmt--><nowiki>*</nowiki>foo
- !!end
- !! test
- Lists: 7. Escape bullets in a multi-line context
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>a
- *b
- </p>
- !! wikitext
- a
- <nowiki>*</nowiki>b
- !!end
- !! test
- Lists: 8. Escape colons only if not present in tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <dl><dt>a:b<i>c:d</i></dt></dl>
- !! wikitext
- ; <nowiki>a:b</nowiki>''c:d''
- !! end
- #### --------------- HRs ---------------
- #### 1. Single line
- #### -----------------------------------
- !! test
- HRs: 1. Single line
- !! options
- parsoid=html2wt
- !! html/parsoid
- <hr />----
- <hr />=foo=
- <hr />*foo
- !! wikitext
- ----<nowiki>----</nowiki>
- ----=foo=
- ----*foo
- !! end
- #### --------------- Tables ---------------
- #### 1a. Simple example
- #### 1b. No escaping needed (!foo)
- #### 1c. No escaping needed (|foo)
- #### 1d. No escaping needed (|}foo)
- ####
- #### 2a. Nested in td (<td>foo|bar</td>)
- #### 2b. Nested in td (<td>foo||bar</td>)
- #### 2c. Nested in td -- no escaping needed(<td>foo!!bar</td>)
- ####
- #### 3a. Nested in th (<th>foo!bar</th>)
- #### 3b. Nested in th (<th>foo!!bar</th>)
- #### 3c. Nested in th -- no escaping needed(<th>foo||bar</th>)
- ####
- #### 4a. Escape -
- #### 4b. Escape +
- #### 4c. No escaping needed
- #### --------------------------------------
- !! test
- Tables: 1a. Simple example
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>{|
- |}
- </p>
- !! wikitext
- <nowiki>{|</nowiki>
- |}
- !! end
- !! test
- Tables: 1b. No escaping needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>!foo
- </p>
- !! wikitext
- !foo
- !! end
- !! test
- Tables: 1c. No escaping needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>|foo
- </p>
- !! wikitext
- |foo
- !! end
- !! test
- Tables: 1d. No escaping needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>|}foo
- </p>
- !! wikitext
- |}foo
- !! end
- !! test
- Tables: 2a. Nested in td
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><tbody><tr>
- <td>foo|bar</td></tr>
- <tr><td>x<div>a|b</div></td>
- </tbody></table>
- !! wikitext
- {|
- |<nowiki>foo|bar</nowiki>
- |-
- |x<div><nowiki>a|b</nowiki></div>
- |}
- !! html/php+tidy
- <table>
- <tbody><tr>
- <td>foo|bar
- </td></tr>
- <tr>
- <td>x<div>a|b</div>
- </td></tr></tbody></table>
- !! end
- !! test
- Tables: 2b. Nested in td
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><tbody><tr>
- <td>foo||bar</td>
- <td>a<i>b||c</i></td>
- <td>a<i><div>b||c</div></i></td>
- </tr></tbody></table>
- !! wikitext
- {|
- |<nowiki>foo||bar</nowiki>
- |a''<nowiki>b||c</nowiki>''
- |a''<div><nowiki>b||c</nowiki></div>''
- |}
- !! html/php
- <table>
- <tr>
- <td>foo||bar
- </td>
- <td>a<i>b||c</i>
- </td>
- <td>a<i><div>b||c</div></i>
- </td></tr></table>
- !! end
- !! test
- Tables: 2c. Nested in td -- no escaping needed
- !! options
- parsoid=html2wt
- !! html/*
- <table>
- <tr>
- <td>foo!!bar
- </td></tr></table>
- !! wikitext
- {|
- |foo!!bar
- |}
- !! end
- !! test
- Tables: 3a. Nested in th
- !! options
- parsoid=html2wt
- !! html/*
- <table>
- <tr>
- <th>foo!bar
- </th></tr></table>
- !! wikitext
- {|
- !foo!bar
- |}
- !! end
- !! test
- Tables: 3b. Nested in th
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><tbody>
- <tr><th>foo!!bar</th>
- <th><i>foo|bar</i></th>
- <th><i>foo!!bar</i></th>
- <th><i><span>foo!!bar</span></i></th>
- </tr></tbody></table>
- !! wikitext
- {|
- !<nowiki>foo!!bar</nowiki>
- !''<nowiki>foo|bar</nowiki>''
- !''<nowiki>foo!!bar</nowiki>''
- !''<span><nowiki>foo!!bar</nowiki></span>''
- |}
- !! html/php
- <table>
- <tr>
- <th>foo!!bar
- </th>
- <th><i>foo|bar</i>
- </th>
- <th><i>foo!!bar</i>
- </th>
- <th><i><span>foo!!bar</span></i>
- </th></tr></table>
- !! end
- !! test
- Tables: 3c. Nested in th
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><tbody>
- <tr><th>foo||bar</th>
- <th><span typeof="mw:Nowiki">foo||bar</span></th>
- </tr></tbody></table>
- !! wikitext
- {|
- !<nowiki>foo||bar</nowiki>
- !<nowiki>foo||bar</nowiki>
- |}
- !! html/php
- <table>
- <tr>
- <th>foo||bar
- </th>
- <th>foo||bar
- </th></tr></table>
- !! end
- !! test
- Tables: 4a. Escape -
- !! options
- parsoid=html2wt
- !! html/*
- <table>
- <tr>
- <th>-bar
- </th></tr>
- <tr>
- <td>-bar
- </td></tr></table>
- !! wikitext
- {|
- !-bar
- |-
- |<nowiki>-bar</nowiki>
- |}
- !! end
- !! test
- Tables: 4b. Escape +
- !! options
- parsoid=html2wt
- !! html/*
- <table>
- <tr>
- <th>+bar
- </th></tr>
- <tr>
- <td>+bar
- </td></tr></table>
- !! wikitext
- {|
- !+bar
- |-
- |<nowiki>+bar</nowiki>
- |}
- !! end
- !! test
- Tables: 4c. No escaping needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><tbody>
- <tr><td>foo-bar</td><td>foo+bar</td></tr>
- <tr><td><i>foo</i>-bar</td><td><i>foo</i>+bar</td></tr>
- <tr><td>foo
- <p>bar|baz
- +bar
- -bar</p></td></tr>
- <tr><td>x
- <div>a|b</div></td>
- </tbody></table>
- !! wikitext
- {|
- |foo-bar
- |foo+bar
- |-
- |''foo''-bar
- |''foo''+bar
- |-
- |foo
- bar|baz
- +bar
- -bar
- |-
- |x
- <div>a|b</div>
- |}
- !! html/php
- <table>
- <tr>
- <td>foo-bar
- </td>
- <td>foo+bar
- </td></tr>
- <tr>
- <td><i>foo</i>-bar
- </td>
- <td><i>foo</i>+bar
- </td></tr>
- <tr>
- <td>foo
- <p>bar|baz
- +bar
- -bar
- </p>
- </td></tr>
- <tr>
- <td>x
- <div>a|b</div>
- </td></tr></table>
- !! end
- !! test
- Tables: 4d. No escaping needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table>
- <tbody><tr><td><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>-bar</td>
- <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>+1</td>
- <td data-parsoid='{"startTagSrc":"|","attrSepSrc":"|"}'>-2</td></tr>
- </tbody></table>
- !! wikitext
- {|
- |[[Foo]]-bar
- ||+1
- ||-2
- |}
- !! html/php
- <table>
- <tr>
- <td><a href="/wiki/Foo" title="Foo">Foo</a>-bar
- </td>
- <td>+1
- </td>
- <td>-2
- </td></tr></table>
- !! end
- !! test
- T97430: Don't emit empty nowiki pairs around marker meta tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>*This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
- |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.</p>
- !! wikitext
- <nowiki>*</nowiki>This is a long sentence here that will make the nowiki algo split up the nowikis into multiple pairs
- |** Make this another long long long sentence forcing the nowiki algo to split up the nowikis.
- !! end
- !! test
- Unclosed xmlish element in table line shouldn't eat end delimiters
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table>
- <tbody><tr><td> <foo</td>
- <td> bar></td></tr>
- </tbody></table>
- !! wikitext
- {|
- | <foo
- | bar>
- |}
- !! html/php
- <table>
- <tr>
- <td><foo
- </td>
- <td>bar>
- </td></tr></table>
- !! end
- #### --------------- Links ----------------
- #### 1. Quote marks in link text
- #### 2. Wikilinks: Escapes needed
- #### 3. Wikilinks: No escapes needed
- #### 4. Extlinks: Escapes needed
- #### 5. Extlinks: No escapes needed
- #### --------------------------------------
- !! test
- Links 1. WikiLinks: No escapes needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="Foo" title="Foo">Foo<i>boo</i></a>
- <a rel="mw:WikiLink" href="Foo" title="Foo">[Foobar]</a>
- <a rel="mw:WikiLink" href="Foo" title="Foo">x [Foobar] x</a></p>
- !! wikitext
- [[Foo|Foo''boo'']]
- [[Foo|[Foobar]]]
- [[Foo|x [Foobar] x]]
- !! html/php
- <p><a href="/wiki/Foo" title="Foo">Foo<i>boo</i></a>
- <a href="/wiki/Foo" title="Foo">[Foobar]</a>
- <a href="/wiki/Foo" title="Foo">x [Foobar] x</a>
- </p>
- !! end
- !! test
- Links 2. WikiLinks: Escapes needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a href="Foo" rel="mw:WikiLink">Foobar]</a>
- <a href="Foo" rel="mw:WikiLink">x [http://google.com g] x</a>
- <a href="Foo" rel="mw:WikiLink">[[Bar]]</a>
- <a href="Foo" rel="mw:WikiLink">x [[Bar]] x</a>
- <a href="Foo" rel="mw:WikiLink">|Bar</a>
- <a href="Foo" rel="mw:WikiLink">]]bar</a>
- <a href="Foo" rel="mw:WikiLink">[[bar</a>
- <a href="Foo" rel="mw:WikiLink">x [[ y</a>
- <a href="Foo" rel="mw:WikiLink">x ]] y</a>
- <a href="Foo" rel="mw:WikiLink">x ]] y [[ z</a>
- !! wikitext
- [[Foo|<nowiki>Foobar]</nowiki>]]
- [[Foo|x <nowiki>[http://google.com g]</nowiki> x]]
- [[Foo|<nowiki>[[Bar]]</nowiki>]]
- [[Foo|<nowiki>x [[Bar]] x</nowiki>]]
- [[Foo|<nowiki>|Bar</nowiki>]]
- [[Foo|<nowiki>]]bar</nowiki>]]
- [[Foo|<nowiki>[[bar</nowiki>]]
- [[Foo|<nowiki>x [[ y</nowiki>]]
- [[Foo|<nowiki>x ]] y</nowiki>]]
- [[Foo|<nowiki>x ]] y [[ z</nowiki>]]
- !! html/php
- <p><a href="/wiki/Foo" title="Foo">Foobar]</a>
- <a href="/wiki/Foo" title="Foo">x [http://google.com g] x</a>
- <a href="/wiki/Foo" title="Foo">[[Bar]]</a>
- <a href="/wiki/Foo" title="Foo">x [[Bar]] x</a>
- <a href="/wiki/Foo" title="Foo">|Bar</a>
- <a href="/wiki/Foo" title="Foo">]]bar</a>
- <a href="/wiki/Foo" title="Foo">[[bar</a>
- <a href="/wiki/Foo" title="Foo">x [[ y</a>
- <a href="/wiki/Foo" title="Foo">x ]] y</a>
- <a href="/wiki/Foo" title="Foo">x ]] y [[ z</a>
- </p>
- !! end
- !! test
- Links 3. WikiLinks: No escapes needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="Foo">[Foobar</a>
- <a rel="mw:WikiLink" href="Foo" title="Foo">foo|bar</a></p>
- !! wikitext
- [[Foo|[Foobar]]
- [[Foo|foo|bar]]
- !! html/php
- <p><a href="/wiki/Foo" title="Foo">[Foobar</a>
- <a href="/wiki/Foo" title="Foo">foo|bar</a>
- </p>
- !! end
- !! test
- Links 4. ExtLinks: Escapes needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel="mw:ExtLink" href="http://google.com">[google]</a>
- <a rel="mw:ExtLink" href="http://google.com">google]</a>
- <a rel="mw:ExtLink" href="http://google.com">goog] le</a></p>
- <p>[http://google.com]</p>
- <p>[http://google.com google]</p>
- <p>[<a rel="mw:ExtLink" href="http://google.com">http://google.com</a>]</p>
- <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>
- !! wikitext
- [http://google.com <nowiki>[google]</nowiki>]
- [http://google.com <nowiki>google]</nowiki>]
- [http://google.com <nowiki>goog] le</nowiki>]
- <nowiki>[http://google.com]</nowiki>
- <nowiki>[http://google.com google]</nowiki>
- [http://google.com<nowiki>]</nowiki>
- [{{echo|http://google.com}}<nowiki>]</nowiki>
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://google.com">[google]</a>
- <a rel="nofollow" class="external text" href="http://google.com">google]</a>
- <a rel="nofollow" class="external text" href="http://google.com">goog] le</a>
- </p><p>[http://google.com]
- </p><p>[http://google.com google]
- </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
- </p><p>[<a rel="nofollow" class="external free" href="http://google.com">http://google.com</a>]
- </p>
- !! end
- !! test
- Links 5. ExtLinks: No escapes needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel="mw:ExtLink" href="http://google.com">[google</a></p>
- <p>[<a ref="mw:ExtLink" href="http://google.com"></a>]</p>
- !! wikitext
- [http://google.com [google]
- [[http://google.com]]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://google.com">[google</a>
- </p><p>[<a rel="nofollow" class="external autonumber" href="http://google.com">[1]</a>]
- </p>
- !! end
- !! test
- Links 6. Add <nowiki/>s between text-nodes and url-links when required (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>x<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>y
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>?x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>&x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>'x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>:x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>;x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>!x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>=x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>(x)
- <a rel="mw:ExtLink" href="http://example.com(x" data-parsoid='{"stx":"url"}'>http://example.com(x</a>)
- </p>
- !! wikitext
- x<nowiki/>http://example.com<nowiki/>y
- http://example.com<nowiki/>?x
- http://example.com<nowiki/>&x
- http://example.com<nowiki/>'x
- http://example.com<nowiki/>,x
- http://example.com<nowiki/>.x
- http://example.com<nowiki/>;x
- http://example.com<nowiki/>:x
- http://example.com<nowiki/>;x
- http://example.com<nowiki/>!x
- http://example.com<nowiki/>=x
- http://example.com<nowiki/>(x)
- http://example.com(x<nowiki/>)
- !! end
- !! test
- Links 7a. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>x
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>
- y
- "<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>"
- (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>)
- (<a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>) foo
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>,
- <a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>, foo
- </p>
- !! wikitext
- x
- http://example.com
- y
- "http://example.com"
- (http://example.com)
- (http://example.com) foo
- http://example.com,
- http://example.com, foo
- !! html/php
- <p>x
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>
- y
- "<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>"
- (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>)
- (<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>) foo
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>,
- <a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>, foo
- </p>
- !! end
- !! test
- Links 7b. Don't add spurious <nowiki/>s between text-nodes and url-links (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel="mw:ExtLink" href="http://example.com" data-parsoid='{"stx":"url"}'>http://example.com</a>.,;:!?\
- -<a rel="mw:ExtLink" href="http://example.com">http://example.com</a>:</p>
- !! wikitext
- http://example.com.,;:!?\
- -http://example.com:
- !! html/php
- <p><a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>.,;:!?\
- -<a rel="nofollow" class="external free" href="http://example.com">http://example.com</a>:
- </p>
- !! end
- !! test
- Links 8. Add <nowiki/>s between text-nodes and RFC-links when required (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>4
- <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y
- X<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>y</p>
- !! wikitext
- RFC 123<nowiki/>4
- RFC 123<nowiki/>y
- X<nowiki/>RFC 123<nowiki/>y
- !! end
- !! test
- Links 9. Don't add spurious <nowiki/>s between text-nodes and RFC-links (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>?foo
- <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>&foo
- -<a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>RFC 123</a>-
- </p>
- !! wikitext
- RFC 123?foo
- RFC 123&foo
- -RFC 123-
- !! html/php
- <p><a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>?foo
- <a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>&foo
- -<a class="external mw-magiclink-rfc" rel="nofollow" href="https://tools.ietf.org/html/rfc123">RFC 123</a>-
- </p>
- !! end
- !! test
- Links 10. Add <nowiki/>s between text-nodes and PMID-links when required (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>4
- <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
- X<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>y
- !! wikitext
- PMID 123<nowiki/>4
- PMID 123<nowiki/>y
- X<nowiki/>PMID 123<nowiki/>y
- !! end
- !! test
- Links 11. Don't add spurious <nowiki/>s between text-nodes and PMID-links (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>?foo
- <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>&foo
- -<a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink" data-parsoid='{"stx":"magiclink"}'>PMID 123</a>-
- </p>
- !! wikitext
- PMID 123?foo
- PMID 123&foo
- -PMID 123-
- !! html/php
- <p><a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>?foo
- <a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>&foo
- -<a class="external mw-magiclink-pmid" rel="nofollow" href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract">PMID 123</a>-
- </p>
- !! end
- !! test
- Links 12. Add <nowiki/>s between text-nodes and ISBN-links when required (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>1
- <a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>x
- a<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>b
- </p>
- !! wikitext
- ISBN 1234567890<nowiki/>1
- ISBN 1234567890<nowiki/>x
- a<nowiki/>ISBN 1234567890<nowiki/>b
- !! end
- !! test
- Links 13. Don't add spurious <nowiki/>s between text-nodes and ISBN-links (T66300)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>-<a href="./Special:BookSources/1234567890" rel="mw:WikiLink" data-parsoid='{"stx":"magiclink"}'>ISBN 1234567890</a>'s
- !! wikitext
- -ISBN 1234567890's
- !! html/php
- <p>-<a href="/wiki/Special:BookSources/1234567890" class="internal mw-magiclink-isbn">ISBN 1234567890</a>'s
- </p>
- !! end
- !! test
- Links 14. Protect link-like plain text. (Parsoid bug T78425)
- !! options
- parsoid=html2wt
- !! html/*
- <p>this is not a link: http://example.com
- </p>
- !! wikitext
- this is not a link: <nowiki>http://example.com</nowiki>
- !! end
- !! test
- Links 15. Link trails can't become link prefixes.
- !! options
- language=is
- parsoid=html2wt
- !! html/parsoid
- <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>
- !! wikitext
- [[Söfnuður]]-[[00]]
- !! html/php
- <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>
- </p>
- !! end
- #### --------------- Quotes ---------------
- #### 1. Quotes inside <b> and <i>
- #### 2. Link fragments separated by <i> and <b> tags
- #### 3. Link fragments inside <i> and <b>
- #### 4. No escaping needed
- #### --------------------------------------
- !! test
- 1a. Quotes inside <b> and <i>
- !! options
- parsoid=html2wt
- !! html/*
- <p><i>'foo'</i>
- <i>''foo''</i>
- <i>'''foo'''</i>
- <i>foo</i>'s
- <b>'foo'</b>
- <b>''foo''</b>
- <b>'''foo'''</b>
- <b>foo'<i>bar'</i>baz</b>
- <b>foo</b>'s
- '<i>foo</i>
- <i>foo</i>'
- <i>foo'</i>'
- '<i>foo</i>'
- '<b>foo</b>
- <b>foo</b>'
- '<b>foo</b>'
- <i>fools'<span> errand</span></i>
- <i><span>fool</span>'s errand</i>
- '<i>foo</i> bar '<i>baz</i>
- a|!*#-:;+-~[]{}b'<i>x</i>
- </p>
- !! wikitext
- ''<nowiki/>'foo'''
- ''<nowiki>''foo''</nowiki>''
- ''<nowiki>'''foo'''</nowiki>''
- ''foo''<nowiki/>'s
- '''<nowiki/>'foo''''
- '''<nowiki>''foo''</nowiki>'''
- '''<nowiki>'''foo'''</nowiki>'''
- '''foo'<nowiki/>''bar'<nowiki/>''baz'''
- '''foo'''<nowiki/>'s
- '''foo''
- ''foo''<nowiki/>'
- ''foo'''<nowiki/>'
- '''foo''<nowiki/>'
- ''''foo'''
- '''foo'''<nowiki/>'
- ''''foo'''<nowiki/>'
- ''fools'<span> errand</span>''
- ''<span>fool</span>'s errand''
- '<nowiki/>''foo'' bar '''baz''
- a|!*#-:;+-~[]{}b'''x''
- !! end
- !! test
- 1b. Quotes inside <b> and <i> with other tags on same line
- !! options
- parsoid=html2wt
- !! html/parsoid
- '<i>a</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
- <i>a'</i> foo <i><a rel="mw:WikiLink" href="Bar" title="Bar">bar</a></i>
- <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>
- <a rel="mw:WikiLink" href="Foo" title="Foo">foo</a> x'<i><a href="Bar" rel="mw:WikiLink" title="Bar">bar</a></i>
- '<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>
- '<i>foo</i> <div title="name">test</div>
- '<i>foo</i> and <br data-parsoid='{"stx":"html","noClose":true}'/> bar
- <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"><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>
- </ol>
- !! wikitext
- '''a'' foo ''[[bar]]''
- ''a''' foo ''[[bar]]''
- ''a''' foo '''{{echo|[[bar]]}}'''
- [[foo]] x'''[[bar]]''
- '''foo'' <ref>test</ref>
- '''foo'' <div title="name">test</div>
- '''foo'' and <br> bar
- <references />
- !! end
- !! test
- 2. Link fragments separated by <i> and <b> tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>[[<i>foo</i>hello]]</p>
- <p>[[<b>foo</b>hello]]</p>
- !! wikitext
- [[''foo''<nowiki>hello]]</nowiki>
- [['''foo'''<nowiki>hello]]</nowiki>
- !! end
- # FIXME: Escaping one or both of [[ and ]] is also acceptable --
- # this is one of the shortcomings of this format
- !! test
- 3. Link fragments inside <i> and <b>
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><i>[[foo</i>]]</p>
- <p><b>[[foo</b>]]</p>
- !! wikitext
- ''[[foo''<nowiki>]]</nowiki>
- '''[[foo'''<nowiki>]]</nowiki>
- !! end
- !! test
- 4. No escaping needed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>'<span><i>bar</i></span>'
- '<span><b>bar</b></span>'
- 'a:b'foo
- </p>
- !! wikitext
- '<span>''bar''</span>'
- '<span>'''bar'''</span>'
- 'a:b'foo
- !! end
- #### ----------- Paragraphs ---------------
- #### 1. No unnecessary escapes
- #### --------------------------------------
- !! test
- 1. No unnecessary escapes
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>bar <span>[[foo]]</span>
- </p><p>=bar <span>[[foo]]</span>
- </p><p>[[bar <span>[[foo]]</span>
- </p><p>]]bar <span>[[foo]]</span>
- </p><p>=bar <span>foo]]</span>=
- </p>
- !! wikitext
- bar <span><nowiki>[[foo]]</nowiki></span>
- =bar <span><nowiki>[[foo]]</nowiki></span>
- [[bar <span><nowiki>[[foo]]</nowiki></span>
- ]]bar <span><nowiki>[[foo]]</nowiki></span>
- =bar <span>foo]]</span><nowiki>=</nowiki>
- !!end
- #### ----------------------- PRE --------------------------
- #### 1. Leading whitespace in SOL context should be escaped
- #### ------------------------------------------------------
- !! test
- 1. Leading whitespace in SOL context should be escaped
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p> a</p>
- <p> a</p>
- <p> a(tab)</p>
- <p> a
- <!--cmt-->
- a</p>
- <p>a
- b</p>
- <p>a
- b</p>
- <p>a
- b</p>
- !! wikitext
- <nowiki> </nowiki>a
- <nowiki> </nowiki> a
- a(tab)
- <nowiki> </nowiki> a
- <!--cmt-->
- <nowiki> </nowiki>a
- a
- <nowiki> </nowiki>b
- a
- b
- a
- b
- !! html/php
- <p> a
- </p><p> a
- </p><p> a(tab)
- </p><p> a
- a
- </p><p>a
- b
- </p><p>a
- b
- </p><p>a
- b
- </p>
- !! end
- !! test
- 2. Leading whitespace in non-indent-pre contexts should not be escaped
- !! options
- parsoid=html2wt
- !! html/parsoid
- <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>
- <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"><i>a</i>
- b</span></li>
- </ol>
- !! wikitext
- foo <ref>''a''
- b</ref>
- <references />
- !! end
- !! test
- 3. Leading whitespace in indent-pre suppressing contexts should not be escaped
- !! options
- parsoid=html2wt
- !! html/parsoid
- <blockquote>
- <p>
- a
- <span>b</span>
- c</p>
- </blockquote>
- !! wikitext
- <blockquote>
- a
- <span>b</span>
- c
- </blockquote>
- !! end
- !! test
- 4. Leading whitespace in indent-pre suppressing contexts should not be escaped
- !! options
- parsoid=html2wt
- !! html/parsoid
- <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>
- !! wikitext
- [[File:Foobar.jpg|thumb|caption]]
- !! end
- !! test
- 5. Nowiki escaping should account for indent-pres
- !! options
- parsoid=html2wt
- !! html/parsoid
- <pre>==foo==</pre>
- !! wikitext
- ==foo==
- !! end
- !!test
- T95794: nowiki escaping should account for leading space at start-of-line in an indent-pre block
- !! options
- parsoid=html2wt
- !! html/parsoid
- <pre>
- * foo
- * bar
- </pre>
- !! wikitext
- * foo
- * bar
- !! end
- #### --------------- Behavior Switches --------------------
- !! test
- 1. Valid behavior switches should be escaped
- !! options
- parsoid=html2wt
- !! html/parsoid
- __TOC__
- <i>__TOC__</i>
- !! wikitext
- <nowiki>__TOC__</nowiki>
- ''<nowiki>__TOC__</nowiki>''
- !! end
- !! test
- 2. Invalid behavior switches should not be escaped
- !! options
- parsoid=html2wt
- !! html/parsoid
- __TOO__
- __|__
- !! wikitext
- __TOO__
- __|__
- !! end
- # We use indent-pre as an indirect way to test for sol-transparent behavior.
- !! test
- Behavior switches should be SOL-transparent
- !! options
- parsoid=html2wt
- !! html/parsoid
- <meta property="mw:PageProp/toc" />
- <!-- this one's bogus -->
- <pre>__TOO__</pre>
- <pre data-parsoid='{}'><meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/> foo</pre>
- <meta property="mw:PageProp/toc" data-parsoid='{"src":"__TOC__","magicSrc":"__TOC__"}'/><pre data-parsoid='{}'>bar</pre>
- !! wikitext
- __TOC__
- <!-- this one's bogus -->
- __TOO__
- __TOC__ foo
- __TOC__
- bar
- !! end
- #### --------------- HTML tags ---------------
- #### 1. a tags
- #### 2. other tags
- #### 3. multi-line html tag
- #### 4. extension tags
- #### -----------------------------------------
- !! test
- 1. a tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a href="http://google.com">google</a>
- !! wikitext
- <a href="http://google.com">google</a>
- !! end
- !! test
- 2. other tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul><li> <div>foo</div></li>
- <li> <div style="color:red">foo</div></li>
- <li> <td></li></ul>
- !! wikitext
- * <nowiki><div>foo</div></nowiki>
- * <nowiki><div style="color:red">foo</div></nowiki>
- * <nowiki><td></nowiki>
- !! end
- !! test
- 3. multi-line html tag
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><div
- >foo</div
- >
- </p>
- !! wikitext
- <nowiki><div
- >foo</div
- ></nowiki>
- !! end
- !! test
- 4. extension tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><ref>foo</ref>
- </p><p><ref>bar
- </p><p>baz</ref>
- </p>
- !! wikitext
- <nowiki><ref>foo</ref></nowiki>
- <nowiki><ref>bar</nowiki>
- baz<nowiki></ref></nowiki>
- !! end
- #### --------------- Others ---------------
- !! test
- Escaping nowikis
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><nowiki>foo</nowiki>
- </p>
- !! wikitext
- <nowiki>foo</nowiki>
- !! end
- ## The quote-char in the input is necessary for triggering the bug
- !! test
- (T54035) Nowiki-escaping should not get tripped by " :" in text
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>foo's bar :</p>
- !! wikitext
- foo's bar :
- !! end
- #----------- End of wikitext escaping tests --------------
- !! test
- Tag-like HTML structures are passed through as text
- !! wikitext
- <x y>
- <x.y>
- <x-y>
- 1>2
- x<y
- a>b
- 1<d e>f
- !! html
- <p><x y>
- </p><p><x.y>
- </p><p><x-y>
- </p><p>1>2
- </p><p>x<y
- </p><p>a>b
- </p><p>1<d e>f
- </p>
- !! end
- !! test
- HTML tag with necessary entities in attributes
- !! wikitext
- <span title="&amp;">foo</span>
- !! html
- <p><span title="&amp;">foo</span>
- </p>
- !! end
- !! test
- HTML tag with 'unnecessary' entity encoding in attributes
- !! wikitext
- <span title="&">foo</span>
- !! html
- <p><span title="&">foo</span>
- </p>
- !! end
- !! test
- HTML tag with broken attribute value quoting
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <span title="Hello world>Foo</span>
- !! html/php
- <p><span title="Hello world">Foo</span>
- </p>
- !! html/parsoid
- <p><span title="Hello world">Foo</span></p>
- !! end
- !! test
- Self-closed tag with broken attribute value quoting
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- <div title="Hello world />Foo
- !! html/php+tidy
- <div title="Hello world"></div><p>Foo
- </p>
- !! html/parsoid
- <div title="Hello world " data-parsoid='{"stx":"html","selfClose":true}'></div><p>Foo</p>
- !! end
- !! test
- Table with broken attribute value quoting
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- | title="Hello world|Foo
- |}
- !! html/php
- <table>
- <tr>
- <td title="Hello world">Foo
- </td></tr></table>
- !! html/parsoid
- <table>
- <tr>
- <td title="Hello world">Foo
- </td></tr></table>
- !! end
- !! test
- Table with broken attribute value quoting on consecutive lines
- !! options
- parsoid=wt2html,html2html
- !! wikitext
- {|
- | title="Hello world|Foo
- | style="color:red|Bar
- |}
- !! html/php
- <table>
- <tr>
- <td title="Hello world">Foo
- </td>
- <td style="color:red">Bar
- </td></tr></table>
- !! html/parsoid
- <table><tbody>
- <tr>
- <td title="Hello world">Foo
- </td><td style="color: red">Bar
- </td></tr></tbody></table>
- !! end
- !!test
- Accept empty td cell attribute
- !! wikitext
- {|
- | align="center" |foo|| |
- |}
- !! html
- <table>
- <tr>
- <td align="center">foo</td>
- <td>
- </td></tr></table>
- !!end
- !!test
- Non-empty attributes in th-cells
- !! wikitext
- {|
- !Foo!! style="color: red" |Bar
- |}
- !! html
- <table>
- <tr>
- <th>Foo</th>
- <th style="color: red">Bar
- </th></tr></table>
- !!end
- !!test
- Accept empty attributes in th-cells
- !! wikitext
- {|
- !|foo!!|bar
- |}
- !! html
- <table>
- <tr>
- <th>foo</th>
- <th>bar
- </th></tr></table>
- !!end
- !!test
- Empty table rows go away
- !! wikitext
- {|
- |Hello
- |there
- |- class="foo"
- |-
- |}
- !! html
- <table>
- <tr>
- <td>Hello
- </td>
- <td>there
- </td></tr>
- </table>
- !! end
- ###
- ### Parsoid-centric tests for testing RTing of inter-element separators
- ### Edge cases not tested by existing parser tests and specific to
- ### Parsoid-specific serialization strategies.
- ###
- !!test
- RT-ed inter-element separators should be valid separators
- !! wikitext
- {|
- |- [[foo]]
- |}
- !! html/php
- <table>
- </table>
- !! html/parsoid
- <table>
- <tbody><tr class='mw-empty-elt' data-parsoid='{"startTagSrc":"|-","a":{"[[foo]]":null},"sa":{"[[foo]]":""},"autoInsertedEnd":true}'></tr>
- </tbody></table>
- !!end
- # Parsoid-only test of a DOM pass
- !!test
- Trailing newlines in a deep dom-subtree that ends a wikitext line should be migrated out
- !! wikitext
- {|
- |<small>foo
- bar
- |}
- {|
- |<small>foo<small>
- |}
- !! html/parsoid
- <table>
- <tbody><tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'><small data-parsoid='{"stx":"html","autoInsertedEnd":true}'>foo
- <p>bar</p></small></td></tr>
- </tbody></table>
- <table>
- <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>
- </tbody></table>
- !!end
- # Note that the "style" attribute is really a template parameter here.
- # The = would have to be {{=}} if you wanted the literal.
- !!test
- Empty TD followed by TD with tpl-generated attribute
- !! wikitext
- {|
- |-
- |
- |{{echo|style='color:red'}}|foo
- |}
- !! html
- <table>
- <tr>
- <td>
- </td>
- <td>foo
- </td></tr></table>
- !!end
- !!test
- Indented table with an empty td
- !! wikitext
- {|
- |-
- |
- |foo
- |}
- !! html
- <table>
- <tr>
- <td>
- </td>
- <td>foo
- </td></tr></table>
- !!end
- ## We have some newline diffs RT-ing this edge case
- ## and it is not important enough -- we seem to be emitting
- ## at most 2 newlines after a </tr> and this is unrelated to
- ## the issue from T85627 that this is testing.
- !!test
- Indented table with blank lines in between (T85627)
- !! options
- parsoid=wt2html
- !! wikitext
- {|
- |foo
-
-
- |}
- !! html
- <table>
- <tr>
- <td>foo
- </td></tr></table>
- !!end
- !!test
- Indented block & table
- !! wikitext
- <div>foo</div>
- {|
- |foo
- |}
- !! html/php
- <div>foo</div>
- <table>
- <tr>
- <td>foo
- </td></tr></table>
- !! html/parsoid
- <div data-parsoid='{"stx":"html"}'>foo</div>
- <table><tbody>
- <tr data-parsoid='{"autoInsertedEnd":true,"autoInsertedStart":true}'><td data-parsoid='{"autoInsertedEnd":true}'>foo</td></tr>
- </tbody></table>
- !!end
- !! test
- Indent and comment before table row
- !! wikitext
- {|
- <!--hi-->|-
- |there
- |}
- !! html/php
- <table>
- <tr>
- <td>there
- </td></tr></table>
- !! html/parsoid
- <table>
- <!--hi--><tbody><tr data-parsoid='{"startTagSrc":"|-","autoInsertedEnd":true}'>
- <td data-parsoid='{"autoInsertedEnd":true}'> there</td></tr>
- </tbody></table>
- !! end
- # Parsoid-specific since PHP parser doesn't handle this mixed tbl-wikitext
- !!test
- Empty TR followed by a template-generated TR
- !!options
- parsoid
- !! wikitext
- {|
- |-
- {{echo|<tr><td>foo</td></tr>}}
- |}
- !! html
- <table>
- <tbody>
- <tr class='mw-empty-elt'></tr>
- <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}}]}'>
- <td>foo</td></tr>
- </tbody></table>
- !!end
- ## PHP and parsoid output differ for this, and since this is primarily
- ## for testing Parsoid's serializer, marking this Parsoid only
- !!test
- Empty TR followed by mixed-ws-comment line should RT correctly
- !!options
- parsoid
- !! wikitext
- {|
- |-
- <!--c-->
- |-
- <!--c--> <!--d-->
- |}
- !! html
- <table>
- <tbody>
- <tr class='mw-empty-elt'></tr>
- <!--c-->
- <tr>
- <!--c--> </tr><!--d-->
- </tbody></table>
- !!end
- !!test
- Multi-line image caption generated by templates with/without trailing newlines
- !! wikitext
- [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}]]
- [[File:Foobar.jpg|thumb|300x300px|foo\n{{echo|A}}\n{{echo|B}}\n{{echo|C}}\n\n]]
- !! html/parsoid
- <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>
- <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>
- !!end
- !! test
- New element inserted (without intervening newlines) after an old sol-transparent node should serialize correctly
- !! options
- parsoid=html2wt
- !! html/parsoid
- <meta typeof="mw:Includes/IncludeOnly" data-parsoid='{"src":"<includeonly>foo</includeonly>"}'/><meta typeof="mw:Includes/IncludeOnly/End" data-parsoid='{"src":""}'/><p>new para</p>
- <link rel="mw:PageProp/Category" href="./Category:Foo" data-parsoid='{}'/><h1>new heading</h1>
- !! wikitext
- <includeonly>foo</includeonly>
- new para
- [[Category:Foo]]
- = new heading =
- !! end
- ## PHP emits broken html for this, and since this is primarily
- ## a Parsoid serializer test, marking this Parsoid only
- !!test
- Improperly nested inline or quotes tags with whitespace in between
- !! wikitext
- <span> <s>x</span> </s>
- ''' ''x''' ''
- !! html/parsoid
- <p><span> <s>x</s></span><s> </s>
- <b> <i>x</i></b><i> </i>
- </p>
- !!end
- !!test
- Encapsulate protected attributes from wt
- !! wikitext
- <div typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true">foo</div>
- {| typeof="mw:placeholder stuff" data-mw="whoo" data-parsoid="weird" data-parsoid-other="no" about="time" rel="mw:true"
- | ok
- |}
- !! html/parsoid
- <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>
- <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">
- <tbody><tr><td data-parsoid='{"autoInsertedEnd":true}'> ok</td></tr>
- </tbody></table>
- !!end
- ## Currently the p-wrapper is fragile in how it adds / removes transformations.
- ## Having nested or stray pre tags results in the attempt to add duplicates,
- ## causing an assertion fail. This test tries to prevent that situation.
- !!test
- Ensure ParagraphWrapper can deal with stray closing pre tags
- !!options
- parsoid=wt2html
- !! wikitext
- plain text</pre>
- !! html/parsoid
- plain text
- !!end
- !!test
- 1. Ensure fostered text content is wrapped in element nodes
- !!options
- parsoid=wt2html
- !! wikitext
- <table>hi</table><table>ho</table>
- !! html/parsoid
- <p>hi</p>
- <table></table>
- <p>ho</p>
- <table></table>
- !!end
- !!test
- 2. Ensure fostered text content is wrapped in element nodes (traps regressions around fostered marker on the element getting lost)
- !!options
- parsoid=wt2html,wt2wt
- !! wikitext
- <table>
- <tr> || ||
- <td> a
- </table>
- !! html/parsoid
- <p> || ||
- </p><table>
- <tbody><tr><td> a</td></tr>
- </tbody></table>
- !!end
- !!test
- Encapsulation properly handles null DSR information from foster box
- !!options
- parsoid=wt2html,wt2wt
- !! wikitext
- {{echo|<table>foo<tr><td>bar</td></tr></table>}}
- !! html/parsoid
- <span typeof="mw:Transclusion" data-mw="{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<table>foo<tr><td>bar</td></tr></table>"}},"i":0}}]}">foo</span><table><tbody><tr><td>bar</td></tr></tbody></table>
- !!end
- !!test
- 1. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table>{{echo|foo<tr><td>bar</td></tr>}}</table>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw="{"parts":["<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo<tr><td>bar</td></tr>"}},"i":0}},"</table>"]}">foo</p><table>
- <tbody>
- <tr>
- <td>bar</td>
- </tr>
- </tbody>
- </table>
- !!end
- !!test
- 2. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table><div>{{echo|foo}}</div><tr><td>bar</td></tr></table>
- !! html/parsoid
- <div typeof="mw:Transclusion" data-mw="{"parts":["<table><div>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo"}},"i":0}},"</div><tr><td>bar</td></tr></table>"]}">foo</div>
- <table>
- <tbody>
- <tr>
- <td>bar</td>
- </tr>
- </tbody>
- </table>
- !!end
- !!test
- 3. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
- !! html/parsoid
- <div typeof="mw:Transclusion" data-mw="{"parts":["<table><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div><tr><td>"}},"i":0}},"bar</td></tr></table>"]}">
- <p>foo</p>
- </div>
- <table>
- <tbody>
- <tr>
- <td>bar</td>
- </tr>
- </tbody>
- </table>
- !!end
- !!test
- 4. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table><div><p>{{echo|foo</p></div><tr><td>}}bar</td></tr></table>
- !! html/parsoid
- <div typeof="mw:Transclusion" data-mw="{"parts":["<table><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div><tr><td>"}},"i":0}},"bar</td></tr></table>"]}">
- <p>foo</p>
- </div>
- <table>
- <tbody>
- <tr>
- <td>bar</td>
- </tr>
- </tbody>
- </table>
- !!end
- !!test
- 5. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table><tr><td><div><p>{{echo|foo</p></div></td>foo}}</tr></table>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw="{"parts":["<table><tr><td><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div></td>foo"}},"i":0}},"</tr></table>"]}">foo</p>
- <table>
- <tbody>
- <tr>
- <td>
- <div>
- <p>foo</p>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- !!end
- !!test
- 6. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table><tr><td><div><p>{{echo|foo</p></div></td>foo</tr></table>}}<p>ok</p>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw="{"parts":["<table><tr><td><div><p>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"foo</p></div></td>foo</tr></table>"}},"i":0}}]}">foo</p>
- <table>
- <tbody>
- <tr>
- <td>
- <div>
- <p>foo</p>
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- <p>ok</p>
- !!end
- !!test
- 7. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table>{{echo|<p>foo</p>}}<td>bar</td></table>
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw="{"parts":["<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<p>foo</p>"}},"i":0}},"<td>bar</td></table>"]}">foo</p>
- <table>
- <tbody>
- <tr>
- <td>bar</td>
- </tr>
- </tbody>
- </table>
- !!end
- # Note that the wt is broken on purpose: the = should be {{=}} if you
- # don't want it to be a template parameter key.
- !!test
- 8. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- {{echo|a
- }}{|{{echo|style='color:red'}}
- |-
- |b
- |}
- !! html/parsoid
- <p typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"a\n"}},"i":0}}]}'>a</p>
- <span> </span>
- <p typeof="mw:Transclusion" data-mw='{"parts":["{|",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"style":{"wt":"'color:red'"}},"i":0}},"\n|-\n|b\n|}"]}'>{{{1}}}</p>
- <table>
- <tbody>
- <tr>
- <td>b</td>
- </tr>
- </tbody>
- </table>
- !!end
- !!test
- 9. Encapsulate foster-parented transclusion content
- !!options
- parsoid=wt2wt,wt2html
- !! wikitext
- <table>{{echo|hi</table>hello}}
- !! html/parsoid
- <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":["<table>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"hi</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>
- !!end
- !!test
- Table in fosterable position
- !!options
- parsoid=wt2html
- !! wikitext
- {{OpenTable}}
- <div>
- {|
- |}
- </div>
- |}
- !! html/parsoid
- <div about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"OpenTable","href":"./Template:OpenTable"},"params":{},"i":0}},"\n<div>\n"]}' data-parsoid='{"stx":"html","autoInsertedEnd":true,"pi":[[]]}'></div><span about="#mwt1">
- </span>
- <table about="#mwt1" data-parsoid='{"autoInsertedEnd":true}'></table>
- <table>
- </table>
- !!end
- # Parsoid only for T66747
- !! test
- Properly encapsulate empty-content transclusions in fosterable positions
- !! wikitext
- <table>
- {{#if:|
- <td>foo</td>
- }}
- </table>
- !! html/parsoid
- <table about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":["<table>\n",{"template":{"target":{"wt":"#if:","function":"if"},"params":{"1":{"wt":"\n<td>foo</td>\n"}},"i":0}},"\n</table>"]}' data-parsoid='{"stx":"html","pi":[[{"k":"1"}]]}'>
- </table>
- !! end
- !! test
- Always encapsulate foster box when template range is expanded to table
- !! options
- parsoid=wt2wt
- !! wikitext
- {|
- hello
- {{OpenTable}}
- |}
- !! html/parsoid
- !! end
- !! test
- T115289: Unclosed table
- !! wikitext
- {{echo|<table>}}<!--c-->[[Category:Two]]
- !! html/parsoid
- <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":"<table>"}},"i":0}},"<!--c-->[[Category:Two]]"]}'/><table about="#mwt1" data-parsoid='{"stx":"html","autoInsertedEnd":true}'><!--c--></table>
- !! end
- !! test
- T115289: Don't migrate newlines out of tables with fostered content
- !! wikitext
- <table><td></td>{{echo|<tr>[[Category:One]]}}<!--c-->[[Category:Two]]
- !! html/parsoid
- <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":["<table><td></td>",{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<tr>[[Category:One]]"}},"i":0}},"<!--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>
- !! end
- !! test
- T73074: More fostering fun
- !! wikitext
- <table><td></td>{{echo|<tr>}}<!--c-->[[Category:Two]]
- !! html/parsoid
- <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":"<tr>"}},"i":0}},"<!--c-->[[Category:Two]]"]}'><!--c--></tr></tbody></table>
- !! end
- !!test
- Support <object> element with .data attribute
- !!options
- parsoid=html2wt
- !! html/parsoid
- <object data="test.swf"></object>
- !! wikitext
- <object data="test.swf"></object>
- !!end
- !! test
- Don't block XML namespace declaration
- !! wikitext
- <span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
- !! html/php
- <p><span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">MediaWiki</span>
- </p>
- !! html/parsoid
- <p><span xmlns:dct="http://purl.org/dc/terms/" data-x-property="dct:title" data-parsoid='{"stx":"html"}'>MediaWiki</span></p>
- !! end
- # -----------------------------------------------------------------
- # The following section of tests are primarily to spec requirements
- # around Parsoid's serialization (old, new, edited content)
- #
- # All these tests are marked Parsoid html2wt and html2html only
- # ----------------------------------------------------------------
- !! test
- Ignore rel attribute in a-tags during serialization to url-links
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a href='http://en.wikipedia.org/wiki/Foobar'>http://en.wikipedia.org/wiki/Foobar</a>
- <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:ExtLink'>http://en.wikipedia.org/wiki/Foobar</a>
- <a href='http://en.wikipedia.org/wiki/Foobar' rel='mw:WikiLink'>http://en.wikipedia.org/wiki/Foobar</a>
- !! wikitext
- http://en.wikipedia.org/wiki/Foobar
- http://en.wikipedia.org/wiki/Foobar
- http://en.wikipedia.org/wiki/Foobar
- !! end
- # 'mi' is a localinterwiki prefix as well as a language
- !! test
- Serialize interwiki links pointing to the current wiki as plain wiki links (T67869)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel="mw:ExtLink" href="http://mi.wikipedia.org/wiki/Foo">Foo</a></p>
- !! wikitext
- [[Foo]]
- !! end
- !! test
- Parsoid should accept interwiki shortcuts
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel='mw:WikiLink' href='./fr:Foo'>Foo</a>
- <a rel='mw:ExtLink' href='./fr:Foo'>Foo</a>
- <a href='./fr:Foo'>Foo</a></p>
- <p><a rel='mw:WikiLink' href='fr%3AFoo'>Foo</a>
- <a rel='mw:ExtLink' href='fr%3AFoo'>Foo</a>
- <a href='fr%3AFoo'>Foo</a></p>
- <p><a href='FR%3AFoo'>Foo</a>
- <a href='./FR:Foo'>Foo</a></p>
- !! wikitext
- [[:fr:Foo|Foo]]
- [[:fr:Foo|Foo]]
- [[:fr:Foo|Foo]]
- [[:fr:Foo|Foo]]
- [[:fr:Foo|Foo]]
- [[:fr:Foo|Foo]]
- [[:fr:Foo|Foo]]
- [[:fr:Foo|Foo]]
- !! end
- !! test
- Parsoid should not accept invalid interwiki shortcuts
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel='mw:WikiLink' href='news:Foo'>Foo</a>
- <a rel='mw:ExtLink' href='news:Foo'>Foo</a>
- <a href='news:Foo'>Foo</a></p>
- !! wikitext
- [news:Foo Foo]
- [news:Foo Foo]
- [news:Foo Foo]
- !! end
- # See T93839
- !! test
- New wikilinks should be serialized properly
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{}'>Foo</a>
- <a rel="mw:WikiLink" href="./Foo" title="Foo">Foo</a>
- <a href="//en.wikipedia.org/wiki/Foo">//en.wikipedia.org/wiki/Foo</a>
- <a href="http://en.wikipedia.org/wiki/Foo">http://en.wikipedia.org/wiki/Foo</a>
- <a href="//en.wikipedia.org/wiki/Foo_bar">//en.wikipedia.org/wiki/Foo bar</a>
- !! wikitext
- [[Foo]]
- [[Foo]]
- [[:en:Foo|//en.wikipedia.org/wiki/Foo]]
- http://en.wikipedia.org/wiki/Foo
- [[:en:Foo_bar|//en.wikipedia.org/wiki/Foo bar]]
- !! end
- !! test
- New wiki links (href variations)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
- <a rel="mw:WikiLink" href="Foo_bar">Foo_bar</a>
- <a rel="mw:WikiLink" href="Foo bar">Foo_bar</a>
- <a rel="mw:WikiLink" href="./Toxine_bact%C3%A9rienne">Toxine bactérienne</a>
- !! wikitext
- [[Foo_bar]]
- [[Foo_bar]]
- [[Foo_bar]]
- [[Toxine bactérienne]]
- !! end
- !! test
- New wiki links (content string variations)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Foo_bar">Foo_bar</a>
- <a rel="mw:WikiLink" href="./Foo_bar">Foo bar</a>
- <a rel="mw:WikiLink" href="./Foo_bar">./Foo_bar</a>
- !! wikitext
- [[Foo_bar]]
- [[Foo bar]]
- [[Foo_bar|./Foo_bar]]
- !! end
- !! test
- New category links (href variations)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <link rel="mw:PageProp/Category" href="./Category:Toxine_bactérienne" />
- <link rel="mw:PageProp/Category" href="./Category:Toxine_bact%C3%A9rienne" />
- <link rel="mw:PageProp/Category" href="Category:Toxine_bact%C3%A9rienne" />
- !! wikitext
- [[Category:Toxine bactérienne]]
- [[Category:Toxine bactérienne]]
- [[Category:Toxine bactérienne]]
- !! end
- !! test
- New sol transparent links don't need indent-pre nowiki protection
- !! options
- parsoid=html2wt
- language=de
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="./Main_Page">
- <!-- this is good --> <link rel="mw:PageProp/Category" href="./Category:Good" />
- <!-- this is great --> <link rel="mw:PageProp/Category" href="./Kategorie:Great" />
- !! wikitext
- #WEITERLEITUNG [[Main Page]]
- <!-- this is good --> [[Category:Good]]
- <!-- this is great --> [[Kategorie:Great]]
- !! end
- !! test
- New interlanguage links (href variations)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine bactérienne" />
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bactérienne" />
- <link rel="mw:PageProp/Language" href="http://es.wikipedia.org/wiki/Toxine_bact%C3%A9rienne" />
- !! wikitext
- [[es:Toxine bactérienne]]
- [[es:Toxine_bactérienne]]
- [[es:Toxine_bactérienne]]
- !! end
- !! test
- Image: Modifying size of an image (1)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["img[height]", "attr", "height", "22"],
- ["img[width]", "attr", "width", "200"]
- ]
- }
- !! wikitext
- [[Image:Foobar.jpg|230x230px]]
- !! wikitext/edited
- [[Image:Foobar.jpg|200x200px]]
- !!end
- !! test
- Image: Modifying size of an image (2)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["img[height]", "attr", "height", "100"],
- ["img[width]", "attr", "width", "500"]
- ]
- }
- !! wikitext
- [[Image:Foobar.jpg|230x230px]]
- !! wikitext/edited
- [[Image:Foobar.jpg|500x500px]]
- !!end
- # Change in size is ignored so long as class='mw-default-size'
- !! test
- Image: Modifying size of an image (3)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["figure[class]", "removeClass", "mw-default-size"],
- ["figure img", "attr", "height", "19"],
- ["figure img", "attr", "width", "170"]
- ]
- }
- !! wikitext
- [[Image:Foobar.jpg|thumb]]
- !! wikitext/edited
- [[Image:Foobar.jpg|thumb|170x170px]]
- !!end
- !! test
- Image: Modifying alignment of an image (T50665)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["figure[class]", "removeClass", "mw-halign-right"],
- ["figure[class]", "addClass", "mw-halign-left"]
- ]
- }
- !! wikitext
- [[Image:Foobar.jpg|thumb|caption|right]]
- !! wikitext/edited
- [[Image:Foobar.jpg|thumb|caption|left]]
- !! end
- !! test
- Image: Modifying mw-default-size of an frameless image (T64805)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["figure.mw-default-size", "removeClass", "mw-default-size"]
- ]
- }
- !! wikitext
- [[Image:Foobar.jpg|frameless|right]]
- !! wikitext/edited
- [[Image:Foobar.jpg|frameless|right|220x220px]]
- !! end
- !! test
- Image: Modifying valign of an image (T51221)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["*[typeof=\"mw:Image\"]", "removeClass", "mw-valign-middle"],
- ["*[typeof=\"mw:Image\"]", "addClass", "mw-valign-text-top"]
- ]
- }
- !! wikitext
- [[File:Foobar.jpg|20px|middle]]
- !! wikitext/edited
- [[File:Foobar.jpg|20px|text-top]]
- !! end
- !! test
- Image: Modifying alt attribute of an image (T58400)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["img[alt]", "attr", "alt", "some alternate edited text"]
- ]
- }
- !! wikitext
- [[File:Foobar.jpg|thumb|some caption|alt=some alternate text]]
- !! wikitext/edited
- [[File:Foobar.jpg|thumb|some caption|alt=some alternate edited text]]
- !!end
- !! test
- Image: Modifying caption of an image
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- ["figcaption", "text", "new caption"]
- ]
- }
- !! wikitext
- [[Image:Foobar.jpg|thumb|original caption]]
- !! wikitext/edited
- [[Image:Foobar.jpg|thumb|new caption]]
- !!end
- !! test
- Image: empty alt attribute (T50924)
- !! options
- parsoid
- !! wikitext
- [[File:Foobar.jpg|thumb|alt=|bar]]
- !! html
- <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>
- !! end
- !! test
- Image: new attributes should be serialized in wiki's language for RTL languages (T53852)
- !! options
- parsoid=html2wt
- language=ar
- disabled
- !! html/parsoid
- <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>
- !! wikitext
- [[Imagen:Foobar.jpg|derecha|miniaturadeimagen]]
- !! end
- !! test
- Image: Block level image should have \n before and after
- !! wikitext
- 123
- [[File:Foobar.jpg|right|thumb|150x150px]]
- 456
- !! html/parsoid
- <p>123</p>
- <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>
- <p>456</p>
- !! end
- !! test
- Image: New block level image should have \n before and after (existing content)
- !! wikitext
- 123
- [[File:Foobar.jpg|right|thumb|150x150px]]
- 456
- !! html/parsoid
- <p>123</p>
- <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>
- <p>456</p>
- !! end
- !! test
- Image: upright option (parsoid)
- !! wikitext
- [[File:Foobar.jpg|thumb|upright|caption]]
- [[File:Foobar.jpg|thumb|upright=0.5|caption]]
- [[File:Foobar.jpg|thumb|500x500px|upright=0.5|caption]]
- !! html/parsoid
- <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>
- <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>
- <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>
- !! end
- !! test
- Image: upright option is ignored on inline and frame images (parsoid)
- !! wikitext
- [[File:Foobar.jpg|500x500px|upright=0.5|caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Image: in template parameter with empty parameter
- !! wikitext
- {{echo|[[File:Foobar.jpg|link=]]}}
- !! html/parsoid
- <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>
- !! end
- !! test
- Image: from basic HTML (1)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <span typeof="mw:Image">
- <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
- </span>
- !! wikitext
- [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
- !! end
- !! test
- Image: from basic HTML (2)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <img src="./File:Foobar.jpg" width=100 height=100 alt="Alt">
- !! wikitext
- [[File:Foobar.jpg|link=|alt=Alt|100x100px]]
- !! end
- !! test
- Image: from basic HTML (3)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a href="Main"><img src="./File:Foobar.jpg" width=100 height=100 alt="Alt"></a>
- !! wikitext
- [[File:Foobar.jpg|link=Main|alt=Alt|100x100px]]
- !! end
- !! test
- Image: from basic HTML (4)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <img src="./File:Foobar.jpg">
- !! wikitext
- [[File:Foobar.jpg|link=]]
- !! end
- !! test
- Image: Invalid title as link
- !! wikitext
- [[File:Foobar.jpg|link=<]]
- !! html/php
- <p><a href="/wiki/File:Foobar.jpg" class="image" title="link=<"><img alt="link=<" src="http://example.com/images/3/3a/Foobar.jpg" width="1941" height="220" /></a>
- </p>
- !! html/parsoid
- <p><figure-inline class="mw-default-size" typeof="mw:Image" data-parsoid='{"optList":[{"ck":"link","ak":"link=<"}]}' data-mw='{"caption":"link=&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>
- !! end
- !! test
- Lists: Serialize correctly even when list content is wrapped in p-tags (like VE does)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul>
- <li><p>foo</p></li>
- </ul>
- !! wikitext
- * foo
- !! end
- !! test
- Lists: Serialize correctly even when list tags has unneeded whitespace between tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul> <li>foo</li></ul>
- !! wikitext
- * foo
- !! end
- !! test
- Don't strip leading whitespace when handling indent-pre suppressing tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table>
- <tr><td> indented row</td></tr>
- </table>
- <blockquote><p>
- <b>This is very bold of you!</b>
- </p>
- <table><tr><td>
- indented cell (no pre-wrapping!)
- </td></tr></table>
- </blockquote>
- <p>foo</p>
- <div>bar</div>
- !! wikitext
- {|
- | indented row
- |}
- <blockquote>
- '''This is very bold of you!'''
- {|
- |
- indented cell (no pre-wrapping!)
- |}
- </blockquote>
- foo
- <div>bar</div>
- !! end
- !! test
- Nowiki-wrap leading whitespace when handling indent-pre inducing tags
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>foo</p>
- <span>bar</span>
- <span>foo2
- </span>bar2
- <div>foo</div>
- <span>bar</span>
- <div>
- <span>foo</span>
- </div>
- !! wikitext
- foo
-
- <span>bar</span>
- <span>foo2
- <nowiki> </nowiki></span>bar2
- <div>foo</div>
- <nowiki> </nowiki><span>bar</span>
- <div>
- <nowiki> </nowiki><span>foo</span>
- </div>
- !! end
- !! test
- Lists: Dont insert newlines in a serialized list item.
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul><li>a<br>b</li><li>c</li></ul>
- !! wikitext
- * a<br />b
- * c
- !! end
- !! test
- 1. Headings: Force sol-transparent links and behavior switches to serialize before/after
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": false
- }
- !! html/parsoid
- <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
- <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
- <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
- <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
- <h2 data-parsoid='{}'>howdy<link href="./Category:A5" rel="mw:PageProp/Category" /></h2>
- <h2><meta property="mw:PageProp/toc" /> ok</h2>
- !! wikitext
- == hello there [[Category:A1]] ==
- == [[Category:A2]] hi pal ==
- == <!--foo--> [[Category:A3]] how goes it ==
- == it goes well [[Category:A4]] <!--bar--> ==
- ==howdy [[Category:A5]]==
- == __TOC__ ok ==
- !! end
- !! test
- 2. Headings: Force sol-transparent links and behavior switches to serialize before/after
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <h2>hello there<link href="./Category:A1" rel="mw:PageProp/Category" /></h2>
- <h2><link href="./Category:A2" rel="mw:PageProp/Category" />hi pal</h2>
- <h2><!--foo--> <link href="./Category:A3" rel="mw:PageProp/Category" /> how goes it</h2>
- <h2>it goes well <link href="./Category:A4" rel="mw:PageProp/Category" /> <!--bar--></h2>
- <h2><meta property="mw:PageProp/toc" /> ok</h2>
- !! wikitext
- == hello there ==
- [[Category:A1]]
- [[Category:A2]]
- == hi pal ==
- <!--foo--> [[Category:A3]]
- == how goes it ==
- == it goes well ==
- [[Category:A4]] <!--bar-->
- __TOC__
- == ok ==
- !! end
- !! test
- Headings: Don't hoist metas that come from templates
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <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>
- !! wikitext
- == {{echo|foo [[Category:Foo]]}} ==
- !! end
- !! test
- Headings: Category in ref isn't hoisted
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <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>
- <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>
- !! wikitext
- == foo <ref>bar
- [[Category:Baz]] </ref> ==
- <references />
- !! end
- !! test
- Parsoid: Serialize positional parameters with = in them as named parameter
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p about="#mwt1" typeof="mw:Transclusion"
- data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"f=oo"}},"i":0}}]}'>foo</p>
- <p 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>
- <!--Orig params with data-parsoid has heuristics for handling = chars-->
- <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
- <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>
- !! wikitext
- {{echo|1=f=oo}}
- {{echo|1=f=oo|2=bar}}
- <!--Orig params with data-parsoid has heuristics for handling = chars-->
- <!--FIXME: But maybe the heuristic needs fixing to apply to new params as well-->
- {{echo|<nowiki>f=oo</nowiki>|bar}}
- !! end
- !! test
- Parsoid: Serialize positional parameters with = in extlink as named parameter
- !! options
- parsoid=html2wt
- !! html/parsoid
- <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>
- !! wikitext
- {{echo|1=http://stuff?is=ok}}
- !! end
- !! test
- Parsoid: Correctly serialize block-node children when they are a combination of text and p-nodes
- !! options
- parsoid=html2wt
- !! html/parsoid
- <div>a<p>b</p></div>
- <div>a
- <p>b</p></div>
- <div>
- a
- <p>b</p></div>
- !! wikitext
- <div>a
- b
- </div>
- <div>a
- b
- </div>
- <div>
- a
- b
- </div>
- !! end
- !! test
- Substrings resembling wikitext in hrefs should not get nowiki escapes
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Foo''bar''baz">Foo''bar''baz</a>
- !! wikitext
- [[Foo''bar''baz]]
- !! end
- !! test
- Enforce single-line context in the serializer
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h2>testing
- 123</h2>
- <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">
- </span><span about="#mwt1">you</span> </h2>
- <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>
- <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
- there</span></li></ol>
- <ul><li>asd
- sdf</li></ul>
- <ul><li>foo
- bar
- baz</li>
- <li>foo <b>bar</b>
- baz</li></ul>
- <dl><dt>hi
- ho </dt><dd data-parsoid='{"stx":"row"}'> hi
- ho</dd></dl>
- <dl><dd> <table>
- <tbody><tr><td> ha
- ha
- ha</td></tr>
- </tbody></table></dd></dl>
- !! wikitext
- == testing 123 ==
- == hi {{bogus|there
- you}} ==
- == foo <ref>hello
- there</ref> ==
- <references />
- * asd sdf
- * foo bar baz
- * foo '''bar''' baz
- ; hi ho : hi ho
- : {|
- | ha
- ha
- ha
- |}
- !! end
- !! test
- Serialize new placeholder space without spans
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>foo<span typeof="mw:Placeholder"> </span>: bar</p>
- <p>foo<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: bar</p>
- <span typeof="mw:Extension/ref" data-mw="{"name":"ref","body":{"html":"foo<span typeof=\"mw:Placeholder\">&nbsp;</span>: bar"}}"><sup>[1]</sup></span>ok</p>
- !! wikitext
- foo : bar
- foo : bar
- <ref>foo : bar</ref>ok
- !! end
- #-----------------------
- # Tag minimization tests
- #-----------------------
- !! test
- 1. I/B quote minimization: wikitext-only tags should be combined
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><i>A</i><i>B</i></p>
- <p><b>A</b><b>B</b></p>
- <p><i>A</i><b><i>B</i></b></p>
- <p><b>A</b><i><b>B</b></i></p>
- <p><b>A</b><i><b>B</b><b>C</b></i><b>D</b></p>
- <p><i><b>A</b></i><i><b>B</b></i></p>
- <p><i><b>A</b></i><b><i>B</i></b></p>
- <p><b><i>A</i></b><i><b>B</b></i></p>
- !! wikitext
- ''AB''
- '''AB'''
- ''A'''B'''''
- '''A''B'''''
- '''A''BC''D'''
- '''''AB'''''
- '''''AB'''''
- '''''AB'''''
- !! end
- !! test
- 2. I/B quote minimization: wikitext and html tags should not be combined
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><i>A</i><i data-parsoid='{"stx":"html"}'>B</i></p>
- <p><i>A</i><b><i data-parsoid='{"stx":"html"}'>B</i></b></p>
- !! wikitext
- ''A''<i>B</i>
- ''A''<nowiki/>'''<i>B</i>'''
- !! end
- !! test
- 3. I/B quote minimization: templated content stops minimization
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><i>A</i><i about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"''B''"}},"i":0}}]}'>B</i>
- <p><i>A</i><b about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"'''''B'''''"}},"i":0}}]}'><i>B</i></b>
- !! wikitext
- ''A''{{echo|''B''}}
- ''A''{{echo|'''''B'''''}}
- !! end
- !! test
- 4. I/B quote minimization: new content should be mimimized with adjacent old content
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><i>A</i><i>B</i></p>
- <p><b>A</b><b>B</b></p>
- <p><i>A</i><b><i>B</i></b></p>
- !! wikitext
- ''AB''
- '''AB'''
- ''A'''B'''''
- !! end
- !! test
- 5a. Merge adjacent quote nodes if they've been edited
- !! options
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- ["p", "contents", "remove", ":contains('b')"]
- ]
- }
- !! wikitext
- ''a''b''c''
- !! wikitext/edited
- ''ac''
- !! end
- !! test
- 5b. Merge adjacent quote nodes if they've been edited
- !! options
- parsoid={
- "modes": ["wt2wt", "selser"],
- "changes": [
- ["#x", "remove"]
- ]
- }
- !! wikitext
- ''a''<span id="x">b</span>''c''
- !! wikitext/edited
- ''ac''
- !! end
- !! test
- 1. Merge adjacent link nodes as long as at least one element is new
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
- <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
- <a data-parsoid="{}" rel="mw:WikiLink" href="./Football">Foot</a><a data-parsoid="{}" rel="mw:WikiLink" href="./Football">ball</a>
- !! wikitext
- [[Football]]
- [[Football]]
- [[Football|Foot]][[Football|ball]]
- !! end
- !! test
- 2. Merge adjacent link nodes and enable additional normalizations
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Football"><i>Foot</i></a><a rel="mw:WikiLink" href="./Football"><i>ball</i></a>
- !! wikitext
- [[Football|''Football'']]
- !! end
- !! test
- 3. Don't merge adjacent link nodes if scrubWikitext is false
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": false
- }
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Football">Foot</a><a rel="mw:WikiLink" href="./Football">ball</a>
- !! wikitext
- [[Football|Foot]][[Football|ball]]
- !! end
- #------------------------------
- # End of tag minimization tests
- #------------------------------
- !!test
- T56262: New entities
- !! options
- parsoid=html2wt
- !! html/parsoid
- <span typeof="mw:Entity"> </span>
- !! wikitext
-
- !! end
- ## Note that there is no wikitext output for 'unknownproperty' ##
- ## Unknown magic words are silently dropped ##
- !! test
- Magic words
- !! options
- parsoid=html2wt
- !! html/parsoid
- <meta property='mw:PageProp/toc' />
- <meta property='mw:PageProp/notoc' />
- <meta property='mw:PageProp/forcetoc' />
- <meta property='mw:PageProp/index' />
- <meta property='mw:PageProp/noindex' />
- <meta property='mw:PageProp/nogallery' />
- <meta property='mw:PageProp/noeditsection' />
- <meta property='mw:PageProp/notitleconvert' />
- <meta property='mw:PageProp/nocontentconvert' />
- <meta property='mw:PageProp/unknownproperty' />
- !! wikitext
- __TOC__
- __NOTOC__
- __FORCETOC__
- __INDEX__
- __NOINDEX__
- __NOGALLERY__
- __NOEDITSECTION__
- __NOTITLECONVERT__
- __NOCONTENTCONVERT__
- !! end
- !! test
- Consecutive <pre>s should not get merged
- !! options
- parsoid=html2wt,html2html
- !! html/parsoid
- <pre>a</pre><pre>b</pre>
- <pre>c
- </pre><pre>
- d</pre>
- <pre>e
- </pre><pre>
- f</pre>
- !! wikitext
- a
- b
- c
- d
- e
-
-
- f
- !! end
- !! test
- Edited ISBN links not serializable as ISBN links should serialize as wikilinks
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a href="./Special:BookSources/1234567890" rel="mw:ExtLink">ISBN 1234567895</a>
- !! wikitext
- [[Special:BookSources/1234567890|ISBN 1234567895]]
- !! end
- !! test
- Edited RFC links not serializable as RFC links should serialize as extlinks
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a href="https://tools.ietf.org/html/rfc123" rel="mw:ExtLink">New RFC</a>
- !! wikitext
- [https://tools.ietf.org/html/rfc123 New RFC]
- !! end
- !! test
- Edited PMID links not serializable as PMID links should serialize as extlinks
- !! options
- parsoid=html2wt
- !! html/parsoid
- <a href="//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract" rel="mw:ExtLink">New PMID</a>
- !! wikitext
- [//www.ncbi.nlm.nih.gov/pubmed/123?dopt=Abstract New PMID]
- !! end
- !! test
- WTS of autolinks with trailing/surrounding context
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a href="http://cscott.net">http://cscott.net</a><b>foo</b></p>
- <p><a href="http://cscott.net">http://cscott.net</a><b data-parsoid='{"stx":"html"}'>foo</b></p>
- <p><b><a href="http://cscott.net">http://cscott.net</a></b></p>
- <p><b><a href="http://cscott.net">http://cscott.net</a> </b></p>
- <p><b><a href="http://cscott.net">http://cscott.net</a>x</b></p>
- <p><a href="http://cscott.net">http://cscott.net</a>x</p>
- !! wikitext
- http://cscott.net'''foo'''
- http://cscott.net<b>foo</b>
- '''http://cscott.net'''
- '''http://cscott.net '''
- '''http://cscott.net<nowiki/>x'''
- http://cscott.net<nowiki/>x
- !! end
- !! test
- WTS of autolinks with nowikis (round-trip)
- !! wikitext
- x<nowiki/>http://cscott.net<nowiki/>x
- !! html/parsoid
- <p>x<a rel="mw:ExtLink" class="external free" href="http://cscott.net">http://cscott.net</a>x</p>
- !! end
- # this is the "easy" test because it leaves in place all the
- # data-parsoid information indicating this is an autolink
- !! test
- WTS of autolinks with escapes (editing)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- [ "span", "remove" ]
- ]
- }
- !! wikitext
- x<nowiki/>http://cscott.net<nowiki/>x
- !! wikitext/edited
- x<nowiki/>http://cscott.net<nowiki/>x
- !! end
- !! test
- WTS of edited autolink-like text (T103364)
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- [ "span[typeof]", "removeAttr", "typeof" ]
- ]
- }
- !! wikitext
- Not a link: <nowiki>http://example.com</nowiki>.
- !! wikitext/edited
- Not a link: <span><nowiki>http://example.com</nowiki></span>.
- !! end
- !! test
- WTS of newly-authored autolink-like text (T103364)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>http://example.com is not a link.</p>
- !! wikitext
- <nowiki>http://example.com</nowiki> is not a link.
- !! end
- !! test
- WTS of autolink-like text after an autolink (T108563)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p><a rel="mw:ExtLink" href="http://example.com">http://example.com</a> http://example.com is not a link.</p>
- !! wikitext
- http://example.com <nowiki>http://example.com</nowiki> is not a link.
- !! end
- !! test
- Magic links inside links (not autolinked)
- !! wikitext
- [[Foo|http://example.com]]
- [[Foo|RFC 1234]]
- [[Foo|PMID 1234]]
- [[Foo|ISBN 123456789x]]
- [http://foo.com http://example.com]
- [http://foo.com RFC 1234]
- [http://foo.com PMID 1234]
- [http://foo.com ISBN 123456789x]
- !! html+tidy
- <p><a href="/wiki/Foo" title="Foo">http://example.com</a>
- <a href="/wiki/Foo" title="Foo">RFC 1234</a>
- <a href="/wiki/Foo" title="Foo">PMID 1234</a>
- <a href="/wiki/Foo" title="Foo">ISBN 123456789x</a>
- </p><p><a rel="nofollow" class="external text" href="http://foo.com">http://example.com</a>
- <a rel="nofollow" class="external text" href="http://foo.com">RFC 1234</a>
- <a rel="nofollow" class="external text" href="http://foo.com">PMID 1234</a>
- <a rel="nofollow" class="external text" href="http://foo.com">ISBN 123456789x</a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo">http://example.com</a>
- <a rel="mw:WikiLink" href="./Foo" title="Foo">RFC 1234</a>
- <a rel="mw:WikiLink" href="./Foo" title="Foo">PMID 1234</a>
- <a rel="mw:WikiLink" href="./Foo" title="Foo">ISBN 123456789x</a></p>
- <p><a rel="mw:ExtLink" class="external text" href="http://foo.com">http://example.com</a>
- <a rel="mw:ExtLink" class="external text" href="http://foo.com">RFC 1234</a>
- <a rel="mw:ExtLink" class="external text" href="http://foo.com">PMID 1234</a>
- <a rel="mw:ExtLink" class="external text" href="http://foo.com">ISBN 123456789x</a></p>
- !! end
- !! test
- Magic links inside image captions (autolinked)
- !! wikitext
- [[File:Foobar.jpg|thumb|http://example.com]]
- [[File:Foobar.jpg|thumb|RFC 1234]]
- [[File:Foobar.jpg|thumb|PMID 1234]]
- [[File:Foobar.jpg|thumb|ISBN 123456789x]]
- !! html+tidy
- <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>
- <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>
- <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>
- <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>
- !! html/parsoid
- <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>
- <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>
- <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>
- <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>
- !! end
- !! test
- WTS of magic word text (T109371)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>RFC 1234</p>
- <p><a href="http://foo.com" rel="mw:ExtLink">RFC 1234</a></p>
- <p><a href="./Foo" rel="mw:WikiLink">RFC 1234</a></p>
- !! wikitext
- <nowiki>RFC 1234</nowiki>
- [http://foo.com RFC 1234]
- [[Foo|RFC 1234]]
- !! end
- !! test
- Edited Redirect link should emit a non-piped wikitext link
- !! options
- parsoid=html2wt
- !! html/parsoid
- <link rel="mw:PageProp/redirect" href="Bar" data-parsoid='{"a":{"href":"./Foo"},"sa":{"href":"Foo"}}'>
- !! wikitext
- #REDIRECT [[Bar]]
- !! end
- !! test
- T75121: Infer extension name from typeOf if data-mw is not present
- !! options
- parsoid={ "modes": ["html2wt"], "suppressErrors": true }
- !! html/parsoid
- <div typeOf="mw:Extension/foo"></div>
- !! wikitext
- <foo />
- !! end
- # Note that the <p> wrapping isn't present in PHP parser output
- # The important thing for this test is that P-wrapping doesn't
- # interfere with the <nowiki> protection for leading - in <td>
- # (which isn't necessary for <th>).
- !! test
- T88318: p-wrapped dash in table.
- !! options
- parsoid=html2wt,wt2wt
- !! html/parsoid
- <table><tbody>
- <tr><th><p>-</p></th><th><p>- </p></th></tr>
- <tr><td><p>-</p></td><td><p>- </p></td></tr>
- <tr><td><small>-</small></td><td><br/><p>-</p></td><td><br/>-</td></tr>
- </tbody></table>
- !! wikitext
- {|
- !-
- !-
- |-
- |<nowiki>-</nowiki>
- |<nowiki>- </nowiki>
- |-
- |<small>-</small>
- |<br />
- -
- |<br />
- -
- |}
- !! html/php+tidy
- <table>
- <tbody><tr>
- <th>-
- </th>
- <th>-
- </th></tr>
- <tr>
- <td>-
- </td>
- <td>-
- </td></tr>
- <tr>
- <td><small>-</small>
- </td>
- <td><br />
- <p>-
- </p>
- </td>
- <td><br />
- <p>-
- </p>
- </td></tr></tbody></table>
- !! end
- !! test
- T149209: WTS: Handle newlines in table cells properly
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table>
- <tbody>
- <tr><td>a
- b
- </td><td data-parsoid='{"stx":"row"}'>c</td></tr>
- <tr><td><p>x</p>
- </td><td data-parsoid='{"stx":"row", "startTagSrc": "{{!}}{{!}}"}'>y</td></tr>
- </tbody></table>
- <table>
- <tbody>
- <tr><th>a
- b
- </th><th data-parsoid='{"stx":"row"}'>c</th></tr>
- <tr><th><p>x</h>
- </th><th data-parsoid='{"stx":"row"}'>y</th></tr>
- </tbody></table>
- !! wikitext
- {|
- |a
- b
- |c
- |-
- |x
- {{!}}y
- |}
- {|
- !a
- b
- !c
- |-
- !x
- !y
- |}
- !! end
- !! test
- T149209: Selser: Handle newlines in table cells properly
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- [ "#h1", "html", "a\nb\n" ],
- [ "#h2", "html", "a\nb\n" ],
- [ "#c1", "html", "a\nb\n" ],
- [ "#c2", "html", "<p>a</p>" ],
- [ "#c3", "html", "<p>a</p>" ],
- [ "#c4", "html", "edit-me<p>a</p>" ]
- ]
- }
- !! wikitext
- {|
- ! id="h1" |edit-me!!1
- |-
- ! id="h2" |edit-me||2
- |-
- | id="c1" |edit-me||3
- |-
- | id="c2" |edit-me||4
- |-
- | id="c3" |edit-me||p||q||r
- |-
- | id="c4" |edit-me||p||q||r
- |}
- !! wikitext/edited
- {|
- ! id="h1" |a
- b
- !1
- |-
- ! id="h2" |a
- b
- !2
- |-
- | id="c1" |a
- b
- |3
- |-
- | id="c2" |a
- |4
- |-
- | id="c3" |a
- |p||q||r
- |-
- | id="c4" |edit-me
- a
- |p||q||r
- |}
- !! end
- !! test
- HTML id attribute with Parsoid-like element ids should not be serialized to wikitext
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table id='mwAb'>
- <td id='mwAc'>foo</td>
- <td id='serialize-this'>bar</td>
- </table>
- !! wikitext
- {|
- |foo
- | id="serialize-this" |bar
- |}
- !! end
- !! test
- Parsoid-like element ids should not be serialized to wikitext unless shadowed
- !! options
- parsoid=html2wt
- !! html/parsoid
- <div id="mwAQ" data-parsoid='{"stx":"html","a":{"id":"mwAQ"},"sa":{"id":"hello"}}'>ok</div>
- !! wikitext
- <div id="hello">ok</div>
- !! end
- !! test
- WTS change modes
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "changes": [
- [ "#xyz", "before", "<b>before</b> stuff " ],
- [ "#xyz", "after", " stuff <i>after</i>" ],
- [ "#xyz", "html", "x <b>y</b> z" ]
- ]
- }
- !! wikitext
- <span id="xyz">hello</span>
- !! wikitext/edited
- '''before''' stuff <span id="xyz">x '''y''' z</span> stuff ''after''
- !! end
- !! test
- Never serialize a-tag as html, regardless of what data-parsoid has to say
- !! options
- parsoid={ "modes": ["html2wt"], "suppressErrors": true }
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Foo" title="Foo" data-parsoid='{"stx":"html"}'>Foo</a>
- !! wikitext
- [[Foo]]
- !! end
- ## SSS FIXME: This is broken output nevertheless.
- ## What might be a reasonable non-broken output for this?
- ## This is an edge case unlikely to be seen in production
- ## that I am not wasting more time on this right now.
- !! test
- Never serialize a-tag as html, no matter what attributes it has
- !! options
- parsoid={ "modes": ["html2wt"], "suppressErrors": true }
- !! html/parsoid
- <a bad='true' href='http://boo.org'><img src='http://boohoo.org' /></a>
- !! wikitext
- [http://boo.org http://boohoo.org]
- !! end
- # Misnested is an indication that selser can reuse the source but these have
- # shown to sneak through on occasion. See T101768.
- # The original wikitext here is: [http://test.com [[one]] two three]
- !! test
- Strip span tags added to mark misnested links
- !! options
- parsoid=html2wt
- !! html/parsoid
- <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>
- !! wikitext
- [http://test.com][[one]] two three
- !! end
- !! test
- Catch regression when unpacking misnested links
- !! options
- parsoid=wt2html
- !! wikitext
- {{echo|hi}}[http://example.com [[ho]]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Catch regression when unpacking with trailing content
- !! wikitext
- {{echo|Foo <references/> bar}}
- !! html/parsoid
- <p about="#mwt2" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"Foo <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>
- !! end
- !! test
- Use data-parsoid.firstWikitextNode to compute newline constraints for template content
- !! options
- parsoid=html2wt
- !! html/parsoid
- <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|}"]}'>
- <tbody><tr><td>d
- </td></tr>
- </tbody></table>
- !! wikitext
- {{echo|a}}
- {|{{echo|c
- {{!}}d
- }}
- |}
- !! end
- ## This test verifies the presence and computation of this attribute indirectly
- ## by making an edit and ensuring that the serialization is correct (which it would be
- ## only if firstWikitextNode is properly set).
- !! test
- data-parsoid.firstWikitextNode should be computed properly in the presence of fostered content
- !! options
- parsoid= {
- "modes": ["wt2wt"],
- "changes": [
- [ "div#x", "remove" ],
- [ "div", "before", "<div>new</div>" ]
- ]
- }
- !! wikitext
- <div id="x">foo</div>
- {|
- {{echo|<div>boo</div>
- {{!}}b}}
- |c
- |}
- !! wikitext/edited
- <div>new</div>
- {|
- {{echo|<div>boo</div>
- {{!}}b}}
- |c
- |}
- !! end
- # --------------------------------------------
- # Tests spec'ing wikitext serialization norms |
- # --------------------------------------------
- !! test
- Serialize multi-line indent-pre starting with wikitext syntax
- !! options
- parsoid=html2wt
- !! html/parsoid
- <pre>* 1
- ** 2
- * 3</pre>
- !! wikitext
- * 1
- ** 2
- * 3
- !! end
- !! test
- 1. Categories should always be serialized on their own line
- !! options
- parsoid=html2wt
- !! html/parsoid
- foo<link rel="mw:PageProp/Category" href="./Category:Foo">bar
- !! wikitext
- foo
- [[Category:Foo]]
- bar
- !! end
- !! test
- 2. Categories that are part of templates should not introduce a line break
- !! wikitext
- foo {{echo|<span>bar</span> [[Category:baz]]}} bar
- !! html/parsoid
- <p>foo <span about="#mwt1" typeof="mw:Transclusion" data-mw='{"parts":[{"template":{"target":{"wt":"echo","href":"./Template:Echo"},"params":{"1":{"wt":"<span>bar</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>
- !! end
- # Careful while editing these next 2 tests. There are \u200f characters
- # before and after the <link> tags in the HTML and following some
- # of the categories in wikitext
- # Do not remove these characters in edits.
- #
- # As part of the serialization, these bidi characters will get stripped.
- !! test
- RTL (\u200f) and LTR (\u200e) markers around category tags should be stripped
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <p><link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />
- <link rel="mw:PageProp/Category" href="./קטגוריה:_שיטות_משפט" /></p>
- !! wikitext
- [[קטגוריה:טקסים]]
- [[קטגוריה: שיטות משפט]]
- !! end
- !! test
- RTL (\u200f) and LTR (\u200e) markers should not be stripped if followed by a text node
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <p><link rel="mw:PageProp/Category" href="./קטגוריה:טקסים" />y</p>
- !! wikitext
- [[קטגוריה:טקסים]]
- y
- !! end
- !! test
- Lists: Add space after bullets
- !! options
- parsoid=html2wt
- !! html/parsoid
- <ul>
- <li>foo</li>
- <li> bar</li>
- <li><span> baz</span></li>
- </ul>
- !! wikitext
- * foo
- * bar
- * <span> baz</span>
- !! end
- !! test
- 1. Headings: Add space before/after == (T53744)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h2>foo</h2>
- <h2> bar</h2>
- <h2>baz </h2>
- <h2><span> baz</span></h2>
- !! wikitext
- == foo ==
- == bar ==
- == baz ==
- == <span> baz</span> ==
- !! end
- !! test
- 2. Headings: Add space before/after == even after hoisted content
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <h2> <link href="./Category:A2" rel="mw:PageProp/Category" />ok</h2>
- !! wikitext
- [[Category:A2]]
- == ok ==
- !! end
- !! test
- 1. Headings: suppress newly created empty headings
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <h2></h2>
- !! wikitext
- !! end
- !! test
- 2. Headings: don't suppress empty headings if scrubWikitext is false
- !! options
- parsoid=html2wt
- !! html/parsoid
- <h2></h2>
- !! wikitext
- ==<nowiki/>==
- !! end
- !! test
- 3. Headings: suppress empty headings on edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "#x", "remove"]
- ]
- }
- !! wikitext
- ==<span id="x">foo</span>==
- !! wikitext/edited
- !! end
- !! test
- Headings: Replace <br/> with a single whitespace char (when scrubWikitext = true)
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <h2>foo<br/>bar</h2>
- <h2>foo <span><br/>bar</span> baz</h2>
- !! wikitext
- == foo bar ==
- == foo <span> bar</span> baz ==
- !! end
- !! test
- Headings: Replace <br/> with a single whitespace char (when scrubWikitext = false)
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": false
- }
- !! html/parsoid
- <h2>foo<br/>bar</h2>
- !! wikitext
- == foo<br /> bar ==
- !! end
- !! test
- 1. WT Quote Tags: suppress newly created empty style tags
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <i></i><b></b>
- !! wikitext
- !! end
- !! test
- 2. WT Quote Tags: don't suppress empty style tags if scrubWikitext is false
- !! options
- parsoid=html2wt
- !! html/parsoid
- <i></i><b></b>
- !! wikitext
- ''<nowiki/>'''''<nowiki/>'''
- !! end
- !! test
- 3. WT Quote Tags: suppress empty style tags on edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "#x", "remove"]
- ]
- }
- !! wikitext
- '''<span id="x">foo</span>'''
- !! wikitext/edited
- !! end
- !! test
- 1. Anchors: suppress newly created empty anchors
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Test" title="Test"></a>
- !! wikitext
- !! end
- !! test
- 2. Anchors: don't suppress empty anchors if scrubWikitext is false
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": false
- }
- !! html/parsoid
- <a rel="mw:WikiLink" href="./Test" title="Test"></a>
- !! wikitext
- [[Test|<nowiki/>]]
- !! end
- !! test
- 3. Anchors: suppress empty anchors on edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "#x", "remove"]
- ]
- }
- !! wikitext
- [[Test|<span id="x">foo</span>]]
- !! wikitext/edited
- !! end
- !! test
- 3a. Anchors: do not suppress numbered extlinks
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "scrubWikitext": true
- }
- !! wikitext
- [http://foo.com]
- !! html/parsoid
- <a rel="mw:ExtLink" href="http://foo.com"></a>
- !! end
- !! test
- 3b. Anchors: do not suppress numbered extlinks
- !! options
- parsoid={
- "modes": ["wt2wt"],
- "scrubWikitext": true,
- "changes": [
- [ "#x", "remove"]
- ]
- }
- !! wikitext
- [http://foo.com <span id="x">foo</span>]
- !! wikitext/edited
- [http://foo.com]
- !! end
- !!test
- Normalizations should be restricted to edited content
- !!options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "h1", "before", "<i></i>"]
- ]
- }
- !!wikitext
- a
- = =
- b
- !!wikitext/edited
- a
- = =
- b
- !!end
- !! test
- 1. Multiple normalizations (html2wt)
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html
- <h2><i></i></h2>
- <p><a href='Foo' rel='mw:WikiLink'>foo<i></i>
- </a><b><i></i></b>x</p>
- !! wikitext
- [[foo]]
- x
- !! end
- !! test
- 2. Multiple normalizations (selser)
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "#x", "after", "<h1><i></i></h1>\n<p> x<b></b></p>"]
- ]
- }
- !! wikitext
- <span id="x">foo</span>
- !! wikitext/edited
- <span id="x">foo</span>
- x
- !! end
- !! test
- 1. Indent Pre Nowiki: suppress whitespace at the start of new paragraph
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <p> hi</p>
- <p> hello</p>
- !! wikitext
- hi
- hello
- !! end
- !! test
- 2. Indent Pre Nowiki: don't suppress whitespace at the start of new paragraph if scrubWikitext is false
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p> hi</p>
- <p> hello</p>
- !! wikitext
- <nowiki> </nowiki>hi
- <nowiki> </nowiki> hello
- !! end
- !! test
- 3. Indent Pre Nowiki: suppress whitespace after newlines in new paragraph or table cell
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <p>Foo
- bar
- baz</p>
- <table><tr><td>Foo
- bar
- baz bang</td></tr></table>
- <p><!--boo--> foo
- bar</p>
- <p> foo
- bar<span>boo</span></p>
- !! wikitext
- Foo
- bar
- baz
- {|
- |Foo
- bar
- baz bang
- |}
- <!--boo-->foo
- bar
- foo
- bar<span>boo</span>
- !! end
- !! test
- 4. Indent Pre Nowiki: suppress leading whitespace in edited paragraphs
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "p", "html", " a\n b" ]
- ]
- }
- !! wikitext
- xyz
- !! wikitext/edited
- a
- b
- !! end
- !! test
- 1. New links that end in spaces
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": false
- }
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
- <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
- !! wikitext
- [[Berlin ]]<nowiki/>is the capital of Germany.
- [[Foo ]]'''bar'''
- [[Boston ]] is a city.
- !! end
- !! test
- 2. New links that end in spaces
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Berlin" title="Berlin">Berlin </a>is the capital of Germany.</p>
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo">Foo </a><b>bar</b></p>
- <p><a rel="mw:WikiLink" href="./Boston" title="Boston">Boston </a> is a city.</p>
- !! wikitext
- [[Berlin]] is the capital of Germany.
- [[Foo]] '''bar'''
- [[Boston]] is a city.
- !! end
- !! test
- 1. Table cells with escapable prefixes
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": false
- }
- !! html
- <table>
- <tr><td>a</td></tr>
- <tr><td>-</td></tr>
- <tr><td>+</td></tr>
- </table>
- !! wikitext
- {|
- |a
- |-
- |<nowiki>-</nowiki>
- |-
- |<nowiki>+</nowiki>
- |}
- !! end
- !! test
- 2. Table cells with escapable prefixes
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html
- <table>
- <tr><td>a</td></tr>
- <tr><td>-</td></tr>
- <tr><td>+</td></tr>
- </table>
- !! wikitext
- {|
- |a
- |-
- | -
- |-
- | +
- |}
- !! end
- !! test
- 3a. Table cells with escapable prefixes after edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "table tbody tr:first-child td:first-child", "remove"]
- ]
- }
- !! wikitext
- {|
- |a||-
- |}
- !! wikitext/edited
- {|
- | -
- |}
- !! end
- !! test
- 3b. Table cells with escapable prefixes after edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "table tbody tr:first-child td:first-child", "html", "-" ],
- [ "#x", "remove" ]
- ]
- }
- !! wikitext
- {|
- |pqr
- |<span id="x">foo</span>+
- |}
- !! wikitext/edited
- {|
- | -
- | +
- |}
- !! end
- # FIXME: This test will fail because
- # normalization doesn't realize that the id attribute
- # will eliminate the escapable scenario
- !! test
- 4a. Table cells without escapable prefixes after edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "#x", "html", "-" ]
- ]
- }
- !! wikitext
- {|
- | id="x" |abcd
- |}
- !! wikitext/edited
- {|
- | id="x" |-
- |}
- !! end
- ## This tests normalizer's ability to discriminate between
- ## cells having identical content.
- !! test
- 4b. Table cells without escapable prefixes after edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "td", "html", "-" ]
- ]
- }
- !! wikitext
- {|
- |a||b
- |}
- !! wikitext/edited
- {|
- | -||-
- |}
- !! end
- ## This tests normalizer's ability to not be tripped by
- ## comments (and whitespace)
- !! test
- 4c. Table cells without escapable prefixes after edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "table tbody tr td:first-child", "remove" ]
- ]
- }
- !! wikitext
- {|
- |-
- <!--foo--> |a||-
- |}
- !! wikitext/edited
- {|
- |-
- <!--foo--> | -
- |}
- !! end
- ## This tests normalizer's ability to handle HTML cells
- !! test
- 4d. Table cells without escapable prefixes after edits
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "td", "html", "-" ]
- ]
- }
- !! wikitext
- <table>
- <tr><td>a</td></tr>
- </table>
- !! wikitext/edited
- <table>
- <tr><td>-</td></tr>
- </table>
- !! end
- ## T111151 Remove font elements without attributes
- !! test
- 5a. font tags without attributes should be dropped in scrubWikitext mode
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": true
- }
- !! html
- <font>foo</font>
- <font><font>bar</font></font>
- <font class="x">boo</font>
- !! wikitext
- foo
- bar
- <font class="x">boo</font>
- !! end
- !! test
- 5b. font tags should not be dropped without scrubWikitext being enabled
- !! options
- parsoid={
- "modes": ["html2wt"],
- "scrubWikitext": false
- }
- !! html
- <font>foo</font>
- !! wikitext
- <font>foo</font>
- !! end
- !! test
- Escape nowiki DOM elements
- !! options
- parsoid=html2wt
- !! html/parsoid
- <nowiki><i>foo</i></nowiki>
- !! wikitext
- <nowiki>''foo''</nowiki>
- !! end
- # This is meant to be an interim fix while we go about figuring out
- # how to not introduce these trailing <nowiki/>s in the first place.
- !! test
- T115717: Strip trailing <nowiki/>s (without affecting valid uses)
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>x<meta typeof="mw:Placeholder" data-parsoid='{"src":"<nowiki/>"}'/><meta typeof="mw:Placeholder" data-parsoid='{"src":"<nowiki/>"}'/>
- y</p>
- <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":"<nowiki/>"}},"i":0}}]}'></span></p>
- <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":"<nowiki/>"}},"i":0}}]}'></span></p>
- !! wikitext
- x
- y
- {{echo|
- 1 = <nowiki/>}}
- {{echo|
- 1 = <nowiki/>
- }}
- !! end
- !! test
- New list is serialized on newlines
- !! options
- parsoid=html2wt
- !! html/parsoid
- <p>The quick brown fox jumps over the lazy dog.</p><ul>
- <li>Yesterday</li>
- <li>Today</li>
- <li>Tomorrow</li>
- </ul><p>The quick onyx goblin jumps over the lazy dwarf.</p>
- !! wikitext
- The quick brown fox jumps over the lazy dog.
- * Yesterday
- * Today
- * Tomorrow
- The quick onyx goblin jumps over the lazy dwarf.
- !! end
- !! test
- New lists in formatting elements serialized w/o newlines
- !! options
- parsoid=html2wt
- !! html/parsoid
- <small>
- <ul>
- <li>123</li>
- </ul>
- </small>
- <small><ul><li>hi</li></ul></small>
- !! wikitext
- <small>
- * 123
- </small>
- <small>
- * hi
- </small>
- !! end
- !! test
- New list in table doesn't need newlines
- !! options
- parsoid=html2wt
- !! html/parsoid
- <table><tr><td><ul><li>test</li><li>123</li></td></tr></table>
- !! wikitext
- {|
- |
- * test
- * 123
- |}
- !! end
- # ---------------------------------------------------
- # End of tests spec'ing wikitext serialization norms |
- # ---------------------------------------------------
- # T104032
- !! test
- Bare inline nodes not wrapped inside p-tags should be treated as p-wrapped
- !! options
- parsoid=html2wt
- !! html/parsoid
- a<p>b</p>
- <b>c</b><p>d</p>
- <table><tr>
- <td>a<p>b</p></td>
- <td><b>c</b><p>d</p></td>
- </tr></table>
- !! wikitext
- a
- b
- '''c'''
- d
- {|
- |a
- b
- |'''c'''
- d
- |}
- !! end
- !! test
- Anchor without href scenarios
- !! options
- parsoid={ "modes": ["html2wt"], "suppressErrors": true }
- !! html/parsoid
- <a class="bc"></a>
- <a class="no">dice</a>
- <a name="foo"></a>
- !! wikitext
- dice
- <span name="foo"></span>
- !! end
- !! test
- New transclusion added after a list should be serialized after the list
- !! options
- parsoid=html2wt
- !! html/parsoid
- <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>
- !! wikitext
- * a
- {{echo|foo}}
- !! end
- # -----------------------------------------------------------------
- # End of section for Parsoid-only html2wt tests for serialization
- # of new content
- # -----------------------------------------------------------------
- # -----------------------------------------------------------------
- # The following section of tests are primarily to spec behavior of
- # the selective serializer. All these tests have manual selser
- # changes. The automated selser changes for all tests handle the
- # wide variation of changes, but these tests here capture specs
- # deterministically.
- # ----------------------------------------------------------------
- ## T90517
- !! test
- Selser: New comments should not be lost
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- [ "#a", "after", "<!--c1-->" ],
- [ "#b", "before", "<!--c2-->" ]
- ]
- }
- !! wikitext
- <span id="a">a</span>
- <span id="b">b</span>
- !! wikitext/edited
- <span id="a">a</span><!--c1-->
- <!--c2--><span id="b">b</span>
- !! end
- ## T89383
- !! test
- Selser: Check for validity of DSR before using it
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- [ "#a", "before", "<meta property='mw:PageProp/displaytitle' content='foo'>" ]
- ]
- }
- !! wikitext
- <span id="a">a</span>
- !! wikitext/edited
- {{DISPLAYTITLE:foo}}
- <span id="a">a</span>
- !! end
- !! test
- 1. DOMDiff: Changes to <ref> content should be looked up using id
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- ["#X", "after", "bar"],
- ["#Y", "after", "baz"]
- ]
- }
- !! wikitext
- X <ref><span id="X">foo</span></ref>
- Y <ref name="a" />
- <references>
- <ref name="a"><span id="Y">foo</span></ref>
- </references>
- !! wikitext/edited
- X <ref><span id="X">foo</span>bar</ref>
- Y <ref name="a" />
- <references>
- <ref name="a"><span id="Y">foo</span>baz</ref>
- </references>
- !! end
- !! test
- 2. DOMDiff: Changes to <ref> content should be looked up using id
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- ["#Z", "after", "bar"]
- ]
- }
- !! wikitext
- A <ref>foo bar for a</ref>
- B <ref group="X" name="b" />
- <references />
- <references group="X">
- <ref name="b"><span id="Z">foo</span></ref>
- </references>
- !! wikitext/edited
- A <ref>foo bar for a</ref>
- B <ref group="X" name="b" />
- <references />
- <references group="X">
- <ref name="b"><span id="Z">foo</span>bar</ref>
- </references>
- !! end
- !! test
- DOMDiff: Edits to content nested in elements with templated attributes should not be lost (T139388)
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- [ "div:first-child", "text", "bar" ]
- ]
- }
- !! wikitext
- <div style="{{1x|color:red;}}%">foo</div>
- !! wikitext/edited
- <div style="{{1x|color:red;}}%">bar</div>
- !! end
- !! test
- Empty LI (T49673)
- !! wikitext
- *a
- *
- *
- *b
- !! html+tidy
- <ul><li>a</li>
- <li class="mw-empty-elt"></li>
- <li class="mw-empty-elt"></li>
- <li>b</li></ul>
- !! end
- !! test
- Thumbnail output
- !! wikitext
- [[File:Thumb.png|thumb]]
- !! html/php+tidy
- <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>
- !! html/parsoid
- <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>
- !! end
- !! test
- unclosed internal link XSS (T137264)
- !! wikitext
- [[#%3Cscript%3Ealert(1)%3C/script%3E|
- !! html/php
- <p>[[#<script>alert(1)</script>|
- </p>
- !! html/parsoid
- <p>[[#%3Cscript%3Ealert(1)%3C/script%3E|</p>
- !! end
- !! test
- Validating that <style> isn't eaten by tidy (T167349)
- !! options
- styletag=1
- !! wikitext
- <div class="foo">
- <style>.foo::before { content: "<foo>"; }</style>
- <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
- </div>
- !! html/php+tidy
- <div class="foo">
- <style>.foo::before { content: "<foo>"; }</style>
- <style data-mw-foobar="baz">.foo::after { content: "<bar>"; }</style>
- </div>
- !! end
- !! test
- Validating that <style> isn't wrapped in a paragraph (T186965)
- !! options
- styletag=1
- !! wikitext
- A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
- <style>.foo::before { content: "<foo>"; }</style>
- <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
- But if it's on a line with other content, let it be wrapped.
- <style>.foo::before { content: "<foo>"; }</style> bar
- foo <style>.foo::before { content: "<foo>"; }</style>
- foo <style>.foo::before { content: "<foo>"; }</style> bar
- And the same if we have non-paragraph-breaking whitespace
- foo
- <style>.foo::before { content: "<foo>"; }</style>
- bar
- !! html/php
- <p>A style tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
- </p>
- <style>.foo::before { content: "<foo>"; }</style>
- <style>.foo::before { content: "<foo>"; }</style> <link rel="foo" href="bar"/><style>.foo::before { content: "<foo>"; }</style>
- <p>But if it's on a line with other content, let it be wrapped.
- </p><p><style>.foo::before { content: "<foo>"; }</style> bar
- </p><p>foo <style>.foo::before { content: "<foo>"; }</style>
- </p><p>foo <style>.foo::before { content: "<foo>"; }</style> bar
- </p><p>And the same if we have non-paragraph-breaking whitespace
- </p><p>foo
- <style>.foo::before { content: "<foo>"; }</style>
- bar
- </p>
- !! end
- !! test
- Validating that <link> isn't wrapped in a paragraph (T186965)
- !! options
- styletag=1
- !! wikitext
- A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
- <link rel="foo" href="bar"/>
- <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
- But if it's on a line with other content, let it be wrapped.
- <link rel="foo" href="bar"/> bar
- foo <link rel="foo" href="bar"/>
- foo <link rel="foo" href="bar"/> bar
- And the same if we have non-paragraph-breaking whitespace
- foo
- <link rel="foo" href="bar"/>
- bar
- !! html/php
- <p>A link tag, by itself or with other style/link tags, shouldn't be wrapped in a paragraph
- </p>
- <link rel="foo" href="bar"/>
- <link rel="foo" href="bar"/> <style>.foo::before { content: "<foo>"; }</style><link rel="foo" href="bar"/>
- <p>But if it's on a line with other content, let it be wrapped.
- </p><p><link rel="foo" href="bar"/> bar
- </p><p>foo <link rel="foo" href="bar"/>
- </p><p>foo <link rel="foo" href="bar"/> bar
- </p><p>And the same if we have non-paragraph-breaking whitespace
- </p><p>foo
- <link rel="foo" href="bar"/>
- bar
- </p>
- !! end
- !! test
- Decoding of HTML entities in headings and links for IDs and link fragments (T103714)
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- ==A&B&C&amp;D&amp;amp;E==
- [[#A&B&C&amp;D&amp;amp;E]]
- !! html/php
- <h2><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE"></span><span class="mw-headline" id="A&B&C&amp;D&amp;amp;E">A&B&C&amp;D&amp;amp;E</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: A&B&C&amp;D&amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p><a href="#A&B&C&amp;D&amp;amp;E">#A&B&C&amp;D&amp;amp;E</a>
- </p>
- !! html/parsoid
- <h2 id="A&B&C&amp;D&amp;amp;E"><span id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE" typeof="mw:FallbackId" data-parsoid="{}"></span>A&B<span typeof="mw:Entity" data-parsoid='{"src":"&amp;","srcContent":"&"}'>&</span>C<span typeof="mw:Entity" data-parsoid='{"src":"&amp;","srcContent":"&"}'>&</span>amp;D<span typeof="mw:Entity" data-parsoid='{"src":"&amp;","srcContent":"&"}'>&</span>amp;amp;E</h2>
- <p><a rel="mw:WikiLink" href="./Main_Page#A&B&C&amp;D&amp;amp;E" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#A&B&C&amp;D&amp;amp;E"},"sa":{"href":"#A&B&amp;C&amp;amp;D&amp;amp;amp;E"}}'>#A&B&C&amp;D&amp;amp;E</a></p>
- !! end
- !! test
- Decoding of HTML entities in headings and links for IDs and link fragments (T103714) (legacy)
- !! config
- wgFragmentMode=[ 'legacy' ]
- !! wikitext
- ==A&B&C&amp;D&amp;amp;E==
- [[#A&B&C&amp;D&amp;amp;E]]
- !! html/php
- <h2><span class="mw-headline" id="A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">A&B&C&amp;D&amp;amp;E</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=1" title="Edit section: A&B&C&amp;D&amp;amp;E">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p><a href="#A.26B.26C.26amp.3BD.26amp.3Bamp.3BE">#A&B&C&amp;D&amp;amp;E</a>
- </p>
- !! end
- !! test
- Decoding of HTML entities in embedded HTML tags
- !! wikitext
- <table class="1&2&3&amp;4&amp;amp;5"><tr><td>x</td></tr></table>
- !! html/php
- <table class="1&2&3&amp;4&amp;amp;5"><tr><td>x</td></tr></table>
- !! html/parsoid
- <table class="1&2&3&amp;4&amp;amp;5" data-parsoid='{"stx":"html","a":{"class":"1&2&3&amp;4&amp;amp;5"},"sa":{"class":"1&2&amp;3&amp;amp;4&amp;amp;amp;5"}}'><tbody><tr data-parsoid='{"stx":"html"}'><td data-parsoid='{"stx":"html"}'>x</td></tr></tbody></table>
- !! end
- !! test
- Decoding of HTML entities in indicator names for IDs (T104196)
- !! options
- parsoid=wt2html,html2html
- showindicators
- !! wikitext
- <indicator name="1&2&3&amp;4&amp;amp;5">Indicator</indicator>
- !! html/php
- 1&2&3&4&amp;5=Indicator
- !! html/parsoid
- <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&2&3&amp;4&amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
- !! end
- # this version of the test strips out the ambiguity so Parsoid rts cleanly
- !! test
- Decoding of HTML entities in indicator names for IDs (unambiguous) (T104196)
- !! options
- showindicators
- !! wikitext
- <indicator name="1&2&3&amp;4&amp;amp;5">Indicator</indicator>
- !! html/php
- 1&2&3&4&amp;5=Indicator
- !! html/parsoid
- <p><span typeof="mw:Extension/indicator" about="#mwt3" data-mw='{"name":"indicator","attrs":{"name":"1&2&3&amp;4&amp;amp;5"},"body":{"extsrc":"Indicator"}}'></span></p>
- !! end
- # This fragment mode is what Parsoid supports.
- !! test
- HTML5 ids: fallback to legacy
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- ==Foo bar==
- ==foo Bar==
- ==Тест==
- ==Тест==
- ==тест==
- ==Hey < # " > % : '==
- [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
- {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
- <!-- These two links should produce identical HTML -->
- [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
- <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
- <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
- <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
- <li class="toclevel-1 tocsection-6"><a href="#Hey_<_#_"_>_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey < # " > % : '</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=3" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=4" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=5" title="Edit section: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <h2><span id="Hey_.3C_.23_.22_.3E_.25_:_.27"></span><span class="mw-headline" id="Hey_<_#_"_>_%_:_'">Hey < # " > % : '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Hey < # " > % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_<_#_"_>_%_:_'">#Hey < # " > % : '</a>
- </p><p>💩 <span id="💩"></span>
- </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
- </p>
- !! html/parsoid
- <h2 id="Foo_bar">Foo bar</h2>
- <h2 id="foo_Bar_2">foo Bar</h2>
- <h2 id="Тест"><span id=".D0.A2.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>Тест</h2>
- <h2 id="Тест_2"><span id=".D0.A2.D0.B5.D1.81.D1.82_2" typeof="mw:FallbackId"></span>Тест</h2>
- <h2 id="тест"><span id=".D1.82.D0.B5.D1.81.D1.82" typeof="mw:FallbackId"></span>тест</h2>
- <h2 id="Hey_<_#_"_>_%_:_'"><span id="Hey_.3C_.23_.22_.3E_.25_:_.27" typeof="mw:FallbackId"></span>Hey < # " > %<span typeof="mw:DisplaySpace mw:Placeholder" data-parsoid='{"src":" ","isDisplayHack":true}'> </span>: '</h2>
- <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_<_#_"_>_%_:_'" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Hey_<_#_\"_>_%_:_'"},"sa":{"href":"#Hey < # \" > % : '"}}'>#Hey < # " > % : '</a></p>
- <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":"<span about=\"#mwt2\" typeof=\"mw:Transclusion\" data-parsoid='{\"pi\":[[]],\"dsr\":[178,197,null,null]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:💩\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}'>💩</span>"}]]}'></span></p>
- <!-- These two links should produce identical HTML -->
- <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>
- !! end
- # Parsoid doesn't support this mode
- !! test
- HTML5 ids: legacy with a fallback to modern
- !! config
- wgFragmentMode=[ 'legacy', 'html5' ]
- !! wikitext
- ==Foo bar==
- ==foo Bar==
- ==Тест==
- ==Тест==
- ==тест==
- ==Hey < # " > % : '==
- [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
- {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
- <!-- These two links should produce identical HTML -->
- [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
- <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>
- <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>
- <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>
- <li class="toclevel-1 tocsection-6"><a href="#Hey_.3C_.23_.22_.3E_.25_:_.27"><span class="tocnumber">6</span> <span class="toctext">Hey < # " > % : '</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=3" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=4" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=5" title="Edit section: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <h2><span id="Hey_<_#_"_>_%_:_'"></span><span class="mw-headline" id="Hey_.3C_.23_.22_.3E_.25_:_.27">Hey < # " > % : '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Hey < # " > % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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 < # " > % : '</a>
- </p><p>.F0.9F.92.A9 <span id=".F0.9F.92.A9"></span>
- </p><p><a href="#.E5.95.A4.E9.85.92">#啤酒</a> <a href="#.E5.95.A4.E9.85.92">#啤酒</a>
- </p>
- !! end
- # Parsoid doesn't support this mode.
- !! test
- HTML5 ids: no legacy
- !! config
- wgFragmentMode=[ 'html5' ]
- !! wikitext
- ==Foo bar==
- ==foo Bar==
- ==Тест==
- ==Тест==
- ==тест==
- ==Hey < # " > % : '==
- [[#Foo bar]] [[#foo Bar]] [[#Тест]] [[#тест]] [[#Hey < # " > % : ']]
- {{anchorencode:💩}} <span id="{{anchorencode:💩}}"></span>
- <!-- These two links should produce identical HTML -->
- [[#啤酒]] [[#%E5%95%A4%E9%85%92]]
- !! html/php
- <div id="toc" class="toc"><div class="toctitle" lang="en" dir="ltr"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Foo_bar"><span class="tocnumber">1</span> <span class="toctext">Foo bar</span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#foo_Bar_2"><span class="tocnumber">2</span> <span class="toctext">foo Bar</span></a></li>
- <li class="toclevel-1 tocsection-3"><a href="#Тест"><span class="tocnumber">3</span> <span class="toctext">Тест</span></a></li>
- <li class="toclevel-1 tocsection-4"><a href="#Тест_2"><span class="tocnumber">4</span> <span class="toctext">Тест</span></a></li>
- <li class="toclevel-1 tocsection-5"><a href="#тест"><span class="tocnumber">5</span> <span class="toctext">тест</span></a></li>
- <li class="toclevel-1 tocsection-6"><a href="#Hey_<_#_"_>_%_:_'"><span class="tocnumber">6</span> <span class="toctext">Hey < # " > % : '</span></a></li>
- </ul>
- </div>
- <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&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: foo Bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <h2><span class="mw-headline" id="Тест">Тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=3" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=4" title="Edit section: Тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <h2><span class="mw-headline" id="тест">тест</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=5" title="Edit section: тест">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <h2><span class="mw-headline" id="Hey_<_#_"_>_%_:_'">Hey < # " > % : '</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/index.php?title=Parser_test&action=edit&section=6" title="Edit section: Hey < # " > % : '">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p><a href="#Foo_bar">#Foo bar</a> <a href="#foo_Bar">#foo Bar</a> <a href="#Тест">#Тест</a> <a href="#тест">#тест</a> <a href="#Hey_<_#_"_>_%_:_'">#Hey < # " > % : '</a>
- </p><p>💩 <span id="💩"></span>
- </p><p><a href="#啤酒">#啤酒</a> <a href="#啤酒">#啤酒</a>
- </p>
- !! end
- !! test
- T90902: Normalize weird characters in section IDs
- !! config
- wgFragmentMode=[ 'html5', 'legacy' ]
- !! wikitext
- ==Foo bar==
- [[#Foo bar]]
- !! html/php
- <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&action=edit&section=1" title="Edit section: Foo bar">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <p><a href="#Foo_bar">#Foo bar</a>
- </p>
- !! html/parsoid
- <h2 id="Foo_bar"> Foo<span typeof="mw:Entity" data-parsoid='{"src":"&nbsp;","srcContent":" "}'> </span>bar </h2>
- <p><a rel="mw:WikiLink" href="./Main_Page#Foo_bar" data-parsoid='{"stx":"simple","a":{"href":"./Main_Page#Foo_bar"},"sa":{"href":"#Foo&nbsp;bar"}}'>#Foo bar</a></p>
- !! end
- !! test
- T51672: Test for brackets in attributes of elements in external link texts
- !! wikitext
- [http://example.com/ link <span title="title with [brackets]">span</span>]
- [http://example.com/ link <span title="title with [brackets]">span</span>]
- !! html/php
- <p><a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
- <a rel="nofollow" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
- </p>
- !! html/parsoid
- <p><a rel="mw:ExtLink" class="external text" href="http://example.com/">link <span title="title with [brackets]">span</span></a>
- <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 &#91;brackets&#93;"}}'>span</span></a></p>
- !! end
- !! test
- T72875: Test for brackets in attributes of elements in internal link texts
- !! wikitext
- [[Foo|link <span title="title with [[double brackets]]">span</span>]]
- [[Foo|link <span title="title with [[double brackets]]">span</span>]]
- !! html/php
- <p><a href="/wiki/Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
- <a href="/wiki/Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
- </p>
- !! html/parsoid
- <p><a rel="mw:WikiLink" href="./Foo" title="Foo">link <span title="title with [[double brackets]]">span</span></a>
- <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 &#91;&#91;double brackets&#93;&#93;"}}'>span</span></a></p>
- !! end
- !! test
- T179544: {{anchorencode:}} output should be always usable in links
- !! config
- wgFragmentMode=[ 'html5' ]
- !! wikitext
- <span id="{{anchorencode:[foo]}}"></span>[[#{{anchorencode:[foo]}}]]
- !! html/php
- <p><span id="[foo]"></span><a href="#[foo]">#[foo]</a>
- </p>
- !! html/parsoid
- <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":"<span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt1\" data-parsoid='{\"srcContent\":\"[\",\"dsr\":[10,32,null,null],\"pi\":[[]]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}'>[</span><span about=\"#mwt1\" data-parsoid=\"{}\">foo</span><span typeof=\"mw:Entity\" about=\"#mwt1\" data-parsoid='{\"src\":\"&amp;#x5D;\",\"srcContent\":\"]\"}'>]</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":"#<span typeof=\"mw:Transclusion mw:Entity\" about=\"#mwt2\" data-parsoid='{\"srcContent\":\"[\",\"dsr\":[44,66,null,null],\"pi\":[[]]}' data-mw='{\"parts\":[{\"template\":{\"target\":{\"wt\":\"anchorencode:[foo]\",\"function\":\"anchorencode\"},\"params\":{},\"i\":0}}]}'>[</span><span about=\"#mwt2\" data-parsoid=\"{}\">foo</span><span typeof=\"mw:Entity\" about=\"#mwt2\" data-parsoid='{\"src\":\"&amp;#x5D;\",\"srcContent\":\"]\"}'>]</span>"}]]}'>#[foo]</a></p>
- !! end
- ## ------------------------------
- ## Parsoid section-wrapping tests
- ## ------------------------------
- !! test
- Section wrapping for well-nested sections (no leading content)
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- =1=
- a
- =2=
- b
- ==2.1==
- c
- ==2.2==
- d
- ===2.2.1===
- e
- =3=
- f
- !! html/parsoid
- <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
- <p>a</p>
- </section><section data-mw-section-id="2"><h1 id="2">2</h1>
- <p>b</p>
- <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
- <p>c</p>
- </section><section data-mw-section-id="4"><h2 id="2.2">2.2</h2>
- <p>d</p>
- <section data-mw-section-id="5"><h3 id="2.2.1">2.2.1</h3>
- <p>e</p>
- </section></section></section><section data-mw-section-id="6"><h1 id="3">3</h1>
- <p>f</p>
- </section>
- !! end
- !! test
- Section wrapping for well-nested sections (with leading content)
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- Para 1.
- Para 2 with a <div>nested in it</div>
- Para 3.
- =1=
- a
- =2=
- b
- ==2.1==
- c
- !! html/parsoid
- <section data-mw-section-id="0"><p>Para 1.</p>
- <p>Para 2 with a </p><div>nested in it</div>
- <p>Para 3.</p>
- </section><section data-mw-section-id="1"><h1 id="1">1</h1>
- <p>a</p>
- </section><section data-mw-section-id="2"><h1 id="2">2</h1>
- <p>b</p>
- <section data-mw-section-id="3"><h2 id="2.1">2.1</h2>
- <p>c</p>
- </section></section>
- !! end
- !! test
- Section wrapping with template-generated sections (good nesting 1)
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- =1=
- a
- {{echo|1=
- ==1.1==
- b
- }}
- ==1.2==
- c
- =2=
- d
- !! html/parsoid
- <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
- <p>a</p>
- <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">
- </span><p about="#mwt1">b</p>
- </section><section data-mw-section-id="3"><h2 id="1.2">1.2</h2>
- <p>c</p>
- </section></section><section data-mw-section-id="4"><h1 id="2">2</h1>
- <p>d</p></section>
- !! end
- # In this example, the template scope is mildly expanded to incorporate the
- # trailing newline after the transclusion since that is part of section 1.1.1
- !! test
- Section wrapping with template-generated sections (good nesting 2)
- !! options
- parsoid={
- "wrapSections": true,
- "modes": ["wt2html", "wt2wt"]
- }
- !! wikitext
- =1=
- a
- {{echo|1=
- ==1.1==
- b
- ===1.1.1===
- d
- }}
- =2=
- e
- !! html/parsoid
- <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
- <p>a</p>
- <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">
- </span><p about="#mwt1">b</p><span about="#mwt1">
- </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.1.1">1.1.1</h3><span about="#mwt1">
- </span><p about="#mwt1">d</p><span about="#mwt1">
- </span></section></section></section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="2">2</h1>
- <p>e</p></section>
- !! end
- # In this example, the template scope is mildly expanded to incorporate the
- # trailing newline after the transclusion since that is part of section 1.2.1
- !! test
- Section wrapping with template-generated sections (good nesting 3)
- !! options
- parsoid={
- "wrapSections": true,
- "modes": ["wt2html", "wt2wt"]
- }
- !! wikitext
- =1=
- a
- {{echo|1=
- x
- ==1.1==
- b
- ==1.2==
- c
- ===1.2.1===
- d
- }}
- =2=
- e
- !! html/parsoid
- <section data-mw-section-id="0"></section><section data-mw-section-id="1" data-parsoid="{}"><h1 id="1"> 1 </h1>
- <p>a</p>
- <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">
- </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.1">1.1</h2><span about="#mwt1">
- </span><p about="#mwt1">b</p><span about="#mwt1">
- </span></section><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="1.2">1.2</h2><span about="#mwt1">
- </span><p about="#mwt1">c</p><span about="#mwt1">
- </span><section data-mw-section-id="-1" about="#mwt1"><h3 about="#mwt1" id="1.2.1">1.2.1</h3><span about="#mwt1">
- </span><p about="#mwt1">d</p><span about="#mwt1">
- </span></section></section></section><section data-mw-section-id="5"><h1 id="2">2</h1>
- <p>e</p></section>
- !! end
- # Because of section-wrapping and template-wrapping interactions,
- # the scope of the template is expanded so that the template markup
- # is valid in the presence of <section> tags.
- # This exercises the s1 is null scenario in the wrapSections code
- !! test
- Section wrapping with template-generated sections (bad nesting 1)
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- <div>
- a
- {{echo|
- =1=
- b
- }}
- c
- </div>
- !! html/parsoid
- <section data-mw-section-id="-1"></section><section data-mw-section-id="-2"><div data-parsoid='{"stx":"html"}'>
- <p>a</p>
- <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"]}'>
- </span><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="1">1</h1><span about="#mwt1">
- </span><p about="#mwt1">b
- </p><span about="#mwt1">
- </span><p about="#mwt1">c</p><span about="#mwt1">
- </span></section></div></section>
- !! end
- # Because of section-wrapping and template-wrapping interactions,
- # the scope of the template is expanded so that the template markup
- # is valid in the presence of <section> tags.
- # This exercises the s1 is ancestor of s2 scenario in the wrapSections code
- !! test
- Section wrapping with template-generated sections (bad nesting 2)
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- =1=
- a
- {{echo|1=
- =2=
- b
- ==2.1==
- c
- }}
- d
- =3=
- e
- !! html/parsoid
- <section data-mw-section-id="0"></section><section data-mw-section-id="1"><h1 id="1">1</h1>
- <p>a</p>
- </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">
- </span><p about="#mwt1">b</p><span about="#mwt1">
- </span><section data-mw-section-id="-1" about="#mwt1"><h2 about="#mwt1" id="2.1">2.1</h2><span about="#mwt1">
- </span><p about="#mwt1">c</p><span about="#mwt1">
- </span><p about="#mwt1">d</p><span about="#mwt1">
- </span></section></section><section data-mw-section-id="4"><h1 id="3">3</h1>
- <p>e</p></section>
- !! end
- # Because of section-wrapping and template-wrapping interactions,
- # additional template wrappers are added to <section> tags
- # so that template wrapping semantics are valid whether section
- # tags are retained or stripped. But, the template scope can expand
- # greatly when accounting for section tags.
- # This exercises the s1 and s2 are in different subtrees scenario
- !! test
- Section wrapping with template-generated sections (bad nesting 3)
- !! options
- parsoid={
- "wrapSections": true,
- "modes": ["wt2html", "wt2wt"]
- }
- !! wikitext
- =1=
- a
- {{echo|1=
- ==1.2==
- b
- =2=
- c
- }}
- d
- =3=
- e
- !! html/parsoid
- <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>
- <p>a</p>
- <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">
- </span><p about="#mwt1">b</p><span about="#mwt1">
- </span></section></section><section data-mw-section-id="-1" about="#mwt1"><h1 about="#mwt1" id="2">2</h1><span about="#mwt1">
- </span><p about="#mwt1">c</p>
- <p>d</p>
- </section><section data-mw-section-id="4" data-parsoid="{}"><h1 id="3">3</h1>
- <p>e</p></section>
- !! end
- !! test
- Section wrapping with uneditable lead section + div wrapping multiple sections
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- foo
- <div style="border:1px solid red;">
- =1=
- a
- ==1.1==
- b
- =2=
- c
- </div>
- =3=
- d
- ==3.1==
- e
- !! html/parsoid
- <section data-mw-section-id="-1"><p>foo</p>
- </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
- <section data-mw-section-id="1"><h1 id="1">1</h1>
- <p>a</p>
- <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
- <p>b</p>
- </section></section><section data-mw-section-id="-1"><h1 id="2">2</h1>
- <p>c</p>
- </section></div>
- </section><section data-mw-section-id="4"><h1 id="3">3</h1>
- <p>d</p>
- <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
- <p>e</p>
- </section></section>
- !! end
- !! test
- Section wrapping with editable lead section + div overlapping multiple sections
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- foo
- =1=
- a
- <div style="border:1px solid red;">
- b
- ==1.1==
- c
- =2=
- d
- </div>
- e
- =3=
- f
- ==3.1==
- g
- !! html/parsoid
- <section data-mw-section-id="0"><p>foo</p>
- </section><section data-mw-section-id="-1"><h1 id="1">1</h1>
- <p>a</p>
- </section><section data-mw-section-id="-2"><div style="border:1px solid red;">
- <p>b</p>
- <section data-mw-section-id="2"><h2 id="1.1">1.1</h2>
- <p>c</p>
- </section><section data-mw-section-id="-1"><h1 id="2">2</h1>
- <p>d</p>
- </section></div>
- <p>e</p>
- </section><section data-mw-section-id="4"><h1 id="3">3</h1>
- <p>f</p>
- <section data-mw-section-id="5"><h2 id="3.1">3.1</h2>
- <p>g</p>
- </section></section>
- !! end
- !! test
- HTML header tags should not be wrapped in section tags
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- foo
- <h1>a</h1>
- =b=
- <h1>c</h1>
- =d=
- !! html/parsoid
- <section data-mw-section-id="0"><p>foo</p>
- <h1 id="a" data-parsoid='{"stx":"html"}'>a</h1>
- </section><section data-mw-section-id="1"><h1 id="b">b</h1>
- <h1 id="c" data-parsoid='{"stx":"html"}'>c</h1>
- </section><section data-mw-section-id="2"><h1 id="d">d</h1></section>
- !! end
- !! test
- Lead section containing only whitespace and comments.
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- <!-- this is a comment, presumably significant to editors -->
- =1=
- a
- =2=
- b
- !! html/parsoid
- <section data-mw-section-id="0" data-parsoid="{}">
- <!-- this is a comment, presumably significant to editors -->
- </section><section data-mw-section-id="1"><h1 id="1">1</h1>
- <p>a</p>
- </section><section data-mw-section-id="2"><h1 id="2">2</h1>
- <p>b</p></section>
- !! end
- !! test
- Pseudo-sections emitted by templates should have id -2
- !! options
- parsoid={
- "wrapSections": true
- }
- !! wikitext
- foo
- {{echo|<div>
- ==a==
- ==b==
- </div>
- }}
- !! html/parsoid
- <section data-mw-section-id="-1"><p>foo</p>
- </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":"<div>\n==a==\n==b==\n</div>\n"}},"i":0}}]}'>
- <section data-mw-section-id="-1"><h2 id="a">a</h2>
- </section><section data-mw-section-id="-1"><h2 id="b">b</h2>
- </section></div><span about="#mwt1">
- </span></section>
- !! end
- ##########################################################################
- Tests demonstrating white-space insensitivity in input wikitext
- for wikitext headings, wikitext list items, and wikitext table captions,
- headings, and cells. HTML versions of the same should preserve whitespace.
- ##########################################################################
- !! test
- Trim whitespace in wikitext headings, list items, table captions, headings, and cells
- !! wikitext
- __NOTOC__
- == <!--c1--> <!--c2--> Spaces <!--c3--> <!--c4--> ==
- == <!--c2--> <!--c2--> Tabs <!--c3--><!--c4--> ==
- * <!--c1--> <!--c2--> List item <!--c3--> <!--c4-->
- ; <!--term to define--> term : <!--term's definition--> definition
- {|
- |+ <!--c1--> <!--c2--> Table Caption <!--c3--> <!--c4-->
- |-
- ! <!--c1--> <!--c2--> Table Heading 1 <!--c3--> <!--c4--> !! Table Heading 2 <!--c5-->
- |-
- | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
- |-
- | class="foo" || <!--c1--> <!--c2--> Table Cell 3 <!--c3--> <!--c4-->
- |-
- | <!--c1--> testing [[one|two]] <!--c2--> | <!--c3--> some content
- |}
- : {|
- | <!--c1--> <!--c2--> Table Cell 1 <!--c3--> <!--c4--> || Table Cell 2 <!--c5-->
- |} foo <!--c1-->
- !! html/php+tidy
- <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&action=edit&section=1" title="Edit section: Spaces">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <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&action=edit&section=2" title="Edit section: Tabs">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
- <ul><li>List item</li></ul>
- <dl><dt>term </dt>
- <dd>definition</dd></dl>
- <table>
- <caption>Table Caption
- </caption>
- <tbody><tr>
- <th>Table Heading 1</th>
- <th>Table Heading 2
- </th></tr>
- <tr>
- <td>Table Cell 1</td>
- <td>Table Cell 2
- </td></tr>
- <tr>
- <td>class="foo"</td>
- <td>Table Cell 3
- </td></tr>
- <tr>
- <td>testing <a href="/index.php?title=One&action=edit&redlink=1" class="new" title="One (page does not exist)">two</a> | some content
- </td></tr></tbody></table>
- <dl><dd><table>
- <tbody><tr>
- <td>Table Cell 1</td>
- <td>Table Cell 2
- </td></tr></tbody></table> foo</dd></dl>
- !! end
- # Looks like <caption> is not accepted in HTML
- !! test
- Do not trim whitespace in HTML headings, list items, table captions, headings, and cells
- !! wikitext
- __NOTOC__
- <h2> <!--c1--> <!--c2--> Heading <!--c3--> <!--c4--> </h2>
- <ul><li> <!--c1--> <!--c2--> List item <!--c3--> <!--c4--> </li></ul>
- <table>
- <tr><th> <!--c1--> <!--c2--> Table Heading <!--c3--> <!--c4--> <th></tr>
- <tr><td> <!--c1--> <!--c2--> Table Cell <!--c3--> <!--c4--> <th></tr>
- </table>
- !! html/php+tidy
- <h2><span class="mw-headline" id="Heading"> Heading </span></h2>
- <ul><li> List item </li></ul>
- <table>
- <tbody><tr><th> Table Heading </th><th></th></tr>
- <tr><td> Table Cell </td><th></th></tr>
- </tbody></table>
- !! end
- !! test
- Do not trim whitespace in links and quotes
- !! wikitext
- foo '' <!--c1--> italic <!--c2--> '' and ''' <!--c3--> bold <!--c4--> '''
- [[Foo| some text ]]
- !! html/php+tidy
- <p>foo <i> italic </i> and <b> bold </b>
- <a href="/wiki/Foo" title="Foo"> some text </a>
- </p>
- !! end
- !! test
- Remove p tags surrounding a single element in a figcaption
- !! options
- parsoid=html2wt
- !! wikitext
- [[File:Foobar.jpg|right|200x200px|Caption]]
- !! html/parsoid
- <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>
- !! end
- !! test
- Selser preserves lack of newline before list and allows newline after the list
- !! options
- parsoid={
- "modes": ["selser"],
- "scrubWikitext": true,
- "changes": [
- [ "ul", "after", "<p>footer</p>" ]
- ]
- }
- !! wikitext
- header
- *foo
- *bar
- !! wikitext/edited
- header
- *foo
- *bar
- footer
- !! end
- !! test
- Selser does not introduce newlines between unedited paragraph preceding the list
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- [ "table tbody tr td p:last-child", "empty" ]
- ]
- }
- !! wikitext
- {|
- |
- header
- *foo
- *bar
- footer
- |}
- !! wikitext/edited
- {|
- |
- header
- *foo
- *bar
- |}
- !! end
- !! test
- Selser does not introduce newlines between unedited paragraph following the list
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- [ "table tbody tr td p:first-child", "empty" ]
- ]
- }
- !! wikitext
- {|
- |
- header
- *foo
- *bar
- footer
- |}
- !! wikitext/edited
- {|
- |
- *foo
- *bar
- footer
- |}
- !! end
- !! test
- Remove a list item but do not insert newline above list
- !! options
- parsoid={
- "modes": ["selser"],
- "changes": [
- [ "ul li:last-child", "remove" ]
- ]
- }
- !! wikitext
- header
- *foo
- *bar
- footer
- !! wikitext/edited
- header
- *foo
- footer
- !! end
|