Skip to content

Commit

Permalink
Bump 3.0.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeShkurko committed Mar 11, 2021
1 parent 96a8087 commit 22ed855
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 57 deletions.
64 changes: 38 additions & 26 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,67 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
The format is based on Keep a Changelog(http://keepachangelog.com/en/1.0.0/)
and this project adheres to Semantic Versioning(http://semver.org/spec/v2.0.0.html).

## Unreleased
## 3.0.0-dev.3
### Changed
- At `EpubReader.{openBook, readBook}` first argument can be future (not before)

## 3.0.0-dev.2
### Fixed
- Fixed null-safety bug

## 3.0.0-dev.1
### Added
- Null-safety migration
### Changed
- Upgrade all dependencies

## [2.1.0] - 2019-08-06
## 2.1.0
### Fixed
- Version 3 EPUBs can have a null Table of Contents
- Version 3 EPUB's can have a null Table of Contents
- Updated `pedantic` analysis options

## [2.0.7] - 2019-05-22
## 2.0.7
### Added
- Added example of using `epub` in a web page: `examples/web_ex`
### Fixed
- Fixed errors from pedantic analysis
### Changed
- Added pedantic analysis options

## [2.0.6] - 2019-05-22
## 2.0.6
### Fixed
- Fixed Issue #35: File cannot be opened if its path is url-encoded in the manifest
- Updated `examples/dart_ex` to have a README as well as use a locally stored file.

## [2.0.5] - 2019-05-16
## 2.0.5
### Changed
- Exposed `EpubChapterRef` to consumers.

## [2.0.4] - 2019-05-15
## 2.0.4
### Fixed
- Merged pull request #45
- Fixes pana hits to make code more readable

## [2.0.3] - 2019-05-15
## 2.0.3
### Changed
- Raised `sdk` version constraint to 2.0.0
- Raised constraint on `async` to 3.0.0
### Fixed
- Merged pull request #40 by vblago.
- Fixes Undefined class 'XmlBuilder'

## [2.0.2] - 2018-08-07
## 2.0.2
### Changed
- Lowered sdk version constraint to 2.0.0-dev.61.0

## [2.0.1] - 2018-08-07
## 2.0.1
### Changed
- Formatted documents

## [2.0.0] - 2018-08-07
## 2.0.0
### Added
- Added support for writing Epubs back to Byte Arrays
- Tests for writing Epubs
Expand All @@ -60,61 +72,61 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Fixed an issue when reading EpubContentFileRef

## [1.3.2] - 2018-08-01
## 1.3.2
### Changed
- Updates to Travis configuration and publishing

## [1.3.1] - 2018-08-01
## 1.3.1
### Changed
- Updates to Travis configuration and publishing
### Removed
- Removed unused variable `FilePath` from `EpubBook` and `EpubBookRef`

## [1.3.0] - 2018-08-01
## 1.3.0
### Added
- Package now supports Dart 2!
### Removed
- Removed support for Dart 1.2.21

## [1.2.10] - 2018-07-29
## 1.2.10
### Fixed
- Merged pull request #15 from ShadowJonathan/dev.
- Fixes issue with parsing schema by removing `opf:` namespace

## [1.2.9] - 2018-03-13
## 1.2.9
### Changed
- Ran code through `dartfmt` as per analysis by `pana`

## [1.2.8] - 2018-03-13
## 1.2.8
### Added
- Added unit tests for Images
### Changed
- Updated dependencies

## [1.2.7] - 2018-03-13
## 1.2.7
### Added
- Added upper limit of Dart version to 2.0.1

## [1.2.6] - 2018-03-12
## 1.2.6
### Added
- Added Support for Dart 2.0

## [1.2.5] - 2018-02-20
## 1.2.5
### Added
- A publish step in the travis deploy

## [1.2.4] - 2018-01-26
## 1.2.4
### Changed
- EnumFromString no longer uses the `mirrors` package to make this Flutter compatible by @MostafaAyesh

## [1.2.3] - 2018-01-26
## 1.2.3
### Added
- This Changelog!

### Changed
- Author email

## [1.2.2] - 2017-01-26
## 1.2.2
### Changed
- Dependencies were updated to more permissive versions by @jarontai

Expand All @@ -126,6 +138,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Issue with case sensitivity in switch statements from @jarontai
- Issue with Async Loops from @jarontai

## [1.2.1] - 2017-05-28
## 1.2.1
### Fixed
- Made code in line with Dart styleguide
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
# epubx

dart-epub fork
It package is [dart-epub](https://github.com/orthros/dart-epub) fork

[Flutter UI implementation](https://pub.dev/packages/epub_view)

Epub Reader and Writer for Dart inspired by [this fantastic C# Epub Reader](https://github.com/versfx/EpubReader)

This does not rely on the ```dart:io``` package in any way, so it is avilable for both desktop and web-based implementations

[![pub package](https://img.shields.io/pub/v/epubx.svg)](https://pub.dartlang.org/packages/epubx)
## Installing
Add the package to the ```dependencies``` section of your pubspec.yaml
```
dependencies:
epubx: ^3.0.0-dev.1
epubx: any
```

## Example
```dart
//Get the epub into memory somehow
String fileName = "hittelOnGoldMines.epub";
String fileName = 'sample.epub';
String fullPath = path.join(io.Directory.current.path, fileName);
var targetFile = new io.File(fullPath);
List<int> bytes = await targetFile.readAsBytes();
Expand Down Expand Up @@ -58,7 +61,7 @@ epubBook.Chapters.forEach((EpubChapter chapter) {
// CONTENT
// Book's content (HTML files, stlylesheets, images, fonts, etc.)
// Book's content (HTML files, stylesheets, images, fonts, etc.)
EpubContent bookContent = epubBook.Content;
Expand Down
13 changes: 0 additions & 13 deletions example/flutter_ex/ios/Flutter/flutter_export_environment.sh

This file was deleted.

33 changes: 22 additions & 11 deletions lib/src/epub_reader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ import 'schema/opf/epub_metadata_creator.dart';

class EpubReader {
/// Opens the book asynchronously without reading its content. Holds the handle to the EPUB file.
static Future<EpubBookRef> openBook(List<int> bytes) async {
var epubArchive = ZipDecoder().decodeBytes(bytes);
static Future<EpubBookRef> openBook(FutureOr<List<int>> bytes) async {
List<int> loadedBytes;
if (bytes is Future) {
loadedBytes = await bytes;
} else {
loadedBytes = bytes;
}

var epubArchive = ZipDecoder().decodeBytes(loadedBytes);

var bookRef = EpubBookRef(epubArchive);
bookRef.Schema = await SchemaReader.readSchema(epubArchive);
Expand All @@ -31,15 +38,21 @@ class EpubReader {
.map((EpubMetadataCreator creator) => creator.Creator)
.toList();
bookRef.Author = bookRef.AuthorList!.join(', ');
bookRef.Content = await ContentReader.parseContentMap(bookRef);
bookRef.Content = ContentReader.parseContentMap(bookRef);
return bookRef;
}

/// Opens the book asynchronously and reads all of its content into the memory. Does not hold the handle to the EPUB file.
static Future<EpubBook> readBook(List<int> bytes) async {
static Future<EpubBook> readBook(FutureOr<List<int>> bytes) async {
var result = EpubBook();

var epubBookRef = await openBook(bytes);
List<int> loadedBytes;
if (bytes is Future) {
loadedBytes = await bytes;
} else {
loadedBytes = bytes;
}

var epubBookRef = await openBook(loadedBytes);
result.Schema = epubBookRef.Schema;
result.Title = epubBookRef.Title;
result.AuthorList = epubBookRef.AuthorList;
Expand All @@ -58,7 +71,7 @@ class EpubReader {
result.Css = await readTextContentFiles(contentRef.Css!);
result.Images = await readByteContentFiles(contentRef.Images!);
result.Fonts = await readByteContentFiles(contentRef.Fonts!);
result.AllFiles = Map<String?, EpubContentFile>();
result.AllFiles = <String?, EpubContentFile>{};

result.Html!.forEach((String? key, EpubTextContentFile value) {
result.AllFiles![key] = value;
Expand Down Expand Up @@ -86,8 +99,7 @@ class EpubReader {

static Future<Map<String?, EpubTextContentFile>> readTextContentFiles(
Map<String?, EpubTextContentFileRef> textContentFileRefs) async {
var result =
Map<String?, EpubTextContentFile>();
var result = <String?, EpubTextContentFile>{};

await Future.forEach(textContentFileRefs.keys, (dynamic key) async {
EpubContentFileRef value = textContentFileRefs[key]!;
Expand All @@ -103,8 +115,7 @@ class EpubReader {

static Future<Map<String?, EpubByteContentFile>> readByteContentFiles(
Map<String?, EpubByteContentFileRef> byteContentFileRefs) async {
var result =
Map<String?, EpubByteContentFile>();
var result = <String?, EpubByteContentFile>{};
await Future.forEach(byteContentFileRefs.keys, (dynamic key) async {
result[key] = await readByteContentFile(byteContentFileRefs[key]!);
});
Expand Down
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: epubx
version: 3.0.0-dev.2
version: 3.0.0-dev.3
description: Epub Parser for Dart. Suitable for use on the Server, the Web, or in Flutter
homepage: https://github.com/rbcprolabs/epubx.dart

Expand All @@ -14,6 +14,6 @@ dependencies:
collection: ^1.15.0-nullsafety.4

dev_dependencies:
test: "^1.0.0"
path: "^1.5.1"
test: ^1.16.7
path: ^1.8.0
pedantic: ^1.11.0

0 comments on commit 22ed855

Please sign in to comment.