GNOME Bugzilla – Bug 168030
Patch for phpwebnotes support for tutorial
Last modified: 2011-02-21 12:06:57 UTC
phpwebnotes is an application to allow users to enter comments on webpages, similar to the system that the php documentation uses (ie http://www.php.net/manual/en/features.remote-files.php). To have docbook-generated documentation use this system, a couple of options have to be configured in a customization layer that will insert the php code necessary. The attached xsl file is such a customization layer; the patch adds support to the docs/tutorial/makefile.am to build that documentation. This way it's easy to build both un-annotated documentation for distribution with the tarball and annotated documentation for the website. Websites that want to display annotated documentation will need to be hosted on a webserver with php support and access to a mysql database. Start with downloading phpwebnotes from http://webnotes.futureware.biz/. Untar the release tarball to the directory where the index.html file of the tutorial is (actually the index.php file, because the xsl will make xsltproc generate .php files instead of .html files). (It is also possible to install phpwebnotes somewhere else, like in the docs/ subdirectory, if you do that you'll have to keep that location in account when reading the rest of this procedure) There is an INSTALL file in the doc/ subdirectory that will tell you how to install phpwebnotes further; basically, you have to make a mysql database and populate it with the script in the sql/ directory, create a file called 'custom_config_inc.php' in the core/ directory and set the database host, name and username/password and the directory where phpwebnotes is installed, relative to the docroot (for example I have it set to '/html/phpwebnotes/' because my docroot is the gtkmm2\docs\tutorial\html\ directory). Now if you generate the annotated version of the tutorial (make html/index.php I think) and navigate to the index.php file in your browser, you'll see that you can enter new annotations there. You can also login (the default username/password is 'administrator'/'root') and then you can delete and approve annotations. If you want annotations to be approved by default (so not needing approval basically), you can set that in the custom_config_inc.php file. Please note that the makefile.am is untested as I don't have a make environment on this (Windows) machine. Also I never really understood automake but I think the patch should work. If it doesn't, the command line in it is clear and should allow anyone who does know how automake work to easily correct any mistakes.
Created attachment 37740 [details] [review] Patch to docs/tutorial/makefile.am
Created attachment 37741 [details] The docbook customization layer needed to insert the phpwebnotes code
As you can see here: http://www.murrayc.com/temp/gtkmm_book_with_comments/html/ch01s02.php#id2637067 it's generating < and > instead of < and >, so the php code is just displayed as plain text instead of being processed. Do you have an idea to fix that?
Apparantly I was using an old version of xsltproc. After upgrading I have the same problem. I'll subscribe to the libxml mailing list and see what I can find out. I've had a similar problem with xsltproc a year or 2 ago; my solution then was to switch to Saxon but that's not included in most Linux distributions so that's not really an option in this case. I'll post here as soon as I know.
I'm sure that xsltproc does the right thing.
yes. Not a bug, here is my answer from the list: -------------------- CDATA does not exist in the XPAth data model. I.e. XSLT does not see CDATA in any input or generated tree, only text nodes with the associated text value. What you're trying to do is not possible in XSLT. The only thing you can do: - force some element content to be CDATA http://www.w3.org/TR/xslt#section-XML-Output-Method using cdata-section-elements - disable escaping for some specific text nodes http://www.w3.org/TR/xslt#disable-output-escaping ------------- Daniel
Ok thanks a lot Daniel. I have attached a new version of the stylesheet that does work.
Created attachment 37769 [details] New version of the customization layer
Created attachment 37773 [details] Semantically more correct stylesheet I've been convinced that there is a better way to write the stylesheet (http://mail.gnome.org/archives/xslt/2005-February/msg00043.html). So the effect of this one should be the same, but it's 'better' xslt.
Excellent. That works. Here's an example: http://www.murrayc.com/temp/gtkmm_book_with_comments/html/ch13s02.php (I'd like to use named sections anyway)
Aha good. Here's a patch that adds id's to all sect's that need it. I tried to keep with the naming scheme, preferring lowercase over uppercase where applicable.
Created attachment 37835 [details] [review] Add id's to all sect's that need it
Thanks. Committed to HEAD. Please do remember to patch the ChangeLog in future.
I've looked in the gnome CVS and I didn't see it commited.
Sorry, I haven't completely forgotten.
This is currently waiting (again) on the results of the library.gnome.org Summer Of Code project. If that works then I would prefer to use it.
All gtkmm documentation is now on library.gnome.org, so any commenting ability would have to be added to that.
*** This bug has been marked as a duplicate of bug 614985 ***