← Back to team overview

zim-wiki team mailing list archive

Re: Getting dates into template

 

Many thanks, will give it a go later on


Iago

On 27/04/2012, Jaap Karssenberg <jaap.karssenberg@xxxxxxxxx> wrote:
> Patched a different implementation in rev536, default calendar
> template will shows subheadings for days of the week in week view.
>
> -- Jaap
>
> On Thu, Feb 23, 2012 at 11:29 AM, Iago Mosqueira
> <iago.mosqueira@xxxxxxxxx> wrote:
>> On 23 February 2012 10:57, Jaap Karssenberg <jaap.karssenberg@xxxxxxxxx>
>> wrote:
>>> On Thu, Feb 23, 2012 at 10:33 AM, Iago Mosqueira
>>> <iago.mosqueira@xxxxxxxxx>
>>> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I am trying to modify the Calendar.txt template when used in weekly mode
>>>> to show
>>>>
>>>> ===== Mon 1 Jan =====
>>>>
>>>> ===== Tue 2 Jan ======
>>>>
>>>> and so on. The calendar plugin only gives variables for the start and
>>>> end dates of the week, so how I can tell strftime to output the other
>>>> days? I tried with
>>>>
>>>> strftime("%a %d %b", calendar_plugin.date + datetime.timedelta(days=1))
>>>>
>>>> but did not work. I am probably doing something very wrong, as I have
>>>> never programmed in python before.
>>>
>>>
>>> The reason it does not work is that the template does not allow arbitrary
>>> python code. The few functions that are available are hard coded in the
>>> template formatting.
>>>
>>> So doing something like this would require additional functions to the
>>> template engine.
>>>
>>> Regards,
>>>
>>> Jaap
>>>
>>
>> Hi,
>>
>> Many thanks for the quick reply. I have hacked calendar.py slightly to
>> achieve what I wanted, by exporting mon_date to fri_date. Please find
>> a diff file attached, but this cannot probably be considered a proper
>> submission, first python ever for me.
>>
>> Regards,
>>
>>
>> Iago
>


References