unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* bug#27153: gnu: sicp: Add the HTML version.
@ 2017-05-30 21:05 Clément Lassieur
  2017-05-30 21:11 ` bug#27153: [PATCH] " Clément Lassieur
  2017-05-31  3:42 ` bug#27153: " Maxim Cournoyer
  0 siblings, 2 replies; 9+ messages in thread
From: Clément Lassieur @ 2017-05-30 21:05 UTC (permalink / raw)
  To: 27153

Yesterday, while browsing the Info version of SICP, I came accross an
incomplete figure (Figure 3.1: environments A and B are missing).  I
thought the HTML version might be complete and indeed it was.  It's
really nice by the way, see http://sarabander.github.io/sicp/.  And real
figures are in my opinion more pleasant to study than ASCII art figures.

So I think we should add the HTML version to our package. :-)  That
would allow us to use it without Internet access.

I find it much easier to browse the Info manual than the HTML one, so I
wrote this small Elisp snippet to switch from the former to the latter:

--8<---------------cut here---------------start------------->8---
(defun sicp-browse ()
  "Ask a browser to load the HTML version of the current node."
  (interactive)
  (let* ((home (expand-file-name "~"))
         (dir (concat "file://" home "/.guix-profile/share/doc/sicp/html/"))
         (node Info-current-node)
         (pattern
          (string-join
           '("^\\(?1:[0-9]\\)\.\\(?2:[0-9]\\)\.\\(?3:[0-9]\\)$" ; 4-5-7
             "^\\(?1:[0-9]\\)\.\\(?2:[0-9]\\)$"                 ; 4-5
             "^Chapter \\(?1:[0-9]\\)$")                        ; Chapter 4
           "\\|")))
    (if (string-match pattern node)
        (let ((chapter     (match-string 1 node)) ; 4
              (section     (match-string 2 node)) ; 5
              (sub-section (match-string 3 node)) ; 7
              base
              (anchor ""))
          (if section
              (setq base (format "%s_002e%s" chapter section))
            (setq base (format "Chapter-%s" chapter)))
          (when sub-section
            (setq anchor (format "#g_t%s_002e%s" base sub-section)))
          (browse-url (concat dir base ".xhtml" anchor)))
      (error "Node not matched"))))
--8<---------------cut here---------------end--------------->8---

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27153: [PATCH] gnu: sicp: Add the HTML version.
  2017-05-30 21:05 bug#27153: gnu: sicp: Add the HTML version Clément Lassieur
@ 2017-05-30 21:11 ` Clément Lassieur
  2017-05-31 13:39   ` Ludovic Courtès
  2017-05-31  3:42 ` bug#27153: " Maxim Cournoyer
  1 sibling, 1 reply; 9+ messages in thread
From: Clément Lassieur @ 2017-05-30 21:11 UTC (permalink / raw)
  To: 27153

* gnu/packages/scheme.scm (sicp)[arguments]: Copy the HTML directory to the
output.
---
 gnu/packages/scheme.scm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gnu/packages/scheme.scm b/gnu/packages/scheme.scm
index f6aee005c..eacfd733d 100644
--- a/gnu/packages/scheme.scm
+++ b/gnu/packages/scheme.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2016 Jan Nieuwenhuizen <janneke@gnu.org>
 ;;; Copyright © 2016, 2017 ng0 <contact.ng0@cryptolab.net>
 ;;; Copyright © 2017 John Darrington <jmd@gnu.org>
+;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -780,7 +781,9 @@ engineering.")
            (let ((gzip (assoc-ref %build-inputs "gzip"))
                  (source (assoc-ref %build-inputs "source"))
                  (texinfo (assoc-ref %build-inputs "texinfo"))
+                 (html-dir (string-append %output "/share/doc/" ,name "/html"))
                  (info-dir (string-append %output "/share/info")))
+             (copy-recursively (string-append source "/html") html-dir)
              (setenv "PATH" (string-append gzip "/bin"
                                            ":" texinfo "/bin"))
              (mkdir-p info-dir)
-- 
2.13.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* bug#27153: gnu: sicp: Add the HTML version.
  2017-05-30 21:05 bug#27153: gnu: sicp: Add the HTML version Clément Lassieur
  2017-05-30 21:11 ` bug#27153: [PATCH] " Clément Lassieur
@ 2017-05-31  3:42 ` Maxim Cournoyer
  2017-05-31  6:44   ` Clément Lassieur
  1 sibling, 1 reply; 9+ messages in thread
From: Maxim Cournoyer @ 2017-05-31  3:42 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 27153

Hi Clément,

Clément Lassieur <clement@lassieur.org> writes:

> Yesterday, while browsing the Info version of SICP, I came accross an
> incomplete figure (Figure 3.1: environments A and B are missing).  I
> thought the HTML version might be complete and indeed it was.  It's
> really nice by the way, see http://sarabander.github.io/sicp/.  And real
> figures are in my opinion more pleasant to study than ASCII art figures.
>
> So I think we should add the HTML version to our package. :-)  That
> would allow us to use it without Internet access.
>
> I find it much easier to browse the Info manual than the HTML one, so I
> wrote this small Elisp snippet to switch from the former to the latter:
>
> (defun sicp-browse ()
>   "Ask a browser to load the HTML version of the current node."
>   (interactive)
>   (let* ((home (expand-file-name "~"))
>          (dir (concat "file://" home "/.guix-profile/share/doc/sicp/html/"))
>          (node Info-current-node)
>          (pattern
>           (string-join
>            '("^\\(?1:[0-9]\\)\.\\(?2:[0-9]\\)\.\\(?3:[0-9]\\)$" ; 4-5-7
>              "^\\(?1:[0-9]\\)\.\\(?2:[0-9]\\)$"                 ; 4-5
>              "^Chapter \\(?1:[0-9]\\)$")                        ; Chapter 4
>            "\\|")))
>     (if (string-match pattern node)
>         (let ((chapter     (match-string 1 node)) ; 4
>               (section     (match-string 2 node)) ; 5
>               (sub-section (match-string 3 node)) ; 7
>               base
>               (anchor ""))
>           (if section
>               (setq base (format "%s_002e%s" chapter section))
>             (setq base (format "Chapter-%s" chapter)))
>           (when sub-section
>             (setq anchor (format "#g_t%s_002e%s" base sub-section)))
>           (browse-url (concat dir base ".xhtml" anchor)))
>       (error "Node not matched"))))

Cool! Thanks for sharing. I having started my study of SICP yet, but
that's something I've been meaning to do.

Also, couldn't the info version contain real figures (bitmaps)? Emacs is
capable of displaying images; maybe the info viewer is able to detect if
yes or no images are supported, and degrade gracefully to an alternative
(ascii art) when support is lacking?

Just some thoughts :)

Maxim

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27153: gnu: sicp: Add the HTML version.
  2017-05-31  3:42 ` bug#27153: " Maxim Cournoyer
@ 2017-05-31  6:44   ` Clément Lassieur
  2017-05-31 13:39     ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Clément Lassieur @ 2017-05-31  6:44 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: 27153

Hi Maxim,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

> Also, couldn't the info version contain real figures (bitmaps)? Emacs is
> capable of displaying images; maybe the info viewer is able to detect if
> yes or no images are supported, and degrade gracefully to an alternative
> (ascii art) when support is lacking?

You're right, I think they should be displayed but for some reason they
aren't.  There is an 'Info-display-images-node' function in 'info.el.gz'
though, but the regexp there isn't matching anything.

Clément

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27153: gnu: sicp: Add the HTML version.
  2017-05-31  6:44   ` Clément Lassieur
@ 2017-05-31 13:39     ` Ludovic Courtès
  2017-06-01 13:27       ` Christopher Allan Webber
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2017-05-31 13:39 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 27153

Hi,

Clément Lassieur <clement@lassieur.org> skribis:

> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> Also, couldn't the info version contain real figures (bitmaps)? Emacs is
>> capable of displaying images; maybe the info viewer is able to detect if
>> yes or no images are supported, and degrade gracefully to an alternative
>> (ascii art) when support is lacking?
>
> You're right, I think they should be displayed but for some reason they
> aren't.

Could it be that they’re not installed in the right place?

The Guix manual has a couple of images (info "(guix) Invoking guix
graph") and they are properly displayed by Emacs on X11.

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27153: [PATCH] gnu: sicp: Add the HTML version.
  2017-05-30 21:11 ` bug#27153: [PATCH] " Clément Lassieur
@ 2017-05-31 13:39   ` Ludovic Courtès
  2017-06-01  9:09     ` Clément Lassieur
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2017-05-31 13:39 UTC (permalink / raw)
  To: Clément Lassieur; +Cc: 27153

Clément Lassieur <clement@lassieur.org> skribis:

> * gnu/packages/scheme.scm (sicp)[arguments]: Copy the HTML directory to the
> output.

LGTM, thanks!

Ludo'.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27153: [PATCH] gnu: sicp: Add the HTML version.
  2017-05-31 13:39   ` Ludovic Courtès
@ 2017-06-01  9:09     ` Clément Lassieur
  0 siblings, 0 replies; 9+ messages in thread
From: Clément Lassieur @ 2017-06-01  9:09 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27153-done

Ludovic Courtès <ludo@gnu.org> writes:

> Clément Lassieur <clement@lassieur.org> skribis:
>
>> * gnu/packages/scheme.scm (sicp)[arguments]: Copy the HTML directory to the
>> output.
>
> LGTM, thanks!
>
> Ludo'.

Pushed, thank you!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27153: gnu: sicp: Add the HTML version.
  2017-05-31 13:39     ` Ludovic Courtès
@ 2017-06-01 13:27       ` Christopher Allan Webber
  2017-06-03  0:48         ` Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Christopher Allan Webber @ 2017-06-01 13:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 27153, Clément Lassieur

Ludovic Courtès writes:

> Hi,
>
> Clément Lassieur <clement@lassieur.org> skribis:
>
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>>
>>> Also, couldn't the info version contain real figures (bitmaps)? Emacs is
>>> capable of displaying images; maybe the info viewer is able to detect if
>>> yes or no images are supported, and degrade gracefully to an alternative
>>> (ascii art) when support is lacking?
>>
>> You're right, I think they should be displayed but for some reason they
>> aren't.
>
> Could it be that they’re not installed in the right place?
>
> The Guix manual has a couple of images (info "(guix) Invoking guix
> graph") and they are properly displayed by Emacs on X11.
>
> Thanks,
> Ludo’.

I think it's because the texinfo version has the images replaced with
ascii art, in most places!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#27153: gnu: sicp: Add the HTML version.
  2017-06-01 13:27       ` Christopher Allan Webber
@ 2017-06-03  0:48         ` Maxim Cournoyer
  0 siblings, 0 replies; 9+ messages in thread
From: Maxim Cournoyer @ 2017-06-03  0:48 UTC (permalink / raw)
  To: Christopher Allan Webber; +Cc: 27153, Clément Lassieur

[-- Attachment #1: Type: text/plain, Size: 172 bytes --]

>
>
> I think it's because the texinfo version has the images replaced with
> ascii art, in most places!
>
>
OK. Not something we can fix at the package level then.

Maxim

[-- Attachment #2: Type: text/html, Size: 480 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-06-03  0:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-30 21:05 bug#27153: gnu: sicp: Add the HTML version Clément Lassieur
2017-05-30 21:11 ` bug#27153: [PATCH] " Clément Lassieur
2017-05-31 13:39   ` Ludovic Courtès
2017-06-01  9:09     ` Clément Lassieur
2017-05-31  3:42 ` bug#27153: " Maxim Cournoyer
2017-05-31  6:44   ` Clément Lassieur
2017-05-31 13:39     ` Ludovic Courtès
2017-06-01 13:27       ` Christopher Allan Webber
2017-06-03  0:48         ` Maxim Cournoyer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).