Skip to content
Open

w #1

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
84e9057
Update MarkdownParse.java
Wumboon Jul 7, 2022
76f1648
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
8ef3199
d
Wumboon Jul 7, 2022
6632d9f
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
baf830a
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
d7434a8
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
ab5d7a3
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
04fd896
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
60eacb6
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
83cbad8
Update MarkdownParse.java
Wumboon Jul 7, 2022
9c50845
Update MarkdownParseTest.java
Wumboon Jul 7, 2022
157157e
Update MarkdownParseTest.java
Wumboon Jul 11, 2022
158231f
First commit
hartejsin Jul 12, 2022
94d51fe
create main.yml
Wumboon Jul 12, 2022
54e891f
Update MarkdownParse.java
Wumboon Jul 12, 2022
b85279e
Update MarkdownParseTest.java
Wumboon Jul 12, 2022
81b9d9f
Merge branch 'main' of https://github.com/Wumboon/markdown-parser-1
Wumboon Jul 12, 2022
5dae7b8
Update MarkdownParse.java
Wumboon Jul 12, 2022
6ae00ea
Update main.yml
Wumboon Jul 12, 2022
935cd19
Update README.md
Wumboon Jul 12, 2022
689b7c8
Merge branch 'main' of https://github.com/Wumboon/markdown-parser-1
Wumboon Jul 12, 2022
6ad1c16
Update main.yml
Wumboon Jul 12, 2022
75c878f
Update README.md
Wumboon Jul 12, 2022
197fdf4
Create makefile
Wumboon Jul 14, 2022
dc89dca
Rename makefile to Makefile
Wumboon Jul 14, 2022
765cc73
Rename Makefile to makefile
Wumboon Jul 14, 2022
c0caa68
make file potential
Wumboon Jul 14, 2022
c128c01
Update makefile
Wumboon Jul 14, 2022
e564d37
Create mdparse
Wumboon Jul 14, 2022
0a9ea7f
makefile
hartejsin Jul 14, 2022
f2e0eb5
Update mdparse
Wumboon Jul 14, 2022
2377338
Update makefile
Wumboon Jul 14, 2022
d5cdd22
Recent makefile
hartejsin Jul 14, 2022
6200daa
mdparse
hartejsin Jul 14, 2022
0c6aa16
Update mdparse
Wumboon Jul 14, 2022
1a200c6
Update mdparse
Wumboon Jul 14, 2022
c10fc25
Update makefile
Wumboon Jul 14, 2022
25d071d
Update makefile
Wumboon Jul 14, 2022
dd07f4e
Update makefile
Wumboon Jul 14, 2022
ec0c57b
Update makefile
Wumboon Jul 14, 2022
18ee358
Update main.yml
Wumboon Jul 14, 2022
0d4b1d5
Update README.md
Wumboon Jul 14, 2022
65f9b2e
Update mdparse
Wumboon Jul 14, 2022
9ca2338
Update MarkdownParse.java
Wumboon Jul 14, 2022
02650da
Update MarkdownParseTest.java
Wumboon Jul 19, 2022
5692b1a
Merge branch 'main' of https://github.com/Wumboon/markdown-parser-1
Wumboon Jul 19, 2022
7a05904
Revert "Update MarkdownParse.java"
Wumboon Jul 20, 2022
20940af
Update README.md
Wumboon Jul 20, 2022
95ccc96
Update MarkdownParseTest.java
Wumboon Jul 20, 2022
d8a1f18
Update MarkdownParseTest.java
Wumboon Jul 20, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
make test

echo Add other actions to build,
echo test, and deploy your project.
Binary file added MarkdownParse.class
Binary file not shown.
23 changes: 21 additions & 2 deletions MarkdownParse.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,41 @@ public static ArrayList<String> getLinks(String markdown) {
// find the next [, then find the ], then find the (, then read link upto next )
int currentIndex = 0;
while(currentIndex < markdown.length()) {

//System.out.println(currentIndex);
int openBracket = markdown.indexOf("[", currentIndex);
if(openBracket==-1){
break;
}
//System.out.println(openBracket);
int closeBracket = markdown.indexOf("]", openBracket);
if(closeBracket==1){
break;
}
//System.out.println(closeBracket);
int openParen = markdown.indexOf("(", closeBracket);
if(openParen==-1){
break;
}
// System.out.println(openParen);
int closeParen = markdown.indexOf(")", openParen);
if(closeParen==-1){
break;
}
//System.out.println(closeBracket);
toReturn.add(markdown.substring(openParen + 1, closeParen));
currentIndex = closeParen + 1;
}

}
return toReturn;
}


public static void main(String[] args) throws IOException {
System.out.println("hello other");
Path fileName = Path.of(args[0]);
String content = Files.readString(fileName);
ArrayList<String> links = getLinks(content);
//System.out.println("Hello");
System.out.println(links);
}
}
Binary file added MarkdownParseTest.class
Binary file not shown.
24 changes: 22 additions & 2 deletions MarkdownParseTest.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
import static org.junit.Assert.*;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;

import org.junit.*;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
public class MarkdownParseTest {

@Test
public void addition() {
assertEquals(2, 1 + 1);
}

}
@Test
public void checkLinks() throws IOException{
ArrayList<String> check = new ArrayList<>();
check.add("https://something.com");
check.add("some-thing.html");
Path filename=Path.of("test-file.md");
String cont=Files.readString(filename);
MarkdownParse x = new MarkdownParse();
assertEquals(check,x.getLinks(cont));
}
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# markdown-parser
# markdown-parser
pls work
10 changes: 10 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CLASSPATH = lib/junit-4.13.2.jar:lib/hamcrest-core-1.3.jar:lib/commonmark-0.18.1.jar:.

MarkdownParseTest.class: MarkdownParseTest.java MarkdownParse.class
/software/CSE/oracle-java-17/jdk-17.0.1/bin/javac -g -cp $(CLASSPATH) MarkdownParseTest.java

MarkdownParse.class: MarkdownParse.java
/software/CSE/oracle-java-17/jdk-17.0.1/bin/javac -g MarkdownParse.java

test: MarkdownParseTest.class
/software/CSE/oracle-java-17/jdk-17.0.1/bin/java -cp $(CLASSPATH) org.junit.runner.JUnitCore MarkdownParseTest
1 change: 1 addition & 0 deletions mdparse
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/software/CSE/oracle-java-17/jdk-17.0.1/bin/java -cp lib/junit-4.13.2.jar:lib/hamcrest-core-1.3.jar:. MarkdownParse $1