README.md 2.63 KB
Newer Older
Ricardo Lafuente's avatar
Ricardo Lafuente committed
1 2 3
The Libre Graphics magazine Archives
====================================

Ricardo Lafuente's avatar
Ricardo Lafuente committed
4
This is an effort to convert the content of the Libre Graphics magazine issues into Markdown, in order to get them together in a [Pelican](https://blog.getpelican.com/) static site.
Ricardo Lafuente's avatar
Ricardo Lafuente committed
5

6 7
## Directory structure

Ana Isabel Carvalho's avatar
Ana Isabel Carvalho committed
8
* **old-content**
Ana Isabel Carvalho's avatar
Ana Isabel Carvalho committed
9
  * **01-original-scribus-files**: the original `.sla` files taken from the repositories
Ana Isabel Carvalho's avatar
Ana Isabel Carvalho committed
10 11 12
  * **02-converted-markdown**: auto-converted Markdown versions of each issue, with pages out of order
  * **03-separated-articles**: individual files for each article, not reviewed for markup yet
  * **image-lists**: list of image files in each issue
Ricardo Lafuente's avatar
Ricardo Lafuente committed
13 14
* **issue-pages**: metadata for each issue
* **content/issueX.X**: marked up files, with metadata headers
Ana Isabel Carvalho's avatar
Ana Isabel Carvalho committed
15
* **content/images**: all images, full size
Ricardo Lafuente's avatar
Ricardo Lafuente committed
16
* **content/images-small**: all images, resized for web
17 18


Ricardo Lafuente's avatar
Ricardo Lafuente committed
19
## Recipes for some of our steps
Ricardo Lafuente's avatar
Ricardo Lafuente committed
20

Ricardo Lafuente's avatar
Ricardo Lafuente committed
21
### Extract text from Scribus files
22

Ricardo Lafuente's avatar
Ricardo Lafuente committed
23
See the `scripts/scribus-extract.py` script.
24 25 26 27 28 29 30 31 32 33

### Extracting image paths from Scribus files

```bash
cat 01-original-scribus-files/lgmag-1.1-p* | \
  grep -oe '"[^ ]*\(jpg\|png\)"' | \
  sort | uniq | \
  sed 's/"//g; s/\.\.\///g' > images-1.1.txt
```

34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
### Re-downloading images from repos

After extracting the image lists from the previous recipe, we did this (example for 2.4):

```bash
mkdir -p images/2.4
cd images/2.4
while read f; do wget "https://gitlab.com/libregraphicsmag/vol2issue4/raw/master/$f"; done < ../../image-lists/images-2.4.txt
```

### Resizing images to a max width and height

We wanted max 1800px width and 1400px height, while keeping smaller images as they are.

```bash
cd images/2.4
for f in *; do echo $f; mogrify -resize 1800x1400\> $f; done
```

Ricardo Lafuente's avatar
Ricardo Lafuente committed
53
or, to alter all images in subdirectories:
54

Ricardo Lafuente's avatar
Ricardo Lafuente committed
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
```bash
cd images
find . -name "*" | xargs mogrify -resize 970x4000\> 
```

### Review text files with a particular string

We needed to check every instance of a lowercase acronym (e.g. "svg") and edit it manually if it needed to be made uppercase again.

```bash
grep '\bsvg\b' issue* -lr | xargs vim -p
```

### Turn all images into image links

We wanted to change all images into a thumbnail which would then link to the original image.

So this

```markdown
![](/images/2.1/picture.png)
```

should become

```markdown
[![](/images-small/2.1/picture.png)](/images/2.1/picture.png)
```

So we use the following sed script:

```bash
cd content
Ricardo Lafuente's avatar
Ricardo Lafuente committed
88
find . -name "*.md" | xargs sed -i 's/!\[\](\(\/images\/[^)]*\))/[![](\1)](\1)/g; s/(\/images\//(\/images-small\//'
Ricardo Lafuente's avatar
Ricardo Lafuente committed
89 90 91
```

The sed operation comes in two parts: first we create the "image inside link", and after that we fix the directory of the thumbnail so that it points to the `images-small` directory.