Ejemplo n.º 1
0
 def _createContentNodeFromTextData(self, parentNode):
     if self.xmlFormat:
         # append xml/xhtml fragment
         contentNode = createHtmlElement(parentNode, u"div")  #$NON-NLS-1$
         appendHtmlFragment(contentNode, self.izBlogThisInformation.getText())
     else:
         # append simple text content
         contentNode = createHtmlElement(parentNode, u"p", elementText = self.izBlogThisInformation.getText())  #$NON-NLS-1$
     return contentNode
Ejemplo n.º 2
0
 def _createContentNodeFromTextData(self, parentNode):
     if self.xmlFormat:
         # append xml/xhtml fragment
         contentNode = createHtmlElement(parentNode, u"div")  #$NON-NLS-1$
         appendHtmlFragment(contentNode,
                            self.izBlogThisInformation.getText())
     else:
         # append simple text content
         contentNode = createHtmlElement(
             parentNode,
             u"p",
             elementText=self.izBlogThisInformation.getText())  #$NON-NLS-1$
     return contentNode
Ejemplo n.º 3
0
    def _createContentNodeFromUrlData(self, parentNode):
        # create content data base one blog post or web site data including 'cite' element
        # and a link back to original document
        url = getSafeString(self.izBlogThisInformation.getUrl())
        title = self._escape(self.izBlogThisInformation.getTitle())
        text = getNoneString(self.izBlogThisInformation.getText())
        author = getNoneString(self.izBlogThisInformation.getAuthor())

        # default title to permanent link
        citeTitle = url
        if title and title != url:
            citeTitle = title
        contentNode = createHtmlElement(parentNode, u"p")  #$NON-NLS-1$
        if text:
            # since content is given, create content in <cite> element
            if author:
                citeTitle = citeTitle + u" (" + author + u")"  #$NON-NLS-1$ #$NON-NLS-2$
            citeTitle = citeTitle + u": "  #$NON-NLS-1$
            citeNode = createHtmlElement(contentNode, u"cite")  #$NON-NLS-1$
            attrs = {u"href": url}  #$NON-NLS-1$
            if citeTitle != url:
                attrs[u"title"] = citeTitle  #$NON-NLS-1$
            # create a <a href="url">citeTitle</a> inside the cite element
            createHtmlElement(citeNode, u"a", attrs, citeTitle)  #$NON-NLS-1$
            innerContentNode = parentNode
            # block quote if needed, then wrap the content node in a blockquote.
            if self.izBlogThisInformation.isQuoted():
                attrs = {u"cite": url}  #$NON-NLS-1$
                innerContentNode = createHtmlElement(innerContentNode,
                                                     u"blockquote",
                                                     attrs)  #$NON-NLS-1$

            if self.xmlFormat:
                innerContentNode = createHtmlElement(innerContentNode, u"div",
                                                     attrs)  #$NON-NLS-1$
                appendHtmlFragment(innerContentNode, text)
            else:
                createHtmlElement(innerContentNode, u"p",
                                  elementText=text)  #$NON-NLS-1$
        else:
            # content is not given. in this case, simply create a link to the url
            attrs = {u"href": url}  #$NON-NLS-1$
            createHtmlElement(contentNode, u"a", attrs,
                              citeTitle)  #$NON-NLS-1$
            createHtmlElement(contentNode, u"br")  #$NON-NLS-1$
        return contentNode
Ejemplo n.º 4
0
    def _createContentNodeFromUrlData(self, parentNode):
        # create content data base one blog post or web site data including 'cite' element
        # and a link back to original document
        url = getSafeString( self.izBlogThisInformation.getUrl() )
        title = self._escape( self.izBlogThisInformation.getTitle() )
        text = getNoneString(self.izBlogThisInformation.getText())
        author = getNoneString(self.izBlogThisInformation.getAuthor())

        # default title to permanent link
        citeTitle = url
        if title and title != url:
            citeTitle = title
        contentNode = createHtmlElement(parentNode, u"p") #$NON-NLS-1$
        if text:
            # since content is given, create content in <cite> element
            if author:
                citeTitle = citeTitle + u" (" + author + u")" #$NON-NLS-1$ #$NON-NLS-2$
            citeTitle = citeTitle + u": " #$NON-NLS-1$
            citeNode = createHtmlElement(contentNode, u"cite") #$NON-NLS-1$
            attrs = { u"href" : url } #$NON-NLS-1$
            if citeTitle != url:
                attrs[u"title"] =  citeTitle #$NON-NLS-1$
            # create a <a href="url">citeTitle</a> inside the cite element
            createHtmlElement(citeNode, u"a", attrs, citeTitle) #$NON-NLS-1$
            innerContentNode = parentNode
            # block quote if needed, then wrap the content node in a blockquote.
            if self.izBlogThisInformation.isQuoted():
                attrs = { u"cite" : url } #$NON-NLS-1$
                innerContentNode = createHtmlElement(innerContentNode, u"blockquote", attrs) #$NON-NLS-1$

            if self.xmlFormat:
                innerContentNode = createHtmlElement(innerContentNode, u"div", attrs) #$NON-NLS-1$
                appendHtmlFragment(innerContentNode, text)
            else:
                createHtmlElement(innerContentNode, u"p", elementText = text)  #$NON-NLS-1$
        else:
            # content is not given. in this case, simply create a link to the url
            attrs = { u"href" : url } #$NON-NLS-1$
            createHtmlElement(contentNode,u"a", attrs, citeTitle) #$NON-NLS-1$
            createHtmlElement(contentNode,u"br") #$NON-NLS-1$
        return contentNode