浏览代码

Modify CSS style: show annotation, hide description

Kandrashin Denis 13 年之前
父节点
当前提交
a710ef0168
共有 3 个文件被更改,包括 22 次插入6 次删除
  1. 3 4
      source/fb2read.cpp
  2. 1 1
      source/fb2read.h
  3. 18 1
      source/res/style.css

+ 3 - 4
source/fb2read.cpp

@@ -123,13 +123,12 @@ FB2_BEGIN_KEYHASH(Fb2ReadHandler::HeadHandler)
     FB2_KEY( Image , "image" );
 FB2_END_KEYHASH
 
-Fb2ReadHandler::HeadHandler::HeadHandler(Fb2ReadWriter &writer, const QString &name, const QXmlAttributes &atts, bool hide)
+Fb2ReadHandler::HeadHandler::HeadHandler(Fb2ReadWriter &writer, const QString &name, const QXmlAttributes &atts)
     : BaseHandler(writer, name)
     , m_empty(true)
 {
     m_writer.writeStartElement("div");
     m_writer.writeAttribute("class", name);
-    if (hide) m_writer.writeAttribute("style", "display:none");
     int count = atts.count();
     for (int i = 0; i < count; i++) {
         m_writer.writeAttribute("fb2:" + atts.qName(i), atts.value(i));
@@ -185,7 +184,7 @@ Fb2XmlHandler::NodeHandler * Fb2ReadHandler::DescrHandler::NewTag(const QString
         case Document :
         case Publish :
         case Custom :
-            return new HeadHandler(m_writer, name, atts, true);
+            return new HeadHandler(m_writer, name, atts);
         default:
             return NULL;
     }
@@ -204,7 +203,7 @@ Fb2ReadHandler::TitleHandler::TitleHandler(Fb2ReadWriter &writer, const QString
 Fb2XmlHandler::NodeHandler * Fb2ReadHandler::TitleHandler::NewTag(const QString &name, const QXmlAttributes &atts)
 {
     if (name == "annotation") return new TextHandler(m_writer, name, atts, "div", name);
-    return new HeadHandler(m_writer, name, atts, true);
+    return new HeadHandler(m_writer, name, atts);
 }
 
 //---------------------------------------------------------------------------

+ 1 - 1
source/fb2read.h

@@ -87,7 +87,7 @@ private:
             Image,
         FB2_END_KEYLIST
     public:
-        explicit HeadHandler(Fb2ReadWriter &writer, const QString &name, const QXmlAttributes &atts, bool hide = false);
+        explicit HeadHandler(Fb2ReadWriter &writer, const QString &name, const QXmlAttributes &atts);
     protected:
         virtual NodeHandler * NewTag(const QString &name, const QXmlAttributes &atts);
         virtual void TxtTag(const QString &text);

+ 18 - 1
source/res/style.css

@@ -2,7 +2,20 @@ body {
   font-family: serif;
 }
 
-div.description div.annotation {
+div.description div {
+  display: none;
+}
+
+div.description div.title-info {
+  display: block;
+}
+
+div.description div.title-info div {
+  display: none;
+}
+
+div.description div.title-info div.annotation {
+  display: block;
   padding-left: 10;
   padding-right: 10;
   border-width: thin;
@@ -16,6 +29,10 @@ div.description div.annotation {
   margin-bottom: 1em;
 }
 
+div.description div.title-info div.annotation div {
+  display: block;
+}
+
 div.section {
   border-top: none;
   border-bottom: none;