Commit 6b130720 authored by Victor Yacovlev's avatar Victor Yacovlev

DocBook: figure captions are numered

parent e71e5899
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
<context> <context>
<name>DocBookViewer::ContentView</name> <name>DocBookViewer::ContentView</name>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="477"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="511"/>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="490"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="524"/>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1339"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1403"/>
<source>Table&amp;nbsp;%1. </source> <source>Table&amp;nbsp;%1. </source>
<translation>Таблица&amp;nbsp;%1. </translation> <translation>Таблица&amp;nbsp;%1. </translation>
</message> </message>
...@@ -15,49 +15,54 @@ ...@@ -15,49 +15,54 @@
<translation type="obsolete">Контекст:</translation> <translation type="obsolete">Контекст:</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="633"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="667"/>
<source>See %1 for more details.</source> <source>See %1 for more details.</source>
<translation>Подробное описание см. в %1</translation> <translation>Подробное описание см. в %1</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="653"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="687"/>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="672"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="706"/>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1338"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1402"/>
<source>Example&amp;nbsp;%1. </source> <source>Example&amp;nbsp;%1. </source>
<translation>Пример&amp;nbsp;%1. </translation> <translation>Пример&amp;nbsp;%1. </translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="693"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="727"/>
<source>Algorithm </source> <source>Algorithm </source>
<translation>Алгоритм</translation> <translation>Алгоритм</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="724"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="758"/>
<source>Synopsis:</source> <source>Synopsis:</source>
<translation>Синтаксис:</translation> <translation>Синтаксис:</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1186"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="992"/>
<source>Figure&amp;nbsp;%1 </source>
<translation>Рисунок&amp;nbsp;%1. </translation>
</message>
<message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1227"/>
<source>(see&amp;nbsp;&lt;a href=&quot;%1&quot;&gt;%2&lt;/a&gt;)</source> <source>(see&amp;nbsp;&lt;a href=&quot;%1&quot;&gt;%2&lt;/a&gt;)</source>
<translation>(см.&amp;nbsp;&lt;a href=&quot;%1&quot;&gt;%2&lt;/a&gt;)</translation> <translation>(см.&amp;nbsp;&lt;a href=&quot;%1&quot;&gt;%2&lt;/a&gt;)</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1293"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1334"/>
<source>List of examples in &quot;%1&quot;</source> <source>List of examples in &quot;%1&quot;</source>
<translation>Список примеров в &quot;%1&quot;</translation> <translation>Список примеров в &quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1296"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1337"/>
<source>List of tables in &quot;%1&quot;</source> <source>List of tables in &quot;%1&quot;</source>
<translation>Список таблиц в &quot;%1&quot;</translation> <translation>Список таблиц в &quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1300"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1341"/>
<source>List of Standard Library algorithms</source> <source>List of Standard Library algorithms</source>
<translation>Список встроенных алгоритмов</translation> <translation>Список встроенных алгоритмов</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1302"/> <location filename="../../../src/shared/docbookviewer/contentview.cpp" line="1343"/>
<source>List of algorithms of module &quot;%1&quot;</source> <source>List of algorithms of module &quot;%1&quot;</source>
<translation>Список алгоритмов исполнителя &quot;%1&quot;</translation> <translation>Список алгоритмов исполнителя &quot;%1&quot;</translation>
</message> </message>
...@@ -230,17 +235,17 @@ ...@@ -230,17 +235,17 @@
<translation type="obsolete">Искать:</translation> <translation type="obsolete">Искать:</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/sidepanel.cpp" line="230"/> <location filename="../../../src/shared/docbookviewer/sidepanel.cpp" line="231"/>
<source>List of examples in &quot;%1&quot;</source> <source>List of examples in &quot;%1&quot;</source>
<translation>Список примеров в &quot;%1&quot;</translation> <translation>Список примеров в &quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/sidepanel.cpp" line="258"/> <location filename="../../../src/shared/docbookviewer/sidepanel.cpp" line="259"/>
<source>List of tables in &quot;%1&quot;</source> <source>List of tables in &quot;%1&quot;</source>
<translation>Список таблиц в &quot;%1&quot;</translation> <translation>Список таблиц в &quot;%1&quot;</translation>
</message> </message>
<message> <message>
<location filename="../../../src/shared/docbookviewer/sidepanel.cpp" line="278"/> <location filename="../../../src/shared/docbookviewer/sidepanel.cpp" line="279"/>
<source>Standard Library functions</source> <source>Standard Library functions</source>
<translation>Встроенные алгоритмы</translation> <translation>Встроенные алгоритмы</translation>
</message> </message>
......
...@@ -277,7 +277,7 @@ QString ContentView::renderElement(ModelPtr data) const ...@@ -277,7 +277,7 @@ QString ContentView::renderElement(ModelPtr data) const
return renderMediaObject(data); return renderMediaObject(data);
} }
else if (data == DocBookModel::Caption) { else if (data == DocBookModel::Caption) {
return renderCaption(data); return renderCaption(data, QString());
} }
else if (data == DocBookModel::InlineMediaObject) { else if (data == DocBookModel::InlineMediaObject) {
return renderInlineMediaObject(data); return renderInlineMediaObject(data);
...@@ -984,17 +984,24 @@ QString ContentView::renderMediaObject(ModelPtr data) const ...@@ -984,17 +984,24 @@ QString ContentView::renderMediaObject(ModelPtr data) const
result += "<div align='center' width='100%' padding='10'>" + result += "<div align='center' width='100%' padding='10'>" +
renderElement(mediaObject); renderElement(mediaObject);
if (caption) { if (caption) {
result += renderCaption(caption); const QString index = chapterNumber(data) > 0
? QString("%1.%2")
.arg(chapterNumber(data))
.arg(elementNumber(data))
: QString::number(elementNumber(data));
const QString prefix = "<b>" + tr("Figure&nbsp;%1 ").arg(index) + "</b>";
result += renderCaption(caption, prefix);
} }
result += "</div>\n"; result += "</div>\n";
} }
return result; return result;
} }
QString ContentView::renderCaption(ModelPtr data) const QString ContentView::renderCaption(ModelPtr data, const QString &captionPrefix) const
{ {
QString result; QString result;
result += "<div align='center' width='100%'>"; result += "<div align='center' width='100%'>";
result += captionPrefix;
result += renderChilds(data); result += renderChilds(data);
result += "</div>"; result += "</div>";
return result; return result;
......
...@@ -70,7 +70,7 @@ private: ...@@ -70,7 +70,7 @@ private:
QString renderRow(ModelPtr data) const; QString renderRow(ModelPtr data) const;
QString renderEntry(ModelPtr data) const; QString renderEntry(ModelPtr data) const;
QString renderCaption(ModelPtr data) const; QString renderCaption(ModelPtr data, const QString &captionPrefix) const;
QString renderMediaObject(ModelPtr data) const; QString renderMediaObject(ModelPtr data) const;
QString renderInlineMediaObject(ModelPtr data) const; QString renderInlineMediaObject(ModelPtr data) const;
QString renderImageObject(ModelPtr data) const; QString renderImageObject(ModelPtr data) const;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment