~ubuntu-branches/debian/squeeze/sword/squeeze

« back to all changes in this revision

Viewing changes to src/modules/filters/plainhtml.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Glassey
  • Date: 2004-01-15 15:50:07 UTC
  • Revision ID: james.westby@ubuntu.com-20040115155007-n9mz4x0zxrs1isd3
Tags: upstream-1.5.7
ImportĀ upstreamĀ versionĀ 1.5.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
                          rwphtml.cpp  -  description
 
3
                             -------------------
 
4
    begin                : Thu Jun 24 1999
 
5
    copyright            : (C) 1999 by Torsten Uhlmann
 
6
    email                : TUhlmann@gmx.de
 
7
 ***************************************************************************/
 
8
 
 
9
/***************************************************************************
 
10
 *                                                                         *
 
11
 *   This program is free software; you can redistribute it and/or modify  *
 
12
 *   it under the terms of the GNU General Public License as published by  *
 
13
 *   the Free Software Foundation; either version 2 of the License, or     *
 
14
 *   (at your option) any later version.                                   *
 
15
 *                                                                         *
 
16
 ***************************************************************************/
 
17
 
 
18
#include <plainhtml.h>
 
19
 
 
20
SWORD_NAMESPACE_START
 
21
 
 
22
PLAINHTML::PLAINHTML()
 
23
{
 
24
}
 
25
 
 
26
 
 
27
char PLAINHTML::processText(SWBuf &text, const SWKey *key, const SWModule *module)
 
28
{
 
29
        int count = 0;
 
30
 
 
31
        SWBuf orig = text;
 
32
        const char *from = orig.c_str();
 
33
        for (text = ""; *from; from++) 
 
34
        {
 
35
                if ((*from == '\n') && (from[1] == '\n')) // two newlinea are a paragraph
 
36
                {
 
37
                        text += "<P>";
 
38
                        from++;
 
39
                        continue;
 
40
                } else {
 
41
                        if ((*from == '\n')) // && (from[1] != '\n')) // only one new line
 
42
                        {
 
43
                                text += "<BR>";
 
44
                                continue;
 
45
                        }
 
46
                }
 
47
                
 
48
                if (*from == '{') { //footnote start
 
49
                        text += "<FONT COLOR=\"#80000\"><SMALL> (";
 
50
                        continue;
 
51
                }
 
52
                else if (*from == '}') //footnote end
 
53
                {
 
54
                        text += ") </SMALL></FONT>";
 
55
                        continue;
 
56
                }
 
57
                else if ((*from == ' ') && (count > 5000))
 
58
                {
 
59
                        text += "<WBR>";
 
60
                        count = 0;
 
61
                        continue;
 
62
                }
 
63
 
 
64
                text += *from;
 
65
                count++;
 
66
        }
 
67
        return 0;
 
68
}
 
69
 
 
70
SWORD_NAMESPACE_END