[xwiki-devs] [VOTE] Add Document.getPlainTitle()
Hi devs, In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do: getRenderedTitle("plain/1.0") Here's my +1 Thanks -Vincent
+1 Jérôme On Mon, Jan 10, 2011 at 6:35 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On 01/10/2011 07:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
How would this be different than getTitle()? What does the plain text rendered actually do? Thanks, Marius
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Jan 11, 2011, at 1:50 PM, Marius Dumitru Florea wrote:
On 01/10/2011 07:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
How would this be different than getTitle()? What does the plain text rendered actually do?
Get title returns the title as is. Imagine you have a document containing: = hello **world** = getDisplayTite --> hello <strong>world</strong> getTitle --> hello **world** getPlainTitle --> hello world Thanks -Vincent
On 01/11/2011 01:50 PM, Marius Dumitru Florea wrote:
On 01/10/2011 07:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
+1.
How would this be different than getTitle()? What does the plain text rendered actually do?
getTitle returns the content of the title field, which can be empty. getDisplayTitle computes a title by looking in the title field, the first heading in the content, or the document name if all else fails, then renders it as xhtml/1.0. getPlainTitle would do the same search, but it will render it as plain/1.0, which means that all markup will be removed, leaving only the relevant text.
Thanks, Marius
Here's my +1
Thanks -Vincent
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Thanks Vincent and Sergiu for the explanation. +1 Thanks, Marius On 01/11/2011 04:53 PM, Sergiu Dumitriu wrote:
On 01/11/2011 01:50 PM, Marius Dumitru Florea wrote:
On 01/10/2011 07:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
+1.
How would this be different than getTitle()? What does the plain text rendered actually do?
getTitle returns the content of the title field, which can be empty. getDisplayTitle computes a title by looking in the title field, the first heading in the content, or the document name if all else fails, then renders it as xhtml/1.0. getPlainTitle would do the same search, but it will render it as plain/1.0, which means that all markup will be removed, leaving only the relevant text.
Thanks, Marius
Here's my +1
Thanks -Vincent
On 01/10/2011 12:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
You mean adding an alias to c.x.x.api.Document#getRenderedTitle("plain/1.0")? If so, I am -0 on that because as I understand, c.x.x.api.Document is on the road to being retired with the old core and any new APIs there should have very compelling rationales. At least (IMO) they should provide functionality which was previously unavailable without programming permission. Caleb
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On Jan 11, 2011, at 3:34 PM, Caleb James DeLisle wrote:
On 01/10/2011 12:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
You mean adding an alias to c.x.x.api.Document#getRenderedTitle("plain/1.0")?
yes because we don't want user of the API (from velocity) hardcoding strings as much as possible. They don't need to know that internally there's a plain text renderer called "plain/1.0".
If so, I am -0 on that because as I understand, c.x.x.api.Document is on the road to being retired
with the old core and any new APIs there should have very compelling rationales.
What part is not compelling?
At least (IMO) they should provide functionality which was previously unavailable without programming permission.
That's why I haven't proposed to put this in XWiiDocument but only in Document. Document is scripting API and it makes a lot of sense for scripting, especially since we don't have a way of sharing a final static String in Velocity. Thanks -Vincent
Caleb
Here's my +1
Thanks -Vincent
On 01/11/2011 11:50 AM, Vincent Massol wrote:
On Jan 11, 2011, at 3:34 PM, Caleb James DeLisle wrote:
On 01/10/2011 12:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
You mean adding an alias to c.x.x.api.Document#getRenderedTitle("plain/1.0")?
yes because we don't want user of the API (from velocity) hardcoding strings as much as possible. They don't need to know that internally there's a plain text renderer called "plain/1.0".
If so, I am -0 on that because as I understand, c.x.x.api.Document is on the road to being retired
with the old core and any new APIs there should have very compelling rationales.
What part is not compelling?
IMO The cost of increasing the amount of deprecated API outweighs the cost of hardcoding strings in script. I should have said that I think there must be some use case with a compelling rationale which is simply impossible without the addition to the API. As it is now, we have velocity code with hardcoded strings and thus it must be refactored. With this change we will have velocity code which depends on deprecated API (Correct me if c.x.x.api.Document is not deprecated) and thus must be refactored. I will let my -0 stand because it's not something I like the sound of but I accept that there are many valid ways of doing things and I may well be missing an important piece if information. Caleb
At least (IMO) they should provide functionality which was previously unavailable without programming permission.
That's why I haven't proposed to put this in XWiiDocument but only in Document. Document is scripting API and it makes a lot of sense for scripting, especially since we don't have a way of sharing a final static String in Velocity.
Thanks -Vincent
Caleb
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
On 01/12/2011 08:30 AM, Caleb James DeLisle wrote:
On 01/11/2011 11:50 AM, Vincent Massol wrote:
On Jan 11, 2011, at 3:34 PM, Caleb James DeLisle wrote:
On 01/10/2011 12:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
You mean adding an alias to c.x.x.api.Document#getRenderedTitle("plain/1.0")?
yes because we don't want user of the API (from velocity) hardcoding strings as much as possible. They don't need to know that internally there's a plain text renderer called "plain/1.0".
If so, I am -0 on that because as I understand, c.x.x.api.Document is on the road to being retired
with the old core and any new APIs there should have very compelling rationales.
What part is not compelling?
IMO The cost of increasing the amount of deprecated API outweighs the cost of hardcoding strings in script. I should have said that I think there must be some use case with a compelling rationale which is simply impossible without the addition to the API. As it is now, we have velocity code with hardcoded strings and thus it must be refactored. With this change we will have velocity code which depends on deprecated API (Correct me if c.x.x.api.Document is not deprecated) and thus must be refactored. I will let my -0 stand because it's not something I like the sound of but I accept that there are many valid ways of doing things and I may well be missing an important piece if information.
c.x.x.a.Document is deprecated implementation, but not necessarily a deprecated API. In the future there will be a new Document API, implemented in a different way, with a different collection of methods, but the current and the future sets of methods will overlap. It is safe to add new methods to API objects that are very likely to exist as components, if the new methods are also likely to be part of the future API. And I think that getPlainTitle should also exist in the future Document.
At least (IMO) they should provide functionality which was previously unavailable without programming permission.
That's why I haven't proposed to put this in XWiiDocument but only in Document. Document is scripting API and it makes a lot of sense for scripting, especially since we don't have a way of sharing a final static String in Velocity.
Thanks -Vincent
-- Sergiu Dumitriu http://purl.org/net/sergiu/
On Jan 12, 2011, at 8:30 AM, Caleb James DeLisle wrote:
On 01/11/2011 11:50 AM, Vincent Massol wrote:
On Jan 11, 2011, at 3:34 PM, Caleb James DeLisle wrote:
On 01/10/2011 12:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
You mean adding an alias to c.x.x.api.Document#getRenderedTitle("plain/1.0")?
yes because we don't want user of the API (from velocity) hardcoding strings as much as possible. They don't need to know that internally there's a plain text renderer called "plain/1.0".
If so, I am -0 on that because as I understand, c.x.x.api.Document is on the road to being retired
with the old core and any new APIs there should have very compelling rationales.
What part is not compelling?
IMO The cost of increasing the amount of deprecated API outweighs the cost of hardcoding strings in script. I should have said that I think there must be some use case with a compelling rationale which is simply impossible without the addition to the API. As it is now, we have velocity code with hardcoded strings and thus it must be refactored. With this change we will have velocity code which depends on deprecated API (Correct me if c.x.x.api.Document is not deprecated) and thus must be refactored.
Document is not deprecated as of now. It'll be deprecated one day when we have the new model.
I will let my -0 stand because it's not something I like the sound of but I accept that there are many valid ways of doing things and I may well be missing an important piece if information.
ok thanks. Since others were ok and your -0 is not a vote I have committed it. We'll need to review title handling in the future in any case. I'm sending another mail on that. Thanks -Vincent
Caleb
At least (IMO) they should provide functionality which was previously unavailable without programming permission.
That's why I haven't proposed to put this in XWiiDocument but only in Document. Document is scripting API and it makes a lot of sense for scripting, especially since we don't have a way of sharing a final static String in Velocity.
Thanks -Vincent
Caleb
Here's my +1
Thanks -Vincent
On Jan 13, 2011, at 9:21 AM, Vincent Massol wrote:
On Jan 12, 2011, at 8:30 AM, Caleb James DeLisle wrote:
On 01/11/2011 11:50 AM, Vincent Massol wrote:
On Jan 11, 2011, at 3:34 PM, Caleb James DeLisle wrote:
On 01/10/2011 12:35 PM, Vincent Massol wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
You mean adding an alias to c.x.x.api.Document#getRenderedTitle("plain/1.0")?
yes because we don't want user of the API (from velocity) hardcoding strings as much as possible. They don't need to know that internally there's a plain text renderer called "plain/1.0".
If so, I am -0 on that because as I understand, c.x.x.api.Document is on the road to being retired
with the old core and any new APIs there should have very compelling rationales.
What part is not compelling?
IMO The cost of increasing the amount of deprecated API outweighs the cost of hardcoding strings in script. I should have said that I think there must be some use case with a compelling rationale which is simply impossible without the addition to the API. As it is now, we have velocity code with hardcoded strings and thus it must be refactored. With this change we will have velocity code which depends on deprecated API (Correct me if c.x.x.api.Document is not deprecated) and thus must be refactored.
Document is not deprecated as of now. It'll be deprecated one day when we have the new model.
I will let my -0 stand because it's not something I like the sound of but I accept that there are many valid ways of doing things and I may well be missing an important piece if information.
ok thanks. Since others were ok and your -0 is not a vote I have committed it.
I meant VETO, not VOTE...
We'll need to review title handling in the future in any case. I'm sending another mail on that.
Sent. Thanks -Vincent
Caleb
At least (IMO) they should provide functionality which was previously unavailable without programming permission.
That's why I haven't proposed to put this in XWiiDocument but only in Document. Document is scripting API and it makes a lot of sense for scripting, especially since we don't have a way of sharing a final static String in Velocity.
Thanks -Vincent
Caleb
Here's my +1
Thanks -Vincent
Hello, On Mon, Jan 10, 2011 at 7:35 PM, Vincent Massol <[email protected]> wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
From my experience, this feature is quite important, so here is my +1.
Raluca.
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
+1 On Mon, Jan 10, 2011 at 18:35, Vincent Massol <[email protected]> wrote:
Hi devs,
In lots of places we need to display the title without any markup rendering. Examples: - breadcrumb - activity stream - search results etc
This is such a common use case I'm proposing to add a new API for it in Document: getPlainTitle() It's a one liner that will do:
getRenderedTitle("plain/1.0")
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
participants (7)
-
Caleb James DeLisle -
Jerome Velociter -
Marius Dumitru Florea -
Raluca Stavro -
Sergiu Dumitriu -
Thomas Mortagne -
Vincent Massol