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

Really forget anchorParentSelector #25

Open
maieul opened this issue Aug 14, 2019 · 11 comments
Open

Really forget anchorParentSelector #25

maieul opened this issue Aug 14, 2019 · 11 comments

Comments

@maieul
Copy link

maieul commented Aug 14, 2019

Hi,

consider this example

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://unpkg.com/littlefoot/dist/littlefoot.css">
</head>
<body>
<!-- Links -->
<p>
  <sup id="fnref:1">
    <a href="index.html#fn:1" rel="footnote">1</a>
  </sup>
</p>

<!-- Footnote List -->
<div class="footnotes">
  <ol>
    <li class="footnote" id="fn:1">
			<p><span>[<a href="#fnref:1" class="spip_note" title="Notes 1" rev="appendix">1</a>]&nbsp;</span>Anciennement Campagne astronomie.
			</p>
    </li>
  </ol>
</div>
<script src="https://unpkg.com/littlefoot/dist/littlefoot.min.js" type="application/javascript"></script>
<script type="application/javascript">
	littlefoot.default({
		anchorParentSelector:'span'
	})
</script>
</body>
</html>

As the <%= content %> contain the <span>, we get a   which, in our case, is not required in the footnote bullet.

@goblindegook goblindegook self-assigned this Aug 15, 2019
@goblindegook
Copy link
Owner

Thanks for reporting this, I can confirm the element selected by anchorParentSelector is emptied but not omitted from the footnote content.

@goblindegook
Copy link
Owner

The backlink is currently not targeted by the anchorParentSelector option, which is about the footnote reference in the body.

Removing the wrapper around the backlink is going to require either a new setting or reworking this one.

@maieul
Copy link
Author

maieul commented Aug 15, 2019 via email

@maieul
Copy link
Author

maieul commented Aug 17, 2019

thanks, but with 3.1.0, the footnote reference is style visible. I get
image

while I would like to get

image

@goblindegook
Copy link
Owner

I think I see the problem now. Does it still occur if you remove the &nbsp;?

@goblindegook goblindegook reopened this Aug 17, 2019
@maieul
Copy link
Author

maieul commented Aug 17, 2019

yes, it still occur.

@maieul
Copy link
Author

maieul commented Aug 17, 2019

Hum,

in a real case use I have still a problem.

Here the real case

<!DOCTYPE html>
<html>
	<head>
		<link rel="stylesheet" href="https://unpkg.com/littlefoot/dist/littlefoot.css" />
	</head>
	<body>
		<p>A<span class="spip_note_ref">&nbsp;[<a href='#nb1' class='spip_note' rel='appendix' title='Mon petit chat est mort. Mont petit chat est mort. Mon petit chat est&nbsp;(...)' id='nh1'>1</a>]</span></p>



		<div id='nb1'>
			<p><span class="spip_note_ref">[<a href='#nh1' class='spip_note' title='Notes 1' rev='appendix'>1</a>]&nbsp;</span>Mon petit chat est mort. Mont petit chat est mort. Mon petit chat est mort.</p>
		</div>

		<script type="text/javascript" src="https://unpkg.com/littlefoot/dist/littlefoot.js"></script>
		<script type="text/javascript">
			littlefoot.default({
				anchorPattern: /(nb\d+(-\d+)?(footnote|appendix))/gi,
				footnoteSelector: "div",
				anchorParentSelector: "span"
			});
		</script>
	</body>
</html>

As you can see, I have still [1]&nbsp; in the note.

@goblindegook
Copy link
Owner

Spotted it, littlefoot was looking for the backlink's target ID on the span wrapper instead of the a element. Fixed and tested with your example, releasing shortly.

@maieul
Copy link
Author

maieul commented Aug 17, 2019

yeh! That work nows. Thank you so much!

@brunob
Copy link
Contributor

brunob commented Oct 14, 2019

@goblindegook sorry but there is still a problem with that, if you test the latest example of @maieul you can see that the footnote contain an empty <p> before the expected content :\ (and another empty one after the content)

@goblindegook goblindegook reopened this Oct 14, 2019
@goblindegook goblindegook removed their assignment May 27, 2020
@maieul
Copy link
Author

maieul commented Dec 14, 2020

any news ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants