Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Config) Make URL fixing optional #500

Open
OndraZizka opened this issue Jul 25, 2018 · 1 comment
Open

(Config) Make URL fixing optional #500

OndraZizka opened this issue Jul 25, 2018 · 1 comment

Comments

@OndraZizka
Copy link
Contributor

OndraZizka commented Jul 25, 2018

The URL manipulation done by this

HtmlUtil.fixImageSourceUrls(fileContents, config);

is not always welcome.

  • First, it brings in JSoup which inherently changes the output of the Markup Engine;
  • Second, relative URLs to images are valid, no need to change them. And sometimes the absolute path /... is simply intended to lead to the server root, out of JBake's scope;
  • Third, the resulting web may reside on multiple DNS spaces, and having full URLs requires the web to be regenerated for each.

Where it is needed is the index page(s) or anywhere the document is rendered out of it's original place. However, JBake currently uses the same content.body for all cases.

I'll make a PR.


What I see as potentially more useful could be image source references, something like Wicket has. Basically, the document refers to /sourceId/my-image.jpg and the framework translates that to the correct URI or URL.
That can be leveraged in many ways. Example:

"/randomImageFromGoogle/quick brown fox jumps over a lazy dog"

would make the framework fetch the image from Google and either put the URL or download and add to local images repo.

OndraZizka added a commit to OndraZizka/jbake that referenced this issue Jul 25, 2018
OndraZizka added a commit to OndraZizka/jbake that referenced this issue Jul 25, 2018
…rg#502

Implement Make URL fixing optional jbake-org#500
These two are hitting the same code, so it's hard to split them.
@OndraZizka OndraZizka changed the title Make URL fixing optional (Config) Make URL fixing optional Jul 26, 2018
@jonbullock
Copy link
Member

This is something I discussed with @manikmagar (in relation to #459) that image manipulation only needs to occur when content is duplicated on other URL's such as the feed or index page and a relative path has been used. We did talk about exposing a utility method to the template engines so you have more control over when the manipulation occurs as a potential solution.

I'm working on a short term fix on #459 at the moment.

OndraZizka added a commit to OndraZizka/jbake that referenced this issue Oct 30, 2018
OndraZizka added a commit to OndraZizka/jbake that referenced this issue Oct 30, 2018
…rg#502

Implement Make URL fixing optional jbake-org#500
These two are hitting the same code, so it's hard to split them.
OndraZizka added a commit to OndraZizka/jbake that referenced this issue Oct 31, 2018
imports cleanup.
Final touches.
Extract the title from the Texy documents.
Improve hasHeader(): only scan first N lines, skip #... lines, skip blank lines, test against a regex; do not require status and type if defaults are set.
Add DebugUtil with map printing, since JBake code uses maps heavily
Wrap Crawler iteration into a try/catch
Start refactoring MarkupEngine so it supports files without a header.
Make DebugUtil more generic
Improve MarkupEngine: Support no header if all values are known; Improve validation; Refactor.
Extract title from Texy documents.
Implement RawMarkupEngine: Extract title from the HTML; Normalize HTML; Pretty print HTML; Export as XHTML; Change exported charset;
Introduce `input.charset`. Fix MarkupEngine - don't return headers map if the header separator is not found.
Allow .-_ in the header names
Refactor HtmlUtil#fixImageSourceUrls(). Keeps the same behavior.
Fix jbake-org#499 file names encoding.
Implements jbake-org#500  Make URL fixing optional jbake-org#500
Refactor createUri() and createNoExtensionUri() into one.
Make index creation bit more readable (just reorder)
Make index creation bit more readable (reuse the attrib name)
Refactor Crawler#crawlSourceFile() logic around updating cache flag.
Implement ContentStore#mergeDocument(Map<String, Object>) to update docs.
Implement Make "relative <img src> points to assets" optional jbake-org#502
Implement Make URL fixing optional jbake-org#500
These two are hitting the same code, so it's hard to split them.
MarkupUtil and RawMarkupUtil cleanup DebugUtil call
Force normalize HTML files if they contain <body>.
Rename vars
Allow deduplication of title autodetected from the document's header - mark that header with a CSS class.
Fix: Storing the altered DOM wrapped in <div> resulted in this <div> being serialized too. This removes it.
Make innerXml more robust.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants