New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add embed entity #101
Add embed entity #101
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just some copy&paste stuff. And some clarification would be great if Markdown is allowed in the description.
Additionally I would prefer to mention that the doesn't need to be present in the status message.
docs/_entities/embed.md
Outdated
|
||
| Property | Type (Length) | Description | | ||
| ------------- | ------------------------ | ------------------------------------------------------------------------ | | ||
| `url` | [URL][url] (65535) | A string describing your location, e.g. a city name, a street name, etc. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
" A string describing your location"? Looks like some copy&paste ;-)
docs/_entities/embed.md
Outdated
| Property | Type (Length) | Description | | ||
| ------------- | ------------------------ | ------------------------------------------------------------------------ | | ||
| `url` | [URL][url] (65535) | A string describing your location, e.g. a city name, a street name, etc. | | ||
| `title` | [String][string] (255) | A string describing your location, e.g. a city name, a street name, etc. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
docs/_entities/embed.md
Outdated
| ------------- | ------------------------ | ------------------------------------------------------------------------ | | ||
| `url` | [URL][url] (65535) | A string describing your location, e.g. a city name, a street name, etc. | | ||
| `title` | [String][string] (255) | A string describing your location, e.g. a city name, a street name, etc. | | ||
| `description` | [String][string] (65535) | The geographical latitude of your location. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dito
docs/_entities/embed.md
Outdated
| `url` | [URL][url] (65535) | A string describing your location, e.g. a city name, a street name, etc. | | ||
| `title` | [String][string] (255) | A string describing your location, e.g. a city name, a street name, etc. | | ||
| `description` | [String][string] (65535) | The geographical latitude of your location. | | ||
| `image` | [URL][url] (65535) | The geographical longitude of your location. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and again :-)
docs/_entities/embed.md
Outdated
| `title` | [String][string] (255) | A string describing your location, e.g. a city name, a street name, etc. | | ||
| `description` | [String][string] (65535) | The geographical latitude of your location. | | ||
| `image` | [URL][url] (65535) | The geographical longitude of your location. | | ||
| `nothing` | [Boolean][boolean] | The geographical longitude of your location. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And again ;-)
9344178
to
8b6bc82
Compare
Oh yes, I forget to change the descriptions m( fixed that now. Markdown is not allowed, it also wouldn't make any sense, because this is provided by websites for all sorts of use-cases and not only diaspora, so I don't think any website would provide markdown there. The |
I would prefer having some "Markdown is not allowed" in the documentation, just to clarify this. And yes, if that hadn't been cleared, I had put it through our HTML to Markdown interpreter, since the fetched description sometimes contain HTML elements. BTW: Is only plaintext allowed or HTML elements? With "optional" I meant that the "embed" could point to an address that doesn't exist in the status message at all. So you could include the links A, B and C in your post, but the "embed" points to the link "D". This is a little bit nitpicking to mention this, but one does never know how people are interpreting specifications. |
Everything is "allowed" (websites can put what they want in that field), but only plaintext is rendered. It has the type String which allows just everything. We have many things that "doesn't allow" markdown, but we don't mention when something doesn't allow markdown, we mention when something explicitly allows Markdown.
While this is theoretically possible, I wouldn't recommend this so I don't think it is a good idea to mention that. When you link to a url that isn't in the status message at all, not everybody can see it (when not every software supports this entity, or old versions), so maybe people talk about a link in the comments, that not everybody can see. While when you include the link in the message too, some softwares maybe embed the wrong url or embed nothing at all (if they don't support embedding at all), but at least everybody can see all links. So I would always include the link in the message for accessibility reasons. |
8b6bc82
to
9688f3f
Compare
@annando I added a little paragraph about the second part now, I hope that it's clear know that the link should also be included in the |
I still am confused by:
So how do I force a linefeed in the description? By doing some CR or with |
The |
@annando are there any open points here or can you approve this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some minor things, otherwise looks good to me!
docs/_entities/embed.md
Outdated
|
||
## Optional Properties | ||
|
||
All entities are "optional", but either `url` is required or `nothing` must be `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All entities are
These are not entities, these are properties.
Nit: I'm not sure if we need to put "optional" in the quotes here. I think it looks better without quotes.
So it should be:
All properties are optional, but either `url` is required or `nothing` must be `true`.
docs/_entities/embed.md
Outdated
| `title` | [String][string] (255) | The title of the embedded URL. | | ||
| `description` | [String][string] (65535) | The description of the embedded URL. | | ||
| `image` | [URL][url] (65535) | The image of the embedded URL. | | ||
| `nothing` | [Boolean][boolean] | `true' if nothing should be embedded. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are inconsistent quotes around true
here
def validate | ||
super | ||
|
||
raise ValidationError, "URL set and 'nothing' is 'true'" if url && nothing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: These two lines can be replaced with one by using xor:
raise ValidationError, "Either URL must be set or 'nothing' must be 'true'" unless nothing ^ url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if we refer the properties' names then it is better to write them the same way, i.e. 'url'
instead of URL
, so that it matches 'nothing'
in style. So: Either 'url' must be set or 'nothing' must be 'true'
9688f3f
to
1fecfa3
Compare
1fecfa3
to
12c1cd8
Compare
Fixes #93
I did a few changes to the proposal:
link
tourl
.nothing
property for when nothing should be embedded and nothing should be scanned. I think this is better to be explicit in this case. When this istrue
theurl
property is optional, otherwise it is required.cc @annando