globalwordnet / cili

The Global WordNet Association Collaborative Inter-Lingual Index
Other
38 stars 8 forks source link

Add make-html.py for generating RDF endpoint pages #12

Closed goodmami closed 2 years ago

goodmami commented 2 years ago

This adds a script for generating HTML pages for CILI IDs:

$ python3 make-html.py out  # "out" is the name of a directory to be created
$ ls out | wc -l  # lots of files
117659
$ du -sh out  # not small
463M    out

The output looks like this:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>i1</title>
</head>
<body>
  <article class="ili" itemscope itemtype="http://globalwordnet.org/ili/Concept" itemid="http://globalwordnet.org/ili/i1">
    <h1>i1</h1>

    <div class="ili-type">Concept</div>

    <blockquote itemprop="http://www.w3.org/2004/02/skos/core#definition">
    (usually followed by `to') having the necessary means or skill or know-how or authority to do something
    </blockquote>

    <dl>
      <dt>Status</dt>
      <dd itemprop="status">active</dd>
      <dt>Source</dt>
      <dd><a href="https://wordnet.princeton.edu/">Princeton WordNet 3.0</a>
          &ndash;
          <a itemprop="http://purl.org/dc/elements/1.1/source" href="http://wordnet-rdf.princeton.edu/wn30/00001740-a">00001740-a</a>
      </dd>
    </dl>

  </article>
</body>
</html>

Some notes:

jmccrae commented 2 years ago

Yeah, I think this looks good. I could recommend adding some CSS styling and such like to make it a bit nicer.

Another nice idea would be to add an RDF export as well. Then perhaps I could help Piek with configuring the forwarding rules to be aware of the request type.

Shall we merge this and work from there?

goodmami commented 2 years ago

I've pushed a commit that adds CSS and an index.html page. The page is pretty basic but it works with light/dark modes and should be readable on desktop or mobile browsers. The CSS is a separate file so there wasn't a big change to the disk usage of the export, but we need to make sure the relative path to load the CSS works on GitHub Pages.

I'll leave the RDF export to more capable hands.

Shall we merge this and work from there?

That sounds good. I don't have commit access, so you or Francis can do the merge.

goodmami commented 2 years ago

And here's a screenshot showing light/dark and scaled down a bit. The black header is full-width. The grey box is centered, 800px wide, or 400px wide if the screen width is <= 799px. The box is harder to see in the dark mode but it's there.

ili-screenshot-dark-light