Closed flywire closed 3 years ago
default class for image (the image_class
param) should be wikilink-image
or wikilink-img
or any known convention. It should be different than link (wikilink
).
I see point 2 is still marked as an issue but there is a commit for it (Clear end_url for images). Does it not work as expected?
I see point 2 is still marked as an issue
Yes, I understand that query is not valid on an image and should be cleared. urlo.query = ''
is invalid.
Also, checkurl does not fix the test that renders as <p><img class="wikilink-image" src="https://www.example.png/" /></p>
(btw I don't understand the syntax for url = self.config['build_url'][0](urlo, base_url, end_url, url_whitespace, url_case)
)
Feel free to jump in when you are ready!
More:
1. default image class as you say
isimage
to image
as a class and any other tidy up - I don't know OOP so you might do the refactoring
I understand that query is not valid on an image and should be cleared. urlo.query = '' is invalid.
If query is given on the wikilink image path, then it can remain, I don't think it will be a problem. When someone uses this, he will most certainly not use query on image wikilink, if he does, then he will get the query as well. So, we can keep the query.
[[/path/to/file name.png/?a=b&b=c]]
[[https://www.example.png/?]]
[[https://www.example.jpg/?a=b&b=c]]
These are not valid, so we don't need to cater for them.
rather, there should be a test for [[https://www.example.jpg?a=b&b=c]]
[[https://www.python.org/static/community_logos/python-powered-h-50x65.png|alt= Python powered logo]]
renders in a GitHub wiki page as [without link below]:
there should be a test for
[[https://www.example.jpg?a=b&b=c]]
I'm not familiar with that implementation. Can you reply with a live code example and add it to the wiki page above?
Can you reply with a live code example
The examples are in test.py
file.
You can copy def test_with_meta(self)
method and write a similar test only changing the input text and output.
Like this:
def test_with_meta(self):
output = """
<p><a class="wikilink" href="/static/wikilink">Wikilink</a> <code>[[wikilink]]</code></p>
<p><a class="wikilink" href="/static/wikilink">Wikilink</a> <code>[[Wikilink]]</code></p>
<p><a class="wikilink" href="/static/path/to/file_name">File name</a></p>
<p><a class="wikilink" href="/static/path/to/file_name">File name</a></p>
<p><a class="wikilink" href="/static/path/to/file-name">File name</a></p>
<p><a class="wikilink" href="/static/path/to/file_name/?a=b&b=c">File name</a></p>
<p><a class="wikilink" href="/static/path/to/file_name.html">File name</a></p>
<p><a class="wikilink" href="/static/path/to/file_name.html?a=b&b=c">File name</a></p>
<p><a class="wikilink" href="https://www.example.com/">www.example.com</a></p>
<p><a class="wikilink" href="https://www.example.com/?a=b&b=c">www.example.com</a></p>
<p><a class="wikilink" href="https://www.example.com/example-tutorial">Example tutorial</a></p>
<p><a class="wikilink" href="https://www.example.com/example-tutorial">Example Tutorial</a></p>
""".strip()
md2 = markdown.Markdown(extensions=[WikiLinkPlusExtension(), MetaExtension()])
html = md2.convert(meta_text+"\n\n"+text)
# ~ print(html)
self.assertEqual(html, output)
def test_with_image(self):
text = 'something'
meta_text = 'see example above'
output = 'something'
md2 = markdown.Markdown(extensions=[WikiLinkPlusExtension(), MetaExtension()])
html = md2.convert(meta_text+"\n\n"+text)
# ~ print(html)
self.assertEqual(html, output)
Once you include all the possible wikiimage syntax in the test and the test passes, you can increase the version number to 1.4.0
The examples are in test.py file.
I'm sceptical that a query works on an image which is why I requested you demonstrate it in the wiki.
Hmm, Seems you haven't been reading the extended description under …
, particularly 75a5b79. The extra code is messy so I'd still recommend some OOP refactoring before release.
I'm not clear what the ~
is in the test code. The default config html is given first but when printing is enabled it prints last. I referenced this file in the readme so it would be good if the coded and printed order were the same.
I'm not clear what the ~ is in the test code
It's one of my editors that is the culprit, it adds # ~
when commented and removes them when uncommented :smile:
The default config html is given first but when printing is enabled it prints last
I am not clear what you are referring to here, but if you feel like changing any order to make it good, feel free to do so.
The extra code is messy so I'd still recommend some OOP refactoring before release.
I shall see what can be done. I should be able to release a new version within a week.
I am not clear what you are referring to here, but if you feel like changing any order to make it good, feel free to do so.
I don't understand why it happens.
test.py
python test.py >test.out
fc test.py test.out
html block for test_without_config
prints last. It is unexpected/confusing if users study test.py
examples.
I see. I have added unittest.TestLoader.sortTestMethodsUsing = None
to test.py
to prevent unittest to sort the methods. It should keep the order as is.
See #6
This code works but it has issues:
1. Only outputalt
tag from label (pipe)2. Clearend_url
for images because it is not valid3. Defineimage_class
Config paramTests at: https://github.com/neurobin/mdx_wikilink_plus/issues/6#issuecomment-740998217
What do you think?