Skip to content

Commit 48a8066

Browse files
dburgenerpcmoore
authored andcommitted
build: don't encode local paths in output
Link instead directly to the github examples, since they aren't packaged. The html is an exception, since the examples could be included in hosting wherever the html is hosted, and the html preserves relative paths. Signed-off-by: Daniel Burgener <[email protected]> [PM: tweak subject line] Signed-off-by: Paul Moore <[email protected]>
1 parent 75e1d91 commit 48a8066

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ IMAGES = $(SRCDIR)/images
1717
EXAMPLES = $(SRCDIR)/notebook-examples
1818
EXAMPLES_EPUB = $(shell echo $(EXAMPLES) | $(SED) 's;/;\\/;g')
1919
METADATA = $(SRCDIR)/metadata.yaml
20+
EXAMPLES_GITHUB = $(shell echo https://github.com/SELinuxProject/selinux-notebook/tree/main/src/notebook-examples | $(SED) 's;/;\\/;g')
2021

2122
HTML_OUT = SELinux_Notebook.html
2223
PDF_OUT = SELinux_Notebook.pdf
@@ -73,6 +74,9 @@ pdf: $(DEP_FILE_LIST) $(METADATA)
7374
$(SED) -i 's/](.*\.md#/](#/' $(PDFDIR)/.full_document.md
7475
# remove the section file name from all HTML links
7576
$(SED) -i 's/href=.*\.md#/href="#/' $(PDFDIR)/.full_document.md
77+
# fixup path for examples, directing at the github repo
78+
$(SED) -i 's/](.\/notebook-examples/]($(EXAMPLES_GITHUB)/g' \
79+
$(PDFDIR)/.full_document.md
7680
[ -e $(PDFDIR)/images ] || ln -s $(IMAGES) $(PDFDIR)
7781
[ -e $(PDFDIR)/notebook-examples ] || ln -s $(EXAMPLES) $(PDFDIR)
7882
(cd $(PDFDIR); $(PANDOC) --pdf-engine=weasyprint $(PANDOC_OPTS) \
@@ -120,8 +124,8 @@ epub: $(DEP_FILE_LIST) $(METADATA)
120124
$(SED) -i 's/](.*\.md#/](#/' $(EPUBDIR)/.full_document.md
121125
# remove the section file name from all HTML links
122126
$(SED) -i 's/href=.*\.md#/href="#/' $(EPUBDIR)/.full_document.md
123-
# fixup path for examples, otherwise defaults to file:///EPUB/text
124-
$(SED) -i 's/](.\/notebook-examples/](file:\/\/$(EXAMPLES_EPUB)/g' \
127+
# fixup path for examples, directing at the github repo
128+
$(SED) -i 's/](.\/notebook-examples/]($(EXAMPLES_GITHUB)/g' \
125129
$(EPUBDIR)/.full_document.md
126130
[ -e $(EPUBDIR)/images ] || ln -s $(IMAGES) $(EPUBDIR)
127131
[ -e $(EPUBDIR)/notebook-examples ] || ln -s $(EXAMPLES) $(EPUBDIR)

0 commit comments

Comments
 (0)