From b9d2ee880ccfe54035a7c5e2d14917d84ec8fd45 Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Thu, 17 Sep 2009 11:29:23 -0400 Subject: Resolve native reStructuredText links to ikiwiki pages --- ...ve_reStructuredText_links_to_ikiwiki_pages.mdwn | 124 +++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn new file mode 100644 index 000000000..c90261dc3 --- /dev/null +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -0,0 +1,124 @@ +I have a working minimal implementation letting the rst renderer resolve undefined native rST links to ikiwiki pages. I have posted it as one patch at: + +Preview commit: http://github.com/engla/ikiwiki/commit/486fd79e520da1d462f00f40e7a90ab07e9c6fdf +Repository: git://github.com/engla/ikiwiki.git + +Design issues of the patch: + +Right now it changes rendering so that undefined pages (previous errors) are resolved to either ikiwiki pages or link to "#". It could be changed (trivially) so that undefined pages give the same error as before. Since it only resolves links that would previously error out, impact on current installations should be minimal. + +I don't know why backlinks don't show up with the patch as it is; they are registered, but not rendered on the linked-to page. + +Desing issues in general: + +We resolve rST links without definition, we don't help resolving defined relative links, so we don't support specifying link name and target separately. + +Many other issues with rST are of course unresolved, but some might be solved by implementing custom rST directives (which is a supported extension mechanism). + +Patch follows: + +---- +
+	From 486fd79e520da1d462f00f40e7a90ab07e9c6fdf Mon Sep 17 00:00:00 2001
+	From: Ulrik Sverdrup 
+	Date: Thu, 17 Sep 2009 15:18:50 +0200
+	Subject: [PATCH] rst: Resolve native reStructuredText links to ikiwiki pages
+
+	Links in rST use syntax `Like This`_ or OneWordLink_, and are
+	generally used for relative or absolue links, with an auxiliary
+	definition:
+
+	.. _`Like This`: http://ikiwiki.info
+	.. _OneWordLink: relative
+
+	We can hook into docutils to resolve unresolved links so that rST
+	links without definition can be resolved to wiki pages. This enables
+	WikiLink_ to link to [[WikiLink]] (if no .. _WikiLink is specified).
+
+	Comparing to Ikiwiki's wikilinks
+
+	[[blogging|blog]] specifies a link to the page blog, with the name
+	blogging. In rST we should use blogging_
+
+	.. _blogging: blog
+
+	*However*, note that this patch does not hook into this. What we
+	resolve in this patch is finding the appropriate "_blogging" if it is
+	not found, not resolving the address 'blog'.
+	---
+	 plugins/rst |   46 +++++++++++++++++++++++++++++++++++++++++-----
+	 1 files changed, 41 insertions(+), 5 deletions(-)
+
+	diff --git a/plugins/rst b/plugins/rst
+	index a2d07eb..a74baa8 100755
+	--- a/plugins/rst
+	+++ b/plugins/rst
+	@@ -6,22 +6,58 @@
+	 # based a little bit on rst.pm by Sergio Talens-Oliag, but only a little bit. :)
+	 #
+	 # Copyright © martin f. krafft 
+	+# Copyright © Ulrik Sverdrup , 2009
+	+#
+	 # Released under the terms of the GNU GPL version 2
+	 #
+	+
+	 __name__ = 'rst'
+	 __description__ = 'xml-rpc-based ikiwiki plugin to process RST files'
+	-__version__ = '0.3'
+	+__version__ = '0.3+'
+	 __author__ = 'martin f. krafft '
+	 __copyright__ = 'Copyright © ' + __author__
+	 __licence__ = 'GPLv2'
+	 
+	 from docutils.core import publish_parts;
+	+from docutils.writers import html4css1
+	 from proxy import IkiWikiProcedureProxy
+	 
+	-def rst2html(proxy, *kwargs):
+	-    # FIXME arguments should be treated as a hash, the order could change
+	-    # at any time and break this.
+	-    parts = publish_parts(kwargs[3], writer_name='html',
+	+class IkiwikiWriter(html4css1.Writer):
+	+    def resolve_node(self, node):
+	+        refname = node.get('refname', None)
+	+        if not refname:
+	+            return False
+	+
+	+        bestlink = self.proxy.rpc('bestlink', self.page, refname)
+	+
+	+        node.resolved = 1
+	+        node['class'] = 'wiki'
+	+        del node['refname']
+	+
+	+        if not bestlink:
+	+            rel_url = "#"
+	+        else:
+	+            rel_url = self.proxy.rpc('urlto', bestlink, self.page)
+	+            self.proxy.rpc('add_link', self.page, bestlink)
+	+        node['refuri'] = rel_url
+	+        self.proxy.rpc('debug', "Emitting link %s => %s" % (refname, rel_url))
+	+        return True
+	+
+	+    resolve_node.priority = 1
+	+
+	+    def __init__(self, proxy, page):
+	+        html4css1.Writer.__init__(self)
+	+        self.proxy = proxy
+	+        self.page = page
+	+        self.unknown_reference_resolvers = (self.resolve_node, )
+	+
+	+def rst2html(proxy, *args):
+	+    # args is a list paired by key, value, so we turn it into a dict
+	+    kwargs = dict((k, v) for k, v in zip(*[iter(args)]*2))
+	+    page = kwargs['page']
+	+
+	+    parts = publish_parts(kwargs['content'],
+	+                          writer=IkiwikiWriter(proxy, page),
+	                           settings_overrides = { 'halt_level': 6
+	                                                , 'file_insertion_enabled': 0
+	                                                , 'raw_enabled': 1
+	-- 
+	1.6.4
+
+
+---- -- cgit v1.2.3 From 470712618401fb3cd322c84d1c57e4b8835850d5 Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Thu, 17 Sep 2009 12:07:23 -0400 Subject: The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to generate backlinks). Can the parse output be safely reused? --- doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index c90261dc3..7adcb5c09 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -7,7 +7,7 @@ Design issues of the patch: Right now it changes rendering so that undefined pages (previous errors) are resolved to either ikiwiki pages or link to "#". It could be changed (trivially) so that undefined pages give the same error as before. Since it only resolves links that would previously error out, impact on current installations should be minimal. -I don't know why backlinks don't show up with the patch as it is; they are registered, but not rendered on the linked-to page. +The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to generate backlinks). Can the parse output be safely reused? Desing issues in general: -- cgit v1.2.3 From 356188f7c65c0e9b78e8be1e477acb785d48d3c2 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 17 Sep 2009 12:42:40 -0400 Subject: response --- doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 7adcb5c09..c98723f2d 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -9,6 +9,11 @@ Right now it changes rendering so that undefined pages (previous errors) are res The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to generate backlinks). Can the parse output be safely reused? +> The page content fed to htmlize may be different than that fed to scan, +> as directives can change the content. If you cached the input and output +> at scan time, you could reuse the cached data at htmlize time for inputs +> that are the same -- but that could be a very big cache! --[[Joey]] + Desing issues in general: We resolve rST links without definition, we don't help resolving defined relative links, so we don't support specifying link name and target separately. -- cgit v1.2.3 From fc1cc57cdca9a7bdab41f0d63e34a98a2d7c78e5 Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Thu, 17 Sep 2009 15:38:40 -0400 Subject: about replacements in rst (renaming links) --- ...Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index c98723f2d..642382b47 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -18,6 +18,16 @@ Desing issues in general: We resolve rST links without definition, we don't help resolving defined relative links, so we don't support specifying link name and target separately. +> I found out this is possible by using rST subsitutions. So to do [[Version history...|releases]] +> you would use: +> +> `|releases|_` +> `.. |releases| replace:: Version history...` +> Which does not seem to have an inline replacement. Using non-resolved links there is the alternative: +> +> ``Version history `_`. --ulrik [kaizer.se] + + Many other issues with rST are of course unresolved, but some might be solved by implementing custom rST directives (which is a supported extension mechanism). Patch follows: -- cgit v1.2.3 From b7db2ca37f400e09a663b01800e3bc5477a304df Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Thu, 17 Sep 2009 15:42:34 -0400 Subject: word use, equivalent is better. --- doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 642382b47..aa96fc431 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -23,7 +23,7 @@ We resolve rST links without definition, we don't help resolving defined relativ > > `|releases|_` > `.. |releases| replace:: Version history...` -> Which does not seem to have an inline replacement. Using non-resolved links there is the alternative: +> Which does not seem to have an inline equivalent. Using non-resolved links there is the alternative: > > ``Version history `_`. --ulrik [kaizer.se] -- cgit v1.2.3 From e19d0c5bbdcd45d810688f990381b639485434bb Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 18 Sep 2009 16:08:16 +0200 Subject: on caching --- .../Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index aa96fc431..c8d7ba5ed 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -14,6 +14,12 @@ The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to genera > at scan time, you could reuse the cached data at htmlize time for inputs > that are the same -- but that could be a very big cache! --[[Joey]] +>> I would propose using a simple heuristic: If you see `[[` anywhere on the +>> page, don't cache it. It would be an effective cache for pure-rst wikis +>> (without any ikiwiki directives or wikilinks). +>> However, I think that if the cache does not work for a big load, it should +>> not work at all; small loads are small so they don't matter. --ulrik + Desing issues in general: We resolve rST links without definition, we don't help resolving defined relative links, so we don't support specifying link name and target separately. -- cgit v1.2.3 From 5cd338fe16ede5aa1dbbf80cdfe027f8bfa09cd3 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 18 Sep 2009 16:10:43 +0200 Subject: escape markup (oops) --- doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index c8d7ba5ed..682229469 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -14,7 +14,7 @@ The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to genera > at scan time, you could reuse the cached data at htmlize time for inputs > that are the same -- but that could be a very big cache! --[[Joey]] ->> I would propose using a simple heuristic: If you see `[[` anywhere on the +>> I would propose using a simple heuristic: If you see \[[ anywhere on the >> page, don't cache it. It would be an effective cache for pure-rst wikis >> (without any ikiwiki directives or wikilinks). >> However, I think that if the cache does not work for a big load, it should -- cgit v1.2.3 From 25eafa8522a9480ca2abb6df45a613ac3d0b9880 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 18 Sep 2009 16:46:41 +0200 Subject: Refactor, and Propose :wiki: syntax for rST wikilinks --- ...ve_reStructuredText_links_to_ikiwiki_pages.mdwn | 112 +++++++++++++++++---- 1 file changed, 94 insertions(+), 18 deletions(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 682229469..49be3f30a 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -1,28 +1,84 @@ -I have a working minimal implementation letting the rst renderer resolve undefined native rST links to ikiwiki pages. I have posted it as one patch at: +_NB! this page has been refactored, hopefully it is clearer now_ +_I propose putting discussion posts somewhere in the vincity of +the secttion Individual reStructuredText Issues_ -Preview commit: http://github.com/engla/ikiwiki/commit/486fd79e520da1d462f00f40e7a90ab07e9c6fdf -Repository: git://github.com/engla/ikiwiki.git +**Goal** -Design issues of the patch: +To be able to use rst as a first-class markup language in ikiwiki. I think +most believe this is almost impossible (ikiwiki is built around markdown). -Right now it changes rendering so that undefined pages (previous errors) are resolved to either ikiwiki pages or link to "#". It could be changed (trivially) so that undefined pages give the same error as before. Since it only resolves links that would previously error out, impact on current installations should be minimal. +**Design** -The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to generate backlinks). Can the parse output be safely reused? +**WikiLinks**, first and foremost, are needed for a wiki. rST already allows +specifying absolue and relative URL links, and relative links can be used to +tie together wiki of rst documents. -> The page content fed to htmlize may be different than that fed to scan, -> as directives can change the content. If you cached the input and output -> at scan time, you could reuse the cached data at htmlize time for inputs -> that are the same -- but that could be a very big cache! --[[Joey]] +1. Below are links to a small, working implementation for resolving + undefined rST references using ikiwiki's mechanism. This is **Proposal 1** + for rst WikiLinks. ->> I would propose using a simple heuristic: If you see \[[ anywhere on the ->> page, don't cache it. It would be an effective cache for pure-rst wikis ->> (without any ikiwiki directives or wikilinks). ->> However, I think that if the cache does not work for a big load, it should ->> not work at all; small loads are small so they don't matter. --ulrik +2. Looking over at rST-using systems such as trac and MoinMoin; I think it + would be wiser to implement wikilinks by the `:role:` mechanism, together + with allowing a custom URL scheme to point to wiki links. This is + **Proposal 2**. + + This is a simple wiki page, with :wiki:`WikiLinks` and other_ links + + .. _other: wiki:wikilink + +Benefits of using a `:role:` and a `wiki: page/subpage` URL scheme are +following: + +1. rST documents taken out of the context (the wiki) will not fail as bad as + if they have lots of Proposal-1 links: They look just the same as valid + references, and you have to edit them all. + In contrast, should the `:wiki:` role disappear, one line is enough + to redefined it and silence all the warnings for the document: + + .. role:: wiki (title) + +*Implementation* there is no implementation of Proposal 2 but it should be +doable; adding a local role is trivial. Rewriting `wiki:` links could be +done in the format phase(?). + +Now **Directives**: As it is now, ikiwiki goes though (roughly): +filter, preprocess, htmlize, format as major stages of content +transformation. rST has major problems to work with any HTML that enters the +picture before it. + +1. Formatting rST in `htmlize` (as is done now): Raw html can be escaped by + raw blocks: + + .. raw:: html + + \[[!inline and do stuff]] + + (This can be simplified to alias the above as `.. ikiwiki::`) + This escape method works, if ikwiki can be persuaded to maintain the + indent when inserting html, so that it stays inside the raw block. + +2. Formatting rST in `filter` (idea) + 1. rST does not have to see any HTML (raw not needed) + 2. rST directives can alias ikiwiki syntax: + + ..ikiwiki:: inline pages= ... -Desing issues in general: + 3. Using rST directives as ikiwiki directives can be complicated; + but rST directives allow a direct line (after :: on first line), + an option list, and a content block. -We resolve rST links without definition, we don't help resolving defined relative links, so we don't support specifying link name and target separately. + +**Discussion** + +I guess you (or someone) has been through this before and knows why it +simply won't work. But I hoped there was something original in the above; +and I know there are wiki installations where rST works. --ulrik + +**Individual reStructuredText Issues** + +* We resolve rST links without definition, we don't help resolving defined + relative links, so we don't support specifying link name and target + separately. > I found out this is possible by using rST subsitutions. So to do [[Version history...|releases]] > you would use: @@ -33,8 +89,28 @@ We resolve rST links without definition, we don't help resolving defined relativ > > ``Version history `_`. --ulrik [kaizer.se] +**A first implementation: Resolving unmatched links** + +I have a working minimal implementation letting the rst renderer resolve +undefined native rST links to ikiwiki pages. I have posted it as one patch at: + +Preview commit: http://github.com/engla/ikiwiki/commit/486fd79e520da1d462f00f40e7a90ab07e9c6fdf +Repository: git://github.com/engla/ikiwiki.git + +Design issues of the patch: + +The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to generate backlinks). Can the parse output be safely reused? + +> The page content fed to htmlize may be different than that fed to scan, +> as directives can change the content. If you cached the input and output +> at scan time, you could reuse the cached data at htmlize time for inputs +> that are the same -- but that could be a very big cache! --[[Joey]] -Many other issues with rST are of course unresolved, but some might be solved by implementing custom rST directives (which is a supported extension mechanism). +>> I would propose using a simple heuristic: If you see \[[ anywhere on the +>> page, don't cache it. It would be an effective cache for pure-rst wikis +>> (without any ikiwiki directives or wikilinks). +>> However, I think that if the cache does not work for a big load, it should +>> not work at all; small loads are small so they don't matter. --ulrik Patch follows: -- cgit v1.2.3 From 18151b8152f01421bb42ab62d9fabd56038126e1 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 18 Sep 2009 20:07:18 +0200 Subject: about default-role --- .../Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 49be3f30a..ba9440b43 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -23,9 +23,16 @@ tie together wiki of rst documents. **Proposal 2**. This is a simple wiki page, with :wiki:`WikiLinks` and other_ links - + .. _other: wiki:wikilink + We can get rid of the role part as well for WikiLinks:: + + .. default-role:: wiki + + Enables `WikiLinks` but does not impact references such as ``other`` + This can be made the default for ikiwiki. + Benefits of using a `:role:` and a `wiki: page/subpage` URL scheme are following: -- cgit v1.2.3 From 254046edcb4c2ed66bf14dbe3526d39acac9cfe3 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Mon, 21 Sep 2009 23:50:42 +0200 Subject: Posting patch series for rst Wikilinks and Preproc indent --- ...ve_reStructuredText_links_to_ikiwiki_pages.mdwn | 163 ++++++--------------- 1 file changed, 42 insertions(+), 121 deletions(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index ba9440b43..54d9a6c4b 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -2,12 +2,14 @@ _NB! this page has been refactored, hopefully it is clearer now_ _I propose putting discussion posts somewhere in the vincity of the secttion Individual reStructuredText Issues_ +## Design ## + **Goal** To be able to use rst as a first-class markup language in ikiwiki. I think most believe this is almost impossible (ikiwiki is built around markdown). -**Design** +## Wikilinks ## **WikiLinks**, first and foremost, are needed for a wiki. rST already allows specifying absolue and relative URL links, and relative links can be used to @@ -44,9 +46,37 @@ following: .. role:: wiki (title) -*Implementation* there is no implementation of Proposal 2 but it should be -doable; adding a local role is trivial. Rewriting `wiki:` links could be -done in the format phase(?). +### Implementation ### + +Implementation of Proposal-2 wikilinks are in the branch +[rst-wikilinks][rst-wl] + + + This is a simple wiki page, with :wiki:`WikiLinks` and |named| links + + .. |named| wiki:: Some Page + + We can get rid of the role part as well for WikiLinks:: + + .. default-role:: wiki + + Enables `WikiLinks` but does not impact references such as ``named`` + This can be made the default for ikiwiki. + +[rst-wl]: http://github.com/engla/ikiwiki/commits/rst-wikilinks + +On top of **rst-wikilinks** is [rst-customize][rst-custom] which adds two +power user features: Global (python) file to read in custom directives +(unsafe), and a wikifile as "header" file for all parsed .rst files (safe, +but disruptive since all .rst depend on it). Well, the customizations have +to be picked and chosen from this, but at least the global python file can +be very convenient. + +Some rst-custom [examples are here](http://kaizer.se/wiki/rst_examples/) + +[rst-custom]: http://github.com/engla/ikiwiki/commits/rst-customize + +## Directives ## Now **Directives**: As it is now, ikiwiki goes though (roughly): filter, preprocess, htmlize, format as major stages of content @@ -74,8 +104,13 @@ picture before it. but rST directives allow a direct line (after :: on first line), an option list, and a content block. +### Implementation ### + +Preserving indents in the preprocessor are in branch [pproc-indent][ppi] -**Discussion** +[ppi]: http://github.com/engla/ikiwiki/commits/pproc-indent + +## Discussion ## I guess you (or someone) has been through this before and knows why it simply won't work. But I hoped there was something original in the above; @@ -86,15 +121,8 @@ and I know there are wiki installations where rST works. --ulrik * We resolve rST links without definition, we don't help resolving defined relative links, so we don't support specifying link name and target separately. - -> I found out this is possible by using rST subsitutions. So to do [[Version history...|releases]] -> you would use: -> -> `|releases|_` -> `.. |releases| replace:: Version history...` -> Which does not seem to have an inline equivalent. Using non-resolved links there is the alternative: -> -> ``Version history `_`. --ulrik [kaizer.se] + + * Resolved by |replacement| links with the wiki:: directive. **A first implementation: Resolving unmatched links** @@ -119,110 +147,3 @@ The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to genera >> However, I think that if the cache does not work for a big load, it should >> not work at all; small loads are small so they don't matter. --ulrik -Patch follows: - ----- -
-	From 486fd79e520da1d462f00f40e7a90ab07e9c6fdf Mon Sep 17 00:00:00 2001
-	From: Ulrik Sverdrup 
-	Date: Thu, 17 Sep 2009 15:18:50 +0200
-	Subject: [PATCH] rst: Resolve native reStructuredText links to ikiwiki pages
-
-	Links in rST use syntax `Like This`_ or OneWordLink_, and are
-	generally used for relative or absolue links, with an auxiliary
-	definition:
-
-	.. _`Like This`: http://ikiwiki.info
-	.. _OneWordLink: relative
-
-	We can hook into docutils to resolve unresolved links so that rST
-	links without definition can be resolved to wiki pages. This enables
-	WikiLink_ to link to [[WikiLink]] (if no .. _WikiLink is specified).
-
-	Comparing to Ikiwiki's wikilinks
-
-	[[blogging|blog]] specifies a link to the page blog, with the name
-	blogging. In rST we should use blogging_
-
-	.. _blogging: blog
-
-	*However*, note that this patch does not hook into this. What we
-	resolve in this patch is finding the appropriate "_blogging" if it is
-	not found, not resolving the address 'blog'.
-	---
-	 plugins/rst |   46 +++++++++++++++++++++++++++++++++++++++++-----
-	 1 files changed, 41 insertions(+), 5 deletions(-)
-
-	diff --git a/plugins/rst b/plugins/rst
-	index a2d07eb..a74baa8 100755
-	--- a/plugins/rst
-	+++ b/plugins/rst
-	@@ -6,22 +6,58 @@
-	 # based a little bit on rst.pm by Sergio Talens-Oliag, but only a little bit. :)
-	 #
-	 # Copyright © martin f. krafft 
-	+# Copyright © Ulrik Sverdrup , 2009
-	+#
-	 # Released under the terms of the GNU GPL version 2
-	 #
-	+
-	 __name__ = 'rst'
-	 __description__ = 'xml-rpc-based ikiwiki plugin to process RST files'
-	-__version__ = '0.3'
-	+__version__ = '0.3+'
-	 __author__ = 'martin f. krafft '
-	 __copyright__ = 'Copyright © ' + __author__
-	 __licence__ = 'GPLv2'
-	 
-	 from docutils.core import publish_parts;
-	+from docutils.writers import html4css1
-	 from proxy import IkiWikiProcedureProxy
-	 
-	-def rst2html(proxy, *kwargs):
-	-    # FIXME arguments should be treated as a hash, the order could change
-	-    # at any time and break this.
-	-    parts = publish_parts(kwargs[3], writer_name='html',
-	+class IkiwikiWriter(html4css1.Writer):
-	+    def resolve_node(self, node):
-	+        refname = node.get('refname', None)
-	+        if not refname:
-	+            return False
-	+
-	+        bestlink = self.proxy.rpc('bestlink', self.page, refname)
-	+
-	+        node.resolved = 1
-	+        node['class'] = 'wiki'
-	+        del node['refname']
-	+
-	+        if not bestlink:
-	+            rel_url = "#"
-	+        else:
-	+            rel_url = self.proxy.rpc('urlto', bestlink, self.page)
-	+            self.proxy.rpc('add_link', self.page, bestlink)
-	+        node['refuri'] = rel_url
-	+        self.proxy.rpc('debug', "Emitting link %s => %s" % (refname, rel_url))
-	+        return True
-	+
-	+    resolve_node.priority = 1
-	+
-	+    def __init__(self, proxy, page):
-	+        html4css1.Writer.__init__(self)
-	+        self.proxy = proxy
-	+        self.page = page
-	+        self.unknown_reference_resolvers = (self.resolve_node, )
-	+
-	+def rst2html(proxy, *args):
-	+    # args is a list paired by key, value, so we turn it into a dict
-	+    kwargs = dict((k, v) for k, v in zip(*[iter(args)]*2))
-	+    page = kwargs['page']
-	+
-	+    parts = publish_parts(kwargs['content'],
-	+                          writer=IkiwikiWriter(proxy, page),
-	                           settings_overrides = { 'halt_level': 6
-	                                                , 'file_insertion_enabled': 0
-	                                                , 'raw_enabled': 1
-	-- 
-	1.6.4
-
-
----- -- cgit v1.2.3 From c399f65b627064de80107f8ee695a9a811604bcd Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Mon, 21 Sep 2009 19:39:03 -0400 Subject: a remark about pproc-indent: I'm not a perl coder. --- doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 54d9a6c4b..d5c92ed6f 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -108,6 +108,9 @@ picture before it. Preserving indents in the preprocessor are in branch [pproc-indent][ppi] +(These simple patches come with a warning: _Those are the first lines of +Perl I've ever written!_) + [ppi]: http://github.com/engla/ikiwiki/commits/pproc-indent ## Discussion ## -- cgit v1.2.3 From d163b06cd6c4a3018a10ced73ec2e74108c3da2a Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Tue, 22 Sep 2009 07:52:10 -0400 Subject: What is missing: Create-links, htmllink --- doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index d5c92ed6f..4bde25bd2 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -76,6 +76,10 @@ Some rst-custom [examples are here](http://kaizer.se/wiki/rst_examples/) [rst-custom]: http://github.com/engla/ikiwiki/commits/rst-customize +**What is missing?** links to nonexistant pages are not resolved. +Perhaps the "link resolver" part should use Ikiwiki's htmllink instead +of its simple subsitutions. + ## Directives ## Now **Directives**: As it is now, ikiwiki goes though (roughly): -- cgit v1.2.3 From 92b3be2f3ef4123f2e5d9afb761cfd7251c2511d Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Tue, 22 Sep 2009 17:17:11 -0400 Subject: rst-wikilinks uses 'htmllink' --- .../Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 4bde25bd2..1782af824 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -65,6 +65,11 @@ Implementation of Proposal-2 wikilinks are in the branch [rst-wl]: http://github.com/engla/ikiwiki/commits/rst-wikilinks +**rst-wikilinks** patch series includes changes at the end to use ikiwiki's +'htmllink' for the links (which is the only sane thing to do to work in all configurations). +This means a :wiki:`Link` should render just exactly like [[Link]] whether +the target exists or not. + On top of **rst-wikilinks** is [rst-customize][rst-custom] which adds two power user features: Global (python) file to read in custom directives (unsafe), and a wikifile as "header" file for all parsed .rst files (safe, @@ -76,10 +81,6 @@ Some rst-custom [examples are here](http://kaizer.se/wiki/rst_examples/) [rst-custom]: http://github.com/engla/ikiwiki/commits/rst-customize -**What is missing?** links to nonexistant pages are not resolved. -Perhaps the "link resolver" part should use Ikiwiki's htmllink instead -of its simple subsitutions. - ## Directives ## Now **Directives**: As it is now, ikiwiki goes though (roughly): -- cgit v1.2.3 From 2aa93377e8845b4dd19af5a470e270c23e4e7e15 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Sep 2009 13:57:36 -0400 Subject: comments and some code review --- ...ve_reStructuredText_links_to_ikiwiki_pages.mdwn | 33 ++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 1782af824..5f21b2272 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -109,6 +109,25 @@ picture before it. but rST directives allow a direct line (after :: on first line), an option list, and a content block. +> You've done a lot of work already, but ... +> +> The filter approach seems much simpler than the other approaches +> for users to understand, since they can just use identical ikiwiki +> markup on rst pages as they would use anywhere else. This is very desirable +> if the wiki allows rst in addition to mdwn, since then users don't have +> to learn two completly different ways of doing wikilinks and directives. +> I also wonder if even those familiar with rst would find entirely natural +> the ways you've found to shoehorn in wikilinks, named wikilinks, and ikiwiki +> directives? +> +> Htmlize in filter avoids these problems. It also leaves open the possibility +> that ikiwiki could become smarter about the rendering chain later, and learn +> to use a better order for rst (ie, htmlize first). If that later happened, +> the htmlize in filter hack could go away. --[[Joey]] + +> (BTW, the [[plugins/txt]] plugin already does html formatting +> in filter, for similar reasons.) --[[Joey]] + ### Implementation ### Preserving indents in the preprocessor are in branch [pproc-indent][ppi] @@ -116,6 +135,20 @@ Preserving indents in the preprocessor are in branch [pproc-indent][ppi] (These simple patches come with a warning: _Those are the first lines of Perl I've ever written!_) +> This seems like a good idea, since it solves issues for eg, indented +> directives in mdwn as well. But, looking at the diff, I see a clear bug: +> +> - return "[[!$command ". +> + $result = "[[!$command ". +> +> That makes it go on and parse an infinitely nested directive chain, instead +> of immediatly throwing an error. +> +> Also, it seems that the "indent" matching in the regexps may be too broad, +> wouldn't it also match whitespace before a directive that was not at the beginning +> of a line, and treat it as an indent? With some bad luck, that could cause mdwn +> to put the indented output in a pre block. --[[Joey]] + [ppi]: http://github.com/engla/ikiwiki/commits/pproc-indent ## Discussion ## -- cgit v1.2.3 From 4f37413050d4c17cb428820991541595e4645c66 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Wed, 30 Sep 2009 20:54:21 +0200 Subject: Comment, type, discuss and otherwise type wayy to much sorry!! --- ...ve_reStructuredText_links_to_ikiwiki_pages.mdwn | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 5f21b2272..4468ce1e9 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -128,6 +128,54 @@ picture before it. > (BTW, the [[plugins/txt]] plugin already does html formatting > in filter, for similar reasons.) --[[Joey]] +>> Thank you for the comments! Forget the work, it's not so much. +>> I'd rank the :wiki: link addition pretty high, and the other changes way +>> behind that: +>> +>> The :wiki:`Wiki Link` syntax is *very* appropriate as rst syntax +>> since it fits well with other uses of roles (notice that :RFC:`822` +>> inserts a link to RFC822 etc, and that the default role is a *title* role +>> (title of some work); thus very appropriate for medium-specific links like +>> wiki links. So I'd rank :wiki: links a worthwhile addition regardless of +>> outcome here, since it's a very rst-like alternative for those who wish to +>> use more rst-like syntax (and documents degrades better outside the wiki as +>> noted). +>> +>> The named link syntax (just like the :wiki: role) are inspired from trac +>> and a good fit, but only if the wiki is committed to using only rst, +>> which I don't think is the case. +>> +>> The rst-customize changes are very useful for custom directive +>> installations (like the sourcecode directive, or shortcut roles I show +>> in the examples page), but there might be a way for the user to inject +>> docutils addons that I'm missing (one very ugly way would be to stick +>> them in sitecustomize.py which affects all Python programs). +>> +>> With the presented changes, I already have a working RestructuredText +>> wiki, but I'm admitting that using .. raw:: html around all directives is +>> very ugly (I use few directives: inline, toggle, meta, tag, map) +>> +>> On filter/htmlize: Well **rst** is clearly antisocial: It can't see HTML, +>> and ikiwiki directives are wrappend in paragraph tags. (For wikilinks +>> this is probably no problem). So the suggestion about `.. ikiwiki:` is +>> partly because it looks good in rst syntax, but also since it would emit +>> a div to wrap around the element instead of a paragraph. +>> +>> I don't know if you mean that rst could be reordered to do htmlize before +>> other phases? rst must be before any preprocess hook to avoid seeing any +>> HTML. +>> +>> With the presented changes, I already have a working RestructuredText +>> wiki, but I'm admitting that using .. raw:: html around all directives is +>> very ugly (I use few directives: inline, toggle, meta, tag, map) +>> +>> If I'm thinking right, processing to HTML already in filter means any +>> processing in scan can be reused directly (or skipped if it's legal to +>> emit 'add_link' in filter.) +>> +>> -- [[ulrik]] + + ### Implementation ### Preserving indents in the preprocessor are in branch [pproc-indent][ppi] @@ -148,6 +196,29 @@ Perl I've ever written!_) > wouldn't it also match whitespace before a directive that was not at the beginning > of a line, and treat it as an indent? With some bad luck, that could cause mdwn > to put the indented output in a pre block. --[[Joey]] +> +>> You are probably right about the bug. I'm not quite sure what the nested +>> directives examples looks like, but I must have overlooked how the +>> recursion counter works; I thought simply changing if to elif the next +>> few lines would solve that. I'm sorry for that! +>> +>> We don't have to change the `$handle` function at all, if it is possible +>> to do the indent substitution all in one line instead of passing it to +>> handle, I don't know if it is possible to turn: +>> +>> $content =~ s{$regex}{$handle->($1, $2, $3, $4, $5)}eg; +>> +>> into +>> +>> $content =~ s{$regex}{s/^/$1/gm{$handle->($2, $3, $4, $5)}}eg; +>> +>> Well, no idea how that would be expressed, but I mean, replace the indent +>> directly in $handle's return value. +>> +>> The indent-catching regex is wrong in the way you mention, it has been +>> nagigng my mind a bit as well; I think matching start of line + spaces +>> and tabs is the only thing we want. +>> -- [[ulrik]] [ppi]: http://github.com/engla/ikiwiki/commits/pproc-indent -- cgit v1.2.3 From e04e9ccea930aefb3b1dbeb8203dce8c6f8bef13 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Sep 2009 15:39:51 -0400 Subject: response --- ..._native_reStructuredText_links_to_ikiwiki_pages.mdwn | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 4468ce1e9..0f8e63aae 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -77,6 +77,9 @@ but disruptive since all .rst depend on it). Well, the customizations have to be picked and chosen from this, but at least the global python file can be very convenient. +> Did you consider just including the global rst header text into an item +> in the setup file? --[[Joey]] + Some rst-custom [examples are here](http://kaizer.se/wiki/rst_examples/) [rst-custom]: http://github.com/engla/ikiwiki/commits/rst-customize @@ -141,6 +144,11 @@ picture before it. >> use more rst-like syntax (and documents degrades better outside the wiki as >> noted). >> +>>> Unsure about the degredation argument. It will work some of +>>> the time, but ikiwiki's [[ikiwiki/subpage/linkingrules]] +>>> are sufficiently different from normal html relative link +>>> rules that it often won't work. --[[Joey]] +>> >> The named link syntax (just like the :wiki: role) are inspired from trac >> and a good fit, but only if the wiki is committed to using only rst, >> which I don't think is the case. @@ -165,9 +173,11 @@ picture before it. >> other phases? rst must be before any preprocess hook to avoid seeing any >> HTML. >> ->> With the presented changes, I already have a working RestructuredText ->> wiki, but I'm admitting that using .. raw:: html around all directives is ->> very ugly (I use few directives: inline, toggle, meta, tag, map) +>>> One of my long term goals is to refactor all the code in ikiwiki +>>> that manually runs the various stages of the render pipeline, +>>> into one centralized place. Once that's done, that place can get +>>> smart about what order to run the stages, and use a different +>>> order for rst. --[[Joey]] >> >> If I'm thinking right, processing to HTML already in filter means any >> processing in scan can be reused directly (or skipped if it's legal to @@ -175,6 +185,7 @@ picture before it. >> >> -- [[ulrik]] +>>> Seems it could be, yes. --[[Joey]] ### Implementation ### -- cgit v1.2.3 From e7de3f0762d9b9ae64bd40d9fe07b00d9d6dc4d7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 30 Sep 2009 15:45:16 -0400 Subject: furthermore --- .../Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 0f8e63aae..bee57f7e7 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -226,10 +226,16 @@ Perl I've ever written!_) >> Well, no idea how that would be expressed, but I mean, replace the indent >> directly in $handle's return value. >> +>> Yes, in effect just `indent($1, handle->($2,$,4))` --[[Joey]] +>> >> The indent-catching regex is wrong in the way you mention, it has been >> nagigng my mind a bit as well; I think matching start of line + spaces >> and tabs is the only thing we want. >> -- [[ulrik]] +>> +>>> Well, seems you want to match the indent at the start of the line containing +>>> the directive, even if the directive does not start the line. That would +>>> be quite hard to make a regexp do, though. --[[Joey]] [ppi]: http://github.com/engla/ikiwiki/commits/pproc-indent -- cgit v1.2.3 From f8ad5988da8676bfeff6db9375f2518a12f79a48 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Wed, 30 Sep 2009 21:59:11 +0200 Subject: clarifications. and indent one of joey's oneliner responses. --- ...ative_reStructuredText_links_to_ikiwiki_pages.mdwn | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index bee57f7e7..084f03304 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -79,6 +79,14 @@ be very convenient. > Did you consider just including the global rst header text into an item > in the setup file? --[[Joey]] +> +>> Then `rst_header` would not be much different from the python script +>> `rst_customize`. rst_header is as safe as other files (though disruptive +>> as noted), so it should/could be a editable file in the Wiki. A Python +>> script of course can not be. There is nothing you can do in the +>> rst_header (that you sensibly would do, I think) that couldn't be done in +>> the Python script. `rst_header` has very limited use, but it is another +>> possibility, mainly for the user-editable aspect. --[[ulrik]] Some rst-custom [examples are here](http://kaizer.se/wiki/rst_examples/) @@ -148,6 +156,15 @@ picture before it. >>> the time, but ikiwiki's [[ikiwiki/subpage/linkingrules]] >>> are sufficiently different from normal html relative link >>> rules that it often won't work. --[[Joey]] +>>> +>>>> With degradation I mean that if you take a file out of the wiki; the +>>>> links degrade to stylized text. If using default role, they degrade to +>>>> :title: which renders italicized text (which I find is exactly +>>>> appropriate). There is no way for them to degrade into links, except of +>>>> course if you reimplement the :wiki: role. You can also respecify +>>>> either the default role (the `wikilink` syntax) or the :wiki: role (the +>>>> :wiki:`wikilink` syntax) to any other markup, for example None. +>>>> --[[ulrik]] >> >> The named link syntax (just like the :wiki: role) are inspired from trac >> and a good fit, but only if the wiki is committed to using only rst, @@ -226,7 +243,7 @@ Perl I've ever written!_) >> Well, no idea how that would be expressed, but I mean, replace the indent >> directly in $handle's return value. >> ->> Yes, in effect just `indent($1, handle->($2,$,4))` --[[Joey]] +>>> Yes, in effect just `indent($1, handle->($2,$,4))` --[[Joey]] >> >> The indent-catching regex is wrong in the way you mention, it has been >> nagigng my mind a bit as well; I think matching start of line + spaces -- cgit v1.2.3 From 9584dfddd89a0b65632201c6aa280b7c5bc964f2 Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Thu, 1 Oct 2009 14:55:36 +0200 Subject: Link to trac's Wiki-RestructuredText syntax description --- .../Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 084f03304..afe50cf07 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -166,9 +166,9 @@ picture before it. >>>> :wiki:`wikilink` syntax) to any other markup, for example None. >>>> --[[ulrik]] >> ->> The named link syntax (just like the :wiki: role) are inspired from trac ->> and a good fit, but only if the wiki is committed to using only rst, ->> which I don't think is the case. +>> The named link syntax (just like the :wiki: role) are inspired from +>> [trac][tracrst] and a good fit, but only if the wiki is committed to +>> using only rst, which I don't think is the case. >> >> The rst-customize changes are very useful for custom directive >> installations (like the sourcecode directive, or shortcut roles I show @@ -204,6 +204,8 @@ picture before it. >>> Seems it could be, yes. --[[Joey]] +[tracrst]: http://trac.edgewall.org/wiki/WikiRestructuredText + ### Implementation ### Preserving indents in the preprocessor are in branch [pproc-indent][ppi] -- cgit v1.2.3 From 009f7ffded7446f1b3954ab1973faed5b96acf4d Mon Sep 17 00:00:00 2001 From: Ulrik Sverdrup Date: Fri, 2 Oct 2009 15:03:14 +0200 Subject: link to docutils mailing list discussion. also ask about

[[!directives]]

--- ...e_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index afe50cf07..e42f22970 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -87,6 +87,17 @@ be very convenient. >> rst_header (that you sensibly would do, I think) that couldn't be done in >> the Python script. `rst_header` has very limited use, but it is another >> possibility, mainly for the user-editable aspect. --[[ulrik]] +>> +>> (I foresaw only two things to be added to the rst_header: the default +>> role could be configured there (as with rst_wikirole), and if you have a +>> meta-role like :shortcut:, shortcuts could be defined there.) +> +> I have some discussion on the [docutils mailing list][dml], the developers +> of docutils seems to favor "Proposal 1", while I defend my ideas. They +> want all users of ReST to use only the basic featureset to remain +> compatible, of course. -- [[ulrik]] + +[dml]: http://thread.gmane.org/gmane.text.docutils.user/5376 Some rst-custom [examples are here](http://kaizer.se/wiki/rst_examples/) @@ -203,6 +214,11 @@ picture before it. >> -- [[ulrik]] >>> Seems it could be, yes. --[[Joey]] +>>> +>>>> It is not clear how we can work around reST wrapping directives with +>>>> paragraph tags. Also, some escaping of xml characters & <> might +>>>> happen, but I can't imagine right now what breakage can come from that. +>>>> -- [[ulrik]] [tracrst]: http://trac.edgewall.org/wiki/WikiRestructuredText -- cgit v1.2.3 From 7b692b5d6ec2c1cf86b627c4e3ed7a5d0a751580 Mon Sep 17 00:00:00 2001 From: "http://kaizer.se/" Date: Sun, 4 Oct 2009 14:43:38 -0400 Subject: Updated pproc-indent by catching only indent at beginning of line --- ...esolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index e42f22970..ca7b282fa 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -271,6 +271,17 @@ Perl I've ever written!_) >>> Well, seems you want to match the indent at the start of the line containing >>> the directive, even if the directive does not start the line. That would >>> be quite hard to make a regexp do, though. --[[Joey]] +>> +>> I wasted a long time getting the simpler `indent($1, handle->($2,$,4))` to +>> work (remember, I don't know perl at all). Somehow `$1` does not arrive, I +>> made a simple testcase that worked, and I conclude something inside $handle +>> results in the value of $1 not arriving as it should! +>> +>> Anyway, instead a very simple incremental patch is in [pproc-indent][ppi] +>> where the indentation regex is `(^[ \t]+|)` instead, which seems to work +>> very well (and the regex is multiline now as well). I'm happy to rebase the +>> changes if you want or you can just squash the four patches 1+3 => 1+1 +>> -- [[ulrik]] [ppi]: http://github.com/engla/ikiwiki/commits/pproc-indent -- cgit v1.2.3 From 98c00730f6455cce03c2dc7486cdc75c150baa69 Mon Sep 17 00:00:00 2001 From: "http://weakish.pigro.net/" Date: Thu, 24 Dec 2009 07:46:42 +0000 Subject: use `SomePage <>` for wikilink? --- .../Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index ca7b282fa..6219f1d14 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -322,3 +322,12 @@ The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to genera >> However, I think that if the cache does not work for a big load, it should >> not work at all; small loads are small so they don't matter. --ulrik +----- + +Another possiblity is use empty url for wiki pages (gitit uses this approach), for example: + + `SomePage <>`_ + +Since it uses *empty* url, I would like to call it *proposal 0* :-) --[weakish] + +[weakish]: http://weakish.pigro.net -- cgit v1.2.3 From 7e0d5aa1fd912cc933c613eab9d3d58d7d71f6d3 Mon Sep 17 00:00:00 2001 From: "http://weakish.pigro.net/" Date: Thu, 24 Dec 2009 07:47:50 +0000 Subject: typo --- doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn') diff --git a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn index 6219f1d14..6e0f32fd5 100644 --- a/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn +++ b/doc/todo/Resolve_native_reStructuredText_links_to_ikiwiki_pages.mdwn @@ -324,7 +324,7 @@ The page is rST-parsed once in 'scan' and once in 'htmlize' (the first to genera ----- -Another possiblity is use empty url for wiki pages (gitit uses this approach), for example: +Another possiblity is using empty url for wikilinks (gitit uses this approach), for example: `SomePage <>`_ -- cgit v1.2.3