On Nov 22, 2008, at 2:21 PM, Marius Dumitru Florea wrote:
Vincent Massol wrote:
On Nov 22, 2008, at 10:53 AM, Marius Dumitru
Florea wrote:
Thomas Mortagne wrote:
On Fri, Nov 21, 2008 at 4:10 PM, Vincent Massol
<vincent(a)massol.net> wrote:
> On Nov 21, 2008, at 12:30 PM, Vincent Massol wrote:
>
>> On Nov 21, 2008, at 12:06 PM, Vincent Massol wrote:
>>
>>> Hi,
>>>
>>> We have a decision to take to support image parameters when
>>> we're
>>> linking to an image.
>>>
>>> Here's what this would mean with the current syntax:
>>>
>>> [[[[image:attach.png||height="100"
width="100"]]>>http://
>>> xwiki.org||
>>> param=value]]
>>>
>>> Is that what we want?
> After discussing with Thomas we both agreed that we'd prefer to
> have
> this syntax above, i.e.
>
> [[[[image:attach.png||height="100" width="100"]]>>http://
> xwiki.org||
> param=value]]
>
> And the good news is that I think I know how to modify wikimodel
> to
> support this.
>
> I'll thus try to implement this starting now.
Ok then no need to answer the previous mail ;)
I will just add something about why I think we need to support the
current syntax in place of finding one:
This is a more generic problem that just image, how do deal with a
link in a link should be only a renderer choice and it should not
break the parser.
If we say that link label is inline wiki syntax then link label is
inline wiki syntax with no particular case. It's really way easier
and
understandable for user and in general more logical to have only
the
label of the link in a link (because XHTML renderer decided to
render
it that way) than a broken link.
So to conclude if we want to change the image syntaxe it should not
be
for this image in link problem.
I agree, +1.
We can't have links inside links. It doesn't make sense since none of
our renderers will support this. I also haven't seen any output
format
supporting this so far (even XPointer doesn't AFAIK). Mikhail (from
wikimodel) is also strongly against it.
What I have implemented is images inside links. So if you have the
following:
[[hello [[nolink]]>>reference]]
it will mean:
A link pointing to the following reference: "hello [[nolink" followed
by the text: ">>reference]]".
Q: Given the following text:
[[a [[b]] ]]
This is the same example I gave above.
This is a link to "a [[b" followed by the text "]]"
Is the first (end) "]]" marker associated
with the first or the last
(start) "[[" marker? In other words, is the parsing based on a queue
or
on a stack?
I would expect it to use a stack. In this case I'm not clear why the
inner block cannot be a child of the outer block in the resulting
DOM-like tree. The previous text can be invalid (doesn't pass a DTD-
like
check), but I think it should be well-formed (start markers pair with
end markers), provided we allow wiki syntax inside link label.
I may be missing something since I don't know much about what the
rendering module does under the hood.
This is not the rendering module. It's WikiModel which is using JavaCC
to parse the content.
What you suggested is possible but every complex and leads to 2 major
problems (this is what I started doing yesterday and ended up
reverting):
* If you don't have a closing ]] you have to go till the end of the
document and thus the rest of the document will be the reference...
* It's very slow (since you have to manually count the opening and
closing tokens till the end of the document)
Thanks
-Vincent
>>>>>> I'm not even sure we can
implement this since wikimodel will
>>>>>> consider
>>>>>> the reference to be:
>>>>>> [[[[image:attach.png||height="100"
width="100"]]
>>>>>>
>>>>>> (since it'll use the first closing reference marker, i.e.
"]]")
>>>>>>
>>>>>> So the question is: do we want to use a different syntax for
>>>>>> images
>>>>>> or
>>>>>> should I try to make this one work?
>>>>>>
>>>>>> WDYT?
>>>>> I can think of the following solutions:
>>>>>
>>>>> 1) Use a different syntax. For example: ((...))
>>>>>
>>>>> [[((attach.png||height="100"
width="100"))>>http://xwiki.org||
>>>>> param=value]]
>>>>>
>>>>> 2) Only allow inline images to be specified (i.e.
>>>>> [[label>>image:...]]
>>>>> wouldn't be valid) and have a special handling for (% %) when
>>>>> placed
>>>>> before an inline image so that the params are applied to the img
>>>>> tag
>>>>> and not to a span tag. Note: not sure how hard this is to do.
>>>>>
>>>>> 3) Allow passing parameters for inline images use a special
>>>>> syntax.
>>>>> For example: image:my.png||param=value. This would mean:
>>>>>
>>>>> [[attach.png||height="100"
width="100">>http://xwiki.org||
>>>>> param=value]]
>>>>>
>>>>> ([[attach.png||height="100" width="100"]] would
still be an image
>>>>> and
>>>>> not a link)
>>>>>
>>>>> WDYT? Any other idea?
>>>>>
>>>>> Thanks
>>>>> -Vincent