commit 2338c3c6f65290d6ec0b240e17ac8f3e7cb7021b
parent b1b161d72b68bb5f65ad32f04373a0ba77beafb5
Author: Dominik Schmidt <das1993@hotmail.com>
Date: Wed, 9 Sep 2015 18:35:48 +0200
Use DDoc rather than doxygen.
Diffstat:
Fb2RSS.d | | | 76 | +++++++++++++++++++++++++++++++++++++++++++++++----------------------------- |
doxyfile | | | 6 | ------ |
2 files changed, 47 insertions(+), 35 deletions(-)
diff --git a/Fb2RSS.d b/Fb2RSS.d
@@ -1,19 +1,19 @@
-
/**
- * @file Fb2RSS.d
- *
- * @author Dominik Schmidt <das1993@hotmail.com>
- *
- * @brief Fb2RSS is a translator from the HTML structure generated by Facebook to
+ * Fb2RSS is a translator from the HTML structure generated by Facebook to
* an atom feed.
*
* The page is formatted like this:
- * - The relevant data is inside `<code></code>` blocks
- * - Inside these blocks is further HTML-Data, which is commented out.
- * - The posting and metadata is inside a `<div></div>`, which has the date-time attribute set.
- * - The actual text to the post is inside another `<div></div>`, with class="_5pbx userContent"
- * - The link to the Post is inside the href of `<a></a>` with class="_5pcq"
+ * $(UL
+ * $(LI The relevant data is inside `<code></code>` blocks)
+ * $(LI Inside these blocks is further HTML-Data, which is commented out.)
+ * $(LI The posting and metadata is inside a `<div></div>`, which has the date-time attribute set.)
+ * $(LI The actual text to the post is inside another `<div></div>`, with class="_5pbx userContent")
+ * $(LI The link to the Post is inside the href of `<a></a>` with class="_5pcq")
+ * )
*
+ * Authors: Dominik Schmidt, das1993@hotmail.com
+ *
+ * License:
* Copyright (C) 2015 Dominik Schmidt <das1993@hotmail.com>
*
* This program is free software: you can redistribute it and/or modify
@@ -30,6 +30,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+module fb2rss;
import std.net.curl;
import std.stdio;
@@ -45,9 +46,11 @@ import std.typecons;
/**
* Manages all the relevant tasks of
- * - Fetching
- * - Parsing
- * - Formatting and Outputting
+ * $(UL
+ * $(LI Fetching)
+ * $(LI Parsing)
+ * $(LI Formatting and Outputting)
+ * )
*/
class FBStream : DRSS!(Post){
///Holds all the retrieved posts
@@ -72,7 +75,7 @@ class FBStream : DRSS!(Post){
immutable string url;
/**
- * @param fetch_url Fetch the Data from this source
+ * Params: fetch_url = Fetch the Data from this source
*/
this(string fetch_url){
auto h=HTTP();
@@ -85,7 +88,10 @@ class FBStream : DRSS!(Post){
}
/**
- * Parses #document. Afterwords #posts, #root, #dataNodes will be filled.
+ * Parses the document.
+ *
+ * Params:
+ * document = The documentstring to parse.
*/
override public void parse(string document){
XmlNode[] arr;
@@ -100,9 +106,10 @@ class FBStream : DRSS!(Post){
}
/**
- * Generates #posts
- * @param nodes The `<code></code>` nodes, where the data can be found.
+ * Generates the posts
+ * Params: nodes = The `<code></code>` nodes, where the data can be found.
*/
+
private void generatePosts(XmlNode[] nodes){
foreach(ref XmlNode node; nodes){
XmlNode subTree=readDocument((cast(XmlComment)(node.getChildren()[0]))._comment);
@@ -116,7 +123,7 @@ class FBStream : DRSS!(Post){
/**
* Gets the information from the data-div and appends it to #posts
- * @param match The data-div node
+ * Params: match = The data-div node
*/
private void appendPost(XmlNode match){
XmlNode[] usercontent=match.parseXPath(`//div[@class="_5pbx userContent"]`);
@@ -132,6 +139,9 @@ class FBStream : DRSS!(Post){
addEntry(Post(usercontent[0],t,href[0].getAttribute("href")));
}
+ /**
+ * Fetches the raw-data, either from File or from URL
+ */
public override bool fetch(){
if(exists(url) && isFile(url)){
buffer=cast(ubyte[])read(url);
@@ -142,6 +152,12 @@ class FBStream : DRSS!(Post){
}
}
+ /**
+ * Generates the RSS-file
+ *
+ * Params:
+ * f = the file to write the RSS-Document to.
+ */
void writeRSS(File f){
import drss.render;
XmlNode n=generateRSS(this,headers);
@@ -151,6 +167,7 @@ class FBStream : DRSS!(Post){
}
+///
struct Post{
///The userdata `<div></div>`
XmlNode content;
@@ -162,8 +179,8 @@ struct Post{
static ushort title_cutoff=80;
/**
- * @return The title of the posting
- * @bug title_cutoff is reached with fewer characters when there are
+ * Return: The title of the posting
+ * Bugs: title_cutoff is reached with fewer characters when there are
* a lot of multibyte characters in the string.
*/
@property string title(){
@@ -174,26 +191,26 @@ struct Post{
}
return cont;
}
- ///@return The link to the post.
+ ///Returns: The link to the post.
@property string link() const{
return "https://facebook.com"~href;
}
/**
- * @return An unique id to the post
- * @bug It should be something sensible here, not just the link.
+ * Returns: An unique id to the post
+ * Bugs: It should be something sensible here, not just the link.
* Optimally, it should be the same as the facebookfeed read.
*/
@property string id() const{
return link();
}
- /// @return The Atom-valid datestring
+ /// Returns: The Atom-valid datestring
@property string ISOTime() const{
return time.toISOExtString();
}
- /// @return An UCData-Object describing the content of the post.
+ /// Returns: An UCData-Object describing the content of the post.
@property UCData getUCContent(){
UCData uc=new UCData();
uc.setCData(content.toString());
@@ -202,7 +219,7 @@ struct Post{
/**
* Compares the object with b by comparing the dates
- * @return -1 if b is bigger, 1 if b is smaller, 0 if they're equal
+ * Returns: -1 if b is bigger, 1 if b is smaller, 0 if they're equal
*/
int opCmp(in ref Post b) const{
if(time<b.time){
@@ -218,7 +235,7 @@ struct Post{
/**
* Generates an Atom-Entry matching the post
- * @return The Entry-Node for inclusion inside the Atom-Feed.
+ * Returns: The Entry-Node for inclusion inside the Atom-Feed.
*/
XmlNode toXML(){
XmlNode e=new XmlNode("entry");
@@ -229,10 +246,11 @@ struct Post{
e.addChild(new XmlNode("content").setAttribute("type","html").addChild(getUCContent()));
return e;
}
-
+ ///
bool opEquals(in ref Post b) const{
return (opCmp(b)==0);
}
+ ///
bool opEquals(in Post b) const{
return (opCmp(b)==0);
}
diff --git a/doxyfile b/doxyfile
@@ -1,6 +0,0 @@
-OUTPUT_DIRECTORY = "doc"
-EXCLUDE = "kxml"
-PROJECT_NAME = "Fb2RSS"
-INPUT = "Fb2RSS.d"
-EXTRACT_ALL = YES
-EXTRACT_PRIVATE = YES