Giter VIP home page Giter VIP logo

vivliostyle-sitegen's Introduction

Vivliostyle

GitHub tag Build Status Sauce Test Status GitHub contributors PR's welcome

Vivliostyle is an open source project for a new typesetting system based on web standard technology.

Vivliostyle.js offers HTML+CSS typesetting and rich paged viewing with EPUB/Web publications support.

🌏 Vivliostyle.org
📖 Documentation
🤝 Join Community
🕶 Awesome Vivliostyle
💅 Vivliostyle Themes

Table of contents

Packages

npm: version npm: total downloads

A core library for HTML+CSS typesetting with EPUB/Web publications support.

See API Reference for further details.

npm: version npm: total downloads

A web app provides intuitive UI for Vivliostyle.

Use officially-hosted Vivliostyle Viewer or download a distribution package from https://vivliostyle.github.io.

npm: version npm: total downloads

A command-line interface of Vivliostyle.

npm: version npm: total downloads

Use React component as a Vivliostyle renderer.

npm: version npm: total downloads

Vivliostyle Flavored Markdown (VFM) is a Markdown syntax optimized for book authoring. It is standardized and published for Vivliostyle and its sibling projects.

npm: version npm: total downloads

Vivliostyle Print allows page-layouting using Vivliostyle Core for printing within a website without destroying the original layout.

npm: version npm: total downloads

The fastest way to start writing book with Vivliostyle ecosystem.

npm: total downloads

Create Vivliostyle theme at ease.

Contribution

Bug Reports & Feature Requests

Please report on GitHub Issues.

Contributors ✨

Thanks goes to these wonderful people (emoji key):

sorotokin
sorotokin

💻
KAWAKUBO Toru
KAWAKUBO Toru

💻
Satoru MATSUSHIMA (℠)
Satoru MATSUSHIMA (℠)

💻
Seiya Konno
Seiya Konno

💻
Johannes Wilm
Johannes Wilm

💻
Florian Rivoal
Florian Rivoal

💻
Satoshi KOJIMA
Satoshi KOJIMA

💻
Masaya Yamauchi
Masaya Yamauchi

💻
Shinyu Murakami
Shinyu Murakami

💻 📖 📢
Shota Kubota
Shota Kubota

💻
spring-raining
spring-raining

💻 📖 📢
Hiroshi Hatake
Hiroshi Hatake

💻
takanakahiko
takanakahiko

💻
Yasuaki Uechi
Yasuaki Uechi

💻 📖 🎨 📢
Zachary Waldowski
Zachary Waldowski

💻
yamasy1549
yamasy1549

💻 🎨
OGATA Katsuhiro
OGATA Katsuhiro

📝 📋
akabeko
akabeko

🖋 🤔
youchan
youchan

💻 📢
Yuku Kotani
Yuku Kotani

💻
Christoph Päper
Christoph Päper

💻
Ikko Eltociear Ashimine
Ikko Eltociear Ashimine

💻
Takai ayumu
Takai ayumu

💻 📢
daisuke-tanabe
daisuke-tanabe

💻
Hiroaki KAWAI
Hiroaki KAWAI

💻
Enoch Gao
Enoch Gao

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Bronze Sponsor

License

Licensed under AGPL Version 3.

Vivliostyle Core is implemented based on Peter Sorotokin's EPUB Adaptive Layout implementation, which is licensed under Apache License, Version 2.0.

Credits

Powered By Vercel

Testing Powered By SauceLabs

vivliostyle-sitegen's People

Contributors

akabekobeko avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vivliostyle-sitegen's Issues

ページ生成をコールバック関数でカスタマイズ可能とする

ページ生成をコールバック関数でカスタマイズ可能とする。GatsbyGatsby Node APIs のような機能を想定。

  • ユーザーはプロジェクトのルートに vivliostyle.sitegen-node.js を用意する
    • ファイル名は一考の余地あり
    • 既に設定ファイルとして vivliostyle.sitegen.js がある、これも -config.js にしたほうがよいかも
  • 必要なコールバック関数を公開する
    • できれば TypeScript にしたい、次点で ESM
    • ダメなら CommonJS にするがそれでも exports.createPage のように名前付きとしたい
  • コールバック関数を検出したら通常のページ生成ではなく、そちらを呼びだす
    • 設計的に HTML 生成とファイル書き出しを分離しておくとよさそう
    • gatsby-node.js だと全ページのデータを渡しているようだが、メモリー使用量とか効率面の工夫があるのだろうか?
    • タグやカテゴリーのページ生成をするにはメタデータだけも全ページ先行解析が必要
    • ブログで前後記事のナビゲーションをリンクするのにも必要

サンプルを用意する

現在ひとつのサンプルを examples に用意しているが、用途別に複数提供したい。

  • simple
    • なにもカスタマイズしていない状態のサンプル
  • blog
    • ブログ用サンプル
    • createPages によるカスタマイズあり
    • Frontmatter の date により日時降順 (最新を先頭) でソートする
    • Frontmatter の tagscategories からタグとカテゴリーのページを生成
    • 最新記事 10 をトップとして生成
    • ブログの前後記事リンクを生成

現行サンプルと同様に最初は npm publish してない開発用ソースを直に参照する。v1.0 以降で publish されたら、それを npm 参照するように修正予定。

ページ生成を再設計する

#2 対応を一通り終えたので watch による差分更新を再設計する。

現在は Markdown ファイルとして用意されているページのみ HTML 化している。しかしカテゴリーやタグなど Markdown のメタデータに基づく別ページも作成したい。

  • createPage で Markdown ファイルではなく Markdown テキストを指定する
    • Content[] には Markdown テキストが既に指定されるので、これはそのまま処理可能
    • カテゴリーやタグの場合、メタデータと EJS テンプレートだけで生成可能なので Markdown テキストは空文字でよい
  • createPagepublic/ 上の HTML 出力パスを指定可能とする
    • 現在の Content.htmlFilePath 相当
    • Markdown ファイルと対応しないページについて Content を生成するか?それとも引数展開して Content 依存を解消するか?

ファイル更新時の差分ページ出力について。

createPages に更新情報を渡して Contents[] と共に差分処理をユーザーへ委ねるつもりだったが、これは面倒で負担が大きいため改善したい。GatsbyJS のようにユーザーは

  • createPages を実装して createPage 経由でページ生成をリクエストする
  • ファイル更新も含めた実際のページ出力は sitegen 側に委ねる

としたい。そのための方法として以下を検討。

  • Content[] と別にページ出力候補のデータを持つ
  • データは public/ 上に出力されるファイルを要素としたコレクションで Array または Object
    • Array の場合、要素に識別子を持たせる、これは public/ 上のファイル パスでよさそう
    • Object の場合、Key を識別子とする、これは public/ 上のファイル パスでよさそう
    • パスの大文字と小文字を区別する OS 想定で lowercase にして区別しないことを強制する?
    • GatsbyJS だとパスではなく ID を生成しているようだ
  • createPage からリクエストされたデータに対応する出力候補を検索、Object の diff を取る
    • deep-object-diff を使うのが手軽でよさそう
    • ファイルの削除で Content[] の数が増減した場合、ブログの前後記事リンク用メタデータが更新されるので対象と前後記事データについて diff 発生、差分更新されることが期待できる

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.