Re: [fossil-users] Automatic creation of file to wiki or embedded docs
I found out that g.zExtra doesn't store the query string parameters but the rest of the path after the page e.g. http://localhost:8080/doc/tip/www/index.wiki g.zExtra = tip/www/index.wiki I had a bit of fun and made th1 fossil env get var command. (actual looking into fossil cgi_parameters) and coded in the header if {[env get name]} { puts name=$name puts current_page=$current_page } else { puts No parameter } in de case of http://localhost:8080/finfo?name=win/version.c I got name=win/version.c current_page=finfo That did work and would make your idea possible. However my conclusion is: I'm sorry to say but you cannot get at the QUERY_STRING or the individual parameters of the request in TH1 (server-side processing). for the curious ( I probably broke 101 rules in coding, not using subcommand) the routine is /* ** TH Syntax: ** ** env get VAR ** ** Does do ** set rc 0 ** set VALUE [cgi_parameter VAR ] ** if($VALUE){ ** set VAR $VALUE ** set rc 1 ** } ** return rc */ static int env_get_command( Th_Interp *interp, void *ctx, int argc, const char **argv, int *argl ){ int rc =0; char *value; if( argc!=3 ){ return Th_WrongNumArgs(interp, env get var); } value = cgi_parameter(argv[2],0); // compiler warning need to include cgi.h and/or define INTERFACE if (value){ Th_SetVar(interp, argv[2], argl[2], value, strlen(value)+1); rc=1; } Th_SetResultInt(interp, rc); return TH_OK; } -- Rene ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Automatic creation of file to wiki or embedded docs
On Tue, Jan 18, 2011 at 11:26 AM, Stephan Beal sgb...@googlemail.comwrote: i hadn't considered that approach - i'll have to try that out. i can think of no reason that that shouldn't work. A quick check shows that those files get processed by fossil, as well, or my browser downloads them instead of displaying them, so this won't work for what i was trying to do. -- - stephan beal http://wanderinghorse.net/home/stephan/ ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Automatic creation of file to wiki or embedded docs
On Tue, 18 Jan 2011 09:25:09 +, David Bovill wrote: Thanks for the comments Rene... On 17 January 2011 23:50, Rene wrote: You can link to the source code file. But the source code file cannot link to the documentation. It could do with a minor tweak to the template for the file info page :) It's a basic UX feature - you go from docs to source code but can't get back :( All the templates fossil is using are under Admin (header, footer, [skins, css]) and you can change them as much as you want. I've been trying these, and they are great. I'm not sure I can use them to create conditional links from the file section to the documentation section - it may be possible using TH1 / and / or some Javascript. I've read the TH1 pdf, and it covers the basic language well. I'm wandering what access we have to Fossil variables - page title, section type etc that may be available to use in the language? Can anyone help with posting a TH1 snippet that would detect if a user was in a particular section - say the file-info page? It is important to understand that th1 is server-side processing javascript is client-side processing e.g. Your browser I checked and in style.c these are axported to TH 1: /* Generate the header up through the main menu */ Th_Store(project_name, db_get(project-name,Unnamed Fossil Project)); Th_Store(title, zTitle); Th_Store(baseurl, g.zBaseURL); Th_Store(home, g.zTop); Th_Store(index_page, db_get(index-page,/home)); Th_Store(current_page, g.zPath); Th_Store(manifest_version, MANIFEST_VERSION); Th_Store(manifest_date, MANIFEST_DATE); Th_Store(compiler_name, COMPILER_NAME); if( g.zLogin ){ Th_Store(login, g.zLogin); } you can check if $current_page == finfo. But you miss the arguments to finfo. in g(lobal) are these 3 defined char *zPath;/* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ zExtra (I assume) contains the name=arg. But it isn't made available in th1. So you cannot generate a link to the documentation. Bummer. You could ask if richard want to add something like: Th_Store(parameters, g.zExtra); -- Rene ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Automatic creation of file to wiki or embedded docs
Very useful Rene! Thanks :) And Richard do please add Th_Store(parameters, g.zExtra) :) On 18 January 2011 13:14, Rene renew...@xs4all.nl wrote: On Tue, 18 Jan 2011 09:25:09 +, David Bovill wrote: Thanks for the comments Rene... On 17 January 2011 23:50, Rene wrote: You can link to the source code file. But the source code file cannot link to the documentation. It could do with a minor tweak to the template for the file info page :) It's a basic UX feature - you go from docs to source code but can't get back :( All the templates fossil is using are under Admin (header, footer, [skins, css]) and you can change them as much as you want. I've been trying these, and they are great. I'm not sure I can use them to create conditional links from the file section to the documentation section - it may be possible using TH1 / and / or some Javascript. I've read the TH1 pdf, and it covers the basic language well. I'm wandering what access we have to Fossil variables - page title, section type etc that may be available to use in the language? Can anyone help with posting a TH1 snippet that would detect if a user was in a particular section - say the file-info page? It is important to understand that th1 is server-side processing javascript is client-side processing e.g. Your browser I checked and in style.c these are axported to TH 1: /* Generate the header up through the main menu */ Th_Store(project_name, db_get(project-name,Unnamed Fossil Project)); Th_Store(title, zTitle); Th_Store(baseurl, g.zBaseURL); Th_Store(home, g.zTop); Th_Store(index_page, db_get(index-page,/home)); Th_Store(current_page, g.zPath); Th_Store(manifest_version, MANIFEST_VERSION); Th_Store(manifest_date, MANIFEST_DATE); Th_Store(compiler_name, COMPILER_NAME); if( g.zLogin ){ Th_Store(login, g.zLogin); } you can check if $current_page == finfo. But you miss the arguments to finfo. in g(lobal) are these 3 defined char *zPath;/* Name of webpage being served */ char *zExtra; /* Extra path information past the webpage name */ char *zBaseURL; /* Full text of the URL being served */ zExtra (I assume) contains the name=arg. But it isn't made available in th1. So you cannot generate a link to the documentation. Bummer. You could ask if richard want to add something like: Th_Store(parameters, g.zExtra); -- Rene ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Automatic creation of file to wiki or embedded docs
On 17 January 2011 01:29, Ron Wilson ronw.m...@gmail.com wrote: On Sun, Jan 16, 2011 at 5:24 AM, David Bovill da...@architex.tv wrote: Do you mean only in Fossil's file display, Yes - this is the main need. Simply put you have to be able to move back and forth between source code and documentation. or are you looking for a way to automatically have a link in the source file's header back to a wiki page? No - I've used that before with svn - but it's a minor issue and tends to complicate things. Another thought that occurs to me is that source code could be embedded in .wiki files using the code or verbatim tags. A rule in your makefile or build script would define how to extract the source from a .wiki file. For example, a make rule for C++ source would be: Embedding source code in the documentation is useful - it's the sort of thing you do on Trac or other full blown wiki systems. But I think this would be a lot of work, and there is always something else that would be useful to embed etc (which is why Trac etc use plugins). I'm trying to keep it simple - so going back and forth between tow pages is fine for now. It's not fine from a UX point of view, to have users need to use the browser back button. .wiki.cpp: sed -n -e '\#code#,\#/code# p' $? | sed -e '\#/?code# d' $@ This would allow extensive documentation, as well as wiki markup, to be interleaved with the code. True but I think it is prob a lot more work - than adding a simple link to the file info page, or better opening up / describing how to hack the template for pages like this? ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Automatic creation of file to wiki or embedded docs
On Sun, 16 Jan 2011 10:24:16 +, David Bovill wrote: One think I'm missing in terms of usability is the ability to intimately link a particular source code file with a wiki page. AFAIK this is not part of the structure or interface at the moment - so no wiki-tags for linking to / embedding the source code from the wiki. as said before you can do that with an [url|display] to the file of you desire. It seems that this may be partly possible by creating your own custom header in the wiki page - but there is no equivalent for the file display page? basically I want to have two-way links between the source code file and a root documentation page. Probably using the Embedded docs as then the docs and source code are versioned together. You can link to the source code file. But the source code file cannot link to the documentation. As said before there is no wiki parsing for source code. Is there a way to access / alter the html template for the non-wiki pages? In general it is nice to have these templates in the wiki itself - reuses the code and allow total flexibility in terms of customisation? But if these files are stored in the db somewhere I can access and alter these directly? All the templates fossil is using are under Admin (header, footer, [skins, css]) and you can change them as much as you want. But the template language is basic, no include other templates. TH1 is available so you have if then else. But you have to code everything in the header and the footer. for instance if you detect that the page is version.c then you could generate a link to the documentation. But al the intelligence for connecting the source code to the documentation must be contained in header and footer. -- Rene ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Automatic creation of file to wiki or embedded docs
On Sun, Jan 16, 2011 at 1:07 PM, Rene renew...@xs4all.nl wrote: You can link to a src file. see http://www.fossil-scm.org/index.html/doc/tip/www/embeddeddoc.wiki for file you need to be logged in. However tweaking the permission of user nobody gets you there. But that also gives the nobody user (e.g. web spiders) the ability to crawl every version of every file, and bots will end up searching your whole (growning) repo each time they walk it. (If you have no bandwidth limitation, then probably no big deal other than the unnecessary stress on the server.) Once a bot hits the timeline page, if links are enabled then all your repo is belong to him. -- - stephan beal http://wanderinghorse.net/home/stephan/ ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
Re: [fossil-users] Automatic creation of file to wiki or embedded docs
On Sun, Jan 16, 2011 at 5:24 AM, David Bovill da...@architex.tv wrote: One think I'm missing in terms of usability is the ability to intimately link a particular source code file with a wiki page. AFAIK this is not part of the structure or interface at the moment - so no wiki-tags for linking to / embedding the source code from the wiki. It seems that this may be partly possible by creating your own custom header in the wiki page - but there is no equivalent for the file display page? basically I want to have two-way links between the source code file and a root documentation page. Do you mean only in Fossil's file display, or are you looking for a way to automatically have a link in the source file's header back to a wiki page? If Fossil were to support a $Documentation$ keyword in source files, I could see such an automated link in a source file. Another thought that occurs to me is that source code could be embedded in .wiki files using the code or verbatim tags. A rule in your makefile or build script would define how to extract the source from a .wiki file. For example, a make rule for C++ source would be: .wiki.cpp: sed -n -e '\#code#,\#/code# p' $? | sed -e '\#/?code# d' $@ This would allow extensive documentation, as well as wiki markup, to be interleaved with the code. ___ fossil-users mailing list fossil-users@lists.fossil-scm.org http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users