| 211 | } |
| 212 | |
| 213 | QString HTMLResource::GetLanguageAttribute() |
| 214 | { |
| 215 | GumboInterface gi = GumboInterface(GetText(),GetEpubVersion()); |
| 216 | gi.parse(); |
| 217 | QList<GumboNode*> htmltags = gi.get_all_nodes_with_tag(GUMBO_TAG_HTML); |
| 218 | if (htmltags.count() != 1) return ""; |
| 219 | GumboNode* node = htmltags.at(0); |
| 220 | QString lang=""; |
| 221 | GumboAttribute* attr = gumbo_get_attribute(&node->v.element.attributes, "xml:lang"); |
| 222 | if (attr) { |
| 223 | lang = QString::fromUtf8(attr->value); |
| 224 | return lang; |
| 225 | } |
| 226 | attr = gumbo_get_attribute(&node->v.element.attributes, "lang"); |
| 227 | if (attr) { |
| 228 | lang = QString::fromUtf8(attr->value); |
| 229 | } |
| 230 | return lang; |
| 231 | } |
| 232 | |
| 233 | void HTMLResource::SetLanguageAttribute(const QString& langcode) |
| 234 | { |
no test coverage detected