mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-04 22:03:29 -06:00
*uppweb: Added RSS feed
git-svn-id: svn://ultimatepp.org/upp/trunk@2273 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6f72f42453
commit
3d7873dc24
4 changed files with 1074 additions and 925 deletions
158
uppbox/uppweb/svn.cpp
Normal file
158
uppbox/uppweb/svn.cpp
Normal file
|
|
@ -0,0 +1,158 @@
|
|||
#include "www.h"
|
||||
|
||||
VectorMap<String, SvnListRev> svndata;
|
||||
Vector<SvnLogRev> svnlog;
|
||||
|
||||
void ParseSvnList(VectorMap<String, SvnListRev> &data, String &out, const String path) {
|
||||
String topicFolder;
|
||||
|
||||
String line;
|
||||
int pos = 0;
|
||||
int newpos;
|
||||
while (true) {
|
||||
int linepos;
|
||||
if((linepos = out.Find("kind=\"file\"", pos)) == -1)
|
||||
return;
|
||||
if((newpos = out.Find("<name>", linepos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("<name>");
|
||||
if((newpos = out.Find("<", pos)) == -1)
|
||||
return;
|
||||
String name = out.Mid(pos, newpos-pos);
|
||||
if((newpos = name.Find('.')) != -1)
|
||||
name = name.Mid(0, newpos);
|
||||
SvnListRev &rev = data.Add(path + name);
|
||||
if((newpos = out.Find("revision=\"", linepos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("revision=\"");
|
||||
if((newpos = out.Find('\"', pos)) == -1)
|
||||
return;
|
||||
rev.revision = ScanInt(out.Mid(pos, newpos-pos));
|
||||
if((newpos = out.Find("<author>", linepos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("<author>");
|
||||
if((newpos = out.Find("<", pos)) == -1)
|
||||
return;
|
||||
rev.author = out.Mid(pos, newpos-pos);
|
||||
if((newpos = out.Find("<date>", linepos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("<date>");
|
||||
if((newpos = out.Find("<", pos)) == -1)
|
||||
return;
|
||||
String time = out.Mid(pos, newpos-pos);
|
||||
rev.time.year = ScanInt(time.Left(4));
|
||||
rev.time.month = ScanInt(time.Mid(5, 2));
|
||||
rev.time.day = ScanInt(time.Mid(8, 2));
|
||||
rev.time.hour = ScanInt(time.Mid(11, 2));
|
||||
rev.time.minute = ScanInt(time.Mid(14, 2));
|
||||
rev.time.second = ScanInt(time.Mid(17));
|
||||
}
|
||||
}
|
||||
void GetSvnFolder(VectorMap<String, SvnListRev> &data, String tppfolder) {
|
||||
tppfolder = UnixPath(tppfolder);
|
||||
String out = Sys("svn list \"" + tppfolder + "\" --xml --recursive --non-interactive");
|
||||
int posp = tppfolder.ReverseFind('.');
|
||||
int pos = tppfolder.ReverseFind('/', posp-1);
|
||||
pos = tppfolder.ReverseFind('/', pos-1);
|
||||
String topic = "topic:/" + tppfolder.Mid(pos, posp-pos) + "/";
|
||||
ParseSvnList(data, out, topic);
|
||||
}
|
||||
void GetSvnFolderDeep(VectorMap<String, SvnListRev> &data, const String &tppfolder) {
|
||||
FindFile fftpp(AppendFileName(tppfolder, "*.tpp"));
|
||||
while(fftpp) {
|
||||
String name = fftpp.GetName();
|
||||
String p = AppendFileName(tppfolder, name);
|
||||
if(fftpp.IsFolder())
|
||||
GetSvnFolder(data, p);
|
||||
fftpp.Next();
|
||||
}
|
||||
FindFile ff(AppendFileName(tppfolder, "*.*"));
|
||||
while(ff) {
|
||||
String name = ff.GetName();
|
||||
String p = AppendFileName(tppfolder, name);
|
||||
if(ff.IsFolder())
|
||||
GetSvnFolderDeep(data, p);
|
||||
ff.Next();
|
||||
}
|
||||
}
|
||||
void GetSvnList(VectorMap<String, SvnListRev> &data) {
|
||||
RLOG("Querying svn for documentation metadata ...");
|
||||
GetSvnFolder(data, AppendFileName(rootdir, "uppbox/uppweb/www.tpp"));
|
||||
GetSvnFolderDeep(data, AppendFileName(rootdir, "uppsrc"));
|
||||
GetSvnFolderDeep(data, AppendFileName(rootdir, "bazaar"));
|
||||
}
|
||||
|
||||
void ParseSvnLog(Vector<SvnLogRev> &log,String& out){
|
||||
int pos = 0;
|
||||
int newpos;
|
||||
while (true) {
|
||||
int linepos;
|
||||
SvnLogRev &rev = log.Add();
|
||||
if((newpos = out.Find("revision=\"", pos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("revision=\"");
|
||||
if((newpos = out.Find('\"', pos)) == -1)
|
||||
return;
|
||||
rev.revision = out.Mid(pos, newpos-pos);
|
||||
if((newpos = out.Find("<author>", pos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("<author>");
|
||||
if((newpos = out.Find("<", pos)) == -1)
|
||||
return;
|
||||
rev.author = out.Mid(pos, newpos-pos);
|
||||
if((newpos = out.Find("<date>", pos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("<date>");
|
||||
if((newpos = out.Find("<", pos)) == -1)
|
||||
return;
|
||||
String time = out.Mid(pos, newpos-pos);
|
||||
rev.time.year = ScanInt(time.Left(4));
|
||||
rev.time.month = ScanInt(time.Mid(5, 2));
|
||||
rev.time.day = ScanInt(time.Mid(8, 2));
|
||||
rev.time.hour = ScanInt(time.Mid(11, 2));
|
||||
rev.time.minute = ScanInt(time.Mid(14, 2));
|
||||
rev.time.second = ScanInt(time.Mid(17));
|
||||
if((newpos = out.Find("<paths>", pos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("<paths>");
|
||||
int maxpos;
|
||||
if((maxpos = out.Find("</paths>", pos)) == -1)
|
||||
return;
|
||||
while(true) {
|
||||
if((newpos = out.Find("kind=\"", pos)) == -1)
|
||||
break;
|
||||
if(newpos>maxpos)
|
||||
break;
|
||||
pos = newpos + strlen("kind=\"");
|
||||
if((newpos = out.Find('\"', pos)) == -1)
|
||||
break;
|
||||
SvnLogRev::SvnChange &chng = rev.changes.Add();
|
||||
chng.kind = out.Mid(pos, newpos-pos);
|
||||
if((newpos = out.Find("action=\"", pos)) == -1)
|
||||
break;
|
||||
pos = newpos + strlen("action=\"");
|
||||
if((newpos = out.Find('\"', pos)) == -1)
|
||||
break;
|
||||
chng.action = out.Mid(pos, newpos-pos);
|
||||
if((newpos = out.Find(">", pos)) == -1)
|
||||
break;
|
||||
pos = newpos + strlen(">");
|
||||
if((newpos = out.Find('<', pos)) == -1)
|
||||
break;
|
||||
chng.path = out.Mid(pos, newpos-pos);
|
||||
}
|
||||
if((newpos = out.Find("<msg>", pos)) == -1)
|
||||
return;
|
||||
pos = newpos + strlen("<msg>");
|
||||
if((newpos = out.Find("<", pos)) == -1)
|
||||
return;
|
||||
rev.msg = out.Mid(pos, newpos-pos);
|
||||
pos=newpos;
|
||||
}
|
||||
}
|
||||
|
||||
void GetSvnLog(Vector<SvnLogRev> &log){
|
||||
RLOG("Querying svn for revisions log ...");
|
||||
String out = Sys("svn log \"" + rootdir + "\" --xml --verbose --non-interactive --limit 30");
|
||||
ParseSvnLog(log,out);
|
||||
}
|
||||
|
|
@ -16,6 +16,7 @@ options(GCC) -DNOWSTRING;
|
|||
file
|
||||
ntl_license.txt,
|
||||
www.h,
|
||||
svn.cpp,
|
||||
topictree.cpp,
|
||||
cpp.cpp,
|
||||
www.cpp,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,31 +1,55 @@
|
|||
#ifndef _uppweb_www_h_
|
||||
#define _uppweb_www_h_
|
||||
|
||||
#include <Web/Web.h>
|
||||
#include <RichText/RichText.h>
|
||||
#include <plugin/gif/gif.h>
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <ide/Browser/Browser.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#ifdef _MULTITHREADED
|
||||
#define MTC
|
||||
#endif
|
||||
|
||||
extern String uppsrc;
|
||||
extern String uppbox;
|
||||
extern String bazaar;
|
||||
extern VectorMap<String, String> reflink;
|
||||
|
||||
String TopicFileName(const char *dir, const char *topic);
|
||||
String TopicFileNameHtml(const char *topic);
|
||||
String GatherTopics(VectorMap<String, Topic>& map, const char *topic, String& title);
|
||||
String GatherTopics(VectorMap<String, Topic>& map, const char *topic);
|
||||
|
||||
String CppAsQtf(const String& s);
|
||||
|
||||
void GatherRefLinks(const char *upp);
|
||||
|
||||
|
||||
#endif
|
||||
#ifndef _uppweb_www_h_
|
||||
#define _uppweb_www_h_
|
||||
|
||||
#include <Web/Web.h>
|
||||
#include <RichText/RichText.h>
|
||||
#include <plugin/gif/gif.h>
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <ide/Browser/Browser.h>
|
||||
|
||||
using namespace Upp;
|
||||
|
||||
#ifdef _MULTITHREADED
|
||||
#define MTC
|
||||
#endif
|
||||
|
||||
struct SvnListRev : Moveable <SvnListRev> {
|
||||
String author;
|
||||
int revision;
|
||||
Time time;
|
||||
};
|
||||
|
||||
struct SvnLogRev : Moveable <SvnLogRev> {
|
||||
String revision;
|
||||
String author;
|
||||
Time time;
|
||||
struct SvnChange : Moveable <SvnChange> {
|
||||
String kind;
|
||||
String action;
|
||||
String path;
|
||||
};
|
||||
Vector<SvnChange> changes;
|
||||
String msg;
|
||||
};
|
||||
|
||||
extern String uppsrc;
|
||||
extern String uppbox;
|
||||
extern String bazaar;
|
||||
extern String rootdir;
|
||||
extern VectorMap<String, String> reflink;
|
||||
extern VectorMap<String, SvnListRev> svndata;
|
||||
extern Vector<SvnLogRev> svnlog;
|
||||
|
||||
String TopicFileName(const char *dir, const char *topic);
|
||||
String TopicFileNameHtml(const char *topic);
|
||||
String GatherTopics(VectorMap<String, Topic>& map, const char *topic, String& title);
|
||||
String GatherTopics(VectorMap<String, Topic>& map, const char *topic);
|
||||
|
||||
String CppAsQtf(const String& s);
|
||||
|
||||
void GatherRefLinks(const char *upp);
|
||||
|
||||
void GetSvnList(VectorMap<String, SvnListRev> &data);
|
||||
void GetSvnLog(Vector<SvnLogRev> &log);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue