depth = ../../..
LOCALSTEPMAKE_TEMPLATES = lilypond ly doclang
include $(depth)/make/stepmake.make
-
-
-local-WWW-1: $(XREF_MAP_FILES) $(outdir)/lilypond-snippets.xref-map \
- $(outdir)/music-glossary.xref-map \
- $(outdir)/lilypond-internals.xref-map
-
-$(outdir)/lilypond-snippets.xref-map:
- ln -sf ../../../../input/lsr/$@ $@
-
-$(outdir)/lilypond-internals.xref-map $(outdir)/music-glossary.xref-map:
- ln -sf ../../../user/$@ $@
depth = ../../..
LOCALSTEPMAKE_TEMPLATES = lilypond ly doclang
include $(depth)/make/stepmake.make
-
-
-local-WWW-1: $(XREF_MAP_FILES) $(outdir)/lilypond-snippets.xref-map \
- $(outdir)/music-glossary.xref-map \
- $(outdir)/lilypond-internals.xref-map
-
-$(outdir)/lilypond-snippets.xref-map:
- ln -sf ../../../../input/lsr/$@ $@
-
-$(outdir)/lilypond-internals.xref-map $(outdir)/music-glossary.xref-map:
- ln -sf ../../../user/$@ $@
depth = ../../..
LOCALSTEPMAKE_TEMPLATES = lilypond ly doclang
include $(depth)/make/stepmake.make
-
-local-WWW-1: $(XREF_MAP_FILES) $(outdir)/lilypond-snippets.xref-map \
- $(outdir)/music-glossary.xref-map \
- $(outdir)/lilypond-internals.xref-map
-
-$(outdir)/lilypond-snippets.xref-map:
- ln -sf ../../../../input/lsr/$@ $@
-
-$(outdir)/lilypond-internals.xref-map $(outdir)/music-glossary.xref-map:
- ln -sf ../../../user/$@ $@
mkdir -p $(dir $@)
ln -sf $(depth)/.. $(@)
-local-WWW-1: $(MASTER_TEXI_FILES) $(MASTER_TEXI_FILES:%.texi=%.xref-map) $(outdir)/lilypond-snippets.xref-map $(PDF_FILES) info
+local-WWW-1: $(MASTER_TEXI_FILES) $(PDF_FILES) info
local-WWW-2: $(HTML_FILES) $(DEEP_HTML_FILES) $(source-links)
$(outdir)/%.bib: %.bib
ln -f $< $@
-$(outdir)/lilypond-snippets.xref-map:
- ln -fs ../../../input/lsr/$@ $@
-
# lilypond.texi deps
$(top-build-dir)/mf/$(outconfbase)/feta16list.ly:
$(MAKE) -C $(top-src-dir)/mf
#!@PYTHON@
# -*- coding: utf-8 -*-
-# extrace_texi_filenames.py
+# extract_texi_filenames.py
# USAGE: extract_texi_filenames.py [-o OUTDIR] FILES
#
# which is then used for the filename/anchor.
#
# If this script is run on a file texifile.texi, it produces a file
-# texifile.xref-map with tab-separated entries of the form
+# texifile[.LANG].xref-map with tab-separated entries of the form
# NODE\tFILENAME\tANCHOR
+# LANG is the document language in case it's not 'en'
# Note: The filename does not have any extension appended!
# This file can then be used by our texi2html init script to determine
# the correct file name and anchor for external refs
import os
import getopt
-#import langdefs
-
optlist, args = getopt.getopt (sys.argv[1:],'o:')
files = args
if x[0] == '-o':
outdir = x[1]
+if not os.path.isdir (outdir):
+ if os.path.exists (outdir):
+ os.unlink (outdir)
+ os.makedirs (outdir)
+
include_re = re.compile (r'@include ((?!../lily-).*?)\.texi$', re.M)
whitespaces = re.compile (r'\s+')
section_translation_re = re.compile (r'@(node|(?:unnumbered|appendix)(?:(?:sub){0,2}sec)?|top|chapter|(?:sub){0,2}section|(?:major|chap|(?:sub){0,2})heading|translationof) (.*?)\s*\n')
def expand_includes (m, filename):
filepath = os.path.join (os.path.dirname (filename), m.group(1)) + '.texi'
if os.path.exists (filepath):
- return extract_sections (filepath)
+ return extract_sections (filepath)[1]
else:
print "Unable to locate include file " + filepath
return ''
+lang_re = re.compile (r'^@documentlanguage (.+)', re.M)
+
def extract_sections (filename):
result = ''
f = open (filename, 'r')
page = f.read ()
f.close()
+ # Search document language
+ m = lang_re.search (page)
+ if m and m.group (1) != 'en':
+ lang_suffix = '.' + m.group (1)
+ else:
+ lang_suffix = ''
# Replace all includes by their list of sections and extract all sections
page = include_re.sub (lambda m: expand_includes (m, filename), page)
sections = section_translation_re.findall (page)
for sec in sections:
result += "@" + sec[0] + " " + sec[1] + "\n"
- return result
+ return (lang_suffix, result)
# Convert a given node name to its proper file name (normalization as explained
# in the texinfo manual:
return texinfo_file_name (remove_texinfo (title))
unnumbered_re = re.compile (r'unnumbered.*')
-def process_sections (filename, page):
+def process_sections (filename, lang_suffix, page):
sections = section_translation_re.findall (page)
- # TODO: Don't rely on the file having a 4-letter extension (texi)!!!
- p = os.path.join (outdir, filename) [:-5] + '.xref-map'
+ basename = os.path.splitext (os.path.basename (filename))[0]
+ p = os.path.join (outdir, basename) + lang_suffix + '.xref-map'
f = open (p, 'w')
this_title = ''
for filename in files:
print "extract_texi_filenames.py: Processing %s" % filename
- sections = extract_sections (filename)
- process_sections (filename, sections)
+ (lang_suffix, sections) = extract_sections (filename)
+ process_sections (filename, lang_suffix, sections)
rm -f $(INFO_IMAGES_DIR)
local-WWW-1: info $(outdir)/lilypond-snippets.pdf \
- $(outdir)/lilypond-snippets.texi \
- $(outdir)/lilypond-snippets.xref-map \
- $(outdir)/lilypond.xref-map \
- $(outdir)/lilypond-learning.xref-map
+ $(outdir)/lilypond-snippets.texi
local-WWW-2: $(outdir)/lilypond-snippets/index.html \
$(outdir)/lilypond-snippets-big-page.html \
$(source-links)
-%.xref-map: %.texi
- $(PYTHON) $(buildscript-dir)/extract_texi_filenames.py $<
-
-$(outdir)/lilypond.xref-map $(outdir)/lilypond-learning.xref-map:
- ln -sf ../../../Documentation/user/$@ $@
-
.SECONDARY:
sub lilypond_init_map ()
{
my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
- my $map_filename = "$docu_dir/${docu_name}.xref-map";
+ my $map_filename = main::locate_include_file ("${docu_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
+ || main::locate_include_file ("${docu_name}.xref-map");
$node_to_filename_map = load_map_file ($map_filename);
}
push @Texi2HTML::Config::command_handler_init, \&lilypond_init_map;
# Load the map if we haven't done so already
if (!exists($translated_books{$map_name})) {
my ($docu_dir, $docu_name) = split_texi_filename ($Texi2HTML::THISDOC{'input_file_name'});
- my $map_filename = "$docu_dir/${map_name}.xref-map";
+ my $map_filename = main::locate_include_file ("${map_name}.$Texi2HTML::THISDOC{current_lang}.xref-map")
+ || main::locate_include_file ("${map_name}.xref-map");
$translated_books{$map_name} = load_map_file ($map_filename);
}
-$(outdir)/%/index.html: $(outdir)/%.texi $(outdir)/%.xref-map $(OUT_PNG_IMAGES) $(outdir)/version.itexi
+$(outdir)/%/index.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map $(OUT_PNG_IMAGES) $(outdir)/version.itexi
mkdir -p $(dir $@)
$(TEXI2HTML) --I=$(outdir) $(TEXI2HTML_FLAGS) --output=$(dir $@) --prefix=index --split=section $(TEXI2HTML_INIT) $<
cp $(top-src-dir)/Documentation/lilypond*.css $(dir $@)
-$(outdir)/%-big-page.html: $(outdir)/%.texi $(outdir)/%.xref-map $(OUT_PNG_IMAGES) $(outdir)/version.itexi
+$(outdir)/%-big-page.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map $(OUT_PNG_IMAGES) $(outdir)/version.itexi
$(TEXI2HTML) --I=$(outdir) -D bigpage $(TEXI2HTML_FLAGS) --output=$@ $(TEXI2HTML_INIT) $<
cp $(top-src-dir)/Documentation/lilypond*.css $(dir $@)
$(outdir)/%.png: $(top-build-dir)/Documentation/user/$(outdir)/%.png
ln -f $< $@
-$(outdir)/%.xref-map: $(outdir)/%.texi
- $(PYTHON) $(buildscript-dir)/extract_texi_filenames.py $<
+$(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map: $(outdir)/%.texi
+ $(PYTHON) $(buildscript-dir)/extract_texi_filenames.py -o $(XREF_MAPS_DIR) $<
# This makes sure lilypond-doc gettext domain has been compiled
# before lilypond-book runs
default:
-local-WWW-1: $(MASTER_TEXI_FILES) $(PDF_FILES) $(XREF_MAP_FILES)
+local-WWW-1: $(MASTER_TEXI_FILES) $(PDF_FILES) $(XREF_MAPS_FILES)
# BIG_PAGE_HTML_FILES is defined differently in each language makefile
local-WWW-2: $(DEEP_HTML_FILES) $(BIG_PAGE_HTML_FILES)
SOURCE_PNG_IMAGES=$(shell ls $(top-src-dir)/Documentation/user/*.png)
OUT_PNG_IMAGES=$(SOURCE_PNG_IMAGES:$(top-src-dir)/Documentation/user/%.png=$(outdir)/%.png) $(outdir)/context-example.png
+TELY_FILES := $(call src-wildcard,*.tely)
+MASTER_TEXI_FILES := $(TELY_FILES:%.tely=$(outdir)/%.texi)
+DEEP_HTML_FILES := $(TELY_FILES:%.tely=$(outdir)/%/index.html)
+PDF_FILES := $(TELY_FILES:%.tely=$(outdir)/%.pdf)
+
+ITELY_FILES := $(call src-wildcard,*.itely)
+ITEXI_FILES := $(call src-wildcard,*.itexi)
+
DOCUMENTATION_INCLUDES = \
-I $(top-src-dir)/Documentation/user \
-I $(top-build-dir)/Documentation/user/$(outdir)
MAKEINFO_FLAGS += --force --enable-encoding $(DOCUMENTATION_INCLUDES)
MAKEINFO = LANG= $(MAKEINFO_PROGRAM) $(MAKEINFO_FLAGS)
+# texi2html xref map files
+XREF_MAPS_DIR=$(top-build-dir)/out/xref-maps
+XREF_MAPS_FILES=$(TELY_FILES:%.tely=$(XREF_MAPS_DIR)/%.$(ISOLANG).xref-map)
+
+# texi2html flags
TEXI2HTML_INIT= --init-file=$(top-src-dir)/lilypond-texi2html.init
TEXI2HTML_LANG=--lang=$(ISOLANG)
-TEXI2HTML_FLAGS += $(TEXI2HTML_LANG) $(DOCUMENTATION_INCLUDES)
+TEXI2HTML_FLAGS += $(TEXI2HTML_LANG) $(DOCUMENTATION_INCLUDES) \
+ -I $(XREF_MAPS_DIR)
TEXI2HTML = LANG= $(TEXI2HTML_PROGRAM)
TEXI2PDF_FLAGS += -q --batch $(DOCUMENTATION_INCLUDES)
-
-TELY_FILES := $(call src-wildcard,*.tely)
-MASTER_TEXI_FILES := $(TELY_FILES:%.tely=$(outdir)/%.texi)
-DEEP_HTML_FILES := $(TELY_FILES:%.tely=$(outdir)/%/index.html)
-PDF_FILES := $(TELY_FILES:%.tely=$(outdir)/%.pdf)
-XREF_MAP_FILES := $(TELY_FILES:%.tely=$(outdir)/%.xref-map)
-
-ITELY_FILES := $(call src-wildcard,*.itely)
-ITEXI_FILES := $(call src-wildcard,*.itexi)
$(outdir)/%.info: $(outdir)/%.texi $(outdir)/$(INFO_IMAGES_DIR).info-images-dir.dep $(outdir)/version.itexi
$(MAKEINFO) -I$(outdir) --output=$@ $<
-$(outdir)/%-big-page.html: $(outdir)/%.texi $(outdir)/%.xref-map $(outdir)/version.itexi
+$(outdir)/%-big-page.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi
$(TEXI2HTML) --I=$(outdir) -D bigpage --output=$@ $(TEXI2HTML_INIT) $<
cp $(top-src-dir)/Documentation/lilypond*.css $(dir $@)
-$(outdir)/%.html: $(outdir)/%.texi $(outdir)/%.xref-map $(outdir)/version.itexi
+$(outdir)/%.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi
$(TEXI2HTML) --I=$(outdir) --output=$@ $(TEXI2HTML_INIT) $<
cp $(top-src-dir)/Documentation/lilypond*.css $(dir $@)
$(outdir)/%.ps.gz.omf: %.texi
$(call GENERATE_OMF,ps.gz)
-$(outdir)/%/index.html: $(outdir)/%.texi $(outdir)/%.xref-map $(outdir)/version.itexi
+$(outdir)/%/index.html: $(outdir)/%.texi $(XREF_MAPS_DIR)/%.xref-map $(outdir)/version.itexi
mkdir -p $(dir $@)
$(TEXI2HTML) --I=$(outdir) --output=$(dir $@) --prefix=index --split=section $(TEXI2HTML_INIT) $<
cp $(top-src-dir)/Documentation/lilypond*.css $(dir $@)
rm -f $@
cp $< $@
-%.xref-map: %.texi
- $(PYTHON) $(buildscript-dir)/extract_texi_filenames.py $<
+$(XREF_MAPS_DIR)/%.xref-map: $(outdir)/%.texi
+ $(PYTHON) $(buildscript-dir)/extract_texi_filenames.py -o $(XREF_MAPS_DIR) $<
$(outdir)/version.%: $(top-src-dir)/VERSION
default: $(INFO_FILES)
-local-WWW-2: $(addprefix $(outdir)/,$(TEXI_FILES:.texi=.html))
+local-WWW-1: $(XREF_MAPS_FILES)
local-doc: $(OUTTXT_FILES)
MAKEINFO_FLAGS = --enable-encoding
MAKEINFO = LANG= $(MAKEINFO_PROGRAM) $(MAKEINFO_FLAGS)
+# texi2html xref map files
+XREF_MAPS_DIR=$(top-build-dir)/out/xref-maps
+XREF_MAPS_FILES=$(INFO_DOCS:%=$(XREF_MAPS_DIR)/%.xref-map)
+
+# texi2html flags
ifneq ($(ISOLANG),)
TEXI2HTML_LANG = --lang=$(ISOLANG)
endif
-TEXI2HTML_FLAGS += --css-ref=lilypond.css $(DOCUMENTATION_INCLUDES)
+TEXI2HTML_FLAGS += --css-ref=lilypond.css $(DOCUMENTATION_INCLUDES) \
+ --I=$(XREF_MAPS_DIR)
TEXI2HTML_INIT = --init-file=$(top-src-dir)/lilypond-texi2html.init
TEXI2HTML = $(TEXI2HTML_PROGRAM) $(TEXI2HTML_FLAGS) $(TEXI2HTML_LANG)