#219 support for VersePosition.Comment

This commit is contained in:
Hamid Reza Mohammadi 2021-10-06 13:00:48 +03:30
parent 761d13c9cd
commit b07c3a9f11
24 changed files with 45 additions and 21 deletions

View File

@ -51,6 +51,8 @@ namespace GanjooRazor.Areas.User.Pages
return "پاراگراف نثر";
case VersePosition.Single:
return "نیمایی یا آزاد";
case VersePosition.Comment:
return "توضیح";
}
return "نامعتبر";
}

View File

@ -65,6 +65,8 @@ namespace GanjooRazor.Areas.User.Pages
return "پاراگراف نثر";
case VersePosition.Single:
return "نیمایی یا آزاد";
case VersePosition.Comment:
return "توضیح";
}
return "نامعتبر";
}

View File

@ -15,7 +15,7 @@
گنجور » نمایش خوانش
</title>
<link href="~/dist/skin/pink.flag/css/jplayer.pink.flag.min.css" rel="stylesheet" type="text/css" />
<link href="~/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="~/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />
<script>

View File

@ -11,7 +11,7 @@
<title>انتخاب قطعهٔ موسیقی مرتبط با شعر از بیپتونز</title>
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/spotify.css" rel="stylesheet" type="text/css" />
<script src="/lib/jquery/dist/jquery.min.js"></script>

View File

@ -14,7 +14,7 @@
@ViewData["Title"]
</title>
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />

View File

@ -10,7 +10,7 @@
<title>انتخاب قطعه‌ای از برنامهٔ گلها مرتبط با این شعر</title>
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/spotify.css" rel="stylesheet" type="text/css" />
<script src="/lib/jquery/dist/jquery.min.js"></script>
<script src="~/js/golha.js"></script>

View File

@ -17,7 +17,7 @@
<meta name="robots" content="noindex, nofollow" />
}
<link href="/dist/skin/blue.monday/css/jplayer.blue.monday.min.css" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/fab.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />

View File

@ -13,7 +13,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="hdr">

View File

@ -11,7 +11,7 @@
<title>پیشنهاد شعر مرتبط با تصویر</title>
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/spotify.css" rel="stylesheet" type="text/css" />
<script src="/lib/jquery/dist//jquery.min.js"></script>

View File

@ -9,7 +9,7 @@
<meta charset="utf-8" />
<title>درخواست حذف حاشیه</title>
<script src="/lib/jquery/dist/jquery.min.js"></script>
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<style>
label{
width:100px;

View File

@ -12,7 +12,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="hdr">

View File

@ -15,7 +15,7 @@
@Html.Raw(ViewData["Title"])
</title>
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/fab.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
<link href="/dist/skin/blue.monday/css/jplayer.blue.monday.min.css" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/fab.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />

View File

@ -9,7 +9,7 @@
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
<link href="/dist/skin/blue.monday/css/jplayer.blue.monday.min.css" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/fab.css" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />

View File

@ -12,7 +12,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="hdr">

View File

@ -11,7 +11,7 @@
<title>انتخاب قطعهٔ موسیقی مرتبط با شعر از اسپاتیفای</title>
<meta name="robots" content="noindex, nofollow" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link href="/css/spotify.css" rel="stylesheet" type="text/css" />
<script src="/lib/jquery/dist/jquery.min.js"></script>

View File

@ -14,7 +14,7 @@
گنجور &raquo; برگردان‌ها و نویس‌های شعر
</title>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<link href="~/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="~/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />
</head>

View File

@ -14,7 +14,7 @@
@ViewData["Title"]
</title>
<link href="/css/p8.css?version=3" rel="stylesheet" type="text/css" />
<link href="/css/p8.css?version=4" rel="stylesheet" type="text/css" />
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<link rel="search" type="application/opensearchdescription+xml" title="گنجور" href="https://ganjoor.net/search.xml" />

View File

@ -296,7 +296,7 @@ a img {
background-color: #f99
}
div.spacer, .item, .b2 {
div.spacer, .item, .b2, .c {
clear: both;
}
@ -358,7 +358,7 @@ div.n, div.l {
text-align: right;
}
.b2 p {
.b2 p, .c p {
text-align: center;
}

View File

@ -29,6 +29,10 @@
/// </summary>
Single = 4, //مصرعهای شعرهای نیمایی یا آزاد
/// <summary>
/// Comment
/// </summary>
Comment = 5, //پاراگرافهایی که حالت توضیحی دارند
/// <summary>
/// Non-poem paragraph
/// </summary>
Paragraph = -1, //نثر

View File

@ -5844,6 +5844,11 @@
Free form verse
</summary>
</member>
<member name="F:RMuseum.Models.Ganjoor.VersePosition.Comment">
<summary>
Comment
</summary>
</member>
<member name="F:RMuseum.Models.Ganjoor.VersePosition.Paragraph">
<summary>
Non-poem paragraph

View File

@ -281,7 +281,7 @@ namespace RMuseum.Services.Implementation
{
totalVerseCount += await context.GanjoorVerses.Where(v => v.PoemId == poem.Id).CountAsync();
var verses = await context.GanjoorVerses.AsNoTracking()
.Where(v => v.PoemId == poem.Id && v.VersePosition != VersePosition.Left && v.VersePosition != VersePosition.CenteredVerse2)
.Where(v => v.PoemId == poem.Id && v.VersePosition != VersePosition.Left && v.VersePosition != VersePosition.CenteredVerse2 && v.VersePosition != VersePosition.Comment)
.OrderBy(v => v.VOrder)
.ToListAsync();
for (int coupletIndex = 0; coupletIndex < verses.Count; coupletIndex++)

View File

@ -846,6 +846,8 @@ namespace RMuseum.Services.Implementation
poemtext = poemtext.Replace("<div class=\"n\">", "s");
poemtext = poemtext.Replace("<div class=\"l\"><p>", "l");
poemtext = poemtext.Replace("<div class=\"l\">", "l");
poemtext = poemtext.Replace("<div class=\"c\"><p>", "c");
poemtext = poemtext.Replace("<div class=\"c\">", "c");
poemtext = poemtext.Replace("<p>", "p");
poemtext = poemtext.Replace("bmp", "b");
poemtext = poemtext.Replace("np", "n");
@ -859,7 +861,7 @@ namespace RMuseum.Services.Implementation
if (poemtext.Length > 0)
{
int idx = poemtext.IndexOfAny(new char[] { 'a', 'b', 'm', 'n', 'p', 's', 'l' });
int idx = poemtext.IndexOfAny(new char[] { 'a', 'b', 'm', 'n', 'p', 's', 'l' , 'c' });
bool preWasBand = false;
while (idx != -1)
{
@ -896,8 +898,12 @@ namespace RMuseum.Services.Implementation
verse.VersePosition = VersePosition.Single;
preWasBand = false;
break;
case 'c':
verse.VersePosition = VersePosition.Comment;
preWasBand = false;
break;
}
int nextIdx = poemtext.IndexOfAny(new char[] { 'a', 'b', 'm', 'n', 'p', 's', 'l' }, idx + 1);
int nextIdx = poemtext.IndexOfAny(new char[] { 'a', 'b', 'm', 'n', 'p', 's', 'l' , 'c' }, idx + 1);
if (nextIdx == -1)
{
verse.Text = poemtext.Substring(idx + 1).Replace("یییییییییییییییییییی", "Adaptation du milieu").Replace("ببببببببب", "Empirique");

View File

@ -852,6 +852,11 @@ namespace RMuseum.Services.Implementation
htmlText += $"<div class=\"m2\"><p>{v.Text}</p></div></div>{Environment.NewLine}";
}
else
if(v.VersePosition == VersePosition.Comment)
{
htmlText += $"<div class=\"c\"><p>{v.Text}</p></div>{Environment.NewLine}";
}
else
if (v.VersePosition == VersePosition.Paragraph || v.VersePosition == VersePosition.Single)
{
coupletIndex++;