File tree Expand file tree Collapse file tree 2 files changed +11
-13
lines changed
DasBlog.Web.UI/TagHelpers/Post Expand file tree Collapse file tree 2 files changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -95,15 +95,3 @@ Global
95
95
SolutionGuid = {8F3ACFB8-CB52-4953-A1CF-4151E2789889}
96
96
EndGlobalSection
97
97
EndGlobal
98
-
99
- string pattern = @"<img.*?src="".*?"".*?>" ;
100
- Regex rx = new Regex (pattern );
101
- var numberImages = string .Empty ;
102
- foreach (Match m in rx .Matches (Post .Content ))
103
- {
104
- var numberImages = m.Count;
105
- }
106
-
107
- var imgMinutes = (numberImages *30)/60 ;
108
- var delimiters = news char [] { ' ', '\r', '\n' } ;
109
- var minute = Math .Round ((double )dasBlogSettings .FilterHtml (Post .Content ).Split (delimiters , StringSplitOptions .RemoveEmptyEntries ).Length / 200 ) + imgMinutes ;
Original file line number Diff line number Diff line change @@ -20,8 +20,18 @@ public PostReadTimeTagHelper(IDasBlogSettings dasBlogSettings)
20
20
21
21
public override void Process ( TagHelperContext context , TagHelperOutput output )
22
22
{
23
+
24
+ string pattern = @"<img.*?src="".*?"".*?>" ;
25
+ Regex rx = new Regex ( pattern ) ;
26
+ var numberImages = string . Empty ;
27
+ foreach ( Match m in rx . Matches ( Post . Content ) )
28
+ {
29
+ var numberImages = m . Count ;
30
+ }
31
+
32
+ var imgMinutes = ( numberImages * 30 ) / 60 ;
23
33
var delimiters = new char [ ] { ' ' , '\r ' , '\n ' } ;
24
- var minute = Math . Round ( ( double ) dasBlogSettings . FilterHtml ( Post . Content ) . Split ( delimiters , StringSplitOptions . RemoveEmptyEntries ) . Length / 200 ) ;
34
+ var minute = Math . Round ( ( double ) dasBlogSettings . FilterHtml ( Post . Content ) . Split ( delimiters , StringSplitOptions . RemoveEmptyEntries ) . Length / 200 ) + imgMinutes ;
25
35
26
36
output . TagName = "span" ;
27
37
output . TagMode = TagMode . StartTagAndEndTag ;
You can’t perform that action at this time.
0 commit comments