Changeset 1f344e6fc38e168234f6c370d06711930d5f9cd5

Show
Ignore:
Timestamp:
10/25/09 22:56:41 (4 years ago)
Author:
Benjamin Herr <ben@…>
Parents:
78495c93fb3e39a9deb182aad5a6a5a79f86e5f6
Children:
b24d6e3f35e707fb850b2b22d7a9fe58cab8ad9f
git-committer:
Benjamin Herr <ben@0x539.de> / 2009-10-25T22:56:41Z+0100
Message:

htmlexport: avoid generating <span/>s with no classes for tagless chunks

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • code/operations/operation-export-html.cpp

    r78495c9 r1f344e6  
    142142                while(!gtk_text_iter_is_end(&begin)) 
    143143                { 
    144                         last_node = last_node->add_child("span"); 
    145  
    146144                        // add current tags as classes for CSS formatting 
    147145                        // (both for author of text and syntax highlighting) 
    148146                        Glib::ustring classes = get_current_tags(tags, &begin); 
    149147                        if(!classes.empty()) 
     148                        { 
     149                                last_node = last_node->add_child("span"); 
    150150                                last_node->set_attribute("class", classes); 
    151151 
    152                         // add mouseover "written by" popup 
    153                         InfTextUser* new_user 
    154                                 = inf_text_gtk_buffer_get_author( 
    155                                         inf_buffer, 
    156                                         &begin); 
    157                         if(new_user) 
    158                         { 
    159                                 last_node->set_attribute( 
    160                                         "title", 
    161                                         uprintf(_("written by: %s"), 
     152                                // add mouseover "written by" popup 
     153                                // this only needs to happen when there are tags, 
     154                                // because the presence of an author implies a tag 
     155                                InfTextUser* user 
     156                                        = inf_text_gtk_buffer_get_author( 
     157                                                inf_buffer, 
     158                                                &begin); 
     159                                if(user) 
     160                                { 
     161                                        char const* user_name = 
    162162                                                inf_user_get_name( 
    163                                                         INF_USER(new_user)))); 
    164                                 users.insert(new_user); 
     163                                                        INF_USER(user)); 
     164                                        last_node->set_attribute( 
     165                                                "title", 
     166                                                uprintf(_("written by: %s"), 
     167                                                        user_name)); 
     168                                        users.insert(user); 
     169                                } 
    165170                        } 
    166171 
     
    206211                        } 
    207212                        g_free(text); 
    208                         last_node = last_node->get_parent(); 
     213 
     214                        // if we do not have any tags, we did not add classes 
     215                        // and consequently did not go into a new span 
     216                        if(!classes.empty()) 
     217                                last_node = last_node->get_parent(); 
    209218 
    210219                        begin = next;