aboutsummaryrefslogtreecommitdiff
path: root/mod/page.hxx
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2018-10-17 18:48:46 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2018-10-17 18:48:46 +0300
commitff96d28f969a6716cfc9ccefe94e70132bc4d6db (patch)
tree1fce38985479e9152fdbaf2348e03036ba487810 /mod/page.hxx
parent48d4ae50d57d58c35b25d2917faad6700783ac0d (diff)
Display package description as a pre-formatted text
Diffstat (limited to 'mod/page.hxx')
-rw-r--r--mod/page.hxx46
1 files changed, 28 insertions, 18 deletions
diff --git a/mod/page.hxx b/mod/page.hxx
index 4b59e7d..f8d2830 100644
--- a/mod/page.hxx
+++ b/mod/page.hxx
@@ -520,53 +520,63 @@ namespace brep
const bbot::result_status& status_;
};
- // Generates package description element.
+ // Generates paragraph elements converting a plain text into XHTML5 applying
+ // some heuristics (see implementation for details). Truncate the text if
+ // requested.
//
- class P_DESCRIPTION
+ // Note that there is no way to specify that some text fragment must stay
+ // pre-formatted. Thus, don't use this type for text that can contain such
+ // kind of fragments and consider using PRE_TEXT instead.
+ //
+ class P_TEXT
{
public:
- // Genereate full description.
+ // Generate full text elements.
//
- P_DESCRIPTION (const string& d, const string& id = "")
- : description_ (d), length_ (d.size ()), url_ (nullptr), id_ (id) {}
+ P_TEXT (const string& t, const string& id = "")
+ : text_ (t), length_ (t.size ()), url_ (nullptr), id_ (id) {}
- // Genereate brief description.
+ // Generate brief text elements.
//
- P_DESCRIPTION (const string& d, size_t l, const string& u)
- : description_ (d), length_ (l), url_ (&u) {}
+ P_TEXT (const string& t, size_t l, const string& u, const string& id = "")
+ : text_ (t), length_ (l), url_ (&u), id_ (id) {}
void
operator() (xml::serializer&) const;
private:
- const string& description_;
+ const string& text_;
size_t length_;
const string* url_; // Full page url.
string id_;
};
- // Generates package description element.
+ // Generates pre-formatted text element. Truncate the text if requested.
//
- class PRE_CHANGES
+ class PRE_TEXT
{
public:
- // Genereate full changes info.
+ // Generate a full text element.
//
- PRE_CHANGES (const string& c)
- : changes_ (c), length_ (c.size ()), url_ (nullptr) {}
+ PRE_TEXT (const string& t, const string& id = "")
+ : text_ (t), length_ (t.size ()), url_ (nullptr), id_ (id) {}
- // Genereate brief changes info.
+ // Generate a brief text element.
//
- PRE_CHANGES (const string& c, size_t l, const string& u)
- : changes_ (c), length_ (l), url_ (&u) {}
+ PRE_TEXT (const string& t,
+ size_t l,
+ const string& u,
+ const string& id = "")
+ : text_ (t), length_ (l), url_ (&u), id_ (id) {}
void
operator() (xml::serializer&) const;
private:
- const string& changes_;
+ const string& text_;
size_t length_;
const string* url_; // Full page url.
+ string id_;
};
// Generates paging element.