From 7a5ed5ba18cd1b11b9468e6e6d45ab1c8987923a Mon Sep 17 00:00:00 2001 From: Julien Rioux Date: Sun, 16 Oct 2011 07:04:17 -0400 Subject: [PATCH] Centralize the css files and fix the links to css files (issue 983). Put them in Documentation/css. --- Documentation/GNUmakefile | 6 +++++- Documentation/css/GNUmakefile | 24 ++++++++++++++++++++++-- Documentation/lilypond-texi2html.init | 6 +++--- make/doc-i18n-root-vars.make | 2 -- make/website.make | 8 ++++---- python/auxiliar/postprocess_html.py | 9 ++++++--- stepmake/stepmake/generic-vars.make | 5 ----- stepmake/stepmake/texinfo-rules.make | 1 - stepmake/stepmake/texinfo-targets.make | 2 -- 9 files changed, 40 insertions(+), 23 deletions(-) diff --git a/Documentation/GNUmakefile b/Documentation/GNUmakefile index 8f5006ef80..9df5573532 100644 --- a/Documentation/GNUmakefile +++ b/Documentation/GNUmakefile @@ -225,7 +225,11 @@ $(outdir)/pictures: $(MAKE) -C pictures WWW-1 ln -sf ../pictures/$(outdir) $@ -$(outdir)/web.texi: $(outdir)/ly-examples +$(outdir)/web.texi: $(outdir)/css $(outdir)/ly-examples + +$(outdir)/css: + $(MAKE) -C css + ln -sf ../css/$(outdir) $@ $(outdir)/ly-examples: $(MAKE) -C web/ly-examples diff --git a/Documentation/css/GNUmakefile b/Documentation/css/GNUmakefile index 3cb02a74dd..41495994ce 100644 --- a/Documentation/css/GNUmakefile +++ b/Documentation/css/GNUmakefile @@ -1,6 +1,26 @@ depth = ../.. -STEPMAKE_TEMPLATES=documentation -EXTRA_DIST_FILES = $(call src-wildcard,*.css) +CSS_FILES = $(call src-wildcard,*.css) + +EXTRA_DIST_FILES = $(CSS_FILES) + +OUT_CSS_FILES = $(CSS_FILES:%=$(outdir)/%) + +STEPMAKE_TEMPLATES = documentation include $(depth)/make/stepmake.make + +########### +### Targets + +default: + +ifeq ($(out),www) +local-WWW-1: $(OUT_CSS_FILES) +endif + +######### +### Rules + +$(outdir)/%.css: %.css + ln -f $< $@ diff --git a/Documentation/lilypond-texi2html.init b/Documentation/lilypond-texi2html.init index 3585a9e8ed..2002912f51 100644 --- a/Documentation/lilypond-texi2html.init +++ b/Documentation/lilypond-texi2html.init @@ -1068,18 +1068,18 @@ sub lilypond_css_lines ($$) foreach my $ref (@CSS_REFS) { $Texi2HTML::THISDOC{'CSS_LINES'} .= - "{TITLE}\" href=\"$ref->{FILENAME}\">\n"; + "{TITLE}\" href=\"css/$ref->{FILENAME}\">\n"; } foreach my $ref (@Texi2HTML::Config::ALT_CSS_REFS) { $Texi2HTML::THISDOC{'CSS_LINES'} .= - "{FILENAME}\" title=\"$ref->{TITLE}\">\n"; + "{FILENAME}\" title=\"$ref->{TITLE}\">\n"; } # The ie-fixes stylesheet is needed for the docs, but not the website. if (not ($web_manual)) { $Texi2HTML::THISDOC{'CSS_LINES'} .= - "\n"; + "\n"; } if ($ENV{'AJAX_SEARCH'} == 1) { diff --git a/make/doc-i18n-root-vars.make b/make/doc-i18n-root-vars.make index 9ba98580c3..8c20f494bd 100644 --- a/make/doc-i18n-root-vars.make +++ b/make/doc-i18n-root-vars.make @@ -2,8 +2,6 @@ LANGS = $(shell $(PYTHON) $(top-src-dir)/python/langdefs.py) -CSS_SOURCE_FILES = $(shell ls $(top-src-dir)/Documentation/lilypond*.css) - TELY_FILES := $(call src-wildcard,*.tely) TEXI_FILES := $(call src-wildcard,*.texi) MASTER_TEXI_FILES := $(TEXI_FILES) $(TELY_FILES:%.tely=$(outdir)/%.texi) diff --git a/make/website.make b/make/website.make index 0b164e44a8..3bb0faca53 100644 --- a/make/website.make +++ b/make/website.make @@ -106,7 +106,7 @@ MANUALS_BASE = $(basename $(MANUALS) $(MANUALS_WEB)) bib-files = $(OUT)/others-did.itexi $(OUT)/we-wrote.itexi css-src-files := $(notdir $(wildcard $(top-src-dir)/Documentation/css/*.css)) -css-files = $(css-src-files:%=$(OUT)/website/%) +css-files = $(css-src-files:%=$(OUT)/website/css/%) example-src-files := $(notdir $(wildcard $(EXAMPLES)/*)) example-files = $(example-src-files:%=$(OUT)/website/ly-examples/%) @@ -139,7 +139,7 @@ website: website-post website-examples website-pictures website-css website-misc website-bibs: website-version $(OUT) $(bib-files) -website-css: $(OUT)/website $(css-files) +website-css: $(OUT)/website/css $(css-files) website-examples: $(OUT)/website/ly-examples $(example-files) @@ -163,7 +163,7 @@ website-xrefs: website-version $(OUT) $(xref-files) ### Rules # Directories -$(OUT) $(OUT)/website $(OUT)/website/ly-examples $(OUT)/website/pictures: %: +$(OUT) $(OUT)/website $(OUT)/website/css $(OUT)/website/ly-examples $(OUT)/website/pictures: %: mkdir -p $@ $(OUT)/pictures: $(OUT)/website/pictures @@ -224,7 +224,7 @@ $(OUT)/website/index.html: $(wildcard $(OUT)/*.html) $(WEB_POST) $(OUT)/website # Simple copy -$(css-files): $(OUT)/website/%: $(top-src-dir)/Documentation/css/% +$(css-files): $(OUT)/website/css/%: $(top-src-dir)/Documentation/css/% cp $< $@ $(example-files): $(OUT)/website/ly-examples/%: $(EXAMPLES)/% diff --git a/python/auxiliar/postprocess_html.py b/python/auxiliar/postprocess_html.py index de3848537c..3ace451bf0 100644 --- a/python/auxiliar/postprocess_html.py +++ b/python/auxiliar/postprocess_html.py @@ -114,6 +114,9 @@ manuals_page_link_re = re.compile (r'href="((?:\.\./)+)Documentation/web/manuals # Get rid of symlinks in GNUmakefile.in (local-WWW-post) # this also fixes missing PNGs only present in translated docs def hack_urls (s, prefix, target, is_development_branch): + depth = (prefix.count ('/') - 1) * '../' + # fix css links + s = css_re.sub ('' % {'rel': depth}, s) if split_docs_re.match (prefix): s = lily_snippets_re.sub ('\\1="../\\2"', s) s = pictures_re.sub ('src="../\\1"', s) @@ -149,11 +152,11 @@ body_tag_re = re.compile ('(?i)]*)>') html_tag_re = re.compile ('(?i)') doctype_re = re.compile ('(?i)\n' -css_re = re.compile ('(?i)]*)href="[^">]*?lilypond.*\.css"([^>]*)>') +css_re = re.compile ('(?i)]*)href="[^">]*?(lilypond.*\.css)"([^>]*)>') end_head_tag_re = re.compile ('(?i)') -css_link = """ +css_link = """ """ diff --git a/stepmake/stepmake/generic-vars.make b/stepmake/stepmake/generic-vars.make index 6a8729df5f..06fa0a9ab2 100644 --- a/stepmake/stepmake/generic-vars.make +++ b/stepmake/stepmake/generic-vars.make @@ -103,11 +103,6 @@ SOURCE_FILES += $(IN_FILES) # Preprocessed .in documentation _FILES: OUTIN_FILES = $(addprefix $(outdir)/, $(IN_FILES:%.in=%)) -# CSS source files are in a unique directory -CSS_DIRECTORY = $(top-src-dir)/Documentation/css -CSS_FILES := $(shell ls $(CSS_DIRECTORY)/*.css) -OUT_CSS_FILES = $(CSS_FILES:$(CSS_DIRECTORY)/%.css=$(outdir)/%.css) - ALL_SOURCES = $(SOURCE_FILES) ifeq (cygwin,$(findstring cygwin,$(HOST_ARCH))) diff --git a/stepmake/stepmake/texinfo-rules.make b/stepmake/stepmake/texinfo-rules.make index 21e4a8ea03..83120ed87f 100644 --- a/stepmake/stepmake/texinfo-rules.make +++ b/stepmake/stepmake/texinfo-rules.make @@ -56,7 +56,6 @@ ifeq ($(WEB_VERSION),yes) else DEPTH=$(depth)/../ AJAX_SEARCH=$(AJAX_SEARCH) $(TEXI2HTML) $(TEXI2HTML_SPLIT) $(TEXI2HTML_FLAGS) --output=$(dir $@) $< endif - cp $(top-src-dir)/Documentation/css/*.css $(dir $@) $(XREF_MAPS_DIR)/%.xref-map: $(outdir)/%.texi $(buildscript-dir)/extract_texi_filenames $(XREF_MAP_FLAGS) -o $(XREF_MAPS_DIR) $< diff --git a/stepmake/stepmake/texinfo-targets.make b/stepmake/stepmake/texinfo-targets.make index 487ee97e49..fecbb47999 100644 --- a/stepmake/stepmake/texinfo-targets.make +++ b/stepmake/stepmake/texinfo-targets.make @@ -4,8 +4,6 @@ default: $(INFO_FILES) ifeq ($(out),www) local-WWW-1: $(XREF_MAPS_FILES) - -local-WWW-2: $(OUT_CSS_FILES) endif local-txt-doc: $(OUTTXT_FILES) -- 2.39.2