Aozora lorem
The fake text generator using Aozora Bunko. This makes better "ใใใซใใญในใใๅ
ฅใใพใ".
Inspired by faker.js.
Install
npm install @yuheiy/aozora-lorem
Usage
const pug = require('pug')
const { loadBook } = require('@yuheiy/aozora-lorem')
loadBook('https://www.aozora.gr.jp/cards/000081/files/456_15050.html').then(
({ lorem }) => {
const html = pug.render('p= lorem.paragraph()', { lorem })
},
)
API
loadBook(url)
Load data from Aozora Bunko and returns an instance of book
. Specify the URL of the book's XHTML file as an argument.
const { loadBook } = require('@yuheiy/aozora-lorem')
loadBook('https://www.aozora.gr.jp/cards/000081/files/456_15050.html').then(
(book) => {
book.lorem.paragraph()
},
)
book.lorem.content
An array containig all of the content.
book.content
book.lorem.paragraph()
Returens a paragraph at random.
book.lorem.paragraph()
book.lorem.paragraphs(lines = random(1, content.length))
Returns paragraphs of the specified number of lines at random. By default the number of lines is random.
book.lorem.paragraphs(3)
License
The license for this software is MIT.
Details of the license for Aozora Bunko is here.