Swiftpack.co - Harumaru169/PencakeUtils as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Harumaru169.
Harumaru169/PencakeUtils 0.8.0
Tools for PenCake's articles and stories
⭐️ 0
🕓 2 weeks ago
iOS macOS
.package(url: "https://github.com/Harumaru169/PencakeUtils.git", from: "0.8.0")

PencakeUtils

pencake is a CLI tool that converts articles or stories of PenCake app into JSON format.

PencakeParser is a library for converting stories or articles into in-memory representations.

Usage

pencake Command

$ pencake story path_to_story_directory --pretty-printed 
{
  "exportedDate" : 2022-01-19T07:44:27Z,
  "createdDate" : 2022-01-19T07:28:10Z,
  "title" : "My Story",
  "subtitle" : "Subtitle",
  "articles" : [
    ...
  ]
}

$ pencake story path_to_story_zipfile -p >> story.json

$ pencake article path_to_article_file --language ja >> Article_001.json

Run pencake --help to show help information.

PencakeParser Library

import PencakeParser

let storyURL = URL(fileURLWithPath: "path_to_story_directory")

let storyParser = ParallelStoryParser()

let options = ParseOptions(language: .english, newline: .lf)

let story = try await storyParser.parse(directoryURL: storyURL, options: options)

print("article count: \(story.articles.count)")

let jsonEncoder = JSONEncoder()
let jsonData = try jsonEncoder.encode(story)
print(String(data: jsonData, encoding: .utf8) ?? "nil")

Installation

pencake Command

Download source code and run make install in the project directory.

Package Dependency

via SwiftPM:

dependencies: [
    .package(url: "https://github.com/Harumaru169/PencakeUtils", from: "0.8.0")
]

GitHub

link
Stars: 0
Last commit: 2 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Renaming of Symbol Names, Sequential Processing
14 weeks ago
  • Fixed the bug that regex patterns in ArticleParser and StoryInfoParser doesn't match contents with carriage return (#13)
  • Renamed symbols to use the word "info" instead of "information" (#14)
  • Renamed existing StoryParser and PhotosLoader as ParallelStoryParser and ParallelPhotosLoader, then added new StoryParser and PhotosLoader, which are for sequential processing (#16)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics