Scribble bug with solution

Aperta Adatta ai principianti
#5,508 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
html
Ambito
documentation

Direzione di ricerca

Leggi racket/pkgs/scribble-lib/scribble/html-render.rkt intorno alla riga 1428 e segui il modo in cui @image produce HTML per i file SVG. Esegui scribble su un documento contenente graph.svg, quindi ispeziona il doc.html generato in un browser. Il lavoro è completato quando le immagini SVG con riferimenti a icone annidati vengono visualizzate correttamente, mentre le immagini non SVG mantengono l’output esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

What version of Racket are you using?
9.1 [cs] on linux

What program did you run?
$ scribble

What should have happened?
Browser should display all images on page.

If you got an error message, please include it here.
No error message during the complete chain of production.

Please include any other relevant details
The problem is a little bit tricky to describe. The solution is easier:

For embeded .svg image files included by @image{<image.svg>} Scribble produces an html tag. In simple cases the image displays correctly but not in complex ones. The complex case will be described later. The solution is to use an html tag instead of the tag.

This could be achieved by replacing the following lines in file racket/pkgs/scribble-lib/scribble/html-render.rkt.
existing code (line 1428):

`((img
([src ,srcref]
[alt ,(content->string (element-content e))]
,@sz
,@(attribs))))))]

replacement code:

(if svg?
((object ([data ,srcref] [type "image/svg+xml"] [alt ,(content->string (element-content e))] ,@sz ,@(attribs)))) ((img
([src ,srcref]
[alt ,(content->string (element-content e))]
,@sz
,@(attribs)))))))]

Problem description (real case szenario):

An icon file icon.svg is used by graphviz within a .dot file (node->image attribute). Graphviz produces another file graph.svg including a link to icon.svg. The file graph.svg is then include in file doc.scrbl by a line @image{"graph.svg"}. Scribble then produces a file doc.html.

The chain of links to svg-images looks like this:

icon.svg <- graph.svg <- doc.html

When using a web browser to display doc.html then the image icon.svg will not display if an html tag <img src="graph.svg" ...> is produced by Scribble. Everything displays perfectly if a tag <object data="graph.svg" type="image/svg+xml" ...> is produced.

Hint: File icon.svg has to be copied manually by the user into the same directory where files doc.html and graph.svg reside.

Lingua principale
Racket
Stelle
5.2k
Fork
708
Merge medio
2g 19h
PR unite (30g)
12

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di racket/racket

Tutte le issue di racket/racket

Issue simili

Altre issue su Documentation

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.