Scribble bug with solution

Abierto Apto para principiantes
#5,508 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 3 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
html

Línea de trabajo

Lee racket/pkgs/scribble-lib/scribble/html-render.rkt alrededor de la línea 1428 y sigue cómo @image genera HTML para archivos SVG. Ejecuta scribble sobre un documento que contenga graph.svg y, después, inspecciona el doc.html generado en un navegador. La tarea estará completada cuando las imágenes SVG con referencias de iconos anidadas se muestren correctamente, mientras que las imágenes que no sean SVG conserven su salida actual.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Racket
Estrellas
5.2k
Forks
708
Merge medio
2 d 19 h
PR fusionados (30 d)
12

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de racket/racket

Todos los issues de racket/racket

Issues similares

Más issues de Documentation

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.