Ejemplo n.º 1
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('DISQUS_SECRET_KEY', '')
    DEFAULT_CONFIG.setdefault('DISQUS_PUBLIC_KEY', '')
    if pelican:
        pelican.settings.setdefault('DISQUS_SECRET_KEY', '')
        pelican.settings.setdefault('DISQUS_PUBLIC_KEY', '')
def initialized(pelican):
	from pelican.settings import DEFAULT_CONFIG
	DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM', False)
	DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_DIR' 'comments')
	if pelican:
		pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM', False)
		pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_DIR', 'comments')
Ejemplo n.º 3
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('STATIC_COMMENTS', False)
    DEFAULT_CONFIG.setdefault('STATIC_COMMENTS_DIR' 'comments')
    if pelican:
        pelican.settings.setdefault('STATIC_COMMENTS', False)
        pelican.settings.setdefault('STATIC_COMMENTS_DIR', 'comments')
Ejemplo n.º 4
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM', False)
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_DIR' 'comments')
    if pelican:
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM', False)
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_DIR', 'comments')
Ejemplo n.º 5
0
def initialized(pelican):
	global fancybox_settings
	from pelican.settings import DEFAULT_CONFIG
	DEFAULT_CONFIG.setdefault('FANCYBOX_SETTINGS', {})
	if pelican:
		pelican.settings.setdefault('FANCYBOX_SETTINGS', {})
		fancybox_settings = supercopy(pelican.settings['FANCYBOX_SETTINGS'])
Ejemplo n.º 6
0
def initialized(pelican):

    p = os.path.expanduser('~/Pictures')

    DEFAULT_CONFIG.setdefault('PHOTO_LIBRARY', p)
    #     DEFAULT_CONFIG.setdefault('PHOTO_GALLERY', (1024, 768, 80))
    #     DEFAULT_CONFIG.setdefault('PHOTO_ARTICLE', (760, 506, 80))
    #     DEFAULT_CONFIG.setdefault('PHOTO_THUMB', (192, 144, 60))
    #     DEFAULT_CONFIG.setdefault('PHOTO_GALLERY_TITLE', '')
    #     DEFAULT_CONFIG.setdefault('PHOTO_ALPHA_BACKGROUND_COLOR', (255, 255, 255))
    #     DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK', False)
    #     DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_THUMB', False)
    #     DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_TEXT', DEFAULT_CONFIG['SITENAME'])
    #     DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_TEXT_COLOR', (255, 255, 255))
    #     DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_IMG', '')
    #     DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_IMG_SIZE', False)
    #     DEFAULT_CONFIG.setdefault('PHOTO_RESIZE_JOBS', 1)
    #     DEFAULT_CONFIG.setdefault('PHOTO_EXIF_KEEP', False)
    #     DEFAULT_CONFIG.setdefault('PHOTO_EXIF_REMOVE_GPS', False)
    #     DEFAULT_CONFIG.setdefault('PHOTO_EXIF_AUTOROTATE', True)
    #     DEFAULT_CONFIG.setdefault('PHOTO_EXIF_COPYRIGHT', False)
    #     DEFAULT_CONFIG.setdefault('PHOTO_EXIF_COPYRIGHT_AUTHOR', DEFAULT_CONFIG['SITENAME'])
    #     DEFAULT_CONFIG.setdefault('PHOTO_LIGHTBOX_GALLERY_ATTR', 'data-lightbox')
    #     DEFAULT_CONFIG.setdefault('PHOTO_LIGHTBOX_CAPTION_ATTR', 'data-title')
    #
    #     DEFAULT_CONFIG['queue_resize'] = {}
    #     DEFAULT_CONFIG['created_galleries'] = {}
    #     DEFAULT_CONFIG['plugin_dir'] = os.path.dirname(os.path.realpath(__file__))
    #
    if pelican:
        pelican.settings.setdefault('PHOTO_LIBRARY', p)
Ejemplo n.º 7
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('DISQUS_SECRET_KEY', '')
    DEFAULT_CONFIG.setdefault('DISQUS_PUBLIC_KEY', '')
    if pelican:
        pelican.settings.setdefault('DISQUS_SECRET_KEY', '')
        pelican.settings.setdefault('DISQUS_PUBLIC_KEY', '')
Ejemplo n.º 8
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('STATIC_COMMENTS', False)
    DEFAULT_CONFIG.setdefault('STATIC_COMMENTS_DIR' 'comments')
    if pelican:
        pelican.settings.setdefault('STATIC_COMMENTS', False)
        pelican.settings.setdefault('STATIC_COMMENTS_DIR', 'comments')
Ejemplo n.º 9
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG

    DEFAULT_CONFIG.setdefault("SUMMARY_BEGIN_MARKER", "<!-- PELICAN_BEGIN_SUMMARY -->")
    DEFAULT_CONFIG.setdefault("SUMMARY_END_MARKER", "<!-- PELICAN_END_SUMMARY -->")
    if pelican:
        pelican.settings.setdefault("SUMMARY_BEGIN_MARKER", "<!-- PELICAN_BEGIN_SUMMARY -->")
        pelican.settings.setdefault("SUMMARY_END_MARKER", "<!-- PELICAN_END_SUMMARY -->")
Ejemplo n.º 10
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG

    DEFAULT_CONFIG.setdefault("STATIC_COMMENTS", False)
    DEFAULT_CONFIG.setdefault("STATIC_COMMENTS_DIR" "comments")
    if pelican:
        pelican.settings.setdefault("STATIC_COMMENTS", False)
        pelican.settings.setdefault("STATIC_COMMENTS_DIR", "comments")
Ejemplo n.º 11
0
def init_default_config(pelican):
    from pelican.settings import DEFAULT_CONFIG

    TOC_DEFAULT = {'TOC_HEADERS': '^h[1-6]', 'TOC_RUN': 'true'}

    DEFAULT_CONFIG.setdefault('TOC', TOC_DEFAULT)
    if (pelican):
        pelican.settings.setdefault('TOC', TOC_DEFAULT)
Ejemplo n.º 12
0
def initialized(pelican):

    p = os.path.expanduser('~/Pictures')

    DEFAULT_CONFIG.setdefault('PHOTO_LIBRARY', p)

    if pelican:
        pelican.settings.setdefault('PHOTO_LIBRARY', p)
Ejemplo n.º 13
0
def initialize(instance):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('CATEGORYNAMES_ATTRIBUTES',
                              ('name', 'name_long'))
    DEFAULT_CONFIG.setdefault('CATEGORYNAMES_ALTERNATIVES', dict())
    instance.settings.setdefault('CATEGORYNAMES_ATTRIBUTES',
                                 ('name', 'name_long'))
    instance.settings.setdefault('CATEGORYNAMES_ALTERNATIVES', dict())
Ejemplo n.º 14
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG

    DEFAULT_CONFIG.setdefault('SHELL_BEGIN', '<!-- SHELL_BEGIN -->')
    DEFAULT_CONFIG.setdefault('SHELL_END', '<!-- SHELL_END -->')

    if pelican:
        pelican.settings.setdefault('SHELL_BEGIN', '<!-- SHELL_BEGIN -->')
        pelican.settings.setdefault('SHELL_END', '<!-- SHELL_END -->')
Ejemplo n.º 15
0
def initialize(pelicanobj):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('SKIPTAGS', [
        'h1',
    ])
    if pelicanobj:
        pelicanobj.settings.setdefault('SKIPTAGS', [
            'h1',
        ])
Ejemplo n.º 16
0
def initialized(pelican):
    """Initialize the plugin """

    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('MDF_DEFAULT_CONFIG', '')
    DEFAULT_CONFIG.setdefault('BOOTSTRAPPER_FIGURES', False)
    if pelican:
        pelican.settings.setdefault('MDF_DEFAULT_CONFIG', '')
        pelican.settings.setdefault('BOOTSTRAPPER_FIGURES', False)
Ejemplo n.º 17
0
def setdefault(pelican, settings):
    from pelican.settings import DEFAULT_CONFIG
    for key, value in settings:
        DEFAULT_CONFIG.setdefault(key, value)

    if not pelican:
        return

    for key, value in settings:
        pelican.settings.setdefault(key, value)
Ejemplo n.º 18
0
def initialized(pelican):
    p = os.path.expanduser('~/Music')

    DEFAULT_CONFIG.setdefault('MUSIC_LIBRARY', p)
    DEFAULT_CONFIG.setdefault('MUSIC_COVER', 'cover.jpg')
    DEFAULT_CONFIG['plugin_dir'] = os.path.dirname(os.path.realpath(__file__))

    if pelican:
        pelican.settings.setdefault('MUSIC_LIBRARY', p)
        pelican.settings.setdefault('MUSIC_COVER', 'cover.jpg')
def setdefault(pelican, settings):
    from pelican.settings import DEFAULT_CONFIG
    for key, value in settings:
        DEFAULT_CONFIG.setdefault(key, value)

    if not pelican:
        return

    for key, value in settings:
        pelican.settings.setdefault(key, value)
Ejemplo n.º 20
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('SUMMARY_BEGIN_MARKER',
                              '<!-- PELICAN_BEGIN_SUMMARY -->')
    DEFAULT_CONFIG.setdefault('SUMMARY_END_MARKER',
                              '<!-- PELICAN_END_SUMMARY -->')
    if pelican:
        pelican.settings.setdefault('SUMMARY_BEGIN_MARKER',
                                    '<!-- PELICAN_BEGIN_SUMMARY -->')
        pelican.settings.setdefault('SUMMARY_END_MARKER',
                                    '<!-- PELICAN_END_SUMMARY -->')
Ejemplo n.º 21
0
Archivo: toc.py Proyecto: sbadia/site
def init_default_config(pelican):
    from pelican.settings import DEFAULT_CONFIG

    TOC_DEFAULT = {
        'TOC_HEADERS': '^h[1-6]',
        'TOC_RUN': 'true'
    }

    DEFAULT_CONFIG.setdefault('TOC', TOC_DEFAULT)
    if(pelican):
        pelican.settings.setdefault('TOC', TOC_DEFAULT)
Ejemplo n.º 22
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('ARTICLEHEAD_BEGIN_MARKER',
                              '<!-- ARTICLE_HEAD_BEGIN -->')
    DEFAULT_CONFIG.setdefault('ARTICLEHEAD_END_MARKER',
                              '<!-- ARTICLE_HEAD_END -->')
    if pelican:
        pelican.settings.setdefault('ARTICLEHEAD_BEGIN_MARKER',
                                  '<!-- ARTICLE_HEAD_BEGIN -->')
        pelican.settings.setdefault('ARTICLEHEAD_END_MARKER',
                                    '<!-- ARTICLE_HEAD_END -->')
Ejemplo n.º 23
0
def initialized(pelican):
    p = os.path.expanduser('~/Pictures')
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('PHOTO_MTIME', False)
    DEFAULT_CONFIG.setdefault('PHOTO_LIBRARY', p)
    DEFAULT_CONFIG.setdefault('PHOTO_GALLERY', (1024, 768, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_ARTICLE', (760, 506, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_THUMB', (192, 144, 60))
    if pelican:
        pelican.settings.setdefault('PHOTO_MTIME', False)
        pelican.settings.setdefault('PHOTO_LIBRARY', p)
        pelican.settings.setdefault('PHOTO_GALLERY', (1024, 768, 80))
        pelican.settings.setdefault('PHOTO_ARTICLE', (760, 506, 80))
        pelican.settings.setdefault('PHOTO_THUMB', (192, 144, 60))
Ejemplo n.º 24
0
def initialized(pelican):
    p = os.path.expanduser('~/Pictures')
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('PHOTO_MTIME', False)
    DEFAULT_CONFIG.setdefault('PHOTO_LIBRARY', p)
    DEFAULT_CONFIG.setdefault('PHOTO_GALLERY', (1024, 768, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_ARTICLE', ( 760, 506, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_THUMB',   ( 192, 144, 60))
    if pelican:
        pelican.settings.setdefault('PHOTO_MTIME', False)
        pelican.settings.setdefault('PHOTO_LIBRARY', p)
        pelican.settings.setdefault('PHOTO_GALLERY', (1024, 768, 80))
        pelican.settings.setdefault('PHOTO_ARTICLE', ( 760, 506, 80))
        pelican.settings.setdefault('PHOTO_THUMB',   ( 192, 144, 60))
Ejemplo n.º 25
0
    def test_do_not_use_folder_as_category(self):

        settings = DEFAULT_CONFIG.copy()
        settings['ARTICLE_DIR'] = 'content'
        settings['DEFAULT_CATEGORY'] = 'Default'
        settings['DEFAULT_DATE'] = (1970, 1, 1)
        settings['USE_FOLDER_AS_CATEGORY'] = False
        settings['filenames'] = {}
        generator = ArticlesGenerator(settings.copy(), settings, CUR_DIR,
                                      DEFAULT_CONFIG['THEME'], None,
                                      DEFAULT_CONFIG['MARKUP'])
        generator.generate_context()
        # test for name
        # categories are grouped by slug; if two categories have the same slug
        # but different names they will be grouped together, the first one in
        # terms of process order will define the name for that category
        categories = [cat.name for cat, _ in generator.categories]
        categories_alternatives = (
            sorted(['Default', 'Yeah', 'test', '指導書']),
            sorted(['Default', 'yeah', 'test', '指導書']),
        )
        self.assertTrue(sorted(categories) in categories_alternatives)
        # test for slug
        categories = [cat.slug for cat, _ in generator.categories]
        categories_expected = ['default', 'yeah', 'test', 'zhi-dao-shu']
        self.assertEqual(sorted(categories), sorted(categories_expected))
Ejemplo n.º 26
0
def twitter_card(generator):
    """
     https://dev.twitter.com/cards
     TWITTER_CARD_USE = (True) # (False)
     TWITTER_CARD_SITE = '@website' # The site's Twitter handle like @my_blog
     TWITTER_CARD_SITE_ID = 123456 # The site's Twitter ID
     TWITTER_CARD_CREATOR = '@username' # Your twitter handle like @yourtwitname
     TWITTER_CARD_CREATOR_ID = 56789 # The site creator's id
     GRAVATAR_URL = ''
    """

    DEFAULT_CONFIG.setdefault('TWITTER_CARD_SITE', '')
    DEFAULT_CONFIG.setdefault('TWITTER_CARD_SITE_ID', '')
    DEFAULT_CONFIG.setdefault('TWITTER_CARD_CREATOR', '')
    DEFAULT_CONFIG.setdefault('TWITTER_CARD_CREATOR_ID', '')
    DEFAULT_CONFIG.setdefault('GRAVATAR_URL', '')
Ejemplo n.º 27
0
def twitter_card(generator):
    """
     https://dev.twitter.com/cards
     TWITTER_CARD_USE = (True) # (False)
     TWITTER_CARD_SITE = '@website' # The site's Twitter handle like @my_blog
     TWITTER_CARD_SITE_ID = 123456 # The site's Twitter ID
     TWITTER_CARD_CREATOR = '@username' # Your twitter handle like @yourtwitname
     TWITTER_CARD_CREATOR_ID = 56789 # The site creator's id
     GRAVATAR_URL = ''
    """

    DEFAULT_CONFIG.setdefault('TWITTER_CARD_SITE', '')
    DEFAULT_CONFIG.setdefault('TWITTER_CARD_SITE_ID', '')
    DEFAULT_CONFIG.setdefault('TWITTER_CARD_CREATOR', '')
    DEFAULT_CONFIG.setdefault('TWITTER_CARD_CREATOR_ID', '')
    DEFAULT_CONFIG.setdefault('GRAVATAR_URL', '')
Ejemplo n.º 28
0
    def test_do_not_use_folder_as_category(self):

        settings = DEFAULT_CONFIG.copy()
        settings['ARTICLE_DIR'] = 'content'
        settings['DEFAULT_CATEGORY'] = 'Default'
        settings['DEFAULT_DATE'] = (1970, 1, 1)
        settings['USE_FOLDER_AS_CATEGORY'] = False
        settings['filenames'] = {}
        generator = ArticlesGenerator(
            settings.copy(), settings, CUR_DIR, DEFAULT_CONFIG['THEME'], None,
            DEFAULT_CONFIG['MARKUP'])
        generator.generate_context()
        # test for name
        # categories are grouped by slug; if two categories have the same slug
        # but different names they will be grouped together, the first one in
        # terms of process order will define the name for that category
        categories = [cat.name for cat, _ in generator.categories]
        categories_alternatives = (
            sorted(['Default', 'Yeah', 'test', '指導書']),
            sorted(['Default', 'yeah', 'test', '指導書']),
        )
        self.assertTrue(sorted(categories) in categories_alternatives)
        # test for slug
        categories = [cat.slug for cat, _ in generator.categories]
        categories_expected = ['default', 'yeah', 'test', 'zhi-dao-shu']
        self.assertEqual(sorted(categories), sorted(categories_expected))
Ejemplo n.º 29
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('AUTOSUMMARY_KEEP_HTMLTAGS',
                              ('a', 'font', 's', 'strong', 'em', 'u', 'b'))
    DEFAULT_CONFIG.setdefault('AUTOSUMMARY_REPLACE_HTMLTAGS',
                              {'h[2-9]': 'strong'})
    DEFAULT_CONFIG.setdefault('AUTOSUMMARY_DELETE_HTMLTAGS', ['h1'])
    DEFAULT_CONFIG.setdefault('AUTOSUMMARY_MAX_LENGTH', 140)
    DEFAULT_CONFIG.setdefault('AUTOSUMMARY_MIN_LENGTH', 1)
    if pelican:
        pelican.settings.setdefault(
            'AUTOSUMMARY_KEEP_HTMLTAGS',
            ('a', 'font', 's', 'strong', 'em', 'u', 'b'))
        pelican.settings.setdefault('AUTOSUMMARY_REPLACE_HTMLTAGS',
                                    {'h[2-9]': 'strong'})
        pelican.settings.setdefault('AUTOSUMMARY_DELETE_HTMLTAGS', ['h1'])
        pelican.settings.setdefault('AUTOSUMMARY_MAX_LENGTH', 140)
        pelican.settings.setdefault('AUTOSUMMARY_MIN_LENGTH', 1)
Ejemplo n.º 30
0
def get_settings(**kwargs):
    """Provide tweaked setting dictionaries for testing

    Set keyword arguments to override specific settings.
    """
    settings = DEFAULT_CONFIG.copy()
    for key,value in kwargs.items():
        settings[key] = value
    return settings
Ejemplo n.º 31
0
def get_settings(**kwargs):
    """Provide tweaked setting dictionaries for testing

    Set keyword arguments to override specific settings.
    """
    settings = DEFAULT_CONFIG.copy()
    for key, value in kwargs.items():
        settings[key] = value
    return settings
Ejemplo n.º 32
0
def create_generator(path):
    settings = DEFAULT_CONFIG.copy()
    settings['filenames'] = {}
    settings['CACHE_CONTENT'] = False  # cache not needed for this logic tests
    return ArticlesGenerator(context=settings.copy(),
                             settings=settings,
                             path=path,
                             theme=settings['THEME'],
                             output_path=None)
Ejemplo n.º 33
0
def initialized(pelican):
    p = os.path.expanduser('~/github/blog/content/')
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('PHOTO_LIBRARY', p)
    DEFAULT_CONFIG.setdefault('PHOTO_GALLERY', (1024, 768, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_ARTICLE', (760, 506, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_THUMB', (192, 144, 60))
    if pelican:
        pelican.settings.setdefault('PHOTO_LIBRARY', p)
        pelican.settings.setdefault('PHOTO_GALLERY', (1024, 768, 80))
        pelican.settings.setdefault('PHOTO_ARTICLE', (760, 506, 80))
        pelican.settings.setdefault('PHOTO_THUMB', (192, 144, 60))
Ejemplo n.º 34
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault(
        'HTMLMINIFY_FILE_EXTENSIONS',
        ['html', 'htm']
    )
    DEFAULT_CONFIG.setdefault(
        'HTMLMINIFY_SETTINGS',
        {}
    )
    if pelican:
        pelican.settings.setdefault(
            'HTMLMINIFY_FILE_EXTENSIONS',
            DEFAULT_CONFIG['HTMLMINIFY_FILE_EXTENSIONS']
        )
        pelican.settings.setdefault(
            'HTMLMINIFY_SETTINGS',
            DEFAULT_CONFIG['HTMLMINIFY_SETTINGS']
        )
Ejemplo n.º 35
0
def initialized(pelican):
    p = os.path.expanduser("~/Pictures")
    from pelican.settings import DEFAULT_CONFIG

    DEFAULT_CONFIG.setdefault("PHOTO_LIBRARY", p)
    DEFAULT_CONFIG.setdefault("PHOTO_GALLERY", (1024, 768, 80))
    DEFAULT_CONFIG.setdefault("PHOTO_ARTICLE", (760, 506, 80))
    DEFAULT_CONFIG.setdefault("PHOTO_THUMB", (192, 144, 60))
    if pelican:
        pelican.settings.setdefault("PHOTO_LIBRARY", p)
        pelican.settings.setdefault("PHOTO_GALLERY", (1024, 768, 80))
        pelican.settings.setdefault("PHOTO_ARTICLE", (760, 506, 80))
        pelican.settings.setdefault("PHOTO_THUMB", (192, 144, 60))
Ejemplo n.º 36
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('SUMMARY_BEGIN_MARKER',
                              '<!-- PELICAN_BEGIN_SUMMARY -->')
    DEFAULT_CONFIG.setdefault('SUMMARY_END_MARKER',
                              '<!-- PELICAN_END_SUMMARY -->')
    DEFAULT_CONFIG.setdefault('SUMMARY_USE_FIRST_PARAGRAPH', False)
    DEFAULT_CONFIG.setdefault('SUMMARY_REMOVE_META', 'removeSummary')
    if pelican:
        pelican.settings.setdefault('SUMMARY_BEGIN_MARKER',
                                    '<!-- PELICAN_BEGIN_SUMMARY -->')
        pelican.settings.setdefault('SUMMARY_END_MARKER',
                                    '<!-- PELICAN_END_SUMMARY -->')
        pelican.settings.setdefault('SUMMARY_USE_FIRST_PARAGRAPH', False)
        pelican.settings.setdefault('SUMMARY_REMOVE_META', False)
Ejemplo n.º 37
0
def defaultsettings(pelicanobj):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('ARTICLE_EXCLUDES_DIRNAMES', [])
    DEFAULT_CONFIG.setdefault('PAGE_EXCLUDES_DIRNAMES', [])
    DEFAULT_CONFIG.setdefault('STATIC_EXCLUDES_DIRNAMES', [])
    if pelicanobj:
        pelicanobj.settings.setdefault('ARTICLE_EXCLUDES_DIRNAMES', [])
        pelicanobj.settings.setdefault('PAGE_EXCLUDES_DIRNAMES', [])
        pelicanobj.settings.setdefault('STATIC_EXCLUDES_DIRNAMES', [])
Ejemplo n.º 38
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('SUMMARY_BEGIN_MARKER',
                              '<!-- PELICAN_BEGIN_SUMMARY -->')
    DEFAULT_CONFIG.setdefault('SUMMARY_END_MARKER',
                              '<!-- PELICAN_END_SUMMARY -->')
    DEFAULT_CONFIG.setdefault('SUMMARY_USE_FIRST_PARAGRAPH', False)
    if pelican:
        pelican.settings.setdefault('SUMMARY_BEGIN_MARKER',
                                    '<!-- PELICAN_BEGIN_SUMMARY -->')
        pelican.settings.setdefault('SUMMARY_END_MARKER',
                                    '<!-- PELICAN_END_SUMMARY -->')
        pelican.settings.setdefault('SUMMARY_USE_FIRST_PARAGRAPH', False)
Ejemplo n.º 39
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG

    DEFAULT_CONFIG.setdefault("SUMMARY_BEGIN_MARKER",
                              "<!-- PELICAN_BEGIN_SUMMARY -->")
    DEFAULT_CONFIG.setdefault("SUMMARY_END_MARKER",
                              "<!-- PELICAN_END_SUMMARY -->")
    DEFAULT_CONFIG.setdefault("SUMMARY_USE_FIRST_PARAGRAPH", False)
    if pelican:
        pelican.settings.setdefault("SUMMARY_BEGIN_MARKER",
                                    "<!-- PELICAN_BEGIN_SUMMARY -->")
        pelican.settings.setdefault("SUMMARY_END_MARKER",
                                    "<!-- PELICAN_END_SUMMARY -->")
        pelican.settings.setdefault("SUMMARY_USE_FIRST_PARAGRAPH", False)
Ejemplo n.º 40
0
def initialized(pelican):
    """Initializes default variables and then checks for changes to the default in the pelican.conf

    Args:
        pelican ([string]): [parameter takes in all the set variables in the pelican.conf]
    """

    DEFAULT_CONFIG.setdefault("UNIT_SYSTEM", "SI")
    DEFAULT_CONFIG.setdefault("UNIT_PRECISION", 2)
    DEFAULT_CONFIG.setdefault("UNIT_HTML_WRAPPER", "{unit} (<em>{converted}</em>)")

    if pelican:
        pelican.settings.setdefault("UNIT_SYSTEM", "SI")
        pelican.settings.setdefault("UNIT_PRECISION", 2)
        pelican.settings.setdefault(
            "UNIT_HTML_WRAPPER", "{unit} (<em>{converted}</em>)"
        )
Ejemplo n.º 41
0
 def initialize(self, pelican):
     default_path = path.join(pelican.path, "images")
     DEFAULT_CONFIG.setdefault('ORG_ASSETS_PATH',
                               default_path)
     if pelican.settings.get("ORG_ASSETS_PATH"):
         self.__org_assets_path = pelican.settings.get("ORG_ASSETS_PATH")
def pelican_initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG

    DEFAULT_CONFIG.setdefault("PELICAN_COMMENT_SYSTEM", False)
    DEFAULT_CONFIG.setdefault("PELICAN_COMMENT_SYSTEM_DIR" "comments")
    DEFAULT_CONFIG.setdefault("PELICAN_COMMENT_SYSTEM_IDENTICON_OUTPUT_PATH" "images/identicon")
    DEFAULT_CONFIG.setdefault("PELICAN_COMMENT_SYSTEM_IDENTICON_DATA", ())
    DEFAULT_CONFIG.setdefault("PELICAN_COMMENT_SYSTEM_IDENTICON_SIZE", 72)
    DEFAULT_CONFIG.setdefault("PELICAN_COMMENT_SYSTEM_AUTHORS", {})
    DEFAULT_CONFIG.setdefault("PELICAN_COMMENT_SYSTEM_FEED", os.path.join("feeds", "comment.%s.atom.xml"))
    DEFAULT_CONFIG.setdefault("COMMENT_URL", "#comment-{path}")
    if pelican:
        pelican.settings.setdefault("PELICAN_COMMENT_SYSTEM", False)
        pelican.settings.setdefault("PELICAN_COMMENT_SYSTEM_DIR", "comments")
        pelican.settings.setdefault("PELICAN_COMMENT_SYSTEM_IDENTICON_OUTPUT_PATH", "images/identicon")
        pelican.settings.setdefault("PELICAN_COMMENT_SYSTEM_IDENTICON_DATA", ())
        pelican.settings.setdefault("PELICAN_COMMENT_SYSTEM_IDENTICON_SIZE", 72)
        pelican.settings.setdefault("PELICAN_COMMENT_SYSTEM_AUTHORS", {})
        pelican.settings.setdefault("PELICAN_COMMENT_SYSTEM_FEED", os.path.join("feeds", "comment.%s.atom.xml"))
        pelican.settings.setdefault("COMMENT_URL", "#comment-{path}")
Ejemplo n.º 43
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG

    DEFAULT_CONFIG.setdefault(WEBRING_FEED_URLS_STR, [])
    DEFAULT_CONFIG.setdefault(WEBRING_MAX_ARTICLES_STR, 3)
    DEFAULT_CONFIG.setdefault(WEBRING_ARTICLES_PER_FEED_STR, 1)
    DEFAULT_CONFIG.setdefault(WEBRING_SUMMARY_WORDS_STR, 20)
    DEFAULT_CONFIG.setdefault(WEBRING_CLEAN_SUMMARY_HTML_STR, True)
    if pelican:
        # Check deprecated settings
        if "WEBRING_SUMMARY_LENGTH" in pelican.settings:
            warning(
                "webring plugin: '%s' has been deprecated by '%s'",
                "WEBRING_SUMMARY_LENGTH",
                "WEBRING_SUMMARY_WORDS",
            )
        # Set default values for unset settings
        for name, value in DEFAULT_CONFIG.items():
            if name.startswith("WEBRING"):
                pelican.settings.setdefault(name, value)
    # save global settings
    global settings
    settings = pelican.settings if pelican else DEFAULT_CONFIG
 def setUp(self):
     settings = DEFAULT_CONFIG.copy()
     settings['EXTRA_TEMPLATES_PATHS'] = ['.']
     context = settings.copy()
     self.generator = Generator(context, settings, settings['PATH'],
                                settings['THEME'], settings['OUTPUT_PATH'])
Ejemplo n.º 45
0
def create_generator(path):
    settings = DEFAULT_CONFIG.copy()
    settings['filenames'] = {}
    settings['CACHE_CONTENT'] = False  # cache not needed for this logic tests
    return ArticlesGenerator(context=settings.copy(), settings=settings,
                             path=path, theme=settings['THEME'], output_path=None)
Ejemplo n.º 46
0
def initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault(WEBRING_FEED_URLS_STR, [])
    DEFAULT_CONFIG.setdefault(WEBRING_MAX_ARTICLES_STR, 3)
    DEFAULT_CONFIG.setdefault(WEBRING_ARTICLES_PER_FEED_STR, 1)
    DEFAULT_CONFIG.setdefault(WEBRING_SUMMARY_LENGTH_STR, 128)
    DEFAULT_CONFIG.setdefault(WEBRING_CLEAN_SUMMARY_HTML_STR, True)
    if pelican:
        for name, value in DEFAULT_CONFIG.items():
            if name.startswith('WEBRING'):
                pelican.settings.setdefault(name, value)
Ejemplo n.º 47
0
def get_settings(**kwargs):
    settings = DEFAULT_CONFIG.copy()
    for key, value in kwargs.items():
        settings[key] = value
    settings['PLUGINS'] = ['microdata']
    return settings
Ejemplo n.º 48
0
import glob
from pathlib import Path

from pelican.settings import DEFAULT_CONFIG
from pelican.readers import MarkdownReader

config = DEFAULT_CONFIG.copy()

AUTHOR = 'Noah Hoffman'
SITENAME = 'Noah Hoffman, MD, PhD'
SITEURL = 'https://faculty.washington.edu/ngh2/home'
SITELOGO = SITEURL + '/images/noah-hoffman.jpg'

PATH = 'content'

TIMEZONE = 'America/Los_Angeles'

DEFAULT_LANG = 'en'

# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

# Blogroll
LINKS = (
    ('DLMP Bio', 'https://dlmp.uw.edu/faculty/hoffman'),
    ('UW Medicine Bio', 'http://www.uwmedicine.org/bios/noah-hoffman'),
    ('borborygmi (blog)', 'https://nhoffman.github.io/borborygmi/'),
Ejemplo n.º 49
0
def initialized(pelican):

    p = os.path.expanduser('~/Pictures')

    DEFAULT_CONFIG.setdefault('PHOTO_LIBRARY', p)
    DEFAULT_CONFIG.setdefault('PHOTO_GALLERY', (1024, 768, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_ARTICLE', (760, 506, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_THUMB', (192, 144, 60))
    DEFAULT_CONFIG.setdefault('PHOTO_GALLERY_TITLE', '')
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK', 'False')
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_TEXT', DEFAULT_CONFIG['SITENAME'])
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_IMG', '')
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_IMG_SIZE', (64, 64))
    DEFAULT_CONFIG.setdefault('PHOTO_RESIZE_JOBS', 1)

    DEFAULT_CONFIG['queue_resize'] = {}
    DEFAULT_CONFIG['created_galleries'] = {}

    if pelican:
        pelican.settings.setdefault('PHOTO_LIBRARY', p)
        pelican.settings.setdefault('PHOTO_GALLERY', (1024, 768, 80))
        pelican.settings.setdefault('PHOTO_ARTICLE', (760, 506, 80))
        pelican.settings.setdefault('PHOTO_THUMB', (192, 144, 60))
        pelican.settings.setdefault('PHOTO_GALLERY_TITLE', '')
        pelican.settings.setdefault('PHOTO_WATERMARK', 'False')
        pelican.settings.setdefault('PHOTO_WATERMARK_TEXT', pelican.settings['SITENAME'])
        pelican.settings.setdefault('PHOTO_WATERMARK_IMG', '')
        pelican.settings.setdefault('PHOTO_WATERMARK_IMG_SIZE', (64, 64))
        pelican.settings.setdefault('PHOTO_RESIZE_JOBS', 1)
def pelican_initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM', False)
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_DIR', 'comments')
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_OUTPUT_PATH' 'images/identicon')
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_DATA', ())
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_SIZE', 72)
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_AUTHORS', {})
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_FEED', os.path.join('feeds', 'comment.%s.atom.xml'))
    DEFAULT_CONFIG.setdefault('COMMENT_URL', '#comment-{slug}')
    DEFAULT_CONFIG['PAGE_EXCLUDES'].append(DEFAULT_CONFIG['PELICAN_COMMENT_SYSTEM_DIR'])
    DEFAULT_CONFIG['ARTICLE_EXCLUDES'].append(DEFAULT_CONFIG['PELICAN_COMMENT_SYSTEM_DIR'])
    if pelican:
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM', False)
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_DIR', 'comments')
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_OUTPUT_PATH', 'images/identicon')
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_DATA', ())
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_SIZE', 72)
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_AUTHORS', {})
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_FEED', os.path.join('feeds', 'comment.%s.atom.xml'))
        pelican.settings.setdefault('COMMENT_URL', '#comment-{slug}')

        pelican.settings['PAGE_EXCLUDES'].append(pelican.settings['PELICAN_COMMENT_SYSTEM_DIR'])
        pelican.settings['ARTICLE_EXCLUDES'].append(pelican.settings['PELICAN_COMMENT_SYSTEM_DIR'])
Ejemplo n.º 51
0
def initialized(pelican):

    DEFAULT_CONFIG.setdefault('CASCADE_CSS', {})

    if pelican:
        pelican.settings.setdefault('CASCADE_CSS', {})
Ejemplo n.º 52
0
def get_settings(**kwargs):
    settings = DEFAULT_CONFIG.copy()
    for key, value in kwargs.items():
        settings[key] = value
    return settings
Ejemplo n.º 53
0
def initialized(pelican):

    p = os.path.expanduser('~/Pictures')

    DEFAULT_CONFIG.setdefault('PHOTO_LIBRARY', p)
    DEFAULT_CONFIG.setdefault('PHOTO_GALLERY', (1024, 768, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_ARTICLE', (760, 506, 80))
    DEFAULT_CONFIG.setdefault('PHOTO_THUMB', (192, 144, 60))
    DEFAULT_CONFIG.setdefault('PHOTO_GALLERY_TITLE', '')
    DEFAULT_CONFIG.setdefault('PHOTO_ALPHA_BACKGROUND_COLOR', (255, 255, 255))
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK', False)
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_THUMB', False)
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_TEXT', DEFAULT_CONFIG['SITENAME'])
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_TEXT_COLOR', (255, 255, 255))
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_IMG', '')
    DEFAULT_CONFIG.setdefault('PHOTO_WATERMARK_IMG_SIZE', False)
    DEFAULT_CONFIG.setdefault('PHOTO_RESIZE_JOBS', 1)
    DEFAULT_CONFIG.setdefault('PHOTO_EXIF_KEEP', False)
    DEFAULT_CONFIG.setdefault('PHOTO_EXIF_REMOVE_GPS', False)
    DEFAULT_CONFIG.setdefault('PHOTO_EXIF_AUTOROTATE', True)
    DEFAULT_CONFIG.setdefault('PHOTO_EXIF_COPYRIGHT', False)
    DEFAULT_CONFIG.setdefault('PHOTO_EXIF_COPYRIGHT_AUTHOR', DEFAULT_CONFIG['SITENAME'])
    DEFAULT_CONFIG.setdefault('PHOTO_LIGHTBOX_GALLERY_ATTR', 'data-lightbox')
    DEFAULT_CONFIG.setdefault('PHOTO_LIGHTBOX_CAPTION_ATTR', 'data-title')

    DEFAULT_CONFIG['queue_resize'] = {}
    DEFAULT_CONFIG['created_galleries'] = {}
    DEFAULT_CONFIG['plugin_dir'] = os.path.dirname(os.path.realpath(__file__))

    if pelican:
        pelican.settings.setdefault('PHOTO_LIBRARY', p)
        pelican.settings.setdefault('PHOTO_GALLERY', (1024, 768, 80))
        pelican.settings.setdefault('PHOTO_ARTICLE', (760, 506, 80))
        pelican.settings.setdefault('PHOTO_THUMB', (192, 144, 60))
        pelican.settings.setdefault('PHOTO_GALLERY_TITLE', '')
        pelican.settings.setdefault('PHOTO_ALPHA_BACKGROUND_COLOR', (255, 255, 255))
        pelican.settings.setdefault('PHOTO_WATERMARK', False)
        pelican.settings.setdefault('PHOTO_WATERMARK_THUMB', False)
        pelican.settings.setdefault('PHOTO_WATERMARK_TEXT', pelican.settings['SITENAME'])
        pelican.settings.setdefault('PHOTO_WATERMARK_TEXT_COLOR', (255, 255, 255))
        pelican.settings.setdefault('PHOTO_WATERMARK_IMG', '')
        pelican.settings.setdefault('PHOTO_WATERMARK_IMG_SIZE', False)
        pelican.settings.setdefault('PHOTO_RESIZE_JOBS', 1)
        pelican.settings.setdefault('PHOTO_EXIF_KEEP', False)
        pelican.settings.setdefault('PHOTO_EXIF_REMOVE_GPS', False)
        pelican.settings.setdefault('PHOTO_EXIF_AUTOROTATE', True)
        pelican.settings.setdefault('PHOTO_EXIF_COPYRIGHT', False)
        pelican.settings.setdefault('PHOTO_EXIF_COPYRIGHT_AUTHOR', pelican.settings['AUTHOR'])
        pelican.settings.setdefault('PHOTO_LIGHTBOX_GALLERY_ATTR', 'data-lightbox')
        pelican.settings.setdefault('PHOTO_LIGHTBOX_CAPTION_ATTR', 'data-title')
def pelican_initialized(pelican):
    from pelican.settings import DEFAULT_CONFIG
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM', False)
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_DIR', 'comments')
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_OUTPUT_PATH'
                              'images/identicon')
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_DATA', ())
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_SIZE', 72)
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_AUTHORS', {})
    DEFAULT_CONFIG.setdefault('PELICAN_COMMENT_SYSTEM_FEED',
                              os.path.join('feeds', 'comment.%s.atom.xml'))
    DEFAULT_CONFIG.setdefault('COMMENT_URL', '#comment-{slug}')
    DEFAULT_CONFIG['PAGE_EXCLUDES'].append(
        DEFAULT_CONFIG['PELICAN_COMMENT_SYSTEM_DIR'])
    DEFAULT_CONFIG['ARTICLE_EXCLUDES'].append(
        DEFAULT_CONFIG['PELICAN_COMMENT_SYSTEM_DIR'])
    if pelican:
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM', False)
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_DIR', 'comments')
        pelican.settings.setdefault(
            'PELICAN_COMMENT_SYSTEM_IDENTICON_OUTPUT_PATH', 'images/identicon')
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_DATA',
                                    ())
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_IDENTICON_SIZE',
                                    72)
        pelican.settings.setdefault('PELICAN_COMMENT_SYSTEM_AUTHORS', {})
        pelican.settings.setdefault(
            'PELICAN_COMMENT_SYSTEM_FEED',
            os.path.join('feeds', 'comment.%s.atom.xml'))
        pelican.settings.setdefault('COMMENT_URL', '#comment-{slug}')

        pelican.settings['PAGE_EXCLUDES'].append(
            pelican.settings['PELICAN_COMMENT_SYSTEM_DIR'])
        pelican.settings['ARTICLE_EXCLUDES'].append(
            pelican.settings['PELICAN_COMMENT_SYSTEM_DIR'])