`time` element syntax
David Chambers
david.chambers.05 at gmail.com
Sun Jun 5 18:23:27 EDT 2011
Hi folks,
Thanks for your input. I'm pleased to have raised this issue for discussion.
Michel Fortin <michel.fortin at michelf.com> wrote:
Personally, I think if you're going to write a lot of dates like this the
> best syntax would be to auto-detect "30 May 2011" as a date. But this might
> need to be done at another layer than Markdown since Markdown doesn't know
> about your time zone and the date format might depend on your language and
> locale.
Rob McBroom <mailinglist0 at skurfer.com> wrote:
I don’t have any strong feelings about syntax, but manually entering the
> date in two formats doesn’t seem very DRY. I’d prefer to just type one
> (probably the machine-readable one, as it contains the time) and let the
> toasters do the work of generating the other.
The problem with the approach suggested by Rob and Michel is that it works
for only a subset of cases. A very large subset perhaps, but a subset
nonetheless. The displayed text may be "Christmas Day" or "7pm tomorrow".
While in many cases it may seem a violation of DRY to include both forms,
it's clearly not possible to go translate from "human" to machine in all
cases, nor is it necessarily possible to translate in the other direction.
Waylan Limberg <waylan at gmail.com> wrote:
Ok, this looks like it would match a valid date and time, but what about a
> date without time or a time without date? According to the spec, all three
> should be allowed. Have fun building that regex.
I lifted the regular expression from
jQuery.localize<https://bitbucket.org/davidchambers/jquery.localize>which
requires at least date, hours, and minutes. You're right, a few more
optional non-capturing groups are required. :)
Waylan Limberg <waylan at gmail.com> wrote:
That said, I'm going to ignore the 'looks like a link' issue for a moment
> and add that I think I would prefer something like a reference syntax with a
> datetime label:
> Some text [30 May 2011] more text.
> [30 May 2011]: datetime: 2011-05-30T15:00-07:00
Heck, Waylan, you've done it again. This is extremely readable and allows
the `pubdate` attribute to be included if desired.
Some text [30 May 2011] more text.
[30 May 2011]: datetime: 2011-05-30T15:00-07:00, pubdate
would become…
<time datetime="2011-05-30T15:00-07:00" pubdate="pubdate">30 May 2011
</time>
Waylan Limberg <waylan at gmail.com> wrote:
Now if you can come up with a clean way to make that look less like a link,
> I might be interested in using it myself. Otherwise, I'll stick to raw html
> here.
Square brackets are simply the right characters for the job. One could
consider them to serve a broader function: wrapping text which relates to
some other data, be it a web page, an image, a timestamp, or something else.
The resemblance to links is actually a *good* thing in my opinion. It allows
readers to guess (correctly) that the there is accompanying data and that
it likely resides after the current paragraph or at the end of the document.
David Parsons <orc at pell.portland.or.us> wrote:
That looks like it would be a good place for a pseudo-protocol:
> [two days ago](time:2011-05-30T15:00-07:00 "May 30th, if you care")
> This would have the advantage of being fairly unambiguous, instead of
> superimposing a magic time string over the existing linkyformat.
This is definitely less ambiguous, but causes the sentence's flow to be
interrupted. Perhaps I've been writing too much JavaScript and CoffeeScript
lately, but overloading existing syntax—as opposed to introducing new
syntax—seems like the right approach to me.
I'm going to go ahead and see if I can implement Waylan's suggestion in
Showdown <http://davidchambers.bitbucket.org/showdown/>.
David
On 2 June 2011 11:31, Michel Fortin <michel.fortin at michelf.com> wrote:
> Le 2011-06-02 à 5:08, David Chambers a écrit :
>
> > Hi folks,
> >
> > I expect that the response to this post will be "we don't need such a
> > thing", but humour me for a moment by pretending that in fact we do.
> >
> > HTML5 added a number of new tags to the mix, but arguably the most
> > significant is the `time` element. It associates a machine-readable
> > timestamp with a human-readable string (e.g. `<time
> > datetime="2011-05-30T15:00-07:00">30 May 2011</time>`).
> >
> > I would love to be able to write something like `[30 May
> > 2011]{2011-05-30T15:00-07:00}`.
> >
> >
> `/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(?:[.](\d+))?)?([-+]\d\d:\d\d|Z)$/`
> > could be used to ensure that only valid `datetime` attribute values are
> > matched. This would avoid false positives and would keep `[foo]{bar}`
> > available for other functions, potentially.
> >
> > Are there any reasons not to use `[human]{computer}`? Can anyone suggest
> a
> > better syntax?
>
> Personally, I think if you're going to write a lot of dates like this the
> best syntax would be to auto-detect "30 May 2011" as a date. But this might
> need to be done at another layer than Markdown since Markdown doesn't know
> about your time zone and the date format might depend on your language and
> locale.
>
> --
> Michel Fortin
> michel.fortin at michelf.com
> http://michelf.com/
>
>
>
> _______________________________________________
> Markdown-Discuss mailing list
> Markdown-Discuss at six.pairlist.net
> http://six.pairlist.net/mailman/listinfo/markdown-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://six.pairlist.net/pipermail/markdown-discuss/attachments/20110605/398b59a6/attachment.htm>
More information about the Markdown-Discuss
mailing list