Skip to content

Commit

Permalink
Tidying for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
davetaz committed Nov 8, 2024
1 parent 8dc8312 commit d06882d
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 8 deletions.
29 changes: 29 additions & 0 deletions old-api.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
How to Use the CSVLint Webservice API

CSVLint has a Webservice API that allows you to POST a file and return a validation.

Currently you POST a file like so:

curl -L --data "urls[]=http://theodi.github.io/hot-drinks/hot-drinks.csv" http://csvlint.io/package.json

(urls[] can also be a comma seperated list of urls)

Or with a schema:

curl -L --data "urls[]=http://theodi.github.io/hot-drinks/hot-drinks.csv&schema=1&schema_url=http://example.com/some_schema.json" http://csvlint.io/package.json

And you get back some json with a URL to a package:

{
"package": {
"url":"http://csvlint.io/package/53a150336373764c17170700"
}
}

You can then get the validation by making a request to the JSON version of the package like so:

curl http://csvlint.io/package/53a150336373764c17170700.json

Note Currently the package is created in the background, so may not be available immediately. This will change in the future.

This then returns the JSON version of the package:
20 changes: 19 additions & 1 deletion public/css/csvlint.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ input.file {
flex: 1;
min-width: 280px;
}

pre {
white-space: pre-wrap; /* Allows the text to wrap within the pre element */
word-wrap: break-word; /* Breaks long words to fit within the container */
overflow-x: auto; /* Adds horizontal scroll if needed */
}
/* Validation box styling */
.validation-box {
flex: 1;
Expand All @@ -38,6 +42,20 @@ input.file {
background-color: var(--color-light-grey);

}
@media (max-width: 768px) {
.validation-box {
width: 75vw;
}
.homeNav {
display: none;
}
section {
padding: 1em;
}
h1 {
margin-top: 12px;
}
}
.validation-box h2 {
margin-top: 0em;
}
Expand Down
10 changes: 5 additions & 5 deletions public/examples/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,32 @@
"title": "Student List",
"description": "A simple CSV file containing a list of students with their names and ages.",
"expectedResult": "This CSV should validate successfully without errors or warnings.",
"csvUrl": "https://raw.githubusercontent.com/theodi/csvlint.io/refs/heads/main/public/examples/students_perfect.csv",
"csvUrl": "https://csvlint.io/examples/students_perfect.csv",
"dialect": "",
"schemaUrl": ""
},
{
"title": "Mixed types",
"description": "A simple CSV file containing a list of students with their names and ages.",
"expectedResult": "This CSV should produce warnings due to data inconsistencies in the age column.",
"csvUrl": "https://raw.githubusercontent.com/theodi/csvlint.io/refs/heads/main/public/examples/students_warnings.csv",
"csvUrl": "https://csvlint.io/examples/students_warnings.csv",
"dialect": "",
"schemaUrl": ""
},
{
"title": "Pipe Separator",
"description": "A simple CSV file containing a list of students with their names and ages.",
"expectedResult": "This CSV is valid but the separator is a pipe character.",
"csvUrl": "https://raw.githubusercontent.com/theodi/csvlint.io/refs/heads/main/public/examples/students_pipe.txt",
"csvUrl": "https://csvlint.io/examples/students_pipe.txt",
"dialect": "delimiter=|",
"schemaUrl": ""
},
{
"title": "Schema validation",
"description": "Same file as in the first example, but this time the schema will throw errors.",
"expectedResult": "This CSV should be invalid based upon the schema.",
"csvUrl": "https://raw.githubusercontent.com/theodi/csvlint.io/refs/heads/main/public/examples/students_perfect.csv",
"csvUrl": "https://csvlint.io/examples/students_perfect.csv",
"dialect": "",
"schemaUrl": "https://raw.githubusercontent.com/theodi/csvlint.io/refs/heads/main/public/examples/studentsSchema.json"
"schemaUrl": "https://csvlint.io/examples/studentsSchema.json"
}
]
2 changes: 1 addition & 1 deletion views/about.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<script src="/javascripts/contents_table.js"></script>
<link rel="stylesheet" media="screen" href="/stylesheets/contents_table.css">

<h2 id="about_this_service">About this service</h2>
<h1 id="about_this_service">About this service</h1>

<p>CSV looks easy, but it can be hard to make a CSV file that other people can work with. <strong>CSVLint</strong> helps you to check that your CSV file is readable. And you can use it to check whether it contains the columns and types of values that it should.</p>

Expand Down
2 changes: 1 addition & 1 deletion views/partials/header.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<a href="/" class="logo"></a>
<nav class="main-nav" aria-label="Main Menu">
<ul>
<li><a href="/" class="toggle-link">Validate</a></li>
<li class="homeNav"><a href="/" class="toggle-link">Validate</a></li>
<li><a href="/examples" class="toggle-link">Examples</a></li>
<li><a href="/api" class="toggle-link">API</a></li>
<li><a href="/about" class="toggle-link">About</a></li>
Expand Down

0 comments on commit d06882d

Please sign in to comment.