Kavita icon indicating copy to clipboard operation
Kavita copied to clipboard

EPUB3 Issues (Zeedif)

Open majora2007 opened this issue 3 years ago • 1 comments

  • Implement support for Header tags within nav elements (docnet doesn't support)

majora2007 avatar Jan 30 '22 23:01 majora2007

I'm having 3 issues when trying to use Kavita:

Issue 1:

This error occurs when a title <hN> is inside a <nav> tag on the toc.xhtml. This makes the EPub index is not to be showed inside Kavita. If the <hN> tag is removed from the <nav> tag, the index is showed on small EPubs, but this solution doesn't work on big EPubs with more than one xhtml documets. On these documents, the console logs Internal Server Error followed by this error log:

fail: API.Middleware.ExceptionMiddleware[0]
      There was an exception
      System.InvalidOperationException: Sequence contains more than one matching element
         at System.Linq.ThrowHelper.ThrowMoreThanOneMatchException()
         at System.Linq.Enumerable.TryGetSingle[TSource](IEnumerable`1 source, Func`2 predicate, Boolean& found)
         at API.Controllers.BookController.GetBookChapters(Int32 chapterId) in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Controllers\BookController.cs:line 0
         at lambda_method723(Closure , Object )
         at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
         at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
         at API.Startup.<>c.<<Configure>b__4_3>d.MoveNext() in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Startup.cs:line 270
      --- End of stack trace from previous location ---
         at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
         at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
         at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.InvokeCore(HttpContext context)
         at API.Middleware.ExceptionMiddleware.InvokeAsync(HttpContext context) in C:\Users\josep\Documents\Projects\KavitaOrg\Kavita\API\Middleware\ExceptionMiddleware.cs:line 30

In addition to this, removing the <hN> tag from the <nav> tag it's not the standard structure/formatting proposed by W3.

Also, the Sigil editor (tool i use for modeling my EBooks) puts the <hN> inside the <nav> tag again. Which makes a hard work to edit all files just to adapt it to the Kavita format.

Issue 2:

Clicking on anchor references like <a href = 'document.xhtml'> from a browser opens a new tab ( for example :http://localhost:5000/Section0001.xhtml ). Analizing Issue 1, i discovered both errors happens because the anchor reference does not look like this <a href = '../Text/documentName.extension'>. If the anchor reference is used this way, both problems dissapear but this ain't correct using the standard structure mentioned before. Besides, the reference is inside the same document, so it turns in a meandering thing.

Issue 3:

This problem is related to i use notes via sup tags that links to a file called notes.xhtml where i include a paragraph list with <a href = '...'> tags from each note. This way, every anchor reference takes me back to the sup tag inside the EPub body. But in the Kavita's visualizer, the notes inside the EPub body don't take me to the notes.xhtml document, but the <a> tags in this last document work as intended taking me back to the sup tag.

zeedif avatar Jan 31 '22 00:01 zeedif

I believe I took care of these in v0.7.3. If any of these are still present, please leave a comment and I'll re-open the issue.

majora2007 avatar Jun 18 '23 16:06 majora2007