mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #1592 from ingwinlu/add_argparse_relative
Add argparse argument for relative URLs
This commit is contained in:
commit
5912608b04
2 changed files with 12 additions and 0 deletions
|
|
@ -283,6 +283,11 @@ def parse_arguments():
|
||||||
help='Relaunch pelican each time a modification occurs'
|
help='Relaunch pelican each time a modification occurs'
|
||||||
' on the content files.')
|
' on the content files.')
|
||||||
|
|
||||||
|
parser.add_argument('--relative-urls', dest='relative_paths',
|
||||||
|
action='store_true',
|
||||||
|
help='Use relative urls in output, '
|
||||||
|
'useful for site development')
|
||||||
|
|
||||||
parser.add_argument('--cache-path', dest='cache_path',
|
parser.add_argument('--cache-path', dest='cache_path',
|
||||||
help=('Directory in which to store cache files. '
|
help=('Directory in which to store cache files. '
|
||||||
'If not specified, defaults to "cache".'))
|
'If not specified, defaults to "cache".'))
|
||||||
|
|
@ -316,6 +321,7 @@ def get_config(args):
|
||||||
config['CACHE_PATH'] = args.cache_path
|
config['CACHE_PATH'] = args.cache_path
|
||||||
if args.selected_paths:
|
if args.selected_paths:
|
||||||
config['WRITE_SELECTED'] = args.selected_paths.split(',')
|
config['WRITE_SELECTED'] = args.selected_paths.split(',')
|
||||||
|
config['RELATIVE_URLS'] = args.relative_paths
|
||||||
config['DEBUG'] = args.verbosity == logging.DEBUG
|
config['DEBUG'] = args.verbosity == logging.DEBUG
|
||||||
|
|
||||||
# argparse returns bytes in Py2. There is no definite answer as to which
|
# argparse returns bytes in Py2. There is no definite answer as to which
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,11 @@ ifeq ($(DEBUG), 1)
|
||||||
PELICANOPTS += -D
|
PELICANOPTS += -D
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
RELATIVE ?= 0
|
||||||
|
ifeq ($(RELATIVE), 1)
|
||||||
|
PELICANOPTS += --relative-urls
|
||||||
|
endif
|
||||||
|
|
||||||
help:
|
help:
|
||||||
@echo 'Makefile for a pelican Web site '
|
@echo 'Makefile for a pelican Web site '
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
@ -52,6 +57,7 @@ help:
|
||||||
@echo ' make github upload the web site via gh-pages '
|
@echo ' make github upload the web site via gh-pages '
|
||||||
@echo ' '
|
@echo ' '
|
||||||
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
|
@echo 'Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html '
|
||||||
|
@echo 'Set the RELATIVE variable to 1 to enable relative urls '
|
||||||
@echo ' '
|
@echo ' '
|
||||||
|
|
||||||
html:
|
html:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue