Skip to content

Commit

Permalink
Correct broken URLs’ base_path
Browse files Browse the repository at this point in the history
Did not happen when the site was hosted directly on its domain root. One possible advantage of this bug is that it seems the FAQ individual pages look better without the extra CSS rules. https://www.amazon.com/Fortune-Failure-Missed-Opportunities-Discoveries/dp/0631160876 "fortune or failure"
  • Loading branch information
shlomif committed Oct 11, 2024
1 parent ab9fc2a commit 0edb99b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
22 changes: 19 additions & 3 deletions fc-solve/site/wml/Tests/content-script-tag-hyperlinks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@

class MyTests(unittest.TestCase):
def test_main(self):
def _count_jquery_ui(root):
return len(root.xpath(
".//script[contains(@src, 'js/jquery-ui/jquery-ui.min.js')]"))
input_fn = './dest/js-fc-solve/text/index.html'
with open(input_fn, "rb") as fh:
root = etree.HTML(fh.read())
Expand All @@ -31,6 +28,25 @@ def _count_jquery_ui(root):
[],
"all are ok")

def test_individual_faq_pages(self):
input_fn = './dest/faq-indiv-nodes/a_move_seems_wrong.xhtml'
with open(input_fn, "rb") as fh:
root = etree.HTML(fh.read())
matches = root.xpath(
".//link[ @rel = 'stylesheet' and @media = 'screen' and @href]"
)
filtered = []
for x in matches:
m = re.match('^((?:\\.\\./)*style.css)\\Z', x.get('href'))
if m:
filtered.append(m.group(1))

self.assertTrue(len(filtered), "matches")
self.assertEqual(
[x for x in filtered if re.match('\\.\\./\\.\\./', x)],
[],
"all are ok")


if __name__ == '__main__':
from pycotap import TAPTestRunner
Expand Down
1 change: 1 addition & 0 deletions fc-solve/site/wml/lib/split-html/faq_splitter_prog.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def _faq_gen(dest_dir):
splitter = XhtmlSplitter(
**COMMON_TITLE_CALLBACKS,
back_to_source_page_css_class=BACK_TO_SOURCE_PAGE_CSS_CLASS,
base_path="../",
individual_node_css_class=INDIVIDUAL_NODE_CSS_CLASS,
input_fn=input_fn,
output_dirname=OUT_DN,
Expand Down

0 comments on commit 0edb99b

Please sign in to comment.