aozoraconv

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2023 License: MIT Imports: 8 Imported by: 0

README

aozoraconv

MIT License GoDoc Go Report Card Releases

Original code is github.com/takahashim/aozoraconv
This fork adds go mod support and features to escape ruby, annotations, etc.


aonzoraconv is a tool/library to convert Shift_JIS <-> Unicode texts in Aozora Bunko Format.

aozoraconvは青空文庫形式のテキストをShift_JISからUnicodeに変換したり、その逆を行ったりするためのツール兼ライブラリです。

Documentation

Overview

Package aozoraconv provides Aozora Bunko format encodings (JIS X 0208/Shift_JIS).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Conv

func Conv(w io.Writer, r io.Reader, opts ...OptionFunc) error

Conv replaces some characters in Unicode

func ConvRev

func ConvRev(w io.Writer, r io.Reader, opts ...OptionFunc) error

ConvRev replaces some characters in Unicode

func Decode

func Decode(output io.Writer, input io.Reader, opts ...OptionFunc) (err error)

Decode convert from UTF-8 into Aozora Bunko format (Shift_JIS)

func Encode

func Encode(output io.Writer, input io.Reader, opts ...OptionFunc) (err error)

Encode convert from Aozora Bunko format (Shift_JIS) into UTF-8

func Is0208

func Is0208(men, ku, ten int) bool

Is0208 checks triplet men-ku-ten is in JIS X 0208 or not

func Jis2Uni

func Jis2Uni(men, ku, ten int) (str string, err error)

Jis2Uni returns a string from jis codepoint

func Kuten2Sjis

func Kuten2Sjis(ku, ten int) []byte

Kuten2Sjis returns SJIS byte strings (2 byte) from ku-ten code

func NewAozoraTextScanner

func NewAozoraTextScanner(r io.Reader) *bufio.Scanner

NewTextScanner aozora text line-feed 'CRLF' scanner

func NewDefaultTextScanner

func NewDefaultTextScanner(r io.Reader) *bufio.Scanner

func SplitCRLF

func SplitCRLF(data []byte, atEOF bool) (int, []byte, error)

Types

type Escaper

type Escaper interface {
	Escape(string) (out string, continues bool)
}

func NewEscape

func NewEscape(opt *option) Escaper

type JisEntry

type JisEntry struct {
	// contains filtered or unexported fields
}

JisEntry is jis character with men, ku, ten

func Uni2Jis

func Uni2Jis(str string) (jis JisEntry, err error)

Uni2Jis returns a pointer of JisEntry

type OptionFunc

type OptionFunc func(*option)

func WithoutAnnotation

func WithoutAnnotation() OptionFunc

func WithoutHeader

func WithoutHeader() OptionFunc

func WithoutRepeatTwo

func WithoutRepeatTwo() OptionFunc

func WithoutRuby

func WithoutRuby() OptionFunc

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL