@@ -37,6 +37,7 @@ defmodule ExDoc.Formatter.HTMLTest do
37
37
assets: "test/tmp/html_assets" ,
38
38
output: output_dir ( ) ,
39
39
source_beam: beam_dir ( ) ,
40
+ source_url: "https://github.com/elixir-lang/elixir" ,
40
41
logo: "test/fixtures/elixir.png" ,
41
42
extras: [
42
43
"test/fixtures/LICENSE" ,
@@ -349,6 +350,9 @@ defmodule ExDoc.Formatter.HTMLTest do
349
350
350
351
assert content =~ "<p><strong>raw content</strong></p>"
351
352
353
+ assert content =~
354
+ ~s{ <a href="https://github.com/elixir-lang/elixir/blob/master/test/fixtures/README.md#L1" title="View Source"}
355
+
352
356
content = File . read! ( "#{ output_dir ( ) } /plaintextfiles.html" )
353
357
354
358
assert content =~
@@ -359,21 +363,39 @@ defmodule ExDoc.Formatter.HTMLTest do
359
363
assert plain_text_file =~
360
364
~R{ <pre>\nThis is plain\n text and nothing\n.+\s+good bye\n</pre>} s
361
365
362
- assert plain_text_file =~ ~R { \n## Neither formatted\n}
363
- assert plain_text_file =~ ~R { \n `t:term/0`\n}
366
+ assert plain_text_file =~ ~s { \n ## Neither formatted\n }
367
+ assert plain_text_file =~ ~s { \n `t:term/0`\n }
364
368
365
- plain_text_file = File . read! ( "#{ output_dir ( ) } /license.html" )
369
+ license = File . read! ( "#{ output_dir ( ) } /license.html" )
366
370
367
- assert plain_text_file =~
371
+ assert license =~
368
372
~s{ <pre>\n Licensed under the Apache License, Version 2.0 (the "License")}
369
373
370
374
content = File . read! ( "#{ output_dir ( ) } /livebookfile.html" )
371
375
372
376
assert content =~
373
- ~R { <p>Read <code class="inline">.livemd</code> files generated by < a href="https://github.com/livebook-dev/livebook">livebook</a>. }
377
+ ~s { < a href="https://github.com/elixir-lang/elixir/blob/master/test/fixtures/LivebookFile.livemd#L1" title="View Source" }
374
378
375
379
assert content =~
376
- ~R{ <img src="https://livebook.dev/badge/v1/blue.svg" alt="Run in Livebook" width="150" />}
380
+ ~s{ <p>Read <code class="inline">.livemd</code> files generated by <a href="https://github.com/livebook-dev/livebook">livebook</a>.}
381
+
382
+ assert content =~
383
+ ~s{ <img src="https://livebook.dev/badge/v1/blue.svg" alt="Run in Livebook" width="150" />}
384
+ end
385
+
386
+ test "with absolute and dot-relative paths for extra" do
387
+ config = doc_config ( extras: [ "./test/fixtures/README.md" , Path . expand ( "test/fixtures/LivebookFile.livemd" ) ] )
388
+ generate_docs ( config )
389
+
390
+ content = File . read! ( "#{ output_dir ( ) } /readme.html" )
391
+
392
+ assert content =~
393
+ ~s{ <a href="https://github.com/elixir-lang/elixir/blob/master/test/fixtures/README.md#L1" title="View Source"}
394
+
395
+ content = File . read! ( "#{ output_dir ( ) } /livebookfile.html" )
396
+
397
+ assert content =~
398
+ ~s{ <a href="https://github.com/elixir-lang/elixir/blob/master/test/fixtures/LivebookFile.livemd#L1" title="View Source"}
377
399
end
378
400
379
401
test "without any other content" do
0 commit comments