Skip to content

Commit

Permalink
added text parsing to omit html tags in length checking (#1410)
Browse files Browse the repository at this point in the history
* added text parsing to omit html tags in length checking

* fixed function to remove markdown tags

* added comment for the RE
  • Loading branch information
umar8hassan authored Jun 24, 2024
1 parent 70e7afe commit 260cab1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion course-v2/layouts/partials/course_description.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{ $courseData := .context.Site.Data.course }}
{{ $shouldCollapseDescription := false }}
{{ with $courseData.course_description }}
{{ $shouldCollapseDescription = gt (len .) 320 }}
<!-- This matches the text inside the square brackets and keeps it, removing the actual link part. -->
{{ $plainDescription := . | replaceRE `\[(.*?)\]\(.*?\)` `$1` }}
{{ $shouldCollapseDescription = gt (len $plainDescription) 320 }}
{{ end }}
<div id="course-description">
<h4 class="course-detail-title">
Expand Down

0 comments on commit 260cab1

Please sign in to comment.