Skip to content

Commit 0601bed

Browse files
krystophnyclaude
andcommitted
fix: Restore working documentation pictures system
- Update Makefile doc target to copy media files from build/example/ to build/doc/example/ - Fix image paths in generate_example_docs.f90 to use example/ prefix instead of ../ - Add -fPIC flag to all FPM commands to fix C compilation linking issues - Ensures FORD documentation has accessible images and PDFs 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ea6c9d6 commit 0601bed

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
# Allow additional arguments to be passed
22
ARGS ?=
33

4+
# FPM flags for C compilation compatibility
5+
FPM_FLAGS = --flag -fPIC
6+
47
.PHONY: all build example debug test clean help matplotlib example_python example_matplotlib doc coverage create_build_dirs
58

69
# Default target
710
all: build
811

912
# Build the project
1013
build:
11-
fpm build $(ARGS)
14+
fpm build $(FPM_FLAGS) $(ARGS)
1215

1316
# Build and run the examples
1417
example: create_build_dirs
15-
fpm run --example $(ARGS)
18+
fpm run --example $(FPM_FLAGS) $(ARGS)
1619

1720
# Build and run the apps for debugging
1821
debug:
19-
fpm run $(ARGS)
22+
fpm run $(FPM_FLAGS) $(ARGS)
2023

2124
# Run tests
2225
test:
23-
fpm test $(ARGS)
26+
fpm test $(FPM_FLAGS) $(ARGS)
2427

2528
# Run Python examples with fortplotlib (default mode)
2629
example_python:
@@ -66,6 +69,9 @@ run-release:
6669
# Build documentation with FORD
6770
doc:
6871
ford doc.md
72+
# Copy example media files to doc build directory for proper linking
73+
mkdir -p build/doc/example
74+
if [ -d build/example ]; then cp -r build/example/* build/doc/example/ 2>/dev/null || true; fi
6975

7076
# Generate coverage report
7177
coverage:

example/generate_example_docs.f90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,15 @@ subroutine write_generated_outputs(unit_out, example_dir, example_name)
276276
if (extension == 'mp4') then
277277
! Embed video using HTML
278278
write(unit_out, '(A)') '<video width="800" height="600" controls>'
279-
write(unit_out, '(A)') ' <source src="../' // trim(example_name) // '/' // &
279+
write(unit_out, '(A)') ' <source src="example/' // trim(example_name) // '/' // &
280280
trim(media_files(j)) // '" type="video/mp4">'
281281
write(unit_out, '(A)') ' Your browser does not support the video tag.'
282282
write(unit_out, '(A)') '</video>'
283283
write(unit_out, '(A)') ''
284-
write(unit_out, '(A)') '[Download MP4](../' // trim(example_name) // '/' // trim(media_files(j)) // ')'
284+
write(unit_out, '(A)') '[Download MP4](example/' // trim(example_name) // '/' // trim(media_files(j)) // ')'
285285
else
286286
! Regular image
287-
write(unit_out, '(A)') '![' // trim(media_files(j)) // '](../' // &
287+
write(unit_out, '(A)') '![' // trim(media_files(j)) // '](example/' // &
288288
trim(example_name) // '/' // trim(media_files(j)) // ')'
289289
write(unit_out, '(A)') ''
290290

@@ -310,7 +310,7 @@ subroutine write_generated_outputs(unit_out, example_dir, example_name)
310310
end if
311311

312312
! Add PDF link
313-
write(unit_out, '(A)') '[Download PDF](../' // trim(example_name) // '/' // &
313+
write(unit_out, '(A)') '[Download PDF](example/' // trim(example_name) // '/' // &
314314
trim(replace_extension(media_files(j), 'pdf')) // ')'
315315
end if
316316
write(unit_out, '(A)') ''
@@ -338,7 +338,7 @@ subroutine process_image_path(line, example_name)
338338
filename = filename(index(filename, '/', back=.true.)+1:)
339339
end if
340340
! Replace with relative path to example directory
341-
new_path = '../' // trim(example_name) // '/' // trim(filename)
341+
new_path = 'example/' // trim(example_name) // '/' // trim(filename)
342342
line = line(1:start_pos+1) // trim(new_path) // ')'
343343
end if
344344
end if

0 commit comments

Comments
 (0)