Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [mylyn-dev] how to support attribute replacement + rendering?

Max,

With other markup languages we parse the document twice - once to resolve the tokens to their metadata, and again to parse the document in full, replacing tokens where appropriate.  This is necessary because the markup associating tokens to their metadata often occurs after token references in the markup.  I haven't seen any other approaches yet, but would be interested to hear of any if you come up with something else.

David

On Mon, May 18, 2015 at 4:16 PM, Max Rydahl Andersen <manderse@xxxxxxxxxx> wrote:
On 18 May 2015, at 20:08, Max Rydahl Andersen wrote:

Hey,

I'm trying to add attribute replacement in AsciiDoc.

i.e.

```
:eclipseurl: http://eclipse.org

Click {eclipse url} or link:{eclipse url}[here]
```

Should render as something like:

```
Click <a href="" href="http://eclipse.org" target="_blank">http://eclipse.org">http://eclipse.org</a> or <a href="" href="http://eclipse.org" target="_blank">http://eclipse.org">here</a>
```

I've added a `AsciidDocContentState` to collect the attributes key/values and then
added a `AttributeToken` in addStandardTokens() that will replace the `{eclipseurl}` reference
with the value.

That works perfectly *BUT* the result is actually not reparsed meaning I only get:

```
Click http://eclipse.org or http://eclipse.org[here]
```

Is there some way to make it "rerender" after a token have been replaced or is there
some other way to support attribute/token replacement ?

So I figured I could put in a PreProcessor that does this *Before* doing the main rendering,
but still wondering if there is a way to do this while parsing since that could be useful in
other contexts.


/max
http://about.me/maxandersen
_______________________________________________
mylyn-dev mailing list
mylyn-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/mylyn-dev



--
David Green
VP of Architecture, Tasktop
Committer, Eclipse Mylyn


Back to the top