Thank you! I never used this module. I want to physically sort rows and
columns of a table, so I have to change the elements of a given table. My
first thouught was write it from scratch with strings, but I hope, this
helps.
JJMC89 <jjmc89.wikimedia(a)gmail.com> ezt írta (időpont: 2022. dec. 22., Cs,
3:21):
mwparserfromhell.nodes.tag.Tag
<https://mwparserfromhell.readthedocs.io/en/v0.6.4/api/mwparserfromhell.nodes.html#mwparserfromhell.nodes.tag.Tag>
can
represent any HTML-style tag. mwparserfromhell will parse wikitext tables
into the HTML tag equivalents
<https://en.wikipedia.org/wiki/Help:Table#Comparison_of_table_syntax>.
Doing something like the below will let you visualize:
>> text = "before\n{|
class='wikitable'\n!c1 h!!c2 h\n|r1 c1\n|r1
c2\n|}\nafter"
>> for tag in
wikicode.ifilter_tags(matches=lambda tag: tag.tag.lower()
in ("table",
"caption", "th", "tr", "td")):
... print(f"{tag!r} is a {tag.tag!r}")
...
"{| class='wikitable'\n!c1 h!!c2 h\n|r1 c1\n|r1 c2\n|}" is a
'table'
'!c1 h' is a 'th'
'!!c2 h\n' is a 'th'
'|r1 c1\n' is a 'td'
'|r1 c2\n' is a 'td'
On Wed, Dec 21, 2022 at 5:04 PM Bináris <wikiposta(a)gmail.com> wrote:
I don't find the description of objects and
available tags in
documentation, can you help me?
Are there cells, rows, columns, headings?
_______________________________________________
pywikibot mailing list -- pywikibot(a)lists.wikimedia.org
To unsubscribe send an email to pywikibot-leave(a)lists.wikimedia.org
_______________________________________________
pywikibot mailing list -- pywikibot(a)lists.wikimedia.org
To unsubscribe send an email to pywikibot-leave(a)lists.wikimedia.org