Exemple #1
0
func prepareGreek(input string) (string, error) {
	grk, err := unigreek.Convert(input)
	if err != nil {
		return "", err
	}
	grk = replaceEscapes(grk)
	grk = trim(grk)
	return grk, nil
}
Exemple #2
0
func (ee *Element) charDataText() (string, error) {
	ss := trim(ee.Content)
	if ss == "" {
		return ss, nil
	}

	switch ee.Parent.Name() {
	default:
		return "", errors.New("Unknown language for <" + ee.Parent.Name() + ">")
	case "title", "author", "titleStmt", "extent", "fileDesc", "biblStruct", "monogr", "publisher", "date", "language", "name", "resp", "item":
		out := trim(ee.Content)
		out = replaceEscapes(out)
		return out, nil
	case "p", "head", "quote":
		out, err := unigreek.Convert(ee.Content)
		if err != nil {
			return "", err
		}
		out = replaceEscapes(out)
		return out, nil
	}
}