MathHubInfo / Legacy-planetary

Legacy: Planetary System is a math-enabled Web 3.0 information portal.
http://trac.mathweb.org/planetary/
79 stars 25 forks source link

Use the Drupal services module to enable editing articles etc. from Emacs, remote shell command, or even just local shell command for now... #416

Open holtzermann17 opened 11 years ago

holtzermann17 commented 11 years ago

See: https://drupal.org/project/services and http://arxana.net for the most advanced idea, for a simple idea, here's an example application for something we could do server side (from @rspuzio).

Basic outline

  1. make some example output done via by hand slicing
  2. automate and generalize by hand slicing
  3. write a simple drush script to upload contents (server side)
  4. write an services API so that this script can be called from an external client

    Use case

I have been slicing and dicing the book the last few days. You can see this for yourself since I moved the process to the linode: /home/shared-folder/HoTT-book

While I was at it, based on the workflow, a way of organizing mass access to the PM database occurred to me. For every article, there would be three files:

my-article.body The TeX source for the body of the article.

my-article.pre Its TeX preamble.

my-article.meta The metadata as a simple table, such as the following:

title: My very own math article!
owner: me
type: Example
msc: 00X00
keywords: me, article
. . .

There would be a program upload-article which would take these three files and the canonical name of an existing PM article as arguments and upload them to the database, a command new-article which would take the three files as arguments and return the canonical name of the new entry it created, and download-article, which would take a file root and a canonical name as argumewnts and return the contents of an article as three files.

new-article my-article.body my-article.pre my-article.meta => MyArticle
upload-article my-article.body my-article.pre my-article.meta MyArticle => t
download-article my-article MyArticle => my-article.body my-article.pre my-article.meta

I am guessing it sould be possibile to write these three utilities as shell scripts using Drush. They could then be called from other scripts to perform all sorts of mass operations like uploading a book or working on FEM.

holtzermann17 commented 10 years ago

@rspuzio's HOWTO for some semi-automated work that he's doing with a particular book:

We start out by slicing the book into bite-sized pieces so that Planetary 
doesn't get indigestion.

csplit -k -f sliced/chap0. book-master/introduction.tex '/^\\subsection.*$/' {30}
csplit -k -f sliced/chap1. book-master/preliminaries.tex '/^\\section.*$/' {30}
csplit -k -f sliced/chap2. book-master/basics.tex '/^\\section.*$/' {30}
. . .

We generate a table of macro definitions and of their dependencies.
Note that we use b order in sort in order to have the join command
work properly further down the line.

./strip_comments < book-master/macros.tex | sed '/^[:blank:]$/d' | 
 awk -f extract-lookup.awk | sort -t"%" -k 1b,1 > macro-lookup-table

./strip_comments < book-master/macros.tex | sed '/^[:blank:]$/d' | 
 awk -f extract-dep-table.awk > dependency-table

Pull out a plain list of macros:

cut -f 1 -d" " macro-lookup-table > defined-terms 

Next, we turn our attention to resolving internal references.  We begin 
by pulling out the relevant information from the various chapters of the
book.

./extract-references preliminaries.tex >> toc.raw
. . .

(More detail coming soon.)