zim-wiki team mailing list archive
-
zim-wiki team
-
Mailing list archive
-
Message #02046
Re: List embedded files into template
Let's go for an other patch.
When creating the page index, I was annoyed by the lack of link and the
presence of "strong" tag.
It is easier when you use css to have a normal link for the current page
and set a class.
=== modified file 'zim/formats/html.py'
--- zim/formats/html.py 2012-11-19 14:27:36 +0000
+++ zim/formats/html.py 2012-11-19 21:45:01 +0000
@@ -133,8 +133,10 @@
elif element.tag == 'link':
href = self.linker.link(element.attrib['href'])
title = text.replace('"', '"')
- hrefType = link_type(element.attrib['href'])
- output.append('<a href="%s" title="%s" class="%s">%s</a>'
% (href, title, hrefType, text))
+ hrefClass = link_type(element.attrib['href'])
+ if element.attrib.get('isCurrentPage', False)==True:
+ hrefClass += " active"
+ output.append('<a href="%s" title="%s" class="%s">%s</a>'
% (href, title, hrefClass, text))
elif element.tag in ['emphasis', 'strong', 'mark', 'strike',
'code','sub','sup']:
if element.tag == 'mark': tag = 'u'
elif element.tag == 'emphasis': tag = 'em'
=== modified file 'zim/templates.py'
--- zim/templates.py 2012-09-22 19:03:55 +0000
+++ zim/templates.py 2012-11-19 21:31:07 +0000
@@ -745,12 +745,12 @@
if page == self._page:
# Current page is marked with the strong style
- builder.start('strong')
+ builder.start('link', {'type': 'page', 'href': ':'+
page.name, 'isCurrentPage':True})
builder.data(page.basename)
- builder.end('strong')
+ builder.end('link')
else:
# links to other pages
- builder.start('link', {'type': 'page', 'href': ':'+
page.name})
+ builder.start('link', {'type': 'page', 'href': ':'+
page.name, 'isCurrentPage':False})
builder.data(page.basename)
builder.end('link')
--
Jean-Baptiste Holcroft
2012/11/19 Jean-Baptiste Holcroft <jb.holcroft@xxxxxxxxx>
> Thanks for your answer, I submited the bug request you asked for.
> https://bugs.launchpad.net/zim/+bug/1080705
>
> I thought to one more thing : it would be interresting to have a
> particular class, according to the type of the
>
> It looks like this patch does the job quite well :
> === modified file 'zim/formats/html.py'
> --- zim/formats/html.py 2012-02-22 12:32:31 +0000
> +++ zim/formats/html.py 2012-11-19 14:25:52 +0000
> @@ -133,7 +133,8 @@
> elif element.tag == 'link':
> href = self.linker.link(element.attrib['href'])
> title = text.replace('"', '"')
> - output.append('<a href="%s" title="%s">%s</a>' % (href,
> title, text))
> + hrefType = link_type(element.attrib['href'])
> + output.append('<a href="%s" title="%s" class="%s">%s</a>'
> % (href, title, hrefType, text))
> elif element.tag in ['emphasis', 'strong', 'mark', 'strike',
> 'code','sub','sup']:
> if element.tag == 'mark': tag = 'u'
> elif element.tag == 'emphasis': tag = 'em'
>
> I tried to commit with bzr, but bzr send failed : no success : bzr: ERROR:
> No mail-to address (--mail-to) or output (-o) specified.
> --
> Jean-Baptiste Holcroft
>
>
>
> 2012/11/17 Jaap Karssenberg <jaap.karssenberg@xxxxxxxxx>
>
>> On Sat, Nov 17, 2012 at 11:45 AM, Jean-Baptiste Holcroft <
>> jb.holcroft@xxxxxxxxx> wrote:
>>
>>> I wanted to have a little bit of fun with Templates using
>>> http://www.initializr.com/
>>>
>>> Is there a way to list all files embeded files in page ?
>>> Do you have more information about Files templates ? I do not understand
>>> what it is. Is says to go to Attachments but I do not understand how it
>>> works :(
>>> "*If you are looking for information for file templates for
>>> attachments, see Attachments<http://zim-wiki.org/manual/Help/Attachments.html>
>>> *"
>>>
>>> In my fun, I also successfully crashed Zim ;) :
>>> https://bugs.launchpad.net/zim/+bug/1079811
>>> I'll be please to give the final templates to Zim in you are interested
>>> and licence allow it.
>>>
>>
>>
>> Assuming your question is how to list attached files in an export
>> template. Correct ?
>>
>> Afraid there is no function for this at the moment, but if you file a
>> request in the tracker, we can check how easy it is to add that.
>>
>> (File templates are something else, those are templates to create new
>> attachments.)
>>
>> Regards,
>>
>> Jaap
>>
>>
>>
>
>
References