docs: #306 adding HtmlText and PlainText to GanjoorPoemSection model and filling and using them

This commit is contained in:
Hamid Reza Mohammadi 2022-04-10 20:52:54 +04:30
parent a9b8dbb9fb
commit 14374ffc8e
6 changed files with 55 additions and 8 deletions

View File

@ -67,5 +67,15 @@
/// rhyme letters
/// </summary>
public string RhymeLetters { get; set; }
/// <summary>
/// verses text
/// </summary>
public string PlainText { get; set; }
/// <summary>
/// verses text as html (ganjoor.net format)
/// </summary>
public string HtmlText { get; set; }
}
}

View File

@ -55,6 +55,11 @@
/// </summary>
public int? ThirdSectionIndex { get; set; }
/// <summary>
/// forth GanjoorPoemSection index
/// </summary>
public int? ForthSectionIndex { get; set; }
public override string ToString()
{
return Text;

View File

@ -8,5 +8,6 @@
First = 1,
Second = 2,
Third = 3,
Forth = 4
}
}

View File

@ -6814,6 +6814,16 @@
rhyme letters
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoemSection.PlainText">
<summary>
verses text
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorPoemSection.HtmlText">
<summary>
verses text as html (ganjoor.net format)
</summary>
</member>
<member name="T:RMuseum.Models.Ganjoor.GanjoorPoemTranslation">
<summary>
poem translation
@ -7256,6 +7266,11 @@
third GanjoorPoemSection index
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorVerse.ForthSectionIndex">
<summary>
forth GanjoorPoemSection index
</summary>
</member>
<member name="P:RMuseum.Models.Ganjoor.GanjoorVerseNumber.Id">
<summary>
id

View File

@ -6,7 +6,6 @@ using RSecurityBackend.Services.Implementation;
using System;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
namespace RMuseum.Services.Implementation
@ -92,7 +91,9 @@ namespace RMuseum.Services.Implementation
Index = sectionIndex,
Number = sectionIndex + 1,
GanjoorMetreId = poem.GanjoorMetreId,
RhymeLetters = poem.RhymeLetters
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(singleVerses),
PlainText = PreparePlainText(singleVerses)
};
context.Add(mainSection);//having a main section for مثنوی inside normal text helps keep track of related versess
foreach (var verse in singleVerses)
@ -156,7 +157,9 @@ namespace RMuseum.Services.Implementation
Index = sectionIndex,
Number = sectionIndex + 1,
GanjoorMetreId = poem.GanjoorMetreId,
RhymeLetters = poem.RhymeLetters
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(singleVerses),
PlainText = PreparePlainText(singleVerses)
};
context.Add(mainSection);//having a main section for مثنوی inside normal text helps keep track of related versess
foreach (var verse in singleVerses)
@ -250,7 +253,9 @@ namespace RMuseum.Services.Implementation
Index = index,
Number = index + 1,
GanjoorMetreId = poem.GanjoorMetreId,
RhymeLetters = poem.RhymeLetters
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(nonCommentVerses),
PlainText = PreparePlainText(nonCommentVerses)
};
context.Add(mainSection);
index++;
@ -286,6 +291,8 @@ namespace RMuseum.Services.Implementation
currentBandVerse.SecondSectionIndex = currentBandSection.Index;
}
currentBandSection.RhymeLetters = LanguageUtils.FindRhyme(currentBandVerses).Rhyme;
currentBandSection.HtmlText = PrepareHtmlText(currentBandVerses);
currentBandSection.PlainText = PreparePlainText(currentBandVerses);
context.Add(currentBandSection);
index++;
@ -311,6 +318,8 @@ namespace RMuseum.Services.Implementation
currentBandVerse.SecondSectionIndex = currentBandSection.Index;
}
currentBandSection.RhymeLetters = LanguageUtils.FindRhyme(currentBandVerses).Rhyme;
currentBandSection.HtmlText = PrepareHtmlText(currentBandVerses);
currentBandSection.PlainText = PreparePlainText(currentBandVerses);
context.Add(currentBandSection);
}
index++;
@ -329,6 +338,8 @@ namespace RMuseum.Services.Implementation
bandVerse.SecondSectionIndex = bandSection.Index;
}
bandSection.RhymeLetters = LanguageUtils.FindRhyme(bandVerses).Rhyme;
bandSection.HtmlText = PrepareHtmlText(bandVerses);
bandSection.PlainText = PreparePlainText(bandVerses);
context.Add(bandSection);
context.UpdateRange(nonCommentVerses);
}
@ -345,7 +356,9 @@ namespace RMuseum.Services.Implementation
Index = index,
Number = index + 1,
GanjoorMetreId = poem.GanjoorMetreId,
RhymeLetters = poem.RhymeLetters
RhymeLetters = poem.RhymeLetters,
HtmlText = PrepareHtmlText(nonCommentVerses),
PlainText = PreparePlainText(nonCommentVerses)
};
//checking for مثنوی phase 1
if (string.IsNullOrEmpty(poem.RhymeLetters))
@ -391,6 +404,10 @@ namespace RMuseum.Services.Implementation
rightVerse.SecondSectionIndex = verseSection.Index;
leftVerse.SecondSectionIndex = verseSection.Index;
var rl = new List<GanjoorVerse>();rl.Add(rightVerse);rl.Add(leftVerse);
verseSection.HtmlText = PrepareHtmlText(rl);
verseSection.PlainText = PreparePlainText(rl);
context.Add(verseSection);
}
}

View File

@ -2244,8 +2244,8 @@ namespace RMuseum.Services.Implementation
FullTitle = section.Poem.FullTitle,
FullUrl = section.Poem.FullUrl,
UrlSlug = section.Poem.UrlSlug,
HtmlText = section.Poem.HtmlText,
PlainText = section.Poem.PlainText,
HtmlText = section.HtmlText,
PlainText = section.PlainText,
GanjoorMetre = section.GanjoorMetre,
RhymeLetters = section.RhymeLetters,
MixedModeOrder = section.Poem.MixedModeOrder,
@ -2283,7 +2283,6 @@ namespace RMuseum.Services.Implementation
item.Category = poet;
}
}
return new RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCompleteViewModel[] Items)>(paginatedResult);