From 173a429725160b76a3fb7f6d2a4a46e013eeadff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9A=D1=83=D0=BB=D0=B8=D0=BA=D0=BE=D0=B2=D0=B0=20=D0=A1?= =?UTF-8?q?=D0=B2=D0=B5=D1=82=D0=BB=D0=B0=D0=BD=D0=B0=20=D0=90=D0=BB=D0=B5?= =?UTF-8?q?=D0=BA=D1=81=D0=B0=D0=BD=D0=B4=D1=80=D0=BE=D0=B2=D0=BD=D0=B0?= <37101627+SylaiseElvenan@users.noreply.github.com> Date: Fri, 10 Jul 2020 16:41:21 +0300 Subject: [PATCH] footnote changes --- Fb2File/Fb2File.cpp | 66 ++++++++++++++++++++++++++++++------------- Fb2File/test/main.cpp | 2 +- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/Fb2File/Fb2File.cpp b/Fb2File/Fb2File.cpp index 3bb01e1db1..8effbeafb4 100644 --- a/Fb2File/Fb2File.cpp +++ b/Fb2File/Fb2File.cpp @@ -922,28 +922,54 @@ public: return false; m_oLightReader.MoveToElement(); - // Пишем сноску - oFootnotes += L""; - - // Читаем внутренность section - int nSDepth = m_oLightReader.GetDepth(); - while(m_oLightReader.ReadNextSiblingNode(nSDepth)) + // Ищем сноску в списке требующихся + std::map::iterator it = m_mFootnotes.find(sFootnoteName); + if(it != m_mFootnotes.end()) { - if(m_oLightReader.GetName() == L"p") - { - // Стиль section-p - oFootnotes += L""; - oFootnotes += L""; - oFootnotes += L""; - if(!readP(L"", oFootnotes)) - return false; - oFootnotes += L""; - } - } + // Пишем сноску + oFootnotes += L"second; + oFootnotes += L"\">"; - oFootnotes += L""; + // Читаем внутренность section + int nSDepth = m_oLightReader.GetDepth(); + while(m_oLightReader.ReadNextSiblingNode(nSDepth)) + { + std::wstring sName = m_oLightReader.GetName(); + if(sName == L"title") + { + int nTDepth = m_oLightReader.GetDepth(); + while(m_oLightReader.ReadNextSiblingNode(nTDepth)) + { + if(m_oLightReader.GetName() == L"p") + { + // Стиль section-p + oFootnotes += L""; + oFootnotes += L""; + oFootnotes += L""; + if(!readP(L"", oFootnotes)) + return false; + oFootnotes += L""; + } + } + } + else if(sName == L"p") + { + // Стиль section-p + oFootnotes += L""; + oFootnotes += L""; + oFootnotes += L""; + if(!readP(L"", oFootnotes)) + return false; + oFootnotes += L""; + } + } + + oFootnotes += L""; + + // Удаляем сноску из списка требующихся + m_mFootnotes.erase(it); + } } } return true; diff --git a/Fb2File/test/main.cpp b/Fb2File/test/main.cpp index e5c8fa8e83..bdc1703a0c 100644 --- a/Fb2File/test/main.cpp +++ b/Fb2File/test/main.cpp @@ -10,7 +10,7 @@ int main() oFile.SetTmpDirectory(NSFile::GetProcessDirectory() + L"/tmp"); // файл, который открываем - std::wstring sFile = NSFile::GetProcessDirectory() + L"/../../../examples/5-kreshcheniye-ognem.fb2"; + std::wstring sFile = NSFile::GetProcessDirectory() + L"/../../../examples/6-bashnya-lastochki.fb2"; // директория, где будем создавать docx std::wstring sOutputDirectory = NSFile::GetProcessDirectory() + L"/res";