Bugfix/anchor rewriting (#260)
* Added book reader reading direction preference * Adds a new marker to the AppUserProgress to capture nearest anchor for resuming scroll point when reading books. Refactored bookmark api to return a BookmarkDto which includes this new data. * Fixed the readme image displaying issue and changed up a bit more of the layout.
This commit is contained in:
parent
4910f1d1d0
commit
e6cfa4feca
2 changed files with 18 additions and 12 deletions
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using API.Entities.Enums;
|
||||
using API.Interfaces;
|
||||
using API.Parser;
|
||||
|
@ -69,9 +70,11 @@ namespace API.Services
|
|||
public static void UpdateLinks(HtmlNode anchor, Dictionary<string, int> mappings, int currentPage)
|
||||
{
|
||||
if (anchor.Name != "a") return;
|
||||
var hrefParts = BookService.CleanContentKeys(anchor.GetAttributeValue("href", string.Empty))
|
||||
var hrefParts = CleanContentKeys(anchor.GetAttributeValue("href", string.Empty))
|
||||
.Split("#");
|
||||
var mappingKey = hrefParts[0];
|
||||
// Some keys get uri encoded when parsed, so replace any of those characters with original
|
||||
var mappingKey = HttpUtility.UrlDecode(hrefParts[0]);
|
||||
|
||||
if (!mappings.ContainsKey(mappingKey))
|
||||
{
|
||||
if (HasClickableHrefPart(anchor))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue