Documentation
¶
Index ¶
- Constants
- Variables
- func Check(fileNames []string, cf CheckFlag) error
- func CheckWord(en string, ja string, vTag string, fileNames []string) error
- func Extract(vTag string, fileNames []string) error
- func ExtractCommon(vTag string, fileNames []string) error
- func IgnoreFileNames(fileNames []string) []string
- func InitJpug()
- func List(opt ListOoptions, fileNames []string)
- func ListCommon(opt ListOoptions)
- func MT(w io.Writer, origin string) error
- func MTReplace(fileNames []string, limit int, prompt bool) error
- func ParaAll(src []byte) [][]byte
- func ReadAllFile(fileName string) ([]byte, error)
- func Replace(fileNames []string, vTag string, update bool, similar int, mt int, wip bool, ...) error
- func RowsAll(src []byte) [][]byte
- func StripEntry(src []byte) []byte
- func TSVList(strip bool, fileNames []string)
- type Catalog
- type Catalogs
- type CheckFlag
- type IgnoreList
- type ListOoptions
- type MTType
- type Rep
Constants ¶
const ( MTTransStart = "«" MTTransEnd = "»" MTL = len(MTTransStart) )
Variables ¶
var ( ErrVersionTag = fmt.Errorf("version tag error") ErrMemberName = fmt.Errorf("member name error") ErrNoMatch = fmt.Errorf("no match") )
var ( COMMENTSTART = regexp.MustCompile(`<!--`) COMMENTEND = regexp.MustCompile(`-->`) )
var ( MultiSpace = regexp.MustCompile(`\s+`) MultiNL = regexp.MustCompile(`\n+`) )
複数のスペースと一致
var ( KUTEN = regexp.MustCompile(`。`) KUTEN2 = regexp.MustCompile(`。)? ?`) )
var BLANKBRACKET = regexp.MustCompile(`(?s)(<\!--\n(.*?)-->\n(.*?))(《》)\n`)
var BLANKBRACKET2 = regexp.MustCompile(`(?s)(.*?)-->\n(.*?)(《》)\n`)
var BLANKLINE = regexp.MustCompile(`^\s*\n`)
var BLANKSLINE = regexp.MustCompile(`(?m)^\n+`)
var CHECKPARA = regexp.MustCompile(`\s*(<!--\n?\s+)?(?s)(<para>\n*)(.*?)(\s*</para>)(\n*\s*-->)?`)
<para> </para> に一致させる(チェック用)
var CLOSEPARA = regexp.MustCompile(`</para>`)
var Config jpugDocConfig
var DicDir = filepath.Join(".", ".jpug-doc-tool/")
var ENAUTHOR = regexp.MustCompile(`\([a-zA-ZÀ-ÿ, \.\-]+\)$`)
var ENDADDCOMMENT = regexp.MustCompile(`\+-->$`)
コメント終わりの追加に一致
var ENDADDCOMMENTWITHC = regexp.MustCompile(`\+--><\!\[CDATA\[`)
コメントが終わりCDATAの始まりに一致
var ENDCOMMENT = regexp.MustCompile(`-->$`)
最後がコメント終わりに一致
var ENDINDEXTERM = regexp.MustCompile(`</indexterm`)
indexterm終わりに一致
var ENNUM = regexp.MustCompile(`[0-9,]+`)
数値
var ENTRYNEWLINE = regexp.MustCompile(`(?s)<entry>(.*?)</entry>`)
var ENTRYSTRIP = regexp.MustCompile(`</?entry>`)
<entry> </entry> と一致
var ENWORD = regexp.MustCompile(`[/a-zA-Z_]+`)
英単語 + /
var EXCOMMENT = regexp.MustCompile(`(?s)<!--(.*?)-->(.*?)(</row>|<!--|<note>|<informaltable>|<footnote>|<screen>|<synopsis>|<variablelist>|<programlisting>|<itemizedlist>|<simplelist>|<itemizedlist|<orderedlist|</para>)`)
コメント(英語原文)と続く文書(日本語翻訳)を取得 100%一致する訳ではない
var HANKAKUKAKKO = regexp.MustCompile(`\((.*?)\)`)
var KATAKANA = regexp.MustCompile(`[ァ-ヺー・]+`)
カタカナ
var MTMARKREG = regexp.MustCompile(`«(.*?)»`)
var NIHONGO = regexp.MustCompile(`[\p{Han}\p{Katakana}\p{Hiragana}]`)
日本語
var NONSTRIPPERIOD = regexp.MustCompile(`\.\.\.|etc\.|Eg\.`)
文の終わりではないピリオドを除外
var RECHECKTITLE = regexp.MustCompile(`(?s)(<!--\n\s*<title>\n*)(.*?)(\s*</title>\n*\s*-->\n\s*<title>(.*?)</title>)`)
<title> </title> をコメントを含めて一致させる
var RECOMMENT = regexp.MustCompile(`(?s)<!--(.*?)-->`)
XMLのコメントに一致
var RECOMMENTEND = regexp.MustCompile(`-->`)
XMLのコメント閉じタグに一致
var RECOMMENTSTART = regexp.MustCompile(`<!--`)
XMLのコメント開始タグに一致
var REJASTRING = regexp.MustCompile(`[ぁ-ん]+|[ァ-ヴー]+|[一-龠]/`)
var RELIRET = regexp.MustCompile(`(?s)(<para>\n*)\s*<literal>.*</literal>\n`)
var RELEASENUM = regexp.MustCompile(`[0-9\.]+`)
var RELIRET = regexp.MustCompile(`(?s)(<para>\n*)\s*<literal>.*</literal>\n*\s*<returnvalue>.*</returnvalue>(\s*</para>)`)
<para><literal></literal><returnvalue></returnvalue></para>に一致させる
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>に一致させる
var RELITERAL = regexp.MustCompile(`(?s)(<para>\n*)\s*<literal>.*</literal>\n*(\s*</para>)`)
<para><literal></literal></para>に一致させる
var REPARA = regexp.MustCompile(`(?s)(<para>\n*)(.*?)(\s*</para>)`)
<para> </para> に一致させる
var REPARA2 = regexp.MustCompile(`(?s)<para>\n(.*?)</para>`)
var REPARASCREEN = regexp.MustCompile(`(?s)(<para>\n*)(.*?)(\s*(</para>|<screen>|<programlisting>))`)
<para> <screen>|<programlisting> に一致させる
var REPHIGHHUN = regexp.MustCompile(`�?45;`)
var REROWS = regexp.MustCompile(`(?s)(<row>\n*)(.*?)(\s+</row>)`)
<row> </row> に一致させる
var RETAG = regexp.MustCompile(`<[^>]+>`)
タグと一致させる
var RETAGBLOCK = regexp.MustCompile(`^\s*<([^>]+)>\n`)
単独タグ(\s+<programlisting>\nなど)に一致させる
var RETITLE = regexp.MustCompile(`(?s)(<title>\n*)(.*?)(\s*</title>)`)
<title> </title> に一致させる
var REVHIGHHUN = regexp.MustCompile(`--`)
var REVHIGHHUN2 = regexp.MustCompile(`---`)
var SPLITCATALOG = regexp.MustCompile(`(?s)␝(.*?)␟(.*?)␟(.*?)␞(.*?)␞(.*?)␞`)
カタログから英語と日本語を取得
var SPLITCOMMENT = regexp.MustCompile(`split-.*-[start|end]`)
split-*コメントに一致
var STARTADDCOMMENT = regexp.MustCompile(`\+<!--$`)
コメント始まりの追加に一致
var STARTADDCOMMENTWITHC = regexp.MustCompile(`\+(.*)?\]\]><!--`)
CDATAが終わりコメントの始まりに一致
var STARTCOMMENT = regexp.MustCompile(`^<!--`)
最初がコメント始まりに一致
var STARTINDEXTERM = regexp.MustCompile(`<indexterm`)
indexterm始まりに一致
var STARTSPACE = regexp.MustCompile(`^\s+`)
最初の連続スペースを一つのスペースに変換
var STRIPM = regexp.MustCompile(`《.*》`)
《》で囲まれた文字列(作業中)に一致させる
var STRIPNONJA = regexp.MustCompile(`[\s\,\(\)\.a-zA-Z0-9\-\/\<\>\n*]+$`)
最後尾の日本語以外を除外
var STRIPNUM = regexp.MustCompile(`,`)
カンマを除外
var STRIPNUMJ = regexp.MustCompile(`, |,|、`)
カンマを除外
var STRIPPMT = regexp.MustCompile(`(?s)《機械翻訳》.*`)
var STRIPPROGRAMLISTING = regexp.MustCompile(`<(programlisting|screen)>.*</(programlisting|screen)>`)
<programlisting>.*</programlisting> を除外
var STRIPXREFLABEL = regexp.MustCompile(`xreflabel=\".*\"`)
xreflabelは除外
var TITLE = regexp.MustCompile(`(?U)\n( *<title>[a-zA-Z0-9 \.\-:]+</title>)\n([^\-])`)
var TITLE2 = regexp.MustCompile(`(?U)<!--\s*(<title>.*</title>)\s*-->\s*(<title>.*</title>)`)
var Tokenizer *sentences.DefaultSentenceTokenizer
var Verbose bool
var Version = "dev"
var XMLTAG = regexp.MustCompile(`<[^>\!]*?>|<[^<>]+/>`)
XMLタグ
var YAKUCHU = regexp.MustCompile(`[\(|\[|(]訳注[^\[|\)|)]]*[\]|\)|)]`)
訳注を除外
Functions ¶
func CheckWord ¶
CheckWord checks if the given English word (en) is paired with the corresponding Japanese word (ja) in the specified files. If both en and ja are provided, it identifies pairs where the English word exists but the Japanese word does not. If only en is provided, it checks for the presence of the English word. If only ja is provided, it checks for the presence of the Japanese word.
Parameters:
- en: The English word to search for.
- ja: The Japanese word to search for.
- vTag: The version tag to use for retrieving file differences. If empty, it will be determined automatically.
- fileNames: A list of file names to search within.
Returns:
- An error if there is an issue retrieving the version tag or file differences, or nil if the operation completes successfully.
Example:
err := CheckWord("example", "例", "v1.0", []string{"file1.txt", "file2.txt"})
if err != nil {
log.Fatal(err)
}
func Extract ¶
ファイル名の配列を受け取り、それぞれのファイル名のdiffから原文と日本語訳の対の配列を抽出し、 それぞれのファイル名に対応するカタログファイル(filename.sgml.t)を作成する
func ExtractCommon ¶ added in v0.7.0
func IgnoreFileNames ¶
func ListCommon ¶ added in v0.7.0
func ListCommon(opt ListOoptions)
func ReadAllFile ¶
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog は原文と日本語訳の対を保持する構造体
func Extraction ¶
diff を原文と日本語訳の対(Catalog)の配列に変換する <para> +<!-- english +--> +japanese </para>
type CheckFlag ¶
type CheckFlag struct {
VTag string
Ignore bool
WIP bool
Para bool
Word bool
Tag bool
Num bool
Author bool
Strict bool
Sentence bool
// contains filtered or unexported fields
}
CheckFlag represents the item to check.