jpugdoc

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MTTransStart = "«"
	MTTransEnd   = "»"
	MTL          = len(MTTransStart)
)

Variables

View Source
var (
	ErrVersionTag = fmt.Errorf("version tag error")
	ErrMemberName = fmt.Errorf("member name error")
	ErrNoMatch    = fmt.Errorf("no match")
)
View Source
var BLANKBRACKET = regexp.MustCompile(`(?s)(<\!--\n(.*?)-->\n(.*?))(《》)\n`)
View Source
var BLANKBRACKET2 = regexp.MustCompile(`(?s)(.*?)-->\n(.*?)(《》)\n`)
View Source
var BLANKLINE = regexp.MustCompile(`^\s*\n`)
View Source
var BLANKSLINE = regexp.MustCompile(`(?m)^\n+`)
View Source
var CHECKPARA = regexp.MustCompile(`\s*(<!--\n?\s+)?(?s)(<para>\n*)(.*?)(\s*</para>)(\n*\s*-->)?`)

<para> </para> に一致させる(チェック用)

View Source
var CLOSEPARA = regexp.MustCompile(`</para>`)
View Source
var COMMENTEND = regexp.MustCompile(`-->`)
View Source
var COMMENTSTART = regexp.MustCompile(`<!--`)
View Source
var Config jpugDocConfig
View Source
var DicDir = filepath.Join(".", ".jpug-doc-tool/")
View Source
var ENAUTHOR = regexp.MustCompile(`\([a-zA-ZÀ-ÿ, \.\-]+\)$`)
View Source
var ENDADDCOMMENT = regexp.MustCompile(`\+-->$`)

コメント終わりの追加に一致

View Source
var ENDADDCOMMENTWITHC = regexp.MustCompile(`\+--><\!\[CDATA\[`)

コメントが終わりCDATAの始まりに一致

View Source
var ENDCOMMENT = regexp.MustCompile(`-->$`)

最後がコメント終わりに一致

View Source
var ENDINDEXTERM = regexp.MustCompile(`</indexterm`)

indexterm終わりに一致

View Source
var ENNUM = regexp.MustCompile(`[0-9,]+`)

数値

View Source
var ENTRYSTRIP = regexp.MustCompile(`</?entry>`)

<entry> </entry> と一致

View Source
var ENWORD = regexp.MustCompile(`[/a-zA-Z_]+`)

英単語 + /

View Source
var EXCOMMENT = regexp.MustCompile(`(?s)<!--(.*?)-->(.*?)(</row>|<!--|<note>|<informaltable>|<footnote>|<screen>|<synopsis>|<variablelist>|<programlisting>|<itemizedlist>|<simplelist>|<itemizedlist|<orderedlist|</para>)`)

コメント(英語原文)と続く文書(日本語翻訳)を取得 100%一致する訳ではない

View Source
var KATAKANA = regexp.MustCompile(`[ァ-ヺー・]+`)

カタカナ

View Source
var KUTEN = regexp.MustCompile(`。`)
View Source
var KUTEN2 = regexp.MustCompile(`。)? ?`)
View Source
var MTMARKREG = regexp.MustCompile(`«(.*?)»`)
View Source
var MultiNL = regexp.MustCompile(`\n+`)
View Source
var MultiSpace = regexp.MustCompile(`\s+`)

複数のスペースと一致

View Source
var NIHONGO = regexp.MustCompile(`[\p{Han}\p{Katakana}\p{Hiragana}]`)

日本語

View Source
var RECHECKTITLE = regexp.MustCompile(`(?s)(<!--\n\s*<title>\n*)(.*?)(\s*</title>\n*\s*-->\n\s*<title>(.*?)</title>)`)

<title> </title> をコメントを含めて一致させる

View Source
var RECOMMENT = regexp.MustCompile(`(?s)<!--(.*?)-->`)

XMLのコメントに一致

View Source
var RECOMMENTEND = regexp.MustCompile(`-->`)

XMLのコメント閉じタグに一致

View Source
var RECOMMENTSTART = regexp.MustCompile(`<!--`)

XMLのコメント開始タグに一致

View Source
var REJASTRING = regexp.MustCompile(`[ぁ-ん]+|[ァ-ヴー]+|[一-龠]/`)

var RELIRET = regexp.MustCompile(`(?s)(<para>\n*)\s*<literal>.*</literal>\n`)

View Source
var RELEASENUM = regexp.MustCompile(`[0-9\.]+`)
View Source
var RELIRET = regexp.MustCompile(`(?s)(<para>\n*)\s*<literal>.*</literal>\n*\s*<returnvalue>.*</returnvalue>(\s*</para>)`)

<para><literal></literal><returnvalue></returnvalue></para>に一致させる

View Source
var RELIRETPROG = regexp.MustCompile(`(?s)(<para>\n*)\s*<literal>.*</literal>\n*\s*<returnvalue>.*</returnvalue>\n*\s*<programlisting>.*</programlisting>(\s*</para>)`)

<para><literal></literal><returnvalue></returnvalue><programlisting></programlisting></para>に一致させる

View Source
var RELITERAL = regexp.MustCompile(`(?s)(<para>\n*)\s*<literal>.*</literal>\n*(\s*</para>)`)

<para><literal></literal></para>に一致させる

View Source
var REPARA = regexp.MustCompile(`(?s)(<para>\n*)(.*?)(\s*</para>)`)

<para> </para> に一致させる

View Source
var REPARA2 = regexp.MustCompile(`(?s)<para>\n(.*?)</para>`)
View Source
var REPARASCREEN = regexp.MustCompile(`(?s)(<para>\n*)(.*?)(\s*(</para>|<screen>|<programlisting>))`)

<para> <screen>|<programlisting> に一致させる

View Source
var REPHIGHHUN = regexp.MustCompile(`&#0?45;`)
View Source
var REROWS = regexp.MustCompile(`(?s)(<row>\n*)(.*?)(\s+</row>)`)

<row> </row> に一致させる

View Source
var RETAG = regexp.MustCompile(`<[^>]+>`)

タグと一致させる

View Source
var RETAGBLOCK = regexp.MustCompile(`^\s*<([^>]+)>\n`)

単独タグ(\s+<programlisting>\nなど)に一致させる

View Source
var RETITLE = regexp.MustCompile(`(?s)(<title>\n*)(.*?)(\s*</title>)`)

<title> </title> に一致させる

View Source
var REVHIGHHUN = regexp.MustCompile(`--`)
View Source
var REVHIGHHUN2 = regexp.MustCompile(`---`)
View Source
var SPLITCATALOG = regexp.MustCompile(`(?s)␝(.*?)␟(.*?)␟(.*?)␞(.*?)␞(.*?)␞`)

カタログから英語と日本語を取得

View Source
var SPLITCOMMENT = regexp.MustCompile(`split-.*-[start|end]`)

split-*コメントに一致

View Source
var STARTADDCOMMENT = regexp.MustCompile(`\+<!--$`)

コメント始まりの追加に一致

View Source
var STARTADDCOMMENTWITHC = regexp.MustCompile(`\+(.*)?\]\]><!--`)

CDATAが終わりコメントの始まりに一致

View Source
var STARTCOMMENT = regexp.MustCompile(`^<!--`)

最初がコメント始まりに一致

View Source
var STARTINDEXTERM = regexp.MustCompile(`<indexterm`)

indexterm始まりに一致

View Source
var STRIPM = regexp.MustCompile(`《.*》`)

《》で囲まれた文字列(作業中)に一致させる

View Source
var STRIPNONJA = regexp.MustCompile(`[\s\,\(\)\.a-zA-Z0-9\-\/\<\>\n*]+$`)

最後尾の日本語以外を除外

View Source
var STRIPNUM = regexp.MustCompile(`,`)

カンマを除外

View Source
var STRIPNUMJ = regexp.MustCompile(`, |,|、`)

カンマを除外

View Source
var STRIPPMT = regexp.MustCompile(`(?s)《機械翻訳》.*`)
View Source
var STRIPPROGRAMLISTING = regexp.MustCompile(`<(programlisting|screen)>.*</(programlisting|screen)>`)

<programlisting>.*</programlisting> を除外

View Source
var STRIPXREFLABEL = regexp.MustCompile(`xreflabel=\".*\"`)

xreflabelは除外

View Source
var TITLE = regexp.MustCompile(`(?U)\n( *<title>[a-zA-Z0-9 \.\-:]+</title>)\n([^\-])`)
View Source
var TITLE2 = regexp.MustCompile(`(?U)<!--\s*(<title>.*</title>)\s*-->\s*(<title>.*</title>)`)
View Source
var Verbose bool
View Source
var Version = "dev"
View Source
var XMLTAG = regexp.MustCompile(`<[^>\!]*?>|<[^<>]+/>`)

XMLタグ

View Source
var YAKUCHU = regexp.MustCompile(`[\(|\[|(]訳注[^\[|\)|)]]*[\]|\)|)]`)

訳注を除外

Functions

func Check

func Check(fileNames []string, cf CheckFlag) error

default check

func CheckWord

func CheckWord(en string, ja string, vTag string, fileNames []string) error

CheckWord は英単語に対して日本語の単語が対になっているかをチェックします。

func Extract

func Extract(fileNames []string) error

ファイル名の配列を受け取り、それぞれのファイル名のdiffから原文と日本語訳の対の配列を抽出し、 それぞれのファイル名に対応するカタログファイル(filename.sgml.t)を作成する

func IgnoreFileNames

func IgnoreFileNames(fileNames []string) []string

func InitJpug

func InitJpug()

func List

func List(wf bool, pre bool, enOnly bool, jaOnly bool, fileNames []string)

英日辞書の内容を表示する wf: ファイル名を表示する pre: preタグを表示する enOnly: 英文のみ表示する jaOnly: 日本語のみ表示する fileNames: ファイル名のリスト

func MT

func MT(w io.Writer, origin string) error

MT はoriginを機械翻訳し出力します。

func MTReplace added in v0.3.0

func MTReplace(fileNames []string, limit int, prompt bool) error

func ParaAll

func ParaAll(src []byte) [][]byte

文書から <para> </para>を取得してsliceで返す

func ReadAllFile

func ReadAllFile(fileName string) ([]byte, error)

func Replace

func Replace(fileNames []string, vTag string, update bool, similar int, mt int, wip bool, prompt bool) error

Replace は指定されたファイル名のファイルを置き換える

func RowsAll

func RowsAll(src []byte) [][]byte

文書から <rows> </rows>を取得してsliceで返す

func StripEntry

func StripEntry(src []byte) []byte

entryタグを取り除くために使用

func TSVList

func TSVList(fileNames []string)

英日辞書の内容をTSV形式で表示する

Types

type Catalog

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

Catalog は原文と日本語訳の対を保持する構造体

func Extraction

func Extraction(diffSrc []byte) []Catalog

diff を原文と日本語訳の対(Catalog)の配列に変換する <para> +<!-- english +--> +japanese </para>

func PARAExtraction

func PARAExtraction(src []byte) []Catalog

一つのファイルから原文と日本語訳の対の配列を抽出する

func (Catalog) String added in v0.3.0

func (c Catalog) String() string

type CheckFlag

type CheckFlag struct {
	VTag   string
	Ignore bool
	WIP    bool
	Para   bool
	Word   bool
	Tag    bool
	Num    bool
	Author bool
	Strict bool
	// contains filtered or unexported fields
}

CheckFlag represents the item to check.

type IgnoreList

type IgnoreList map[string]bool

type MTType added in v0.3.0

type MTType struct {
	APIAutoTranslateType string
	// contains filtered or unexported fields
}

func (*MTType) Replace added in v0.3.0

func (mt *MTType) Replace(src string, prompt bool) (string, error)

func (*MTType) ReplaceText added in v0.3.0

func (mt *MTType) ReplaceText(src string) (string, error)

type Rep

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

Rep は置き換えを行う構造体

Jump to

Keyboard shortcuts

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