Example #1
0
 def testAddBrief(self):
     entry = raw_doc.RawEntry()
     self.assertEqual(entry.briefs, [])
     b = raw_doc.RawBrief(raw_doc.RawText())
     entry.addBrief(b)
     self.assertEqual(len(entry.briefs), 1)
     self.assertEqual(entry.briefs, [b])
Example #2
0
 def processSummary(self, entry, node):
     for text in node.texts:
         if text.startswith('type=text:'):
             t = lexer.Token('WORD', text[len('type=text:'):], 0, 0, 0)
             raw_text = raw_doc.RawText(translateTokens([t]))
         else:
             t = lexer.Token('WORD', text, 0, 0, 0)
             raw_text = raw_doc.RawText(translateTokens([t]))
         entry.addBrief(raw_doc.RawBrief(raw_text))
Example #3
0
 def testGetFormatted(self):
     b = raw_doc.RawBrief(raw_doc.RawText([self.brief_tok]))
     entry = raw_doc.RawEntry([b])
     entry.name = raw_doc.RawText([self.name_tok])
     entry.title = raw_doc.RawText([self.title_tok])
     entry.sees = [raw_doc.RawSee(raw_doc.RawText([self.tok_see]))]
     formatter = raw_doc.DoxFormatter()
     msg = ('@<entry> Concept Concept Title\n\n'
            '@brief This is brief.\n\n'
            '@see See\n\n')
     self.assertMultiLineEqual(entry.getFormatted(formatter), msg)
Example #4
0
 def testGetFormatted(self):
     b = raw_doc.RawBrief(raw_doc.RawText([self.brief_tok]))
     code_entry = raw_doc.RawVariable([b])
     code_entry.name = raw_doc.RawText([self.name_tok])
     code_entry.type = raw_doc.RawText([self.type_tok])
     code_entry.sees = [raw_doc.RawSee(raw_doc.RawText([self.tok_see]))]
     s = raw_doc.RawSignature(raw_doc.RawText([self.tok_sig]))
     code_entry.addSignature(s)
     txt = ('@var int var\n\n'
            '@brief This is brief.\n\n'
            '@signature payload\n\n'
            '@see See\n\n')
     self.assertMultiLineEqual(code_entry.getFormatted(self.formatter), txt)
Example #5
0
 def testGetFormatted(self):
     code_entry = raw_doc.RawCodeEntry()
     b = raw_doc.RawBrief(raw_doc.RawText([self.brief_tok]))
     code_entry = raw_doc.RawCodeEntry([b])
     code_entry.name = raw_doc.RawText([self.name_tok])
     code_entry.title = raw_doc.RawText([self.title_tok])
     code_entry.sees = [raw_doc.RawSee(raw_doc.RawText([self.tok_see]))]
     s = raw_doc.RawSignature(raw_doc.RawText([self.tok_sig]))
     code_entry.addSignature(s)
     formatter = raw_doc.DoxFormatter()
     txt = ('@<code entry> Concept Concept Title\n\n'
            '@brief This is brief.\n\n'
            '@signature payload\n\n'
            '@see See\n\n')
     self.assertMultiLineEqual(code_entry.getFormatted(formatter), txt)
Example #6
0
def migratePages(node):
    #print >>sys.stderr, 'Migrating pages...'
    pages = []
    #print node
    for name, child in node.children.iteritems():
        if name == 'Glossary':
            continue
        page = raw_doc.RawPage()
        page.title.tokens.append(lexer.Token('WORD', name, 0, 0, 0))
        s = 'Page'
        page.name.tokens.append(
            lexer.Token('WORD', s + page.title.text, 0, 0, 0))
        if child.children.get('summary'):
            for text in child.children['summary'].texts:
                if text.startswith('type=text:'):
                    t = lexer.Token('WORD', text[len('type=text:'):], 0, 0, 0)
                else:
                    t = lexer.Token('WORD', text, 0, 0, 0)
                raw_text = raw_doc.RawText(translateTokens([t]))
                raw_brief = raw_doc.RawBrief(raw_text)
                page.briefs.append(raw_brief)
        if child.children.get('description'):
            for text in child.children['description'].texts:
                if text.startswith('type=text:'):
                    t = lexer.Token('WORD', text[len('type=text:'):], 0, 0, 0)
                    raw_par = raw_doc.RawParagraph(
                        raw_doc.RawText(translateTokens([t])))
                elif text.startswith('type=section:#'):
                    t = lexer.Token('WORD', text[len('type=section:#'):], 0, 0,
                                    0)
                    raw_par = raw_doc.RawSection(
                        raw_doc.RawText(translateTokens([t])))
                elif text.startswith('type=subsection:#.#'):
                    t = lexer.Token('WORD', text[len('type=subsection:#.#'):],
                                    0, 0, 0)
                    raw_par = raw_doc.RawSection(
                        raw_doc.RawText(translateTokens([t])), 1)
                else:
                    t = lexer.Token('WORD', text, 0, 0, 0)
                    raw_par = raw_doc.RawParagraph(
                        raw_doc.RawText(translateTokens([t])))
                page.body.addParagraph(raw_par)
        pages.append(page)
    print 'RESULTING PAGES %s' % [p.title.text for p in pages]
    return pages
Example #7
0
 def testGetFormatted(self):
     brief = raw_doc.RawBrief(self.txt)
     self.assertEqual(brief.getFormatted(self.formatter), '@brief aword\n')
Example #8
0
 def testGetType(self):
     brief = raw_doc.RawBrief(self.txt)
     self.assertEqual(brief.getType(), 'brief')
Example #9
0
 def testCreation(self):
     brief = raw_doc.RawBrief(self.txt)
     self.assertEqual(brief.text, self.txt)