Yes, I did not find rst2docbook.py very well maintained either (I guess
the author knows better?) and I would be very much interested in this,
too.
In the meanwhile I have managed to translate rst to docbook
by means of some xslt stylesheets.
Basically I am using these two steps
rst2xml file.rst > file.xml
4xslt -o file.dbk file.xml stylesheet.xsl
(4xslt is my xml processor - xalan, saxon etc. might
do just a well)
I broke down stylesheet.xsl into smaller pieces
(i. e. stylesheet.xsl has includes of other .xsl files)
Some of the elements are easy enough to translate:
e. g. block_quote in rst becomes blockquote in docbook
<xsl:template match="block_quote">
<blockquote>
<xsl:apply-templates />
</blockquote>
</xsl:template>
Footnotes are a bit more complicated
<xsl:template match="footnote_reference">
<footnote>
<xsl:apply-templates
select="//footnote[@ids=current()/@refid]/paragraph"
/>
</footnote>
</xsl:template>
<xsl:template match="footnote" />
and I decided to use rst citations as docbook bibliomixed
items etc.
<xsl:template match="citation_reference">
<xref linkend="{@refid}" />
</xsl:template>
<xsl:template match="citation">
<bibliomixed id="{@ids}">
<abbrev>
<xsl:value-of select="@names" />
</abbrev>
<xsl:apply-templates mode="bib" />
</bibliomixed>
</xsl:template>
<!-- without para -->
<xsl:template match="paragraph" mode="bib">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="label" mode="bib" />
This particular example of citation_reference/citation
shows a general difficulty: Say I have my citation_reference
in a file chapterx.rst und my citation in another file
bib.rst. For rst2xml to work properly both have to be present.
Therefore I am always translating the complete book.rst/article.rst
e.g. book.rst
Some Title
----------
.. include:: chapterx.rst
.. include:: bib.rst
rst2xml book.rst > book.xml
However I like the idea of having different docbook files
chapterx.dbk, bib.dbk as the result of my translation.
Therefore I am extracting the section of interest from
book.xml and use the stylesheet on this particular section.
The whole process needs some more cleanup and was also
an exercise in Makefile writing (automatically generated
dependencies files etc.). Also I have so far only
translated a subset of rst to docbook. My idea was
I would just see how far that would take me, I could
at some point switch over and keep on writing in docbook
(if translation would not be possible for whatever reason)
I would however like to see a broader support for
docbook2rst.
(And don't claim that my way of using xslt rather than pure python is
any better, it was just easier for me at this point).
Are there more people interested? Maybe maintaining rst2docbook
more as a community project?
-Andreas
On Fri, Aug 25, 2006 at 01:58:09PM +0000, HickWu wrote:
> I found this rst2docbook.py, but it could not even deal with the hyperlink
> function.
>
> I installed it with Docutils 0.4 in Windows XP pro sp2.
> I only need a script that can support some frequently used structure.
>
> thanks
>
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Docutils-develop mailing list
> Docutils-develop@...
> https://lists.sourceforge.net/lists/listinfo/docutils-develop
>
> Please use "Reply All" to reply to the list.
>
>
> !DSPAM:44ef0701182743018114270!
|