public void CatsAndDefaultSort() { ArticleText = @"{{infobox person}} '''John Smith''' (born 11 April 1990) is great."; GenFixes("John Smith"); Assert.IsTrue(ArticleText.Contains(@"[[Category:1990 births]]")); Assert.IsTrue(ArticleText.Contains(@"[[Category:Living people]]")); Assert.IsTrue(ArticleText.Contains(@"{{DEFAULTSORT:Smith, John}}")); }
public void MergeRefsErrors() { ArticleText = @"A.<ref name=”XXL Mag”>{{cite web|url=http://www.somesite.com/online/?p=70413 |title=a}}</ref><ref name=c>x</ref> B.<ref name=c /> C.<ref name=”XXL Mag”>{{cite web|url=http://www.somesite.com/online/?p=70413 |title=a}}</ref> ==References== {{reflist}}"; GenFixes("Test"); Assert.IsTrue(ArticleText.Contains(@"<ref name=""XXL Mag"">") && ArticleText.Contains(@"<ref name=""XXL Mag""/>"), "Fix the ref quote errors, then merge them"); }
public override int GetHashCode() { var toReturn = ArticleId.GetHashCode() ^ NewsletterId.GetHashCode() ^ ArticleSequence.GetHashCode() ^ ImageFileLocation.GetHashCode() ^ ArticleType.GetHashCode() ^ ArticleTableOfContentsText.GetHashCode() ^ ArticleTitle.GetHashCode() ^ ArticleText.GetHashCode(); return(toReturn); }
public void MultipleIssues() { string before = @"{{Unreferenced|auto=yes|date=December 2009}} {{Underlinked|date=November 2006}} {{Notability|1=Music|date=September 2010}} {{Advert|date=December 2007}} '''Band''' is. [[Category:Blues rock groups]] {{Norway-band-stub}}", after = @"{{Multiple issues| {{Unreferenced|date=December 2009}} {{Underlinked|date=November 2006}} {{Notability|1=Music|date=September 2010}} {{Advert|date=December 2007}} }} '''Band''' is. [[Category:Blues rock groups]] {{Norway-band-stub}}"; AssertChange(before, after); ArticleText = @"{{POV|date=May 2016}} {{NPOV|date=May 2016}} {{Orphan|date=May 2016}} {{Dead end|date=May 2016}} Minor bug"; WikiRegexes.TemplateRedirects.Clear(); WikiRegexes.TemplateRedirects = Parsers.LoadTemplateRedirects(@"{{tl|NPOV}} → {{tl|POV}}"); GenFixes("A"); Assert.IsTrue(ArticleText.Contains(@"{{Multiple issues| {{POV|date=May 2016}} {{Orphan|date=May 2016}} {{Dead end|date=May 2016}} }}"), "No excess pipes left when MI incorporates duplicate tags"); }
public void CatsAndDefaultSort2() { ArticleText = @"{{infobox person}} '''Cecilia Uddén''' (born 11 April 1990) is great."; GenFixes("Cecilia Uddén"); Assert.IsTrue(ArticleText.Contains(@"[[Category:1990 births]]"), "birth category"); Assert.IsTrue(ArticleText.Contains(@"[[Category:Living people]]"), "living people"); Assert.IsTrue(ArticleText.Contains(@"{{DEFAULTSORT:Udden, Cecilia}}"), "human name defaultsort without special characters"); ArticleText = @"{{infobox person}} '''İbrahim Smith''' (born 12 April 1991) is great."; GenFixes("İbrahim Smith"); Assert.IsTrue(ArticleText.Contains(@"{{DEFAULTSORT:Ibrahim Smith}}"), "human name defaultsort (diacritics removed)"); }
public void LivingPeople() { ArticleText = @"{{Multiple issues|{{refimprove|date=July 2015}}{{BLP sources|date=July 2015}}}} {{Infobox football biography | name = Am | birth_date = 3 May 1983 }} '''Amir''' is.<ref>http://ca.soccerway.com/players/</ref> ==References== <references/> {{iran-footy-bio-stub}} {{DEFAULTSORT:Amir}} [[Category:A players]]"; GenFixes(); Assert.IsFalse(ArticleText.Contains(@"{Multiple issues")); Assert.IsTrue(ArticleText.Contains(@"Category:Living people")); }
public override void Save(int revisingUserId) { IDbConnection newConnection = DataProvider.GetConnection(); IDbTransaction trans = newConnection.BeginTransaction(); try { SaveInfo(trans, revisingUserId); UpdateItem(trans, ItemId, ModuleId); UpdateApprovalStatus(trans); //update article version now //replace <br> with <br /> AddArticleVersion(trans, ItemVersionId, ItemId, VersionNumber, VersionDescription, ArticleText.Replace("<br>", "<br />"), ReferenceNumber); //Save the Relationships SaveRelationships(trans); //Save the ItemVersionSettings //SaveItemVersionSettings(trans); trans.Commit(); } catch { trans.Rollback(); //Rolling back to the original version, exception thrown. ItemVersionId = OriginalItemVersionId; throw; } finally { //clean up connection stuff newConnection.Close(); } SaveItemVersionSettings(); Utility.ClearPublishCache(PortalId); string s = HostController.Instance.GetString(Utility.PublishEnableTags + PortalId.ToString(CultureInfo.InvariantCulture)); if (Utility.HasValue(s)) { if (Convert.ToBoolean(s, CultureInfo.InvariantCulture)) { //Save Tags //SaveTags(trans); SaveTags(); } } try { if (Utility.IsPingEnabledForPortal(PortalId)) { if (ApprovalStatusId == ApprovalStatus.Approved.GetId()) { string surl = HostController.Instance.GetString(Utility.PublishPingChangedUrl + PortalId.ToString(CultureInfo.InvariantCulture)); string changedUrl = Utility.HasValue(surl) ? surl : DotNetNuke.Common.Globals.NavigateURL(DisplayTabId); PortalSettings ps = Utility.GetPortalSettings(PortalId); //ping Ping.SendPing(ps.PortalName, ps.PortalAlias.ToString(), changedUrl, PortalId); } } } catch (Exception exc) { /// WHAT IS THIS? Why try/catch and gooble up errors??? /// this was added because some exceptions occur for ping servers that we don't need to let the users know about. /// //catch the ping exception but let everything else proceed. /// localize this error DotNetNuke.Services.Exceptions.Exceptions.LogException(exc); //Exceptions.ProcessModuleLoadException(Localize.GetString("PingError", LocalResourceFile), exc); } }