浏览代码

New CSS styles: subtitle, notes

Kandrashin Denis 13 年之前
父节点
当前提交
2467f6fd53
共有 3 个文件被更改,包括 35 次插入1 次删除
  1. 3 0
      source/fb2edit.pro
  2. 4 1
      source/fb2read.cpp
  3. 28 0
      source/res/style.css

+ 3 - 0
source/fb2edit.pro

@@ -25,3 +25,6 @@ QT += xml
 QT += webkit
 
 LIBS += -lqscintilla2
+
+OTHER_FILES += \
+    res/style.css

+ 4 - 1
source/fb2read.cpp

@@ -282,7 +282,10 @@ Fb2Handler::BodyHandler::BodyHandler(Fb2HtmlWriter &writer, const QString &name,
     } else if (m_tag == "div" || m_tag == "img") {
         m_writer.writeAttribute("id", m_writer.newId());
     }
-    if (!style.isEmpty()) m_writer.writeAttribute("class", style);
+    if (!m_style.isEmpty()) {
+        if (m_style == "body" && Value(attributes, "name").toLower() == "notes") m_style = "notes";
+        m_writer.writeAttribute("class", m_style);
+    }
 }
 
 Fb2Handler::BaseHandler * Fb2Handler::BodyHandler::NewTag(const QString &name, const QXmlAttributes &attributes)

+ 28 - 0
source/res/style.css

@@ -1,9 +1,11 @@
 body {
   font-family: serif;
 }
+
 div.description {
   display: none;
 }
+
 div.annotation {
   padding-left: 10;
   padding-right: 10;
@@ -15,6 +17,7 @@ div.annotation {
   border-bottom-left-radius: 10;
   border-bottom-right-radius: 10;
 }
+
 div.section {
   border-top: none; 
   border-bottom: none; 
@@ -25,12 +28,23 @@ div.section {
   padding-left: 4; 
   padding-right: 0;
 }
+
 div.title {
   color: white;
   background: green;
   text-align: center;
   font-family: sans-serif;
 }
+
+div.subtitle {
+  color: white;
+  background: #d8a903;
+  text-align: center;
+  font-family: sans-serif;
+  margin-left: 5%;
+  margin-right: 5%;
+}
+
 div.poem {
   border-left: thin solid blue; 
   margin-left: 5%;
@@ -46,3 +60,17 @@ div.poem p {
   margin-top: 0;
   margin-bottom: 0;
 }
+
+div.notes div.section div.title {
+  font: inherit;
+  float: left;
+  margin-left: 4;
+  margin-right: 4;
+  padding-left: 4;
+  padding-right: 4;
+}
+
+div.notes div.section div.title p {
+  margin-top: 0;
+  margin-bottom: 0;
+}