Comments (2)
It looks like there are only specific circumstances where tables can be parsed at the moment. The first line must be present that has a distinct character to indicate where the columns are, all the remaining column separators must be lined up with the header line separators.
A more generalized solution might be to compare each line to see where there are (non-alphanumeric?) characters that are the same all the way from the bottom to the top of the table to be parsed, or at least are tied for the most in a single column.
Dealing with HTML and wikimedia syntax would be a bit more, there is a javascript implementation of an html to csv parser here: https://gist.github.com/adilapapaya/9787842
I didn't see a wikimedia table parser written in javascript, but I suspect I'm just not using the right search terms.
from ascii-tables.
Regarding the original issue, I don't think parsing wikimedia is actually much of a priority here. There are so many different table formats wikimedia supports and I don't really understand why. It's almost like they had an old way, then changed it, and never removed the first one. But since you are attempting to parse in javascript it can definitely get tricky as you said. Since the table definitions aren't consistent, I'd just avoid that idea all together.
I'd honestly disable the parse button when wikimedia is selected for now and just throw a message below it letting people know its not supported. This will keep the appearance of the site looking good, though I don't know how many people besides myself who have/would try this.
from ascii-tables.
Related Issues (20)
- Idea: Re-parse table
- Idea: Support Restructured Text
- Feature Request: change input format HOT 1
- NPM Package HOT 1
- Idea: line prefix HOT 3
- Comment style: Javadoc HOT 4
- Parse back from output doesn't work if comment is present HOT 1
- idea: merge and centre text
- reStructuredText with simple style generates extra whitespace in the beginning
- https in README
- Feature: support escaping custom field separators HOT 1
- Feature: provide option for stripping double quotes around (CSV) field values
- Headerless tables don't work in GitHub Markdown output
- Reddit : add Pipe "|" to comment style drop-down. HOT 1
- Library on NPM HOT 2
- Feature: allow an option to set width of the column
- suggestion: add a button on the web page to copy the TAB character to the clipboard
- Feature: Add support for reStructuredText list tables HOT 2
- Question re: privacy and pasting data to the website. HOT 1
- No option for left, center, right
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ascii-tables.