Swiftpack.co - Harumaru169/PencakeParser as Swift Package

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

PencakeParser

CLI tool that converts PenCake's articles or stories into a JSON file.

PencakeParserCore is a library for converting stories to in-memory representation.

Usage

pencakeparser command

$ pencakeparser story path_to_story_directory --pretty-printed
{
  "exportedDate" : 662745042,
  "createdDate" : 595585385,
  "title" : "My Story",
  "subtitle" : "Subtitle",
  "articles" : [
    ...
  ]
}

$ pencakeparser story path_to_story_directory -p >> story.json

PencakeParserCore

import PencakeParserCore

Task {
    let storyURL = URL(fileURLWithPath: "path_to_story_directory")
    let story: Story = try await StoryParser.shared.parse(directoryURL: storyURL)
    
    print("article count: \(story.articles.count)")
    
    let jsonEncoder = JSONEncoder()
    let jsonData = try jsonEncoder.encode(story)
    print(String(data: jsonData, encoding: .utf8) ?? "nil")
}

Installation

via SwiftPM

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

GitHub

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

Release Notes

Initial release
2 weeks ago

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