Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse template fail when wikitext lack closing tag #282

Open
lehoanganh298 opened this issue Mar 15, 2022 · 0 comments
Open

Parse template fail when wikitext lack closing tag #282

lehoanganh298 opened this issue Mar 15, 2022 · 0 comments

Comments

@lehoanganh298
Copy link

lehoanganh298 commented Mar 15, 2022

I'm trying to parse the wikitext in a live wikipedia page (https://vi.wikipedia.org/wiki/Apple_Inc.?action=raw) and get the template of the infobox but fail. After some inspection I find that the <li> tags inside the template are the reason, removing them and it's parsed correctly.
Here's the template's wikitext:
{{Hộp thông tin tóm tắt về công ty\n| name = Apple Inc.\n| logo = [[Tập tin:Apple logo black.svg||80px|Logo của Apple Inc.]]\n| image = Apple park cupertino 2019.jpg\n| image_size = 260px\n| image_caption = Trụ sở Apple ở [[Cupertino, California]]\n| type = [[Công ty đại chúng]]\n| traded_as = {{nasdaq|AAPL}}, {{lse|0HDZ}}, {{FWB|APC}}\n| predecessor = \n| foundation = {{Start date and age|1976|04|01}} ([[Cupertino, California|Cupertino]], [[California]], [[Hoa Kỳ|Mỹ]])\n| founder = [[Steve Jobs]], [[Steve Wozniak]], [[Ronald Wayne]]<ref name=AppleConf>{{chú thích sách| last = Linzmayer| first = Ronald W.| title = Apple Confidential: The Real Story of Apple Computer, Inc.| publisher = No Starch Press| year = 1999| url = http://extras.denverpost.com/books/chap0411h.htm| access-date = ngày 1 tháng 6 năm 2018 | access-date = ngày 1 tháng 6 năm 2018}}</ref>\n| location_city = [[Cupertino, California]]\n| location_country = Mỹ\n| num_locations = 510 cửa hàng bán lẻ\n| num_locations_year = 2020\n| area_served = Toàn thế giới\n| key_people = [[Tim Cook]] ([[Tổng giám đốc điều hành|CEO]])\n[[Arthur D. Levinson]] ([[Chủ tịch hội đồng quản trị]])\n[[Jeff Williams]] ([[Giám đốc điều hành|COO]])\n| industry = [[Phần cứng|Phần cứng máy tính]]{{·}} [[Phần mềm|Phần mềm máy tính]], phụ kiện, thiết bị di động\n| products =\n{{Collapsible list\n |framestyle=border:none; padding:0;\n |title=\n |1=<li>[[Macintosh|Mac]]\n |2=<li>[[iPod]]\n |3=<li>[[iPhone]]\n |4=<li>[[iPad]]\n |5=<li>[[Apple Watch]]\n |6=<li>[[Apple TV]]\n |7=<li>[[macOS]]\n |8=<li>[[iOS(Apple)|iOS]] |9=<li>[[iPadOS]]\n |10=<li>[[watchOS]]\n |11=<li>[[tvOS]]\n}}\n| services =\n{{Collapsible list\n |framestyle=border:none; padding:0;\n |title=\n |1=<li>[[Apple Arcade]]\n |2=<li>[[Apple Card]]\n |3=<li>[[Apple Music]]\n |4=<li>[[Apple News+]]\n |5=<li>[[Apple TV+]]\n |6=<li>[[Apple Store (online)|Apple Store online]]\n |7=<li>[[App Store (iOS)|App Store]]\n |8=<li>[[iTunes|iTunes Store]]\n |9=<li>[[Mac App Store]]\n |10=<li>[[iBookstore|iBooks]]\n |11=<li>[[iCloud]]\n |12=<li>[[Apple Pay]]\n |13=<li>[[iMessage]]\n |14=<li>[[FaceTime]]\n}}\n| revenue = {{increase}} {{US$|274.515&nbsp;tỉ|link=yes}}<ref name=\"SEC filing\">{{chú thích web|url=https://s2.q4cdn.com/470004039/files/doc_financials/2020/q4/FY20_Q4_Consolidated_Financial_Statements.pdf|date=30 tháng 10 năm 2020}}</ref>\n| revenue_year = 2020\n| operating_income = {{increase}} {{US$|66.288&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| income_year = 2020\n| net_income = {{increase}} {{US$|57.411&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| net_income_year = 2020\n| assets = {{decrease}} {{US$|323.888&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| assets_year = 2020\n| equity = {{decrease}} {{US$|65.339&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| equity_year = 2020\n| num_employees = 147,000<ref name=\"SEC filing\"/>\n| num_employees_year = 2020\n| divisions = \n| subsid = [[Shazam (company)|Shazam]], [[FileMaker Inc.]], [[Anobit]], [[Braeburn Capital]], [[Beats Electronics]]\n| website = {{URL|apple.com}}\n| intl = yes\n}}

Here the template's wikitext after removing the <li> tags (parsed sucessfully):
{{Hộp thông tin tóm tắt về công ty\n| name = Apple Inc.\n| logo = [[Tập tin:Apple logo black.svg||80px|Logo của Apple Inc.]]\n| image = Apple park cupertino 2019.jpg\n| image_size = 260px\n| image_caption = Trụ sở Apple ở [[Cupertino, California]]\n| type = [[Công ty đại chúng]]\n| traded_as = {{nasdaq|AAPL}}, {{lse|0HDZ}}, {{FWB|APC}}\n| predecessor = \n| foundation = {{Start date and age|1976|04|01}} ([[Cupertino, California|Cupertino]], [[California]], [[Hoa Kỳ|Mỹ]])\n| founder = [[Steve Jobs]], [[Steve Wozniak]], [[Ronald Wayne]]<ref name=AppleConf>{{chú thích sách| last = Linzmayer| first = Ronald W.| title = Apple Confidential: The Real Story of Apple Computer, Inc.| publisher = No Starch Press| year = 1999| url = http://extras.denverpost.com/books/chap0411h.htm| access-date = ngày 1 tháng 6 năm 2018 | access-date = ngày 1 tháng 6 năm 2018}}</ref>\n| location_city = [[Cupertino, California]]\n| location_country = Mỹ\n| num_locations = 510 cửa hàng bán lẻ\n| num_locations_year = 2020\n| area_served = Toàn thế giới\n| key_people = [[Tim Cook]] ([[Tổng giám đốc điều hành|CEO]])\n[[Arthur D. Levinson]] ([[Chủ tịch hội đồng quản trị]])\n[[Jeff Williams]] ([[Giám đốc điều hành|COO]])\n| industry = [[Phần cứng|Phần cứng máy tính]]{{·}} [[Phần mềm|Phần mềm máy tính]], phụ kiện, thiết bị di động\n| products =\n{{Collapsible list\n |framestyle=border:none; padding:0;\n |title=\n |1=[[Macintosh|Mac]]\n |2=[[iPod]]\n |3=[[iPhone]]\n |4=[[iPad]]\n |5=[[Apple Watch]]\n |6=[[Apple TV]]\n |7=[[macOS]]\n |8=[[iOS(Apple)|iOS]] |9=[[iPadOS]]\n |10=[[watchOS]]\n |11=[[tvOS]]\n}}\n| services =\n{{Collapsible list\n |framestyle=border:none; padding:0;\n |title=\n |1=[[Apple Arcade]]\n |2=[[Apple Card]]\n |3=[[Apple Music]]\n |4=[[Apple News+]]\n |5=[[Apple TV+]]\n |6=[[Apple Store (online)|Apple Store online]]\n |7=[[App Store (iOS)|App Store]]\n |8=[[iTunes|iTunes Store]]\n |9=[[Mac App Store]]\n |10=[[iBookstore|iBooks]]\n |11=[[iCloud]]\n |12=[[Apple Pay]]\n |13=[[iMessage]]\n |14=[[FaceTime]]\n}}\n| revenue = {{increase}} {{US$|274.515&nbsp;tỉ|link=yes}}<ref name=\"SEC filing\">{{chú thích web|url=https://s2.q4cdn.com/470004039/files/doc_financials/2020/q4/FY20_Q4_Consolidated_Financial_Statements.pdf|date=30 tháng 10 năm 2020}}</ref>\n| revenue_year = 2020\n| operating_income = {{increase}} {{US$|66.288&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| income_year = 2020\n| net_income = {{increase}} {{US$|57.411&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| net_income_year = 2020\n| assets = {{decrease}} {{US$|323.888&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| assets_year = 2020\n| equity = {{decrease}} {{US$|65.339&nbsp;tỉ}}<ref name=\"SEC filing\"/>\n| equity_year = 2020\n| num_employees = 147,000<ref name=\"SEC filing\"/>\n| num_employees_year = 2020\n| divisions = \n| subsid = [[Shazam (company)|Shazam]], [[FileMaker Inc.]], [[Anobit]], [[Braeburn Capital]], [[Beats Electronics]]\n| website = {{URL|apple.com}}\n| intl = yes\n}}

The <li> tags that don't have closing tags </li> might be not syntactically correct, but it shouldn't lead to fail in parsing the whole template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant