summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-06-06 09:16:27 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2021-06-06 09:16:27 -0600
commit765305ca30a142145c1fdf39072086c8502fe71c (patch)
treeb52248db132f97e40d3dd0f1aaff528363f970a0
parent111e431188e04c1ca44717aa7b8b4664d39d9493 (diff)
fix bug on image_url
-rw-r--r--ChangeLog5
-rw-r--r--README.md81
-rw-r--r--src/pyssg/page.py2
3 files changed, 47 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index d6a6983..8561190 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,11 @@
CHANGES
=======
+v0.5.5
+------
+
+* fix another bug
+
v0.5.4
------
diff --git a/README.md b/README.md
index ff20b5b..ab0fe9b 100644
--- a/README.md
+++ b/README.md
@@ -9,15 +9,16 @@ I'm writing this in *pYtHoN* (thought about doing it in Go, but I'm most comfort
**This is still a WIP. Still doesn't build `sitemap.xml` or `rss.xml` files.**
- [x] Build static site parsing `markdown` files ( `*.md` -> `*.html`)
- - [x] ~~Using plain `*.html` files for templates.~~ Changed to Jinja templates.
- - [x] Would like to change to something more flexible and easier to manage ([`jinja`](https://jinja.palletsprojects.com/en/3.0.x/), for example).
- - [x] Preserves hand-made `*.html` files.
- - [x] Tag functionality.
- - [ ] Open Graph (and similar) support.
+ - [x] ~~Using plain `*.html` files for templates.~~ Changed to Jinja templates.
+ - [x] Would like to change to something more flexible and easier to manage ([`jinja`](https://jinja.palletsprojects.com/en/3.0.x/), for example).
+ - [x] Preserves hand-made `*.html` files.
+ - [x] Tag functionality.
+ - [ ] Open Graph (and similar) support. (Technically, this works if you add the correct metadata to the `*.md` files and use the variables available for Jinja)
- [x] Build `sitemap.xml` file.
- [x] Build `rss.xml` file.
+ - [ ] Join the `static_url` to all relative URLs found to comply with the [RSS 2.0 spec](https://validator.w3.org/feed/docs/rss2.html) (this would be added to the parsed HTML text extracted from the MD files, so it would be available to the created `*.html` and `*.xml` files). Note that depending on the reader, it will append the URL specified in the RSS file or use the [`xml:base`](https://www.rssboard.org/news/151/relative-links) specified ([newsboat](https://newsboat.org/) parses `xml:base`).
- [x] Only build page if `*.md` is new or updated.
- - [ ] Extend this to tag pages and index (right now all tags and index is built no matter if no new/updated file is present).
+ - [ ] Extend this to tag pages and index (right now all tags and index is built no matter if no new/updated file is present).
- [x] Configuration file as an alternative to using command line flags (configuration file options are prioritized).
### Markdown features
@@ -72,39 +73,39 @@ For more options/flags just checkout `pyssg -h`.
Here is the list of variables that you can use specific Jinja templates with a short description. Note that all urls are without the trailing slash `/`.
- `config` (`Configuration`) (all): configuration object containing general/global attributes, the useful ones being:
- - `title` (`str`): title of the website.
- - `url` (`str`): base url of the website.
- - `static_url` (`str`): base static url where all static files are located, mostly needed for correct rss feed generator when using a `base` tag and using relative links to files. For more, see [<base>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base).
- - `default_image_url` (`str`): as defined in `DEFAULT_IMAGE_URL` configuration option.
- - `version` (`str`): version in numeric form, i.e. `0.5.0`.
- - `run_date` (`str`): date when the program was run, with format required for rss.
+ - `title` (`str`): title of the website.
+ - `url` (`str`): base url of the website.
+ - `static_url` (`str`): base static url where all static files are located, mostly needed for correct rss feed generator when using a `base` tag and using relative links to files. For more, see [<base>](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base).
+ - `default_image_url` (`str`): as defined in `DEFAULT_IMAGE_URL` configuration option.
+ - `version` (`str`): version in numeric form, i.e. `0.5.0`.
+ - `run_date` (`str`): date when the program was run, with format required for rss.
- Pages:
- - `all_pages` (`list(Page)`) (all): list of all the pages, sorted by creation time, reversed.
- - `page` (`Page`) (`page.html`): page object that contains the following attributes:
- - `title` (`str`): title of the page.
- - `author` (`str`): author of the page.
- - `content` (`str`): actual content of the page.
- - `cdatetime` (`str`): creation datetime object of the page.
- - `cdate` (`str`): formatted `cdatetime` as the configuration option `DATE_FORMAT`.
- - `cdate_list` (`str`): formatted `cdatetime` as the configuration option `LIST_DATE_FORMAT`.
- - `cdate_list_sep` (`str`): formatted `cdatetime` as the configuration option `LIST_SEP_DATE_FORMAT`.
- - `cdate_rss` (`str`): formatted `cdatetime` as required by rss.
- - `cdate_sitemap` (`str`): formatted `cdatetime` as required by sitemap.
- - `mdatetime` (`str`): modification datetime object of the page. Defaults to None.
- - `mdate` (`str`): formatted `mdatetime` as the configuration option `DATE_FORMAT`. Defaults to None.
- - `mdate_list` (`str`): formatted `mdatetime` as the configuration option `LIST_DATE_FORMAT`.
- - `mdate_list_sep` (`str`): formatted `mdatetime` as the configuration option `LIST_SEP_DATE_FORMAT`.
- - `mdate_rss` (`str`): formatted `mdatetime` as required by rss.
- - `mdate_sitemap` (`str`): formatted `mdatetime` as required by sitemap.
- - `summary` (`str`): summary of the page, as specified in the `*.md` file.
- - `lang` (`str`): page language, used for the general `html` tag `lang` attribute.
- - `tags` (`list(tuple(str))`): list of tuple of tags of the page, containing the name and the url of the tag, in that order. Defaults to empty list.
- - `url` (`str`): url of the page, this already includes the `config.url`.
- - `image_url` (`str`): image url of the page, this already includes the `config.static_url`. Defaults to the `DEFAULT_IMAGE_URL` configuration option.
- - `next/previous` (`Page`): reference to the next or previous page object (containing all these attributes). Defaults to None
- - `og` (`dict(str, str)`): dict for object graph metadata.
- - `meta` (`dict(str, list(str))`): meta dict as obtained from python-markdown, in case you use a meta tag not yet supported, it will be available there.
+ - `all_pages` (`list(Page)`) (all): list of all the pages, sorted by creation time, reversed.
+ - `page` (`Page`) (`page.html`): page object that contains the following attributes:
+ - `title` (`str`): title of the page.
+ - `author` (`str`): author of the page.
+ - `content` (`str`): actual content of the page.
+ - `cdatetime` (`str`): creation datetime object of the page.
+ - `cdate` (`str`): formatted `cdatetime` as the configuration option `DATE_FORMAT`.
+ - `cdate_list` (`str`): formatted `cdatetime` as the configuration option `LIST_DATE_FORMAT`.
+ - `cdate_list_sep` (`str`): formatted `cdatetime` as the configuration option `LIST_SEP_DATE_FORMAT`.
+ - `cdate_rss` (`str`): formatted `cdatetime` as required by rss.
+ - `cdate_sitemap` (`str`): formatted `cdatetime` as required by sitemap.
+ - `mdatetime` (`str`): modification datetime object of the page. Defaults to None.
+ - `mdate` (`str`): formatted `mdatetime` as the configuration option `DATE_FORMAT`. Defaults to None.
+ - `mdate_list` (`str`): formatted `mdatetime` as the configuration option `LIST_DATE_FORMAT`.
+ - `mdate_list_sep` (`str`): formatted `mdatetime` as the configuration option `LIST_SEP_DATE_FORMAT`.
+ - `mdate_rss` (`str`): formatted `mdatetime` as required by rss.
+ - `mdate_sitemap` (`str`): formatted `mdatetime` as required by sitemap.
+ - `summary` (`str`): summary of the page, as specified in the `*.md` file.
+ - `lang` (`str`): page language, used for the general `html` tag `lang` attribute.
+ - `tags` (`list(tuple(str))`): list of tuple of tags of the page, containing the name and the url of the tag, in that order. Defaults to empty list.
+ - `url` (`str`): url of the page, this already includes the `config.url`.
+ - `image_url` (`str`): image url of the page, this already includes the `config.static_url`. Defaults to the `DEFAULT_IMAGE_URL` configuration option.
+ - `next/previous` (`Page`): reference to the next or previous page object (containing all these attributes). Defaults to None
+ - `og` (`dict(str, str)`): dict for object graph metadata.
+ - `meta` (`dict(str, list(str))`): meta dict as obtained from python-markdown, in case you use a meta tag not yet supported, it will be available there.
- Tags:
- - `tag` (`tuple(str)`) (`tag.html`): tuple of name and url of the current tag.
- - `tag_pages` (`list(Page)`) (`tag.html`): similar to `all_pages` but contains all the pages for the current tag.
- - `all_tags` (`list(tuple(str))`) (all): similar to `page.tags` but contains all the tags.
+ - `tag` (`tuple(str)`) (`tag.html`): tuple of name and url of the current tag.
+ - `tag_pages` (`list(Page)`) (`tag.html`): similar to `all_pages` but contains all the pages for the current tag.
+ - `all_tags` (`list(tuple(str))`) (all): similar to `page.tags` but contains all the tags.
diff --git a/src/pyssg/page.py b/src/pyssg/page.py
index c87b237..6b83d39 100644
--- a/src/pyssg/page.py
+++ b/src/pyssg/page.py
@@ -98,7 +98,7 @@ class Page:
try:
self.image_url = \
- f'{self.config.static_url}/{self.meta["image_url"]}'
+ f'{self.config.static_url}/{self.meta["image_url"][0]}'
except KeyError:
self.image_url = \
f'{self.config.static_url}/{self.config.default_image_url}'