well, i choice a

actually, i have checked some source code in docutils packages
like statemachine and parser.rst

as a lazy programmer, its best to use some tech like register a hook to got the target filedlist and then store the value to return

this is neccessary on the statemachine lib
but the rst parser implement ignore the context variable ,so any registed processer couldnt access the context to the statemachine

the plan b might be a quick way , but it seems not directive, why not return a python dict instead of xml node tree?


On Thu, May 5, 2011 at 3:22 PM, Guenter Milde <milde@users.berlios.de> wrote:
On 2011-05-04, Yunfan Jiang wrote:

> hi,
> i got some knowledges here
> http://docutils.sourceforge.net/docs/howto/rst-directives.html while i
> am looking for the documents for developer

Did you find the developer docs in the
http://docutils.sourceforge.net/docs/dev/ directory, too?

> i am doing my own blog system which use rst as the main format,
> currently my target is to use a single rst file to contains all the
> field that a blog entry needs, like title, tags, uri_code, and content,
> and i want to store the title, tags, and uri_code in the file's
> FieldList like this

>:title: the first blog of mine
>:uri_code: the-first-blog
>:tags: test python about

> here is content

> but the problem is i dont know how to parsing a reSturctured text and
> got the target field's value , there's so many documents that tolds how
> to translate from rst to another format ( html, xml, ...), could you
> show me same documents about this target, or could you give me some
> sample?

This depends on what exactly you want to achieve. In any case you might
need to look at the source (in addition to the developers documentation).

a) do you implement a "blog-writer" and want to use the field values in
† them?

† -> have a look at html4css1/__init__.py or latex2e/__init__.py to see
† how special field names are detected (hint: look at the
† visit_docinfo() and visit_field_name() definitions).

b) do you want to parse the rst source separtely?

† -> convert to XML and use standard tools to extract the info,

† or convert to a Docutils doctree and extract the info traversing
† † †the tree (similar to what is done in the transforms
† † †-> see docutils/docutils/transforms/*.py).

GŁnter




------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network
management toolset available today. †Delivers lowest initial
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Docutils-users mailing list
Docutils-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/docutils-users

Please use "Reply All" to reply to the list.



--
ME = {
† †"name": [ "jyf", "yunfan", "wuxian" ],
† †"im": {
† † † † "gtalk": "jyf1987@gmail.com",
† † † † "msn": "geek42@live.cn"
† † † † † },
† †"job": "python engineer",
† †"site": "http://hi.baidu.com/jyf1987",
† †"interested": †{
† † † †"tech": [ "linux", "python", "lua", "php", "html5", "c", "nosql"],
† † † †"history": ["chinese history", "global history"],
† † † †"SF": [ "hard SF", "Thought experiment" ],
† † † †"music": [ "New Age", "Chinese old theme", "Electronic music", "Strange Music :}"]
† † †}
†}